<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/drivers/firewire/core-device.c, branch v6.12.80</title>
<subtitle>Clone of https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git</subtitle>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/'/>
<entry>
<title>firewire: core: update fw_device outside of device_find_child()</title>
<updated>2024-08-20T13:21:32+00:00</updated>
<author>
<name>Takashi Sakamoto</name>
<email>o-takashi@sakamocchi.jp</email>
</author>
<published>2024-08-20T13:21:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=e2c87f484190b12fedcea9c428906aafcb8783cf'/>
<id>e2c87f484190b12fedcea9c428906aafcb8783cf</id>
<content type='text'>
When detecting updates of bus topology, the data of fw_device is newly
allocated and caches the content of configuration ROM from the
corresponding node. Then, the tree of device is sought to find the
previous data of fw_device corresponding to the node. If found, the
previous data is updated and reused and the data of fw_device newly
allocated is going to be released.

The above procedure is done in the call of device_find_child(), however it
is a bit abusing against the intention of the helper function, since it is
preferable to find only without updating.

This commit splits the update outside of the call.

Cc: Zijun Hu &lt;zijun_hu@icloud.com&gt;
Link: https://lore.kernel.org/r/20240820132132.28839-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Sakamoto &lt;o-takashi@sakamocchi.jp&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When detecting updates of bus topology, the data of fw_device is newly
allocated and caches the content of configuration ROM from the
corresponding node. Then, the tree of device is sought to find the
previous data of fw_device corresponding to the node. If found, the
previous data is updated and reused and the data of fw_device newly
allocated is going to be released.

The above procedure is done in the call of device_find_child(), however it
is a bit abusing against the intention of the helper function, since it is
preferable to find only without updating.

This commit splits the update outside of the call.

Cc: Zijun Hu &lt;zijun_hu@icloud.com&gt;
Link: https://lore.kernel.org/r/20240820132132.28839-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Sakamoto &lt;o-takashi@sakamocchi.jp&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>firewire: core/ohci: minor refactoring for computation of configuration ROM size</title>
<updated>2024-08-14T13:12:22+00:00</updated>
<author>
<name>Takashi Sakamoto</name>
<email>o-takashi@sakamocchi.jp</email>
</author>
<published>2024-08-14T13:12:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=e8b89bc158199b60f3ae6c655ced4461c42d650b'/>
<id>e8b89bc158199b60f3ae6c655ced4461c42d650b</id>
<content type='text'>
The size of space for configuration ROM is defined by IEEE 1212. The start
and end offsets are available as some macros in UAPI header.

This commit uses these macros to compute the size.

Link: https://lore.kernel.org/r/20240814131222.69949-4-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Sakamoto &lt;o-takashi@sakamocchi.jp&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The size of space for configuration ROM is defined by IEEE 1212. The start
and end offsets are available as some macros in UAPI header.

This commit uses these macros to compute the size.

Link: https://lore.kernel.org/r/20240814131222.69949-4-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Sakamoto &lt;o-takashi@sakamocchi.jp&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>firewire: core: use lock in Xarray instead of local R/W semaphore</title>
<updated>2024-08-12T01:42:51+00:00</updated>
<author>
<name>Takashi Sakamoto</name>
<email>o-takashi@sakamocchi.jp</email>
</author>
<published>2024-08-12T01:42:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=7a0a57cff296bbd90451fbf1f5614ffc48da73cd'/>
<id>7a0a57cff296bbd90451fbf1f5614ffc48da73cd</id>
<content type='text'>
The data of XArray structure includes spinlock and requires no external
lock, while the data is still under the critical section by
fw_device_rwsem.

This commit deletes the critical section.

Link: https://lore.kernel.org/r/20240812014251.165492-3-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Sakamoto &lt;o-takashi@sakamocchi.jp&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The data of XArray structure includes spinlock and requires no external
lock, while the data is still under the critical section by
fw_device_rwsem.

This commit deletes the critical section.

Link: https://lore.kernel.org/r/20240812014251.165492-3-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Sakamoto &lt;o-takashi@sakamocchi.jp&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>firewire: core: replace IDR with XArray to maintain fw_device</title>
<updated>2024-08-12T01:42:50+00:00</updated>
<author>
<name>Takashi Sakamoto</name>
<email>o-takashi@sakamocchi.jp</email>
</author>
<published>2024-08-12T01:42:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=7e5a7725a0e4030cf37f8b93ff9d4328166a3b85'/>
<id>7e5a7725a0e4030cf37f8b93ff9d4328166a3b85</id>
<content type='text'>
In core function, the instances of fw_device corresponding to firewire device
node in system are maintained by IDR. As of kernel v6.0, IDR has been
superseded by XArray and deprecated.

