Netdev List
 help / color / mirror / Atom feed
From: Nikolay Aleksandrov <razor@blackwall.org>
To: Jakub Kicinski <kuba@kernel.org>, davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
	andrew+netdev@lunn.ch, horms@kernel.org,
	Sashiko <sashiko-bot@kernel.org>,
	bobbyeshleman@gmail.com, dw@davidwei.uk, daniel@iogearbox.net,
	sdf@fomichev.me, willemb@google.com, kaiyuanz@google.com
Subject: Re: [PATCH net] netdev: fix double-free in netdev_nl_bind_rx_doit()
Date: Mon, 8 Jun 2026 16:43:25 +0300	[thread overview]
Message-ID: <2626cb5b-d221-439f-9ef9-ddee80491fdf@blackwall.org> (raw)
In-Reply-To: <20260606012124.4060950-1-kuba@kernel.org>

On 06/06/2026 04:21, Jakub Kicinski wrote:
> Sashiko flags that genlmsg_reply() always consumes the skb.
> The error path calls nlmsg_free(rsp) so we can't jump directly
> to it. Let's not unbind, just propagate the error to the user.
> This is the typical way of handling genlmsg_reply() failures.
> They shouldn't happen unless user does something silly like
> calling the kernel with an already-full rcvbuf.
> 
> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Fixes: 170aafe35cb9 ("netdev: support binding dma-buf to netdevice")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> CC: bobbyeshleman@gmail.com
> CC: dw@davidwei.uk
> CC: daniel@iogearbox.net
> CC: razor@blackwall.org
> CC: sdf@fomichev.me
> CC: willemb@google.com
> CC: kaiyuanz@google.com
> ---
>   net/core/netdev-genl.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c
> index b4d48f3672a5..11b0b91683d7 100644
> --- a/net/core/netdev-genl.c
> +++ b/net/core/netdev-genl.c
> @@ -1095,8 +1095,6 @@ int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info)
>   	genlmsg_end(rsp, hdr);
>   
>   	err = genlmsg_reply(rsp, info);
> -	if (err)
> -		goto err_unbind;
>   
>   	bitmap_free(rxq_bitmap);
>   
> @@ -1104,7 +1102,7 @@ int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info)
>   
>   	mutex_unlock(&priv->lock);
>   
> -	return 0;
> +	return err < 0 ? err : 0;
>   
>   err_unbind:
>   	net_devmem_unbind_dmabuf(binding);

Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>


  parent reply	other threads:[~2026-06-08 13:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-06  1:21 [PATCH net] netdev: fix double-free in netdev_nl_bind_rx_doit() Jakub Kicinski
2026-06-06 22:06 ` Bobby Eshleman
2026-06-08 13:21 ` Daniel Borkmann
2026-06-08 13:43 ` Nikolay Aleksandrov [this message]
2026-06-09  0:50 ` patchwork-bot+netdevbpf

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=2626cb5b-d221-439f-9ef9-ddee80491fdf@blackwall.org \
    --to=razor@blackwall.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=bobbyeshleman@gmail.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dw@davidwei.uk \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kaiyuanz@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sashiko-bot@kernel.org \
    --cc=sdf@fomichev.me \
    --cc=willemb@google.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