[PATCH] ubi: Reject device with erasesize 0

Tudor Ambarus tudor.ambarus at linaro.org
Fri Sep 1 03:22:43 PDT 2023



On 9/1/23 10:37, Jan Kara wrote:
> On Fri 01-09-23 10:25:11, Tudor Ambarus wrote:
>> Hi, Richard,
>>
>> On 8/31/23 12:11, Jan Kara wrote:
>>> In principle MTD device with erasesize 0 can exist and it is possible to create them e.g. via KVM. If that happens UBI layer currently crashes
>>
>> mtd devices are organized in erase blocks, having a mtd with erase
>> size zero looks suspicious to me. Do you know if there are any mtd
>> devices with erasesize of zero?
> 
> Please see the discussion I've referenced from the patch. I agree such
> devices are strange but apparently devices reporting erasesize==0 do exist
> and can be created in virtualized environment. IMO we don't need to work
> with them but we shouldn't crash a kernel if they are attached...
> 
> 								Honza
> 

Thanks, Jan. I agree we shouldn't crash the kernel. I was wondering
whether on the long term we should aim to not allow the creation of
mtd devices with erasesize zero, or/and to not accept devices with
erasesize of zero under mtd. Was curious about the why, I don't have
anything against the patch. I guess I'll answer my questions myself
if I ever stumble on this.

Cheers,
ta



More information about the linux-mtd mailing list