]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
ubi: Refuse attaching if mtd's erasesize is 0
authorZhihao Cheng <chengzhihao1@huawei.com>
Thu, 26 Oct 2023 15:35:08 +0000 (11:35 -0400)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 30 Oct 2023 11:00:34 +0000 (12:00 +0100)
commit7a8e6c68879d92242607b6141c4404c3baeb8552
tree63ac609612ef715ee0b128f33c54c89959e75857
parentb93cd8513a5d6c42712a491a7241cd4eb558fcd1
ubi: Refuse attaching if mtd's erasesize is 0

There exists mtd devices with zero erasesize, which will trigger a
divide-by-zero exception while attaching ubi device.
Fix it by refusing attaching if mtd's erasesize is 0.

Fixes: 801c135ce73d ("UBI: Unsorted Block Images")
Reported-by: Yu Hao <yhao016@ucr.edu>
Link: https://lore.kernel.org/lkml/977347543.226888.1682011999468.JavaMail.zimbra@nod.at/T/
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
(cherry picked from commit 017c73a34a661a861712f7cc1393a123e5b2208c)
CVE-2023-31085
Signed-off-by: Yuxuan Luo <yuxuan.luo@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
drivers/mtd/ubi/build.c