]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
brd: fix overflow in __brd_direct_access
authorMikulas Patocka <mpatocka@redhat.com>
Wed, 13 Sep 2017 13:17:57 +0000 (09:17 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Oct 2017 07:47:31 +0000 (09:47 +0200)
commit676b7ae6c40434dcff827e0f67725de25ddd32fc
treed9b3c72dd23105662a9139ecfc46e722781055e6
parentf0e85f56f70f172ada0d06b26baff47823695629
brd: fix overflow in __brd_direct_access

commit 02a4843618fb35f847cf8c31cd3893873aa0edde upstream.

The code in __brd_direct_access multiplies the pgoff variable by page size
and divides it by 512. It can cause overflow on 32-bit architectures. The
overflow happens if we create ramdisk larger than 4G and use it as a
sparse device.

This patch replaces multiplication and division with multiplication by the
number of sectors per page.

Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Fixes: 1647b9b959c7 ("brd: add dax_operations support")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/block/brd.c