linux/drivers/staging/gasket
Xiyu Yang e3436ce60c staging: gasket: Fix mapping refcnt leak when register/store fails
gasket_sysfs_register_store() invokes get_mapping(), which returns a
reference of the specified gasket_sysfs_mapping object to "mapping" with
increased refcnt.

When gasket_sysfs_register_store() returns, local variable "mapping"
becomes invalid, so the refcount should be decreased to keep refcount
balanced.

The reference counting issue happens in one exception handling path of
gasket_sysfs_register_store(). When gasket_dev is NULL, the function
forgets to decrease the refcnt increased by get_mapping(), causing a
refcnt leak.

Fix this issue by calling put_mapping() when gasket_dev is NULL.

Signed-off-by: Xiyu Yang <xiyuyang19@fudan.edu.cn>
Signed-off-by: Xin Tan <tanxin.ctf@gmail.com>
Link: https://lore.kernel.org/r/1587618941-13718-1-git-send-email-xiyuyang19@fudan.edu.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-23 13:37:25 +02:00
..
apex_driver.c Staging: gasket: Use temporaries to reduce line length. 2019-09-12 10:38:45 +01:00
apex.h
gasket_constants.h PCI: Add PCI_STD_NUM_BARS for the number of standard BARs 2019-10-14 10:22:26 -05:00
gasket_core.c mm/vma: introduce VM_ACCESS_FLAGS 2020-04-10 15:36:21 -07:00
gasket_core.h PCI: Add PCI_STD_NUM_BARS for the number of standard BARs 2019-10-14 10:22:26 -05:00
gasket_interrupt.c staging: gasket: gasket_interuppt.c: Fix string split issue. 2019-03-18 07:49:45 +01:00
gasket_interrupt.h
gasket_ioctl.c staging: gasket: Fix lines ending with a '(' 2019-10-27 08:15:42 +01:00
gasket_ioctl.h
gasket_page_table.c staging/gasket: Fix string split 2019-05-30 14:09:47 -07:00
gasket_page_table.h
gasket_sysfs.c staging: gasket: Fix mapping refcnt leak when register/store fails 2020-04-23 13:37:25 +02:00
gasket_sysfs.h staging: gasket: Replace macro __ATTR with __ATTR_NULL 2019-03-18 07:05:58 +01:00
gasket.h
Kconfig staging: add missing SPDX lines to Kconfig files 2019-04-03 11:10:15 +02:00
Makefile staging: add missing SPDX lines to Makefile files 2019-04-03 11:10:15 +02:00
TODO staging: gasket: TODO: re-implement using UIO 2018-09-10 18:08:06 +02:00