From: Paolo Abeni <pabeni@redhat.com>
To: Bart Van Assche <bvanassche@acm.org>, netdev@vger.kernel.org
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>,
Leo Yang <leo.yang.sy0@gmail.com>,
linux-kernel@vger.kernel.org, Leo Yang <Leo-Yang@quantatw.com>,
Jeremy Kerr <jk@codeconstruct.com.au>,
Matt Johnston <matt@codeconstruct.com.au>
Subject: Re: [PATCH net] mctp i3c: Fix locking in an error path
Date: Thu, 29 Oct 2026 13:00:25 +0100 [thread overview]
Message-ID: <e291eaa8-c090-41a7-8e8e-9f86e58723b2@redhat.com> (raw)
In-Reply-To: <58aab766b8ce35d1a7ff38880853cedaec244bf1.1793044759.git.bvanassche@acm.org>
On 10/26/26 20:59, 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 jumping to a label that only frees the skb. 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>
> ---
> drivers/net/mctp/mctp-i3c.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/mctp/mctp-i3c.c b/drivers/net/mctp/mctp-i3c.c
> index 4e857dd5df64..59e7bf56fce3 100644
> --- a/drivers/net/mctp/mctp-i3c.c
> +++ b/drivers/net/mctp/mctp-i3c.c
> @@ -112,7 +112,7 @@ static int mctp_i3c_read(struct mctp_i3c_device *mi)
> if (!skb) {
> stats->rx_dropped++;
> rc = -ENOMEM;
> - goto err;
> + goto free_skb;
Why the additional churn? Just return -ENOMEM, no point in freeing a NULL skb.
/P
prev parent reply other threads:[~2026-10-29 12:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-26 19:59 [PATCH net] mctp i3c: Fix locking in an error path Bart Van Assche
2026-10-29 12:00 ` Paolo Abeni [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=e291eaa8-c090-41a7-8e8e-9f86e58723b2@redhat.com \
--to=pabeni@redhat.com \
--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=matt@codeconstruct.com.au \
--cc=netdev@vger.kernel.org \
/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