This commit replaces the usage of IDR with XArray to maintain the device
instances. The instance of XArray is allocated statically, and
initialized with XA_FLAGS_ALLOC so that the index of allocated entry starts
with zero and available as the minor identifier of device node.

Link: https://lore.kernel.org/r/20240812014251.165492-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Sakamoto &lt;o-takashi@sakamocchi.jp&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In core function, the instances of fw_device corresponding to firewire device
node in system are maintained by IDR. As of kernel v6.0, IDR has been
superseded by XArray and deprecated.

This commit replaces the usage of IDR with XArray to maintain the device
instances. The instance of XArray is allocated statically, and
initialized with XA_FLAGS_ALLOC so that the index of allocated entry starts
with zero and available as the minor identifier of device node.

Link: https://lore.kernel.org/r/20240812014251.165492-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Sakamoto &lt;o-takashi@sakamocchi.jp&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>firewire: core: use guard macro to maintain properties of fw_card</title>
<updated>2024-08-05T08:54:05+00:00</updated>
<author>
<name>Takashi Sakamoto</name>
<email>o-takashi@sakamocchi.jp</email>
</author>
<published>2024-08-05T08:54:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=27310d5616227c2ba8c0cedc5cdbe236042738b7'/>
<id>27310d5616227c2ba8c0cedc5cdbe236042738b7</id>
<content type='text'>
The core functions uses spinlock in instance of fw_card structure to
protect concurrent access to properties in the instance.

This commit uses guard macro to maintain the spinlock.

Link: https://lore.kernel.org/r/20240805085408.251763-15-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Sakamoto &lt;o-takashi@sakamocchi.jp&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The core functions uses spinlock in instance of fw_card structure to
protect concurrent access to properties in the instance.

This commit uses guard macro to maintain the spinlock.

Link: https://lore.kernel.org/r/20240805085408.251763-15-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Sakamoto &lt;o-takashi@sakamocchi.jp&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>firewire: core: use guard macro to access to IDR for fw_device</title>
<updated>2024-08-05T08:53:57+00:00</updated>
<author>
<name>Takashi Sakamoto</name>
<email>o-takashi@sakamocchi.jp</email>
</author>
<published>2024-08-05T08:53:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=2a6a58f06bd5d123a5b248a565b90b5df26c9ea8'/>
<id>2a6a58f06bd5d123a5b248a565b90b5df26c9ea8</id>
<content type='text'>
The core function maintains the instance of fw_device structure by IDR.
The concurrent access to IDR is protected by static read/write semaphore.
The semaphore is also utilized to protect concurrent access to the
content of configuration ROM cached to the instance so that the cache is
swapped to the latest one.

This commit uses guard macro to maintain the mutex.

Link: https://lore.kernel.org/r/20240805085408.251763-7-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Sakamoto &lt;o-takashi@sakamocchi.jp&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The core function maintains the instance of fw_device structure by IDR.
The concurrent access to IDR is protected by static read/write semaphore.
The semaphore is also utilized to protect concurrent access to the
content of configuration ROM cached to the instance so that the cache is
swapped to the latest one.

This commit uses guard macro to maintain the mutex.

Link: https://lore.kernel.org/r/20240805085408.251763-7-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Sakamoto &lt;o-takashi@sakamocchi.jp&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>driver core: have match() callback in struct bus_type take a const *</title>
<updated>2024-07-03T13:16:54+00:00</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2024-07-01T12:07:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=d69d804845985c29ab5be5a4b3b1f4787893daf8'/>
<id>d69d804845985c29ab5be5a4b3b1f4787893daf8</id>
<content type='text'>
In the match() callback, the struct device_driver * should not be
changed, so change the function callback to be a const *.  This is one
step of many towards making the driver core safe to have struct
device_driver in read-only memory.

Because the match() callback is in all busses, all busses are modified
to handle this properly.  This does entail switching some container_of()
calls to container_of_const() to properly handle the constant *.

For some busses, like PCI and USB and HV, the const * is cast away in
the match callback as those busses do want to modify those structures at
this point in time (they have a local lock in the driver structure.)
That will have to be changed in the future if they wish to have their
struct device * in read-only-memory.

