WSL2-Linux-Kernel/drivers/firewire
Takashi Sakamoto 531390a243 firewire: fix memory leak for payload of request subaction to IEC 61883-1 FCP region
This patch is fix for Linux kernel v2.6.33 or later.

For request subaction to IEC 61883-1 FCP region, Linux FireWire subsystem
have had an issue of use-after-free. The subsystem allows multiple
user space listeners to the region, while data of the payload was likely
released before the listeners execute read(2) to access to it for copying
to user space.

The issue was fixed by a commit 281e20323a ("firewire: core: fix
use-after-free regression in FCP handler"). The object of payload is
duplicated in kernel space for each listener. When the listener executes
ioctl(2) with FW_CDEV_IOC_SEND_RESPONSE request, the object is going to
be released.

However, it causes memory leak since the commit relies on call of
release_request() in drivers/firewire/core-cdev.c. Against the
expectation, the function is never called due to the design of
release_client_resource(). The function delegates release task
to caller when called with non-NULL fourth argument. The implementation
of ioctl_send_response() is the case. It should release the object
explicitly.

This commit fixes the bug.

Cc: <stable@vger.kernel.org>
Fixes: 281e20323a ("firewire: core: fix use-after-free regression in FCP handler")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20230117090610.93792-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-01-17 18:09:21 +01:00
..
Kconfig
Makefile
core-card.c Merge branch 'for-linus' into for-next 2022-05-23 07:48:27 +02:00
core-cdev.c firewire: fix memory leak for payload of request subaction to IEC 61883-1 FCP region 2023-01-17 18:09:21 +01:00
core-device.c firewire: convert sysfs sprintf/snprintf family to sysfs_emit 2022-06-17 10:43:20 +02:00
core-iso.c
core-topology.c firewire: core: extend card->lock in fw_core_handle_bus_reset 2022-04-25 08:01:09 +02:00
core-transaction.c Merge branch 'for-linus' into for-next 2022-05-23 07:48:27 +02:00
core.h
init_ohci1394_dma.c
net.c firewire: net: Make use of get_unaligned_be48(), put_unaligned_be48() 2022-07-28 22:21:54 -07:00
nosy-user.h
nosy.c firewire: nosy: switch from 'pci_' to 'dma_' API 2021-07-05 22:23:15 +02:00
nosy.h
ohci.c
ohci.h
sbp2.c firewire: remove check of list iterator against head past the loop body 2022-04-25 08:01:08 +02:00