* [PATCH] tg3: Use slab_build_skb() when needed
@ 2023-08-18 17:54 Kees Cook
2023-08-21 3:54 ` Pavan Chebbi
2023-08-22 3:10 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Kees Cook @ 2023-08-18 17:54 UTC (permalink / raw)
To: Siva Reddy Kallam
Cc: Kees Cook, Fiona Ebner, Prashant Sreedharan, Michael Chan,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Bagas Sanjaya, netdev, linux-kernel, linux-hardening
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 ce098da1497c ("skbuff: Introduce
slab_build_skb()"):
Use slab_build_skb() instead
...
tg3_poll_work+0x638/0xf90 [tg3]
Reported-by: Fiona Ebner <f.ebner@proxmox.com>
Closes: https://lore.kernel.org/all/1bd4cb9c-4eb8-3bdb-3e05-8689817242d1@proxmox.com
Cc: Siva Reddy Kallam <siva.kallam@broadcom.com>
Cc: Prashant Sreedharan <prashant@broadcom.com>
Cc: Michael Chan <mchan@broadcom.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Bagas Sanjaya <bagasdotme@gmail.com>
Cc: netdev@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
drivers/net/ethernet/broadcom/tg3.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 5ef073a79ce9..cb2810f175cc 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -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;
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] tg3: Use slab_build_skb() when needed
2023-08-18 17:54 [PATCH] tg3: Use slab_build_skb() when needed Kees Cook
@ 2023-08-21 3:54 ` Pavan Chebbi
2023-08-22 3:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Pavan Chebbi @ 2023-08-21 3:54 UTC (permalink / raw)
To: Kees Cook
Cc: Siva Reddy Kallam, Fiona Ebner, Prashant Sreedharan,
Michael Chan, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Bagas Sanjaya, netdev, linux-kernel,
linux-hardening
[-- Attachment #1: Type: text/plain, Size: 1986 bytes --]
On Fri, Aug 18, 2023 at 11:24 PM Kees Cook <keescook@chromium.org> wrote:
>
> 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 ce098da1497c ("skbuff: Introduce
> slab_build_skb()"):
>
> Use slab_build_skb() instead
> ...
> tg3_poll_work+0x638/0xf90 [tg3]
>
> Reported-by: Fiona Ebner <f.ebner@proxmox.com>
> Closes: https://lore.kernel.org/all/1bd4cb9c-4eb8-3bdb-3e05-8689817242d1@proxmox.com
> Cc: Siva Reddy Kallam <siva.kallam@broadcom.com>
> Cc: Prashant Sreedharan <prashant@broadcom.com>
> Cc: Michael Chan <mchan@broadcom.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Eric Dumazet <edumazet@google.com>
> Cc: Jakub Kicinski <kuba@kernel.org>
> Cc: Paolo Abeni <pabeni@redhat.com>
> Cc: Bagas Sanjaya <bagasdotme@gmail.com>
> Cc: netdev@vger.kernel.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
> drivers/net/ethernet/broadcom/tg3.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
> index 5ef073a79ce9..cb2810f175cc 100644
> --- a/drivers/net/ethernet/broadcom/tg3.c
> +++ b/drivers/net/ethernet/broadcom/tg3.c
> @@ -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;
> --
> 2.34.1
>
>
Thanks. LGTM.
Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4209 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tg3: Use slab_build_skb() when needed
2023-08-18 17:54 [PATCH] tg3: Use slab_build_skb() when needed Kees Cook
2023-08-21 3:54 ` Pavan Chebbi
@ 2023-08-22 3:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-08-22 3:10 UTC (permalink / raw)
To: Kees Cook
Cc: siva.kallam, f.ebner, prashant, mchan, davem, edumazet, kuba,
pabeni, bagasdotme, netdev, linux-kernel, linux-hardening
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Fri, 18 Aug 2023 10:54:21 -0700 you wrote:
> 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 ce098da1497c ("skbuff: Introduce
> slab_build_skb()"):
>
> Use slab_build_skb() instead
> ...
> tg3_poll_work+0x638/0xf90 [tg3]
>
> [...]
Here is the summary with links:
- tg3: Use slab_build_skb() when needed
https://git.kernel.org/netdev/net/c/99b415fe8986
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-08-22 3:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-18 17:54 [PATCH] tg3: Use slab_build_skb() when needed Kees Cook
2023-08-21 3:54 ` Pavan Chebbi
2023-08-22 3:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).