Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: mctp i2c: Copy headers if cloned

Use skb_cow_head() prior to modifying the TX SKB. This is necessary
when the SKB has been cloned, to avoid modifying other shared clones.

Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
Fixes: f5b8abf9fc3d ("mctp i2c: MCTP I2C binding driver")
Link: https://patch.msgid.link/20250306-matt-mctp-i2c-cow-v1-1-293827212681@codeconstruct.com.au
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Matt Johnston and committed by
Jakub Kicinski
df8ce77b 26db9c9e

+5
+5
drivers/net/mctp/mctp-i2c.c
··· 583 583 struct mctp_i2c_hdr *hdr; 584 584 struct mctp_hdr *mhdr; 585 585 u8 lldst, llsrc; 586 + int rc; 586 587 587 588 if (len > MCTP_I2C_MAXMTU) 588 589 return -EMSGSIZE; ··· 593 592 594 593 lldst = *((u8 *)daddr); 595 594 llsrc = *((u8 *)saddr); 595 + 596 + rc = skb_cow_head(skb, sizeof(struct mctp_i2c_hdr)); 597 + if (rc) 598 + return rc; 596 599 597 600 skb_push(skb, sizeof(struct mctp_i2c_hdr)); 598 601 skb_reset_mac_header(skb);