mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-28 07:13:34 +00:00
net/packet: fix 4gb buffer limit due to overflow check
[ Upstream commitfc62814d69
] When calculating rb->frames_per_block * req->tp_block_nr the result can overflow. Check it for overflow without limiting the total buffer size to UINT_MAX. This change fixes support for packet ring buffers >= UINT_MAX. Fixes:8f8d28e4d6
("net/packet: fix overflow in check for tp_frame_nr") Signed-off-by: Kal Conley <kal.conley@dectris.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
7c3969ff8b
commit
2226f95924
1 changed files with 1 additions and 1 deletions
|
@ -4313,7 +4313,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,
|
||||||
rb->frames_per_block = req->tp_block_size / req->tp_frame_size;
|
rb->frames_per_block = req->tp_block_size / req->tp_frame_size;
|
||||||
if (unlikely(rb->frames_per_block == 0))
|
if (unlikely(rb->frames_per_block == 0))
|
||||||
goto out;
|
goto out;
|
||||||
if (unlikely(req->tp_block_size > UINT_MAX / req->tp_block_nr))
|
if (unlikely(rb->frames_per_block > UINT_MAX / req->tp_block_nr))
|
||||||
goto out;
|
goto out;
|
||||||
if (unlikely((rb->frames_per_block * req->tp_block_nr) !=
|
if (unlikely((rb->frames_per_block * req->tp_block_nr) !=
|
||||||
req->tp_frame_nr))
|
req->tp_frame_nr))
|
||||||
|
|
Loading…
Reference in a new issue