Commit fe4297e8 authored by Zhihao Cheng's avatar Zhihao Cheng Committed by ZhaoLong Wang
Browse files

ubi: Refuse attaching if mtd's erasesize is 0

mainline inclusion
from mainline-v6.6-rc5
commit 017c73a3
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I6YOAJ
CVE: CVE-2023-31085

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=017c73a34a661a861712f7cc1393a123e5b2208c



-------------------------------------------------

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: 801c135c ("UBI: Unsorted Block Images")
Reported-by: default avatarYu Hao <yhao016@ucr.edu>
Link: https://lore.kernel.org/lkml/977347543.226888.1682011999468.JavaMail.zimbra@nod.at/T/


Signed-off-by: default avatarZhihao Cheng <chengzhihao1@huawei.com>
Reviewed-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
Signed-off-by: default avatarZhaoLong Wang <wangzhaolong1@huawei.com>
parent b95b27cb
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment