Patch "mtd: mtdconcat: Check _read, _write callbacks existence before assignment" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    mtd: mtdconcat: Check _read, _write callbacks existence before assignment

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     mtd-mtdconcat-check-_read-_write-callbacks-existence.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 7b346db2954bc65af7bb30cb79369ded3eae2013
Author: Zhihao Cheng <chengzhihao1@xxxxxxxxxx>
Date:   Tue Aug 17 19:48:57 2021 +0800

    mtd: mtdconcat: Check _read, _write callbacks existence before assignment
    
    [ Upstream commit a89d69a44e282be95ae76125dddc79515541efeb ]
    
    Since 2431c4f5b46c3 ("mtd: Implement mtd_{read,write}() as wrappers
    around mtd_{read,write}_oob()") don't allow _write|_read and
    _write_oob|_read_oob existing at the same time, we should check the
    existence of callbacks "_read and _write" from subdev's master device
    (We can trust master device since it has been registered) before
    assigning, otherwise following warning occurs while making
    concatenated device:
    
      WARNING: CPU: 2 PID: 6728 at drivers/mtd/mtdcore.c:595
      add_mtd_device+0x7f/0x7b0
    
    Fixes: 2431c4f5b46c3 ("mtd: Implement mtd_{read,write}() around ...")
    Signed-off-by: Zhihao Cheng <chengzhihao1@xxxxxxxxxx>
    Signed-off-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>
    Link: https://lore.kernel.org/linux-mtd/20210817114857.2784825-3-chengzhihao1@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c
index af51eee6b5e8..f685a581df48 100644
--- a/drivers/mtd/mtdconcat.c
+++ b/drivers/mtd/mtdconcat.c
@@ -694,6 +694,10 @@ struct mtd_info *mtd_concat_create(struct mtd_info *subdev[],	/* subdevices to c
 		concat->mtd._block_markbad = concat_block_markbad;
 	if (subdev_master->_panic_write)
 		concat->mtd._panic_write = concat_panic_write;
+	if (subdev_master->_read)
+		concat->mtd._read = concat_read;
+	if (subdev_master->_write)
+		concat->mtd._write = concat_write;
 
 	concat->mtd.ecc_stats.badblocks = subdev[0]->ecc_stats.badblocks;
 
@@ -755,8 +759,6 @@ struct mtd_info *mtd_concat_create(struct mtd_info *subdev[],	/* subdevices to c
 	concat->mtd.name = name;
 
 	concat->mtd._erase = concat_erase;
-	concat->mtd._read = concat_read;
-	concat->mtd._write = concat_write;
 	concat->mtd._sync = concat_sync;
 	concat->mtd._lock = concat_lock;
 	concat->mtd._unlock = concat_unlock;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux