<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/base/class.c, branch v6.3</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v6.3</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.3'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2023-02-14T14:46:56Z</updated>
<entry>
<title>driver core: class: move EXPORT_SYMBOL_GPL() lines to the correct place</title>
<updated>2023-02-14T14:46:56Z</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2023-02-14T14:41:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=779aeb73d925586945b5dacab7453824766f149d'/>
<id>urn:sha1:779aeb73d925586945b5dacab7453824766f149d</id>
<content type='text'>
For some reason, the drivers/base/class.c file still had the "old style"
of exports, at the end of the file.  Move the exports to the proper
location, right after the function, to be correct.

Reviewed-by: Rafael J. Wysocki &lt;rafael@kernel.org&gt;
Link: https://lore.kernel.org/r/20230214144117.158956-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>driver core: make kobj_type structures constant</title>
<updated>2023-02-08T12:34:30Z</updated>
<author>
<name>Thomas Weißschuh</name>
<email>linux@weissschuh.net</email>
</author>
<published>2023-02-04T22:36:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c83d9ab42f1ef70d81bb3c637a12c098a9a05057'/>
<id>urn:sha1:c83d9ab42f1ef70d81bb3c637a12c098a9a05057</id>
<content type='text'>
Since commit ee6d3dd4ed48 ("driver core: make kobj_type constant.")
the driver core allows the usage of const struct kobj_type.

Take advantage of this to constify the structure definitions to prevent
modification at runtime.

Signed-off-by: Thomas Weißschuh &lt;linux@weissschuh.net&gt;
Link: https://lore.kernel.org/r/20230204-kobj_type-driver-core-v1-1-b9f809419f2c@weissschuh.net
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>driver core: class: Clear private pointer on registration failures</title>
<updated>2023-01-23T13:47:18Z</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rafael.j.wysocki@intel.com</email>
</author>
<published>2023-01-20T19:46:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0b2a1a3938aad80fb19cb53cbbd4679eeb37e3a8'/>
<id>urn:sha1:0b2a1a3938aad80fb19cb53cbbd4679eeb37e3a8</id>
<content type='text'>
Clear the class private pointer if __class_register() fails for it, so
as to allow its users to verify that the class is usable by checking
the value of that pointer.

For consistency, clear that pointer before freeing the object pointed
to by it in class_release().

Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Link: https://lore.kernel.org/r/4463268.LvFx2qVVIh@kreacher
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>driver core: change to_subsys_private() to use container_of_const()</title>
<updated>2023-01-11T15:10:09Z</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2023-01-11T09:33:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7bbb89b420d9e290cb34864832de8fcdf2c140dc'/>
<id>urn:sha1:7bbb89b420d9e290cb34864832de8fcdf2c140dc</id>
<content type='text'>
The macro to_subsys_private() needs to switch to using
container_of_const() as it turned out to being incorrectly casting a
const pointer to a non-const one.  Make this change and fix up the one
offending user to be correctly handling a const pointer properly.

Cc: "Rafael J. Wysocki" &lt;rafael@kernel.org&gt;
Reviewed-by: Rafael J. Wysocki &lt;rafael@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Link: https://lore.kernel.org/r/20230111093327.3955063-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>kobject: make kobject_get_ownership() take a constant kobject *</title>
<updated>2022-11-22T16:34:29Z</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2022-11-21T09:46:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=02a476d932287cf3096f78962ccb70d94d6203c6'/>
<id>urn:sha1:02a476d932287cf3096f78962ccb70d94d6203c6</id>
<content type='text'>
The call, kobject_get_ownership(), does not modify the kobject passed
into it, so make it const.  This propagates down into the kobj_type
function callbacks so make the kobject passed into them also const,
ensuring that nothing in the kobject is being changed here.

This helps make it more obvious what calls and callbacks do, and do not,
modify structures passed to them.

Cc: Trond Myklebust &lt;trond.myklebust@hammerspace.com&gt;
Cc: Anna Schumaker &lt;anna@kernel.org&gt;
Cc: Roopa Prabhu &lt;roopa@nvidia.com&gt;
Cc: "David S. Miller" &lt;davem@davemloft.net&gt;
Cc: Eric Dumazet &lt;edumazet@google.com&gt;
Cc: Paolo Abeni &lt;pabeni@redhat.com&gt;
Cc: Chuck Lever &lt;chuck.lever@oracle.com&gt;
Cc: Jeff Layton &lt;jlayton@kernel.org&gt;
Cc: linux-nfs@vger.kernel.org
Cc: bridge@lists.linux-foundation.org
Cc: netdev@vger.kernel.org
Acked-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Acked-by: Rafael J. Wysocki &lt;rafael@kernel.org&gt;
Acked-by: Nikolay Aleksandrov &lt;razor@blackwall.org&gt;
Link: https://lore.kernel.org/r/20221121094649.1556002-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>class: fix possible memory leak in __class_register()</title>
<updated>2022-11-09T13:58:29Z</updated>
<author>
<name>Yang Yingliang</name>
<email>yangyingliang@huawei.com</email>
</author>
<published>2022-10-26T08:28:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8c3e8a6bdb5253b97ad532570f8b5db5f7a06407'/>
<id>urn:sha1:8c3e8a6bdb5253b97ad532570f8b5db5f7a06407</id>
<content type='text'>
If class_add_groups() returns error, the 'cp-&gt;subsys' need be
unregister, and the 'cp' need be freed.

We can not call kset_unregister() here, because the 'cls' will
be freed in callback function class_release() and it's also
freed in caller's error path, it will cause double free.

