mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matt Johnston <matt@codeconstruct.com.au>
To: Bart Van Assche <bvanassche@acm.org>,
	Jeremy Kerr <jk@codeconstruct.com.au>
Cc: Leo Yang <Leo-Yang@quantatw.com>, Paolo Abeni <pabeni@redhat.com>,
	 netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Andrew Lunn	 <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet	 <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>,
	Nathan Chancellor	 <nathan@kernel.org>,
	Leo Yang <leo.yang.sy0@gmail.com>
Subject: Re: [PATCH v2] mctp i3c: Fix locking in an error path
Date: Mon, 02 Nov 2026 12:03:38 +0800	[thread overview]
Message-ID: <e83e3ae9505a60b58acc960b3256b5970fb5cca1.camel@codeconstruct.com.au> (raw)
In-Reply-To: <71e0a880ffe7a83237e501b07884bf54343e76ca.1793296780.git.bvanassche@acm.org>

On Thu, 2026-10-29 at 11:00 -0700, Bart Van Assche wrote:
> If netdev_alloc_skb() fails, mctp_i3c_read() jumps to a label that
> unlocks mi->lock although that mutex has not been locked yet. Fix this
> by returning -ENOMEM directly. This bug has been detected by the Clang
> thread-safety analyzer.
> 
> Cc: Leo Yang <Leo-Yang@quantatw.com>
> Cc: Paolo Abeni <pabeni@redhat.com>
> Cc: Jeremy Kerr <jk@codeconstruct.com.au>
> Cc: Matt Johnston <matt@codeconstruct.com.au>
> Cc: netdev@vger.kernel.org
> Fixes: 2d2d4f60ed26 ("mctp i3c: fix MCTP I3C driver multi-thread issue")
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> v1 -> v2:
> - Return -ENOMEM directly upon allocation failure instead of adding a
>   free_skb label.
> 
>  drivers/net/mctp/mctp-i3c.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/mctp/mctp-i3c.c b/drivers/net/mctp/mctp-i3c.c
> index 4e857dd5df64..5f225999d715 100644
> --- a/drivers/net/mctp/mctp-i3c.c
> +++ b/drivers/net/mctp/mctp-i3c.c
> @@ -111,8 +111,7 @@ static int mctp_i3c_read(struct mctp_i3c_device *mi)
>  			       mi->mrl + sizeof(struct mctp_i3c_internal_hdr));
>  	if (!skb) {
>  		stats->rx_dropped++;
> -		rc = -ENOMEM;
> -		goto err;
> +		return -ENOMEM;
>  	}

Thank you.

Acked-by: Matt Johnston <matt@codeconstruct.com.au>


      reply	other threads:[~2026-11-02  4:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29 18:00 Bart Van Assche
2026-11-02  4:03 ` Matt Johnston [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=e83e3ae9505a60b58acc960b3256b5970fb5cca1.camel@codeconstruct.com.au \
    --to=matt@codeconstruct.com.au \
    --cc=Leo-Yang@quantatw.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=bvanassche@acm.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=jk@codeconstruct.com.au \
    --cc=kuba@kernel.org \
    --cc=leo.yang.sy0@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nathan@kernel.org \
    --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

all inboxes | Powered by JetHome®