Skip to content

Commit 26db9c9

Browse files
mkjkuba-moo
authored andcommitted
net: mctp i3c: 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: c8755b2 ("mctp i3c: MCTP I3C driver") Link: https://patch.msgid.link/20250306-matt-i3c-cow-head-v1-1-d5e6a5495227@codeconstruct.com.au Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent dc5340c commit 26db9c9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/net/mctp/mctp-i3c.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,10 +506,15 @@ static int mctp_i3c_header_create(struct sk_buff *skb, struct net_device *dev,
506506
const void *saddr, unsigned int len)
507507
{
508508
struct mctp_i3c_internal_hdr *ihdr;
509+
int rc;
509510

510511
if (!daddr || !saddr)
511512
return -EINVAL;
512513

514+
rc = skb_cow_head(skb, sizeof(struct mctp_i3c_internal_hdr));
515+
if (rc)
516+
return rc;
517+
513518
skb_push(skb, sizeof(struct mctp_i3c_internal_hdr));
514519
skb_reset_mac_header(skb);
515520
ihdr = (void *)skb_mac_header(skb);

0 commit comments

Comments
 (0)