Skip to content

Commit

Permalink
mctp i2c: Fix potential use-after-free
Browse files Browse the repository at this point in the history
The skb is handed off to netif_rx() which may free it.
Found by Smatch.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Matt Johnston authored and Jakub Kicinski committed Feb 26, 2022
1 parent f62457d commit 06bf1ce
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/mctp/mctp-i2c.c
Original file line number Diff line number Diff line change
@@ -338,7 +338,7 @@ static int mctp_i2c_recv(struct mctp_i2c_dev *midev)

if (status == NET_RX_SUCCESS) {
ndev->stats.rx_packets++;
ndev->stats.rx_bytes += skb->len;
ndev->stats.rx_bytes += recvlen;
} else {
ndev->stats.rx_dropped++;
}

0 comments on commit 06bf1ce

Please sign in to comment.