[openwrt/openwrt] generic: fitblk: close block device if mapping image failed

LEDE Commits lede-commits at lists.infradead.org
Mon Apr 14 10:35:24 PDT 2025


dangole pushed a commit to openwrt/openwrt.git, branch openwrt-24.10:
https://git.openwrt.org/9e9f6875bcc576946f37dce8d88742d259065f0b

commit 9e9f6875bcc576946f37dce8d88742d259065f0b
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Fri Mar 28 15:40:28 2025 +0000

    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 at makrotopia.org>
    (cherry picked from commit 2b9c81d1cbc65eeb9304b7274058418efa8a9c78)
---
 .../pending-6.6/510-block-add-uImage.FIT-subimage-block-driver.patch  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/linux/generic/pending-6.6/510-block-add-uImage.FIT-subimage-block-driver.patch b/target/linux/generic/pending-6.6/510-block-add-uImage.FIT-subimage-block-driver.patch
index b06c29ffaf..5a88631513 100644
--- a/target/linux/generic/pending-6.6/510-block-add-uImage.FIT-subimage-block-driver.patch
+++ b/target/linux/generic/pending-6.6/510-block-add-uImage.FIT-subimage-block-driver.patch
@@ -656,7 +656,7 @@ Signed-off-by: Daniel Golle <daniel at 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 at makrotopia.org>
 +	kfree(bootconf);
 +	kfree(fit);
 +out_blkdev:
-+	if (!found || ret)
++	if (!slot)
 +		blkdev_put(bdev, &_fitblk_claim_ptr);
 +
 +	return ret;




More information about the lede-commits mailing list