]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
fs/ufs: avoid potential u32 multiplication overflow
authorColin Ian King <colin.king@canonical.com>
Wed, 12 Aug 2020 01:35:53 +0000 (18:35 -0700)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Fri, 4 Sep 2020 19:30:10 +0000 (16:30 -0300)
commit13fa9b1b63b588b36318c3d500f88dac050b96fb
treee3f78fbb46406f5f070d434c1ed9e5215be90169
parent13215188240c4be2d549a8beba7551a83745aa54
fs/ufs: avoid potential u32 multiplication overflow

BugLink: https://bugs.launchpad.net/bugs/1892899
[ Upstream commit 88b2e9b06381551b707d980627ad0591191f7a2d ]

The 64 bit ino is being compared to the product of two u32 values,
however, the multiplication is being performed using a 32 bit multiply so
there is a potential of an overflow.  To be fully safe, cast uspi->s_ncg
to a u64 to ensure a 64 bit multiplication occurs to avoid any chance of
overflow.

Fixes: f3e2a520f5fb ("ufs: NFS support")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Evgeniy Dushistov <dushistov@mail.ru>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Link: http://lkml.kernel.org/r/20200715170355.1081713-1-colin.king@canonical.com
Addresses-Coverity: ("Unintentional integer overflow")
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
fs/ufs/super.c