Re: [linus:master] [connector/cn_proc] 2aa1f7a1f4: BUG:kernel_NULL_pointer_dereference,address
From: Anjali Kulkarni
Date: Fri Oct 13 2023 - 19:00:57 EST
> On Oct 4, 2023, at 8:40 AM, Jakub Kicinski <kuba@xxxxxxxxxx> wrote:
>
> On Wed, 20 Sep 2023 14:51:32 +0800 kernel test robot wrote:
>> kernel test robot noticed "BUG:kernel_NULL_pointer_dereference,address" on:
>>
>> commit: 2aa1f7a1f47ce8dac7593af605aaa859b3cf3bb1 ("connector/cn_proc: Add filtering to fix some bugs")
>> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git master
>
> Anjali, have you had the chance to look into this?
Hi,
I was unable to reproduce the issues with the steps given - many packages are missing, etc. - I am still trying though - however, the stack trace of this issue shows it is a NULL pointer de-reference (it looks like in cn_filter() function) - and I found a potential suspect where a check for NULL pointer was missing. So I’ve sent out the patch fix for this - is it possible for someone to please test with this fix and let me know if the issue is resolved? The fix looks like:
diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c
index 05d562e9c8b1..a8e55569e4f5 100644
--- a/drivers/connector/cn_proc.c
+++ b/drivers/connector/cn_proc.c
@@ -54,7 +54,7 @@ static int cn_filter(struct sock *dsk, struct sk_buff *skb, void *data)
enum proc_cn_mcast_op mc_op;
uintptr_t val;
- if (!dsk || !data)
+ if (!dsk || !data || !dsk->sk_user_data)
return 0;
ptr = (__u32 *)data;
-- 2.42.0