Skip to content

Commit 115c0f4

Browse files
edumazetkuba-moo
authored andcommitted
idpf: fix potential use-after-free in idpf_tso()
skb_cow_head() can change skb->head (and thus skb_shinfo(skb)) We must not cache skb_shinfo(skb) before skb_cow_head(). Fixes: 6818c4d ("idpf: add splitq start_xmit") Signed-off-by: Eric Dumazet <[email protected]> Cc: Joshua Hay <[email protected]> Cc: Alan Brady <[email protected]> Cc: Madhu Chittim <[email protected]> Cc: Phani Burra <[email protected]> Cc: Sridhar Samudrala <[email protected]> Cc: Willem de Bruijn <[email protected]> Cc: Pavan Kumar Linga <[email protected]> Cc: Tony Nguyen <[email protected]> Cc: Bailey Forrest <[email protected]> Reviewed-by: Jacob Keller <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 9fc3bc7 commit 115c0f4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/net/ethernet/intel/idpf/idpf_txrx.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2365,7 +2365,7 @@ static void idpf_tx_splitq_map(struct idpf_queue *tx_q,
23652365
*/
23662366
int idpf_tso(struct sk_buff *skb, struct idpf_tx_offload_params *off)
23672367
{
2368-
const struct skb_shared_info *shinfo = skb_shinfo(skb);
2368+
const struct skb_shared_info *shinfo;
23692369
union {
23702370
struct iphdr *v4;
23712371
struct ipv6hdr *v6;
@@ -2379,13 +2379,15 @@ int idpf_tso(struct sk_buff *skb, struct idpf_tx_offload_params *off)
23792379
u32 paylen, l4_start;
23802380
int err;
23812381

2382-
if (!shinfo->gso_size)
2382+
if (!skb_is_gso(skb))
23832383
return 0;
23842384

23852385
err = skb_cow_head(skb, 0);
23862386
if (err < 0)
23872387
return err;
23882388

2389+
shinfo = skb_shinfo(skb);
2390+
23892391
ip.hdr = skb_network_header(skb);
23902392
l4.hdr = skb_transport_header(skb);
23912393

0 commit comments

Comments
 (0)