Patch "md: don't rely on 'mddev->pers' to be set in mddev_suspend()" has been added to the 6.6-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

    md: don't rely on 'mddev->pers' to be set in mddev_suspend()

to the 6.6-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:
     md-don-t-rely-on-mddev-pers-to-be-set-in-mddev_suspe.patch
and it can be found in the queue-6.6 subdirectory.

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



commit ff995c501649ac2ea35de819751069e44a8b880e
Author: Yu Kuai <yukuai3@xxxxxxxxxx>
Date:   Fri Aug 25 11:09:52 2023 +0800

    md: don't rely on 'mddev->pers' to be set in mddev_suspend()
    
    [ Upstream commit b721e7885eb242aa2459ee66bb42ceef1bcf0f0c ]
    
    'active_io' used to be initialized while the array is running, and
    'mddev->pers' is set while the array is running as well. Hence caller
    must hold 'reconfig_mutex' and guarantee 'mddev->pers' is set before
    calling mddev_suspend().
    
    Now that 'active_io' is initialized when mddev is allocated, such
    restriction doesn't exist anymore. In the meantime, follow up patches
    will refactor mddev_suspend(), hence add checking for 'mddev->pers' to
    prevent null-ptr-deref.
    
    Signed-off-by: Yu Kuai <yukuai3@xxxxxxxxxx>
    Signed-off-by: Song Liu <song@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230825030956.1527023-4-yukuai1@xxxxxxxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/md/md.c b/drivers/md/md.c
index a104a025084dc..9247e55c7eafc 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -449,7 +449,7 @@ void mddev_suspend(struct mddev *mddev)
 	set_bit(MD_ALLOW_SB_UPDATE, &mddev->flags);
 	percpu_ref_kill(&mddev->active_io);
 
-	if (mddev->pers->prepare_suspend)
+	if (mddev->pers && mddev->pers->prepare_suspend)
 		mddev->pers->prepare_suspend(mddev);
 
 	wait_event(mddev->sb_wait, percpu_ref_is_zero(&mddev->active_io));



[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