diff options
author | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2012-08-18 08:11:42 -0400 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2012-09-04 02:39:01 -0400 |
commit | abb3e01103eb4e2ea5c15e6fedbc74e08bd4cc2b (patch) | |
tree | a83d9e615df93b083d6018b0bf5dea3f7f25bdf0 /drivers/mtd | |
parent | db7e21c21f293d52f5363fe8d9ee91d6bd0a503a (diff) |
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>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/ubi/build.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index 355756bd37ab..89660881aa31 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c | |||
@@ -799,6 +799,11 @@ static int autoresize(struct ubi_device *ubi, int vol_id) | |||
799 | struct ubi_volume *vol = ubi->volumes[vol_id]; | 799 | struct ubi_volume *vol = ubi->volumes[vol_id]; |
800 | int err, old_reserved_pebs = vol->reserved_pebs; | 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 | * Clear the auto-resize flag in the volume in-memory copy of the | 808 | * Clear the auto-resize flag in the volume in-memory copy of the |
804 | * volume table, and 'ubi_resize_volume()' will propagate this change | 809 | * volume table, and 'ubi_resize_volume()' will propagate this change |