linux-hams.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: memory leak in nr_rx_frame
@ 2023-11-10 17:36 Bragatheswaran Manickavel
  2023-11-10 21:31 ` Kuniyuki Iwashima
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Bragatheswaran Manickavel @ 2023-11-10 17:36 UTC (permalink / raw)
  To: ralf, davem, edumazet, kuba, pabeni
  Cc: Bragatheswaran Manickavel, linux-hams, netdev, linux-kernel,
	syzbot+0145ea560de205bc09f0

The condition (make = nr_make_new(sk)) == NULL suggests
that nr_make_new allocates memory and returns a pointer.
If this allocation fails (returns NULL), it indicates a
potential memory leak.

Added sock_put() for make which can potentially solve
this issue

Reported-by: syzbot+0145ea560de205bc09f0@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=0145ea560de205bc09f0
Signed-off-by: Bragatheswaran Manickavel <bragathemanick0908@gmail.com>
---
 net/netrom/af_netrom.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 0eed00184adf..7d7cda4ae300 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -970,6 +970,8 @@ int nr_rx_frame(struct sk_buff *skb, struct net_device *dev)
 		nr_transmit_refusal(skb, 0);
 		if (sk)
 			sock_put(sk);
+		if (make)
+			sock_put(make);
 		return 0;
 	}
 
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-11-13  0:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-10 17:36 [PATCH] net: memory leak in nr_rx_frame Bragatheswaran Manickavel
2023-11-10 21:31 ` Kuniyuki Iwashima
2023-11-11  6:16   ` Bragatheswaran Manickavel
2023-11-11  6:37 ` kernel test robot
2023-11-13  0:56 ` Willem de Bruijn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).