linux-kernel-mentees.lists.linuxfoundation.org archive mirror
 help / color / mirror / Atom feed
* [Linux-kernel-mentees] [PATCH v2 net] rose: Fix Null pointer dereference in rose_send_frame()
@ 2020-11-05 15:56 Anmol Karn
  2020-11-06 21:04 ` Saeed Mahameed
  2020-11-07 18:56 ` [Linux-kernel-mentees] [PATCH v2] net: " Anmol Karn
  0 siblings, 2 replies; 13+ messages in thread
From: Anmol Karn @ 2020-11-05 15:56 UTC (permalink / raw)
  To: ralf, davem, kuba
  Cc: syzkaller-bugs, linux-kernel, syzbot+a1c743815982d9496393,
	netdev, linux-hams, linux-kernel-mentees

rose_send_frame() dereferences `neigh->dev` when called from
rose_transmit_clear_request(), and the first occurance of the `neigh`
is in rose_loopback_timer() as `rose_loopback_neigh`, and it is initialized
in rose_add_loopback_neigh() as NULL. i.e when `rose_loopback_neigh` used in 
rose_loopback_timer() its `->dev` was still NULL and rose_loopback_timer() 
was calling rose_rx_call_request() without checking for NULL.

- net/rose/rose_link.c
This bug seems to get triggered in this line:

rose_call = (ax25_address *)neigh->dev->dev_addr;

Fix it by adding NULL checking for `rose_loopback_neigh->dev` in rose_loopback_timer(). 

Reported-and-tested-by: syzbot+a1c743815982d9496393@syzkaller.appspotmail.com 
Link: https://syzkaller.appspot.com/bug?id=9d2a7ca8c7f2e4b682c97578dfa3f236258300b3 
Signed-off-by: Anmol Karn <anmol.karan123@gmail.com>
---
 net/rose/rose_loopback.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/rose/rose_loopback.c b/net/rose/rose_loopback.c
index 7b094275ea8b..cd7774cb1d07 100644
--- a/net/rose/rose_loopback.c
+++ b/net/rose/rose_loopback.c
@@ -96,7 +96,7 @@ static void rose_loopback_timer(struct timer_list *unused)
 		}
 
 		if (frametype == ROSE_CALL_REQUEST) {
-			if ((dev = rose_dev_get(dest)) != NULL) {
+			if (rose_loopback_neigh->dev && (dev = rose_dev_get(dest)) != NULL) {
 				if (rose_rx_call_request(skb, dev, rose_loopback_neigh, lci_o) == 0)
 					kfree_skb(skb);
 			} else {
-- 
2.29.2

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

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

end of thread, other threads:[~2020-11-20 18:06 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-05 15:56 [Linux-kernel-mentees] [PATCH v2 net] rose: Fix Null pointer dereference in rose_send_frame() Anmol Karn
2020-11-06 21:04 ` Saeed Mahameed
2020-11-07  8:20   ` Anmol Karn
2020-11-07 19:18     ` [Linux-kernel-mentees] [PATCH v3 " Anmol Karn
2020-11-10 17:58       ` Jakub Kicinski
2020-11-10 19:45         ` Anmol Karn
2020-11-11 16:59           ` [Linux-kernel-mentees] [PATCH v4 " Anmol Karn
2020-11-14 19:18             ` Jakub Kicinski
2020-11-15 11:44               ` Anmol Karn
2020-11-19 19:10                 ` [Linux-kernel-mentees] [PATCH v5 " Anmol Karn
2020-11-20 18:06                   ` Jakub Kicinski
2020-11-07 18:56 ` [Linux-kernel-mentees] [PATCH v2] net: " Anmol Karn
2020-11-07 19:02   ` Anmol karn

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).