So fix this by calling kobject_del() and kfree_const(name) to
cleanup kobject. Besides, call kfree() to free the 'cp'.

Fault injection test can trigger this:

unreferenced object 0xffff888102fa8190 (size 8):
  comm "modprobe", pid 502, jiffies 4294906074 (age 49.296s)
  hex dump (first 8 bytes):
    70 6b 74 63 64 76 64 00                          pktcdvd.
  backtrace:
    [&lt;00000000e7c7703d&gt;] __kmalloc_track_caller+0x1ae/0x320
    [&lt;000000005e4d70bc&gt;] kstrdup+0x3a/0x70
    [&lt;00000000c2e5e85a&gt;] kstrdup_const+0x68/0x80
    [&lt;000000000049a8c7&gt;] kvasprintf_const+0x10b/0x190
    [&lt;0000000029123163&gt;] kobject_set_name_vargs+0x56/0x150
    [&lt;00000000747219c9&gt;] kobject_set_name+0xab/0xe0
    [&lt;0000000005f1ea4e&gt;] __class_register+0x15c/0x49a

unreferenced object 0xffff888037274000 (size 1024):
  comm "modprobe", pid 502, jiffies 4294906074 (age 49.296s)
  hex dump (first 32 bytes):
    00 40 27 37 80 88 ff ff 00 40 27 37 80 88 ff ff  .@'7.....@'7....
    00 00 00 00 ad 4e ad de ff ff ff ff 00 00 00 00  .....N..........
  backtrace:
    [&lt;00000000151f9600&gt;] kmem_cache_alloc_trace+0x17c/0x2f0
    [&lt;00000000ecf3dd95&gt;] __class_register+0x86/0x49a

Fixes: ced6473e7486 ("driver core: class: add class_groups support")
Signed-off-by: Yang Yingliang &lt;yangyingliang@huawei.com&gt;
Link: https://lore.kernel.org/r/20221026082803.3458760-1-yangyingliang@huawei.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>class: use IS_ERR_OR_NULL() helper in class_unregister()</title>
<updated>2022-09-01T16:15:40Z</updated>
<author>
<name>Yang Yingliang</name>
<email>yangyingliang@huawei.com</email>
</author>
<published>2022-08-22T06:19:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e9628e015fe205f10766f031f17e217f85650570'/>
<id>urn:sha1:e9628e015fe205f10766f031f17e217f85650570</id>
<content type='text'>
Use IS_ERR_OR_NULL() helper in class_unregister() to simplify code.

Signed-off-by: Yang Yingliang &lt;yangyingliang@huawei.com&gt;
Link: https://lore.kernel.org/r/20220822061922.3884113-1-yangyingliang@huawei.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>block: remove genhd.h</title>
<updated>2022-02-02T14:49:59Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2022-01-24T09:39:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=322cbb50de711814c42fb088f6d31901502c711a'/>
<id>urn:sha1:322cbb50de711814c42fb088f6d31901502c711a</id>
<content type='text'>
There is no good reason to keep genhd.h separate from the main blkdev.h
header that includes it.  So fold the contents of genhd.h into blkdev.h
and remove genhd.h entirely.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Chaitanya Kulkarni &lt;kch@nvidia.com&gt;
Reviewed-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Link: https://lore.kernel.org/r/20220124093913.742411-4-hch@lst.de
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>drivers: base: fix some kernel-doc markups</title>
<updated>2020-11-09T17:56:49Z</updated>
<author>
<name>Mauro Carvalho Chehab</name>
<email>mchehab+huawei@kernel.org</email>
</author>
<published>2020-10-23T16:32:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=33c0c9bdf7a59051a654cd98b7d2b48ce0080967'/>
<id>urn:sha1:33c0c9bdf7a59051a654cd98b7d2b48ce0080967</id>
<content type='text'>
class_create is actually defined at the header. Fix the
markup there and add a new one at the right place.

While here, also fix some markups for functions that have
different names between their prototypes and kernel-doc
comments.

Signed-off-by: Mauro Carvalho Chehab &lt;mchehab+huawei@kernel.org&gt;
Link: https://lore.kernel.org/r/2fb6efd6a1f90d69ff73bf579566079cbb051e15.1603469755.git.mchehab+huawei@kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>drivers core: Miscellaneous changes for sysfs_emit</title>
<updated>2020-10-02T11:12:07Z</updated>
<author>
<name>Joe Perches</name>
<email>joe@perches.com</email>
</author>
<published>2020-09-16T20:40:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=948b3edba8988306b635578a72b0dab6091a5eb0'/>
<id>urn:sha1:948b3edba8988306b635578a72b0dab6091a5eb0</id>
<content type='text'>
Change additional instances that could use sysfs_emit and sysfs_emit_at
that the coccinelle script could not convert.

o macros creating show functions with ## concatenation
o unbound sprintf uses with buf+len for start of output to sysfs_emit_at
o returns with ?: tests and sprintf to sysfs_emit
o sysfs output with struct class * not struct device * arguments

Miscellanea:

o remove unnecessary initializations around these changes
o consistently use int len for return length of show functions
o use octal permissions and not S_&lt;FOO&gt;
o rename a few show function names so DEVICE_ATTR_&lt;FOO&gt; can be used
o use DEVICE_ATTR_ADMIN_RO where appropriate
o consistently use const char *output for strings
o checkpatch/style neatening

Signed-off-by: Joe Perches &lt;joe@perches.com&gt;
Link: https://lore.kernel.org/r/8bc24444fe2049a9b2de6127389b57edfdfe324d.1600285923.git.joe@perches.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
