Patch "driver core: bus: Return -EIO instead of 0 when show/store invalid bus attribute" has been added to the 6.11-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

    driver core: bus: Return -EIO instead of 0 when show/store invalid bus attribute

to the 6.11-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:
     driver-core-bus-return-eio-instead-of-0-when-show-st.patch
and it can be found in the queue-6.11 subdirectory.

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



commit 5e5c52020e15ef7d687687634ec30d3aee1d6fcd
Author: Zijun Hu <quic_zijuhu@xxxxxxxxxxx>
Date:   Wed Jul 24 21:54:48 2024 +0800

    driver core: bus: Return -EIO instead of 0 when show/store invalid bus attribute
    
    [ Upstream commit c0fd973c108cdc22a384854bc4b3e288a9717bb2 ]
    
    Return -EIO instead of 0 for below erroneous bus attribute operations:
     - read a bus attribute without show().
     - write a bus attribute without store().
    
    Signed-off-by: Zijun Hu <quic_zijuhu@xxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240724-bus_fix-v2-1-5adbafc698fb@xxxxxxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 08362ecec0ecb..6a68734e7ebd1 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -152,7 +152,8 @@ static ssize_t bus_attr_show(struct kobject *kobj, struct attribute *attr,
 {
 	struct bus_attribute *bus_attr = to_bus_attr(attr);
 	struct subsys_private *subsys_priv = to_subsys_private(kobj);
-	ssize_t ret = 0;
+	/* return -EIO for reading a bus attribute without show() */
+	ssize_t ret = -EIO;
 
 	if (bus_attr->show)
 		ret = bus_attr->show(subsys_priv->bus, buf);
@@ -164,7 +165,8 @@ static ssize_t bus_attr_store(struct kobject *kobj, struct attribute *attr,
 {
 	struct bus_attribute *bus_attr = to_bus_attr(attr);
 	struct subsys_private *subsys_priv = to_subsys_private(kobj);
-	ssize_t ret = 0;
+	/* return -EIO for writing a bus attribute without store() */
+	ssize_t ret = -EIO;
 
 	if (bus_attr->store)
 		ret = bus_attr->store(subsys_priv->bus, buf, count);




[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