Patch "reset: bail if try_module_get() fails" 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

    reset: bail if try_module_get() fails

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:
     reset-bail-if-try_module_get-fails.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 90a753312c782c9845055ed651249c1b5dc77ac4
Author: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>
Date:   Mon Jun 7 10:26:15 2021 +0200

    reset: bail if try_module_get() fails
    
    [ Upstream commit 4fb26fb83f0def3d39c14e268bcd4003aae8fade ]
    
    Abort instead of returning a new reset control for a reset controller
    device that is going to have its module unloaded.
    
    Reported-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
    Fixes: 61fc41317666 ("reset: Add reset controller API")
    Acked-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20210607082615.15160-1-p.zabel@xxxxxxxxxxxxxx
    Signed-off-by: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/reset/core.c b/drivers/reset/core.c
index 71c1c8264b2d..e2a6a927b84c 100644
--- a/drivers/reset/core.c
+++ b/drivers/reset/core.c
@@ -774,7 +774,10 @@ static struct reset_control *__reset_control_get_internal(
 	if (!rstc)
 		return ERR_PTR(-ENOMEM);
 
-	try_module_get(rcdev->owner);
+	if (!try_module_get(rcdev->owner)) {
+		kfree(rstc);
+		return ERR_PTR(-ENODEV);
+	}
 
 	rstc->rcdev = rcdev;
 	list_add(&rstc->list, &rcdev->reset_control_head);



[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