]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 4.19
authorSasha Levin <sashal@kernel.org>
Tue, 22 Nov 2022 15:18:01 +0000 (10:18 -0500)
committerSasha Levin <sashal@kernel.org>
Tue, 22 Nov 2022 15:18:01 +0000 (10:18 -0500)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-4.19/input-i8042-fix-leaking-of-platform-device-on-module.patch [new file with mode: 0644]
queue-4.19/scsi-target-tcm_loop-fix-possible-name-leak-in-tcm_l.patch [new file with mode: 0644]
queue-4.19/series

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 (file)
index 0000000..034ad85
--- /dev/null
@@ -0,0 +1,54 @@
+From cf6d421349a21d8f55851a7d440482007b707dd5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 18 Nov 2022 15:40:03 -0800
+Subject: Input: i8042 - fix leaking of platform device on module removal
+
+From: Chen Jun <chenjun102@huawei.com>
+
+[ 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 <chenjun102@huawei.com>
+Link: https://lore.kernel.org/r/20221109034148.23821-1-chenjun102@huawei.com
+Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ 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 (file)
index 0000000..f19d725
--- /dev/null
@@ -0,0 +1,51 @@
+From db139547d4e46696d45938d21e677ad3d8a7b7cb Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+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 <yangyingliang@huawei.com>
+
+[ 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 <yangyingliang@huawei.com>
+Link: https://lore.kernel.org/r/20221115015042.3652261-1-yangyingliang@huawei.com
+Reviewed-by: Mike Christie <michael.chritie@oracle.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ 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
+
index 0f72d0ea8dd896ab93e483c96dd04f32be349425..c05897d00819a5f8db29a9692809514bd91cd15c 100644 (file)
@@ -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