From: Simon Horman <horms@kernel.org>
To: Anjali Kulkarni <anjali.k.kulkarni@oracle.com>
Cc: linux-kernel@vger.kernel.org, davem@davemloft.net,
Liam.Howlett@oracle.com, netdev@vger.kernel.org,
oliver.sang@intel.com, kuba@kernel.org
Subject: Re: [PATCH v1] Fix NULL pointer dereference in cn_filter()
Date: Tue, 17 Oct 2023 10:02:10 +0200 [thread overview]
Message-ID: <20231017080210.GG1751252@kernel.org> (raw)
In-Reply-To: <20231013225619.987912-1-anjali.k.kulkarni@oracle.com>
On Fri, Oct 13, 2023 at 03:56:19PM -0700, Anjali Kulkarni wrote:
> Check that sk_user_data is not NULL, else return from cn_filter().
Thanks,
I agree that this change seems likely to address the problem at the link
below. And I also think cn_filter() is a good place to fix this [1].
But I am wondering if you could add some commentary to the patch
description, describing under what circumstances this problem can occur.
[1] https://lore.kernel.org/all/20231013120105.GH29570@kernel.org/
> Fixes: 2aa1f7a1f47c ("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>
> ---
> drivers/connector/cn_proc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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
>
next prev parent reply other threads:[~2023-10-17 8:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-13 22:56 [PATCH v1] Fix NULL pointer dereference in cn_filter() Anjali Kulkarni
2023-10-17 8:02 ` Simon Horman [this message]
2023-10-17 18:23 ` Anjali Kulkarni
2023-10-20 23:30 ` Anjali Kulkarni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231017080210.GG1751252@kernel.org \
--to=horms@kernel.org \
--cc=Liam.Howlett@oracle.com \
--cc=anjali.k.kulkarni@oracle.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=oliver.sang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).