Re: [PATCH net] sfc: allocate a big enough SKB for loopback selftest packet

From
Simon Horman <horms@kernel.org>
Date
2023-08-22 07:38:29
Reply to
unknown sender, 2023-08-21
On Mon, Aug 21, 2023 at 07:01:53PM +0100, edward.cree@amd.com wrote:
From: Edward Cree <redacted>

Cited commits passed a size to alloc_skb that was only big enough for
 the actual packet contents, but the following skb_put + memcpy writes
 the whole struct efx_loopback_payload including leading and trailing
 padding bytes (which are then stripped off with skb_pull/skb_trim).
This could cause an skb_over_panic, although in practice we get saved
 by kmalloc_size_roundup.
Pass the entire size we use, instead of the size of the final packet.

Reported-by: Andy Moreton <andy.moreton@amd.com>
Fixes: cf60ed469629 ("sfc: use padding to fix alignment in loopback test")
Fixes: 30c24dd87f3f ("sfc: siena: use padding to fix alignment in loopback test")
Fixes: 1186c6b31ee1 ("sfc: falcon: use padding to fix alignment in loopback test")
Signed-off-by: Edward Cree <redacted>
Reviewed-by: Simon Horman <horms@kernel.org>
Thread (3 messages) 3 messages, 3 authors, last reply 2023-08-22
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help