From: Sasha Levin Date: Tue, 22 Nov 2022 15:18:01 +0000 (-0500) Subject: Fixes for 4.19 X-Git-Tag: v4.19.266~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=251b8b6146359f830e6ce65d718a2d874b40ee7b;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.19 Signed-off-by: Sasha Levin --- diff --git a/queue-4.19/input-i8042-fix-leaking-of-platform-device-on-module.patch b/queue-4.19/input-i8042-fix-leaking-of-platform-device-on-module.patch new file mode 100644 index 00000000000..034ad85035c --- /dev/null +++ b/queue-4.19/input-i8042-fix-leaking-of-platform-device-on-module.patch @@ -0,0 +1,54 @@ +From cf6d421349a21d8f55851a7d440482007b707dd5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 18 Nov 2022 15:40:03 -0800 +Subject: Input: i8042 - fix leaking of platform device on module removal + +From: Chen Jun + +[ Upstream commit 81cd7e8489278d28794e7b272950c3e00c344e44 ] + +Avoid resetting the module-wide i8042_platform_device pointer in +i8042_probe() or i8042_remove(), so that the device can be properly +destroyed by i8042_exit() on module unload. + +Fixes: 9222ba68c3f4 ("Input: i8042 - add deferred probe support") +Signed-off-by: Chen Jun +Link: https://lore.kernel.org/r/20221109034148.23821-1-chenjun102@huawei.com +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/serio/i8042.c | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c +index 082afbf088d6..c9b51511b33d 100644 +--- a/drivers/input/serio/i8042.c ++++ b/drivers/input/serio/i8042.c +@@ -1544,8 +1544,6 @@ static int i8042_probe(struct platform_device *dev) + { + int error; + +- i8042_platform_device = dev; +- + if (i8042_reset == I8042_RESET_ALWAYS) { + error = i8042_controller_selftest(); + if (error) +@@ -1583,7 +1581,6 @@ static int i8042_probe(struct platform_device *dev) + i8042_free_aux_ports(); /* in case KBD failed but AUX not */ + i8042_free_irqs(); + i8042_controller_reset(false); +- i8042_platform_device = NULL; + + return error; + } +@@ -1593,7 +1590,6 @@ static int i8042_remove(struct platform_device *dev) + i8042_unregister_ports(); + i8042_free_irqs(); + i8042_controller_reset(false); +- i8042_platform_device = NULL; + + return 0; + } +-- +2.35.1 + diff --git a/queue-4.19/scsi-target-tcm_loop-fix-possible-name-leak-in-tcm_l.patch b/queue-4.19/scsi-target-tcm_loop-fix-possible-name-leak-in-tcm_l.patch new file mode 100644 index 00000000000..f19d7254659 --- /dev/null +++ b/queue-4.19/scsi-target-tcm_loop-fix-possible-name-leak-in-tcm_l.patch @@ -0,0 +1,51 @@ +From db139547d4e46696d45938d21e677ad3d8a7b7cb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 15 Nov 2022 09:50:42 +0800 +Subject: scsi: target: tcm_loop: Fix possible name leak in + tcm_loop_setup_hba_bus() + +From: Yang Yingliang + +[ Upstream commit bc68e428d4963af0201e92159629ab96948f0893 ] + +If device_register() fails in tcm_loop_setup_hba_bus(), the name allocated +by dev_set_name() need be freed. As comment of device_register() says, it +should use put_device() to give up the reference in the error path. So fix +this by calling put_device(), then the name can be freed in kobject_cleanup(). +The 'tl_hba' will be freed in tcm_loop_release_adapter(), so it don't need +goto error label in this case. + +Fixes: 3703b2c5d041 ("[SCSI] tcm_loop: Add multi-fabric Linux/SCSI LLD fabric module") +Signed-off-by: Yang Yingliang +Link: https://lore.kernel.org/r/20221115015042.3652261-1-yangyingliang@huawei.com +Reviewed-by: Mike Christie +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/target/loopback/tcm_loop.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c +index bc8918f382e4..80b74db4048b 100644 +--- a/drivers/target/loopback/tcm_loop.c ++++ b/drivers/target/loopback/tcm_loop.c +@@ -409,6 +409,7 @@ static int tcm_loop_setup_hba_bus(struct tcm_loop_hba *tl_hba, int tcm_loop_host + ret = device_register(&tl_hba->dev); + if (ret) { + pr_err("device_register() failed for tl_hba->dev: %d\n", ret); ++ put_device(&tl_hba->dev); + return -ENODEV; + } + +@@ -1103,7 +1104,7 @@ static struct se_wwn *tcm_loop_make_scsi_hba( + */ + ret = tcm_loop_setup_hba_bus(tl_hba, tcm_loop_hba_no_cnt); + if (ret) +- goto out; ++ return ERR_PTR(ret); + + sh = tl_hba->sh; + tcm_loop_hba_no_cnt++; +-- +2.35.1 + diff --git a/queue-4.19/series b/queue-4.19/series index 0f72d0ea8dd..c05897d0081 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -96,3 +96,5 @@ mmc-core-properly-select-voltage-range-without-power-cycle.patch mmc-sdhci-pci-fix-possible-memory-leak-caused-by-missing-pci_dev_put.patch docs-update-mediator-contact-information-in-coc-doc.patch misc-vmw_vmci-fix-an-infoleak-in-vmci_host_do_receive_datagram.patch +scsi-target-tcm_loop-fix-possible-name-leak-in-tcm_l.patch +input-i8042-fix-leaking-of-platform-device-on-module.patch