Netdev List
 help / color / mirror / Atom feed
From: Jeremy Kerr <jk@codeconstruct.com.au>
To: Andrew Stellman <bugs@stellman-greene.com>,
	Matt Johnston <matt@codeconstruct.com.au>
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	 Jakub Kicinski	 <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>, Simon Horman	 <horms@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] net: mctp: don't hold a zero-refcount socket in mctp_key_alloc()
Date: Fri, 04 Dec 2026 19:05:00 +0800	[thread overview]
Message-ID: <9985892b00754b12f1e43eb676970aa6723f027b.camel@codeconstruct.com.au> (raw)
In-Reply-To: <20261202164958.49945-1-bugs@stellman-greene.com>

Hi Andrew,

> From: Andrew Stellman <astellman@stellman-greene.com>
> 
> mctp_dst_input() finds the bound socket with mctp_lookup_bind() under
> RCU only, without holding a reference. If a concurrent close drops
> the last reference after that lookup, mctp_key_alloc() calls
> sock_hold() on a zero refcount, which saturates it and warns, and
> mctp_key_unref() later underflows it.
> 
> Take the reference with refcount_inc_not_zero() and fail the key
> allocation if the socket is already at zero.

Looks good, thanks.

Reviewed-by: Jeremy Kerr <jk@codeconstruct.com.au>

> Tested on net-next 19c484e12ed2 (7.4.0-rc4) in arm64 QEMU with a
> private KUnit case

Can we have that too?

Cheers,


Jeremy

      reply	other threads:[~2026-12-04 11:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 16:49 [PATCH net] net: mctp: don't hold a zero-refcount socket in mctp_key_alloc() Andrew Stellman
2026-12-04 11:05 ` Jeremy Kerr [this message]

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=9985892b00754b12f1e43eb676970aa6723f027b.camel@codeconstruct.com.au \
    --to=jk@codeconstruct.com.au \
    --cc=bugs@stellman-greene.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt@codeconstruct.com.au \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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