mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
mctp i3c: Fix locking in an error path
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: 2d2d4f60ed ("mctp i3c: fix MCTP I3C driver multi-thread issue")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: Matt Johnston <matt@codeconstruct.com.au>
Link: https://patch.msgid.link/71e0a880ffe7a83237e501b07884bf54343e76ca.1793296780.git.bvanassche@acm.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
684603842b
commit
750eb5ab45
|
|
@ -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;
|
||||
}
|
||||
|
||||
skb->protocol = htons(ETH_P_MCTP);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user