Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

UBI: fix autoresize handling in R/O mode

Currently UBI fails in autoresize when it is in R/O mode (e.g., because the
underlying MTD device is R/O). This patch fixes the issue - we just skip
autoresize and print a warning.

Reported-by: Pali Rohár <pali.rohar@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>

+5
+5
drivers/mtd/ubi/build.c
··· 799 799 struct ubi_volume *vol = ubi->volumes[vol_id]; 800 800 int err, old_reserved_pebs = vol->reserved_pebs; 801 801 802 + if (ubi->ro_mode) { 803 + ubi_warn("skip auto-resize because of R/O mode"); 804 + return 0; 805 + } 806 + 802 807 /* 803 808 * Clear the auto-resize flag in the volume in-memory copy of the 804 809 * volume table, and 'ubi_resize_volume()' will propagate this change