mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02:00
net/packet: avoid truncating TPACKET_V3 private size
tpacket_req3.tp_sizeof_priv is an unsigned int, and packet_set_ring() validates the full value against the block size. init_prb_bdqc() then stores it in the unsigned short blk_sizeof_priv field. Commit2b6867c2ce("net/packet: fix overflow in check for priv area size") fixed the validation arithmetic, but an accepted value above USHRT_MAX still narrows when it is stored. For a 131072-byte block, tp_sizeof_priv=65536 is valid. The narrowing makes offset_to_first_pkt 48 instead of 65584, so packet records can be placed in the private area that userspace asked the kernel to preserve. blk_sizeof_priv is internal state, so widen it to hold the validated UAPI value. Fixes:f6fb8f100b("af-packet: TPACKET_V3 flexible buffer implementation.") Cc: stable@vger.kernel.org Signed-off-by: Mark Amirkan <markdamirkan@gmail.com> Reviewed-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20260913-b4-send-packet-private-v1-1-925eab2cd388@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
60404266ef
commit
37213e6112
|
|
@ -21,7 +21,7 @@ struct tpacket_kbdq_core {
|
|||
unsigned int hdrlen;
|
||||
unsigned char reset_pending_on_curr_blk;
|
||||
unsigned short kactive_blk_num;
|
||||
unsigned short blk_sizeof_priv;
|
||||
unsigned int blk_sizeof_priv;
|
||||
|
||||
unsigned short version;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user