]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
ptr_ring: prevent integer overflow when calculating size
authorJason Wang <jasowang@redhat.com>
Sun, 11 Feb 2018 03:28:12 +0000 (11:28 +0800)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Mon, 27 Aug 2018 14:40:05 +0000 (16:40 +0200)
commite3dd909f9f223dd8ff60d7def87f0e83666195cf
tree7d7b41705a5b3277929985f39af7e9fc0339abb1
parent782f7e4504219420f68bd8e8f4e7cc0ba5234872
ptr_ring: prevent integer overflow when calculating size

BugLink: http://bugs.launchpad.net/bugs/1786352
[ Upstream commit 54e02162d4454a99227f520948bf4494c3d972d0 ]

Switch to use dividing to prevent integer overflow when size is too
big to calculate allocation size properly.

Reported-by: Eric Biggers <ebiggers3@gmail.com>
Fixes: 6e6e41c31122 ("ptr_ring: fail early if queue occupies more than KMALLOC_MAX_SIZE")
Signed-off-by: Jason Wang <jasowang@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
include/linux/ptr_ring.h