mirror of
https://github.com/openwrt/openwrt.git
synced 2025-04-19 08:36:47 +00:00
generic: fitblk: close block device if mapping image failed
In case a broken fit image is present on flash the fitblk driver would not map any /dev/fit* devices, but also not always close the block device the image resides on. In case of ubiblock devices this is fatal as one then cannot remove the ubiblock device (-EBUSY), and hence cannot replace the broken image. Always close the block device in case no sub-image was mapped. Signed-off-by: Daniel Golle <daniel@makrotopia.org> (cherry picked from commit 2b9c81d1cbc65eeb9304b7274058418efa8a9c78)
This commit is contained in:
parent
be1b254888
commit
9e9f6875bc
@ -656,7 +656,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
+ add_fit_subimage_device(bdev, slot++, start_sect, nr_sects, true);
|
||||
+ }
|
||||
+
|
||||
+ if (!found || !slot)
|
||||
+ if (!slot)
|
||||
+ goto out_bootconf;
|
||||
+
|
||||
+ dev_info(dev, "mapped %u uImage.FIT filesystem sub-image%s as /dev/fit%s%u%s\n",
|
||||
@ -675,7 +675,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
+ kfree(bootconf);
|
||||
+ kfree(fit);
|
||||
+out_blkdev:
|
||||
+ if (!found || ret)
|
||||
+ if (!slot)
|
||||
+ blkdev_put(bdev, &_fitblk_claim_ptr);
|
||||
+
|
||||
+ return ret;
|
||||
|
Loading…
x
Reference in New Issue
Block a user