[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201107191835.5541-1-anmol.karan123@gmail.com>
Date: Sun, 8 Nov 2020 00:48:35 +0530
From: Anmol Karn <anmol.karan123@...il.com>
To: ralf@...ux-mips.org, davem@...emloft.net, kuba@...nel.org
Cc: saeed@...nel.org, gregkh@...uxfoundation.org,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-hams@...r.kernel.org,
linux-kernel-mentees@...ts.linuxfoundation.org,
syzkaller-bugs@...glegroups.com, anmol.karan123@...il.com,
syzbot+a1c743815982d9496393@...kaller.appspotmail.com
Subject: [Linux-kernel-mentees] [PATCH v3 net] rose: Fix Null pointer dereference in rose_send_frame()
rose_send_frame() dereferences `neigh->dev` when called from
rose_transmit_clear_request(), and the first occurrence 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().
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: syzbot+a1c743815982d9496393@...kaller.appspotmail.com
Tested-by: syzbot+a1c743815982d9496393@...kaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?id=9d2a7ca8c7f2e4b682c97578dfa3f236258300b3
Signed-off-by: Anmol Karn <anmol.karan123@...il.com>
---
Changes in v3:
- Corrected checkpatch warnings and errors (Suggested-by: Saeed Mahameed <saeed@...nel.org>)
- Added "Fixes:" tag (Suggested-by: Saeed Mahameed <saeed@...nel.org>)
Changes in v2:
- Added NULL check in rose_loopback_timer() (Suggested-by: Greg KH <gregkh@...uxfoundation.org>)
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..2c51756ed7bf 100644
--- a/net/rose/rose_loopback.c
+++ b/net/rose/rose_loopback.c
@@ -96,7 +96,8 @@ static void rose_loopback_timer(struct timer_list *unused)
}
if (frametype == ROSE_CALL_REQUEST) {
- if ((dev = rose_dev_get(dest)) != NULL) {
+ dev = rose_dev_get(dest);
+ if (rose_loopback_neigh->dev && dev) {
if (rose_rx_call_request(skb, dev, rose_loopback_neigh, lci_o) == 0)
kfree_skb(skb);
} else {
-
2.29.2
Powered by blists - more mailing lists