Skip to content

Commit

Permalink
Fix NULL pointer dereference in cn_filter()
Browse files Browse the repository at this point in the history
Check that sk_user_data is not NULL, else return from cn_filter().
Could not reproduce this issue, but Oliver Sang verified it has fixed
the "Closes" problem below.

Fixes: 2aa1f7a ("connector/cn_proc: Add filtering to fix some bugs")
Reported-by: kernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202309201456.84c19e27-oliver.sang@intel.com/
Signed-off-by: Anjali Kulkarni <anjali.k.kulkarni@oracle.com>
Link: https://lore.kernel.org/r/20231020234058.2232347-1-anjali.k.kulkarni@oracle.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
  • Loading branch information
Anjali Kulkarni authored and Paolo Abeni committed Oct 24, 2023
1 parent d788c93 commit 9644bc4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/connector/cn_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 || !dsk->sk_user_data || !data)
return 0;

ptr = (__u32 *)data;
Expand Down

0 comments on commit 9644bc4

Please sign in to comment.