Cc: Rafael J. Wysocki &lt;rafael@kernel.org&gt;
Reviewed-by: Alex Elder &lt;elder@kernel.org&gt;
Acked-by: Sumit Garg &lt;sumit.garg@linaro.org&gt;
Link: https://lore.kernel.org/r/2024070136-wrongdoer-busily-01e8@gregkh
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In the match() callback, the struct device_driver * should not be
changed, so change the function callback to be a const *.  This is one
step of many towards making the driver core safe to have struct
device_driver in read-only memory.

Because the match() callback is in all busses, all busses are modified
to handle this properly.  This does entail switching some container_of()
calls to container_of_const() to properly handle the constant *.

For some busses, like PCI and USB and HV, the const * is cast away in
the match callback as those busses do want to modify those structures at
this point in time (they have a local lock in the driver structure.)
That will have to be changed in the future if they wish to have their
struct device * in read-only-memory.

Cc: Rafael J. Wysocki &lt;rafael@kernel.org&gt;
Reviewed-by: Alex Elder &lt;elder@kernel.org&gt;
Acked-by: Sumit Garg &lt;sumit.garg@linaro.org&gt;
Link: https://lore.kernel.org/r/2024070136-wrongdoer-busily-01e8@gregkh
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>firewire: core: add memo about the caller of show functions for device attributes</title>
<updated>2024-03-21T12:20:18+00:00</updated>
<author>
<name>Takashi Sakamoto</name>
<email>o-takashi@sakamocchi.jp</email>
</author>
<published>2024-03-18T08:59:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=bfb1ad3c6aab2341ace13222ac0a78e5b4c239c8'/>
<id>bfb1ad3c6aab2341ace13222ac0a78e5b4c239c8</id>
<content type='text'>
In the case of firewire core function, the caller of show functions for
device attributes is not only sysfs user, but also device initialization.

This commit adds memo about it against the typical assumption that the
functions are just dedicated to sysfs user.

Link: https://lore.kernel.org/lkml/20240318091759.678326-1-o-takashi@sakamocchi.jp/
Signed-off-by: Takashi Sakamoto &lt;o-takashi@sakamocchi.jp&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In the case of firewire core function, the caller of show functions for
device attributes is not only sysfs user, but also device initialization.

This commit adds memo about it against the typical assumption that the
functions are just dedicated to sysfs user.

Link: https://lore.kernel.org/lkml/20240318091759.678326-1-o-takashi@sakamocchi.jp/
Signed-off-by: Takashi Sakamoto &lt;o-takashi@sakamocchi.jp&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "firewire: Kill unnecessary buf check in device_attribute.show"</title>
<updated>2024-03-18T09:10:44+00:00</updated>
<author>
<name>Li Zhijian</name>
<email>lizhijian@fujitsu.com</email>
</author>
<published>2024-03-18T06:05:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=946593d1555921720fa674432e998a1b5931ddac'/>
<id>946593d1555921720fa674432e998a1b5931ddac</id>
<content type='text'>
This reverts commit 4a2b06ca33763b363038d333274e212db6ff0de1.

The previous fix didn't consider callers from other than sysfs. Revert
it to fix the NULL dereference

 kernel:  ? sysfs_emit+0xb5/0xc0
 kernel:  show_immediate+0x13f/0x1d0 [firewire_core]
 kernel:  init_fw_attribute_group+0x81/0x150 [firewire_core]
 kernel:  create_units+0x119/0x160 [firewire_core]
 kernel:  fw_device_init+0x1a9/0x330 [firewire_core]
 kernel:  fw_device_workfn+0x12/0x20 [firewire_core]
 kernel:  process_one_work+0x16f/0x350
 kernel:  worker_thread+0x306/0x440
 kernel:  ? __pfx_worker_thread+0x10/0x10
 kernel:  kthread+0xf2/0x120
 kernel:  ? __pfx_kthread+0x10/0x10
 kernel:  ret_from_fork+0x47/0x70
 kernel:  ? __pfx_kthread+0x10/0x10
 kernel:  ret_from_fork_asm+0x1b/0x30
 kernel:  &lt;/TASK&gt;
 kernel: ---[ end trace 0000000000000000 ]---
 kernel: ------------[ cut here ]------------

