android_kernel_xiaomi_sm7250/drivers/firewire
Niels Dossche 914c59ddab firewire: core: extend card->lock in fw_core_handle_bus_reset
commit a7ecbe92b9243edbe94772f6f2c854e4142a3345 upstream.

card->local_node and card->bm_retries are both always accessed under
card->lock.
fw_core_handle_bus_reset has a check whose condition depends on
card->local_node and whose body writes to card->bm_retries.
Both of these accesses are not under card->lock. Move the lock acquiring
of card->lock to before this check such that these accesses do happen
when card->lock is held.
fw_destroy_nodes is called inside the check.
Since fw_destroy_nodes already acquires card->lock inside its function
body, move this out to the callsites of fw_destroy_nodes.
Also add a comment to indicate which locking is necessary when calling
fw_destroy_nodes.

Cc: <stable@vger.kernel.org>
Signed-off-by: Niels Dossche <dossche.niels@gmail.com>
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20220409041243.603210-4-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-05-12 12:20:24 +02:00
..
core-card.c firewire: core: extend card->lock in fw_core_handle_bus_reset 2022-05-12 12:20:24 +02:00
core-cdev.c firewire: fix potential uaf in outbound_phy_packet_callback() 2022-05-12 12:20:24 +02:00
core-device.c scripts/spelling.txt: add "intialization" pattern and fix typo instances 2017-02-27 18:43:47 -08:00
core-iso.c treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00
core-topology.c firewire: core: extend card->lock in fw_core_handle_bus_reset 2022-05-12 12:20:24 +02:00
core-transaction.c firewire: remove check of list iterator against head past the loop body 2022-05-12 12:20:24 +02:00
core.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
init_ohci1394_dma.c
Kconfig firewire: IEEE 1394 (FireWire) support should depend on HAS_DMA 2014-07-13 20:53:25 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
net.c net: add annotations on hh->hh_len lockless accesses 2020-01-09 10:19:09 +01:00
nosy-user.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
nosy.c firewire: nosy: Fix a use-after-free bug in nosy_ioctl() 2021-04-07 12:48:50 +02:00
nosy.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ohci.c IEEE 1394 subsystem patches: 2018-02-02 14:57:44 -08:00
ohci.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sbp2.c firewire: remove check of list iterator against head past the loop body 2022-05-12 12:20:24 +02:00