Patch "gpiolib: Fix scope-based gpio_device refcounting" has been added to the 6.7-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

    gpiolib: Fix scope-based gpio_device refcounting

to the 6.7-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:
     gpiolib-fix-scope-based-gpio_device-refcounting.patch
and it can be found in the queue-6.7 subdirectory.

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



commit 1c7e002205e7f2b22b6b136ccc9669cc82f03338
Author: Lukas Wunner <lukas@xxxxxxxxx>
Date:   Mon Jan 15 16:05:26 2024 +0100

    gpiolib: Fix scope-based gpio_device refcounting
    
    [ Upstream commit 832b371097eb928d077c827b8f117bf5b99d35c0 ]
    
    Commit 9e4555d1e54a ("gpiolib: add support for scope-based management to
    gpio_device") sought to add scope-based gpio_device refcounting, but
    erroneously forgot a negation of IS_ERR_OR_NULL().
    
    As a result, gpio_device_put() is not called if the gpio_device pointer
    is valid (meaning the ref is leaked), but only called if the pointer is
    NULL or an ERR_PTR().
    
    While at it drop a superfluous trailing semicolon.
    
    Fixes: 9e4555d1e54a ("gpiolib: add support for scope-based management to gpio_device")
    Signed-off-by: Lukas Wunner <lukas@xxxxxxxxx>
    Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index 0aed62f0c633..f2878b361463 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -614,7 +614,7 @@ struct gpio_device *gpio_device_get(struct gpio_device *gdev);
 void gpio_device_put(struct gpio_device *gdev);
 
 DEFINE_FREE(gpio_device_put, struct gpio_device *,
-	    if (IS_ERR_OR_NULL(_T)) gpio_device_put(_T));
+	    if (!IS_ERR_OR_NULL(_T)) gpio_device_put(_T))
 
 struct device *gpio_device_to_device(struct gpio_device *gdev);
 




[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