<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/base/bus.c, branch v6.1.168</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.1.168</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.1.168'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2024-12-14T18:54:00+00:00</updated>
<entry>
<title>driver core: bus: Fix double free in driver API bus_register()</title>
<updated>2024-12-14T18:54:00+00:00</updated>
<author>
<name>Zijun Hu</name>
<email>quic_zijuhu@quicinc.com</email>
</author>
<published>2024-07-27T08:34:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=fc1f391a71a3ee88291e205cffd673fe24d99266'/>
<id>urn:sha1:fc1f391a71a3ee88291e205cffd673fe24d99266</id>
<content type='text'>
commit bfa54a793ba77ef696755b66f3ac4ed00c7d1248 upstream.

For bus_register(), any error which happens after kset_register() will
cause that @priv are freed twice, fixed by setting @priv with NULL after
the first free.

Signed-off-by: Zijun Hu &lt;quic_zijuhu@quicinc.com&gt;
Link: https://lore.kernel.org/r/20240727-bus_register_fix-v1-1-fed8dd0dba7a@quicinc.com
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
[ Brennan : Backport requires bus-&gt;p = NULL instead of priv = NULL ]
Signed-off-by: Brennan Lamoreaux &lt;brennan.lamoreaux@broadcom.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>driver core: bus: Return -EIO instead of 0 when show/store invalid bus attribute</title>
<updated>2024-10-17T13:22:17+00:00</updated>
<author>
<name>Zijun Hu</name>
<email>quic_zijuhu@quicinc.com</email>
</author>
<published>2024-07-24T13:54:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b80d8c2c55e53e725bcef5d40a8f1a3f029df5af'/>
<id>urn:sha1:b80d8c2c55e53e725bcef5d40a8f1a3f029df5af</id>
<content type='text'>
[ 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 &lt;quic_zijuhu@quicinc.com&gt;
Link: https://lore.kernel.org/r/20240724-bus_fix-v2-1-5adbafc698fb@quicinc.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>driver: base: fix UAF when driver_attach failed</title>
<updated>2022-05-19T17:28:42+00:00</updated>
<author>
<name>Schspa Shi</name>
<email>schspa@gmail.com</email>
</author>
<published>2022-05-13T11:24:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=310862e574001a97ad02272bac0fd13f75f42a27'/>
<id>urn:sha1:310862e574001a97ad02272bac0fd13f75f42a27</id>
<content type='text'>
When driver_attach(drv); failed, the driver_private will be freed.
But it has been added to the bus, which caused a UAF.

To fix it, we need to delete it from the bus when failed.

Fixes: 190888ac01d0 ("driver core: fix possible missing of device probe")
Signed-off-by: Schspa Shi &lt;schspa@gmail.com&gt;
Link: https://lore.kernel.org/r/20220513112444.45112-1-schspa@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>kobject: remove kset from struct kset_uevent_ops callbacks</title>
<updated>2021-12-28T10:26:18+00:00</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2021-12-27T16:39:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=cf6299b6101903c31bddb0065804b2121ed510c7'/>
<id>urn:sha1:cf6299b6101903c31bddb0065804b2121ed510c7</id>
<content type='text'>
There is no need to pass the pointer to the kset in the struct
kset_uevent_ops callbacks as no one uses it, so just remove that pointer
entirely.

Reviewed-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Reviewed-by: Wedson Almeida Filho &lt;wedsonaf@google.com&gt;
Link: https://lore.kernel.org/r/20211227163924.3970661-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>driver core: make kobj_type constant.</title>
<updated>2021-12-27T09:40:00+00:00</updated>
<author>
<name>Wedson Almeida Filho</name>
<email>wedsonaf@google.com</email>
</author>
<published>2021-12-24T23:13:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ee6d3dd4ed48ab24b74bab3c3977b8218518247d'/>
<id>urn:sha1:ee6d3dd4ed48ab24b74bab3c3977b8218518247d</id>
<content type='text'>
This way instances of kobj_type (which contain function pointers) can be
stored in .rodata, which means that they cannot be [easily/accidentally]
modified at runtime.

Signed-off-by: Wedson Almeida Filho &lt;wedsonaf@google.com&gt;
Link: https://lore.kernel.org/r/20211224231345.777370-1-wedsonaf@google.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>driver: base: Replace symbolic permissions with octal permissions</title>
<updated>2021-07-21T12:56:00+00:00</updated>
<author>
<name>Jinchao Wang</name>
<email>wjc@cdjrlc.com</email>
</author>
<published>2021-06-26T09:46:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=16b0dd40922995bb13f140b025bb760b6c5224b0'/>
<id>urn:sha1:16b0dd40922995bb13f140b025bb760b6c5224b0</id>
<content type='text'>
Resolve following checkpatch issue,
Replace symbolic permissions with octal permissions

Signed-off-by: Jinchao Wang &lt;wjc@cdjrlc.com&gt;
Link: https://lore.kernel.org/r/20210626094606.53152-1-wjc@cdjrlc.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>driver core: Flow the return code from -&gt;probe() through to sysfs bind</title>
<updated>2021-06-21T21:29:24+00:00</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2021-06-17T14:22:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ef6dcbdd8eb2f44dce70a3abecc32d43cc5f3e64'/>
<id>urn:sha1:ef6dcbdd8eb2f44dce70a3abecc32d43cc5f3e64</id>
<content type='text'>
Currently really_probe() returns 1 on success and 0 if the probe() call
fails. This return code arrangement is designed to be useful for
__device_attach_driver() which is walking the device list and trying every
driver. 0 means to keep trying.

However, it is not useful for the other places that call through to
really_probe() that do actually want to see the probe() return code.

For instance bind_store() would be better to return the actual error code
from the driver's probe method, not discarding it and returning -ENODEV.

Reorganize things so that really_probe() returns the error code from
-&gt;probe as a (inverted) positive number, and 0 for successful attach.

With this, __device_attach_driver can ignore the (positive) probe errors,
return 1 to exit the loop for a successful binding and pass on the
other negative errors, while device_driver_attach simplify inverts the
positive errors and returns all errors to the sysfs code.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Reviewed-by: Cornelia Huck &lt;cohuck@redhat.com&gt;
Link: https://lore.kernel.org/r/20210617142218.1877096-4-hch@lst.de
Signed-off-by: Alex Williamson &lt;alex.williamson@redhat.com&gt;
</content>
</entry>
<entry>
<title>driver core: Pull required checks into driver_probe_device()</title>
<updated>2021-06-21T21:29:24+00:00</updated>
<author>
<name>Jason Gunthorpe</name>
<email>jgg@nvidia.com</email>
</author>
<published>2021-06-17T14:22:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=204db60c83574559a8e08ce4bbd0029d56b8ab2e'/>
<id>urn:sha1:204db60c83574559a8e08ce4bbd0029d56b8ab2e</id>
<content type='text'>
Checking if the dev is dead or if the dev is already bound is a required
precondition to invoking driver_probe_device(). All the call chains
leading here duplicate these checks.

Add it directly to driver_probe_device() so the precondition is clear and
remove the checks from device_driver_attach() and
__driver_attach_async_helper().

The other call chain going through __device_attach_driver() does have
these same checks but they are inlined into logic higher up the call stack
and can't be removed.

The sysfs uAPI call chain starting at bind_store() is a bit confused
because it reads dev-&gt;driver unlocked and returns -ENODEV if it is !NULL,
otherwise it reads it again under lock and returns 0 if it is !NULL. Fix
this to always return -EBUSY and always read dev-&gt;driver under its lock.

Done in preparation for the next patches which will add additional
callers to driver_probe_device() and will need these checks as well.

Signed-off-by: Jason Gunthorpe &lt;jgg@nvidia.com&gt;
[hch: drop the extra checks in device_driver_attach and bind_store]
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Reviewed-by: Cornelia Huck &lt;cohuck@redhat.com&gt;
Link: https://lore.kernel.org/r/20210617142218.1877096-2-hch@lst.de
Signed-off-by: Alex Williamson &lt;alex.williamson@redhat.com&gt;
</content>
</entry>
<entry>
<title>drivers: base: change 'driver_create_groups' to 'driver_add_groups' in printk</title>
<updated>2021-01-27T13:35:09+00:00</updated>
<author>
<name>Joe Pater</name>
<email>02joepater06@gmail.com</email>
</author>
<published>2021-01-10T14:54:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4044b2fcfb2048a256529ecbd869b43713982006'/>
<id>urn:sha1:4044b2fcfb2048a256529ecbd869b43713982006</id>
<content type='text'>
driver_create_groups doesn't seem to have ever existed. Change its
mention in a printk to 'driver_add_groups'.

Signed-off-by: Joe Pater &lt;02joepater06@gmail.com&gt;
Link: https://lore.kernel.org/r/20210110145442.15301-1-02joepater06@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>drivers: base: remove unused function find_bus()</title>
<updated>2021-01-07T19:33:03+00:00</updated>
<author>
<name>Joe Pater</name>
<email>02joepater06@gmail.com</email>
</author>
<published>2021-01-03T20:32:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7520962b66906574267994c285d04c739ebaf722'/>
<id>urn:sha1:7520962b66906574267994c285d04c739ebaf722</id>
<content type='text'>
find_bus() isn't doing anyone any good sitting in a '#if 0' (as it's
been doing since 2006!).

Signed-off-by: Joe Pater &lt;02joepater06@gmail.com&gt;
Link: https://lore.kernel.org/r/20210103203238.111565-1-02joepater06@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
