Patch "block: grab a device refcount in disk_uevent" has been added to the 5.13-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

    block: grab a device refcount in disk_uevent

to the 5.13-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:
     block-grab-a-device-refcount-in-disk_uevent.patch
and it can be found in the queue-5.13 subdirectory.

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



commit 84104052d93977ed1de374998c4cddf8bcfc67c5
Author: Christoph Hellwig <hch@xxxxxx>
Date:   Thu Jul 1 10:16:37 2021 +0200

    block: grab a device refcount in disk_uevent
    
    [ Upstream commit 498dcc13fd6463de29b94e160f40ed04d5477cd8 ]
    
    Sending uevents requires the struct device to be alive.  To
    ensure that grab the device refcount instead of just an inode
    reference.
    
    Fixes: bc359d03c7ec ("block: add a disk_uevent helper")
    Signed-off-by: Christoph Hellwig <hch@xxxxxx>
    Link: https://lore.kernel.org/r/20210701081638.246552-2-hch@xxxxxx
    Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/block/genhd.c b/block/genhd.c
index 9f8cb7beaad1..ad7436bd60c1 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -402,12 +402,12 @@ void disk_uevent(struct gendisk *disk, enum kobject_action action)
 	xa_for_each(&disk->part_tbl, idx, part) {
 		if (bdev_is_partition(part) && !bdev_nr_sectors(part))
 			continue;
-		if (!bdgrab(part))
+		if (!kobject_get_unless_zero(&part->bd_device.kobj))
 			continue;
 
 		rcu_read_unlock();
 		kobject_uevent(bdev_kobj(part), action);
-		bdput(part);
+		put_device(&part->bd_device);
 		rcu_read_lock();
 	}
 	rcu_read_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