Skip to content

Commit

Permalink
tg3: Use slab_build_skb() when needed
Browse files Browse the repository at this point in the history
The tg3 driver will use kmalloc() under some conditions. Check the
frag_size and use slab_build_skb() when frag_size is 0. Silences
the warning introduced by commit ce098da ("skbuff: Introduce
slab_build_skb()"):

	Use slab_build_skb() instead
	...
	tg3_poll_work+0x638/0xf90 [tg3]

Fixes: ce098da ("skbuff: Introduce slab_build_skb()")
Reported-by: Fiona Ebner <[email protected]>
Closes: https://lore.kernel.org/all/[email protected]
Cc: Siva Reddy Kallam <[email protected]>
Cc: Prashant Sreedharan <[email protected]>
Cc: Michael Chan <[email protected]>
Cc: Bagas Sanjaya <[email protected]>
Signed-off-by: Kees Cook <[email protected]>
Reviewed-by: Pavan Chebbi <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
kees authored and kuba-moo committed Aug 22, 2023
1 parent be80942 commit 99b415f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/net/ethernet/broadcom/tg3.c
Original file line number Diff line number Diff line change
Expand Up @@ -6881,7 +6881,10 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget)

ri->data = NULL;

skb = build_skb(data, frag_size);
if (frag_size)
skb = build_skb(data, frag_size);
else
skb = slab_build_skb(data);
if (!skb) {
tg3_frag_free(frag_size != 0, data);
goto drop_it_no_recycle;
Expand Down

0 comments on commit 99b415f

Please sign in to comment.