Re: [linus:master] [connector/cn_proc] 2aa1f7a1f4: BUG:kernel_NULL_pointer_dereference,address

From: Anjali Kulkarni
Date: Tue Oct 17 2023 - 14:24:19 EST




> On Oct 17, 2023, at 12:12 AM, Oliver Sang <oliver.sang@xxxxxxxxx> wrote:
>
> hi, Anjali Kulkarni,
>
> On Fri, Oct 13, 2023 at 11:00:31PM +0000, Anjali Kulkarni wrote:
>>
>>
>>> 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:
>
> I applied below patch upon v6.6-rc6, the issue reported by original report was
> gone.
>

Thank you very much for testing!

> (and I confirmed the issue still can be reproduced on v6.6-rc6)
>
> Tested-by: kernel test robot <oliver.sang@xxxxxxxxx>
>
>>
>> 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