Fixes: 4a2b06ca3376 ("firewire: Kill unnecessary buf check in device_attribute.show")
Reported-by: Takashi Sakamoto &lt;o-takashi@sakamocchi.jp&gt;
Signed-off-by: Li Zhijian &lt;lizhijian@fujitsu.com&gt;
Link: https://lore.kernel.org/lkml/625470f3-b196-43f7-9844-fa1cb6da99f8@fujitsu.com/
Signed-off-by: Takashi Sakamoto &lt;o-takashi@sakamocchi.jp&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit 4a2b06ca33763b363038d333274e212db6ff0de1.

The previous fix didn't consider callers from other than sysfs. Revert
it to fix the NULL dereference

 kernel:  ? sysfs_emit+0xb5/0xc0
 kernel:  show_immediate+0x13f/0x1d0 [firewire_core]
 kernel:  init_fw_attribute_group+0x81/0x150 [firewire_core]
 kernel:  create_units+0x119/0x160 [firewire_core]
 kernel:  fw_device_init+0x1a9/0x330 [firewire_core]
 kernel:  fw_device_workfn+0x12/0x20 [firewire_core]
 kernel:  process_one_work+0x16f/0x350
 kernel:  worker_thread+0x306/0x440
 kernel:  ? __pfx_worker_thread+0x10/0x10
 kernel:  kthread+0xf2/0x120
 kernel:  ? __pfx_kthread+0x10/0x10
 kernel:  ret_from_fork+0x47/0x70
 kernel:  ? __pfx_kthread+0x10/0x10
 kernel:  ret_from_fork_asm+0x1b/0x30
 kernel:  &lt;/TASK&gt;
 kernel: ---[ end trace 0000000000000000 ]---
 kernel: ------------[ cut here ]------------

Fixes: 4a2b06ca3376 ("firewire: Kill unnecessary buf check in device_attribute.show")
Reported-by: Takashi Sakamoto &lt;o-takashi@sakamocchi.jp&gt;
Signed-off-by: Li Zhijian &lt;lizhijian@fujitsu.com&gt;
Link: https://lore.kernel.org/lkml/625470f3-b196-43f7-9844-fa1cb6da99f8@fujitsu.com/
Signed-off-by: Takashi Sakamoto &lt;o-takashi@sakamocchi.jp&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>firewire: core: fix build failure due to the caller of fw_csr_string()</title>
<updated>2024-03-11T01:38:13+00:00</updated>
<author>
<name>Takashi Sakamoto</name>
<email>o-takashi@sakamocchi.jp</email>
</author>
<published>2024-02-05T06:04:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=04f082d39b99f0b7b4b1cada14280f41d99f1e1f'/>
<id>04f082d39b99f0b7b4b1cada14280f41d99f1e1f</id>
<content type='text'>
A commit 47dc55181dcb ("firewire: core: search descriptor leaf just after
vendor directory entry in root directory") for v6.8-rc3 and a commit
67a5a58c0443 ("firewire: Kill unnecessary buf check in
device_attribute.show") for v6.9 bring build failure in for-next tree due
to the change of the name of local variable.

This commit fixes it.

Reported-by: Stephen Rothwell &lt;sfr@canb.auug.org.au&gt;
Closes: https://lore.kernel.org/lkml/20240202111602.6f6e2c1a@canb.auug.org.au/
Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Closes: https://lore.kernel.org/oe-kbuild-all/202402022343.NkgsMITA-lkp@intel.com/
Link: https://lore.kernel.org/r/20240205060448.13881-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Sakamoto &lt;o-takashi@sakamocchi.jp&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A commit 47dc55181dcb ("firewire: core: search descriptor leaf just after
vendor directory entry in root directory") for v6.8-rc3 and a commit
67a5a58c0443 ("firewire: Kill unnecessary buf check in
device_attribute.show") for v6.9 bring build failure in for-next tree due
to the change of the name of local variable.

This commit fixes it.

Reported-by: Stephen Rothwell &lt;sfr@canb.auug.org.au&gt;
Closes: https://lore.kernel.org/lkml/20240202111602.6f6e2c1a@canb.auug.org.au/
Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Closes: https://lore.kernel.org/oe-kbuild-all/202402022343.NkgsMITA-lkp@intel.com/
Link: https://lore.kernel.org/r/20240205060448.13881-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Sakamoto &lt;o-takashi@sakamocchi.jp&gt;
</pre>
</div>
</content>
</entry>
</feed>
