netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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
Subject: Re: [PATCH v2] Fix NULL pointer deref due to filtering on fork
Date: Fri, 13 Oct 2023 14:01:05 +0200	[thread overview]
Message-ID: <20231013120105.GH29570@kernel.org> (raw)
In-Reply-To: <20231011051225.3674436-1-anjali.k.kulkarni@oracle.com>

On Tue, Oct 10, 2023 at 10:12:25PM -0700, Anjali Kulkarni wrote:
> cn_netlink_send_mult() should be called with filter & filter_data only
> for EXIT case. For all other events, filter & filter_data should be
> NULL.
> 
> Fixes: 2aa1f7a1f47c ("connector/cn_proc: Add filtering to fix some bugs")
> Reported-by: kernel test robot <oliver.sang@intel.com>
> Closes: https://urldefense.com/v3/__https://lore.kernel.org/oe-lkp/202309201456.84c19e27-oliver.sang@intel.com__;!!ACWV5N9M2RV99hQ!PgqlHq_nOe_KlyKkB9Mm_S8QstTJvicjuENwskatuuQK05KPuFw-KvRZeOH8iuEAMjRhkxEMPKJJnLcaT8zrPf9aqNs$

For the record, this got a bit mangled. I believe it should be:

Closes: https://lore.kernel.org/oe-lkp/202309201456.84c19e27-oliver.sang@intel.com/

Also, there is probably no need to resend because of this,
but no blank line here, please.

> Signed-off-by: Anjali Kulkarni <anjali.k.kulkarni@oracle.com>
> ---
>  drivers/connector/cn_proc.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c
> index 05d562e9c8b1..01e17f18d187 100644
> --- a/drivers/connector/cn_proc.c
> +++ b/drivers/connector/cn_proc.c
> @@ -104,13 +104,13 @@ static inline void send_msg(struct cn_msg *msg)
>  	if (filter_data[0] == PROC_EVENT_EXIT) {
>  		filter_data[1] =
>  		((struct proc_event *)msg->data)->event_data.exit.exit_code;
> +		cn_netlink_send_mult(msg, msg->len, 0, CN_IDX_PROC, GFP_NOWAIT,
> +				     cn_filter, (void *)filter_data);
>  	} else {
> -		filter_data[1] = 0;
> +		cn_netlink_send_mult(msg, msg->len, 0, CN_IDX_PROC, GFP_NOWAIT,
> +				     NULL, NULL);
>  	}
>  
> -	cn_netlink_send_mult(msg, msg->len, 0, CN_IDX_PROC, GFP_NOWAIT,
> -			     cn_filter, (void *)filter_data);
> -

I am wondering if you considered making cn_filter slightly smarter.
It seems it already understands not to do very much for PROC_EVENT_ALL.

>  	local_unlock(&local_event.lock);
>  }
>  
> -- 
> 2.42.0
> 
> 

  reply	other threads:[~2023-10-13 12:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-11  5:12 [PATCH v2] Fix NULL pointer deref due to filtering on fork Anjali Kulkarni
2023-10-13 12:01 ` Simon Horman [this message]
2023-10-13 16:16   ` Anjali Kulkarni
2023-10-13 23:01   ` 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=20231013120105.GH29570@kernel.org \
    --to=horms@kernel.org \
    --cc=Liam.Howlett@oracle.com \
    --cc=anjali.k.kulkarni@oracle.com \
    --cc=davem@davemloft.net \
    --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).