]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.9-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 2 Feb 2021 13:18:53 +0000 (14:18 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 2 Feb 2021 13:18:53 +0000 (14:18 +0100)
added patches:
nfc-fix-possible-resource-leak.patch
nfc-fix-resource-leak-when-target-index-is-invalid.patch

queue-4.9/nfc-fix-possible-resource-leak.patch [new file with mode: 0644]
queue-4.9/nfc-fix-resource-leak-when-target-index-is-invalid.patch [new file with mode: 0644]
queue-4.9/series

diff --git a/queue-4.9/nfc-fix-possible-resource-leak.patch b/queue-4.9/nfc-fix-possible-resource-leak.patch
new file mode 100644 (file)
index 0000000..11c2e53
--- /dev/null
@@ -0,0 +1,32 @@
+From d8f923c3ab96dbbb4e3c22d1afc1dc1d3b195cd8 Mon Sep 17 00:00:00 2001
+From: Pan Bian <bianpan2016@163.com>
+Date: Thu, 21 Jan 2021 07:37:45 -0800
+Subject: NFC: fix possible resource leak
+
+From: Pan Bian <bianpan2016@163.com>
+
+commit d8f923c3ab96dbbb4e3c22d1afc1dc1d3b195cd8 upstream.
+
+Put the device to avoid resource leak on path that the polling flag is
+invalid.
+
+Fixes: a831b9132065 ("NFC: Do not return EBUSY when stopping a poll that's already stopped")
+Signed-off-by: Pan Bian <bianpan2016@163.com>
+Link: https://lore.kernel.org/r/20210121153745.122184-1-bianpan2016@163.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ net/nfc/netlink.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/net/nfc/netlink.c
++++ b/net/nfc/netlink.c
+@@ -887,6 +887,7 @@ static int nfc_genl_stop_poll(struct sk_
+       if (!dev->polling) {
+               device_unlock(&dev->dev);
++              nfc_put_device(dev);
+               return -EINVAL;
+       }
diff --git a/queue-4.9/nfc-fix-resource-leak-when-target-index-is-invalid.patch b/queue-4.9/nfc-fix-resource-leak-when-target-index-is-invalid.patch
new file mode 100644 (file)
index 0000000..c5e0faa
--- /dev/null
@@ -0,0 +1,33 @@
+From 3a30537cee233fb7da302491b28c832247d89bbe Mon Sep 17 00:00:00 2001
+From: Pan Bian <bianpan2016@163.com>
+Date: Thu, 21 Jan 2021 07:27:48 -0800
+Subject: NFC: fix resource leak when target index is invalid
+
+From: Pan Bian <bianpan2016@163.com>
+
+commit 3a30537cee233fb7da302491b28c832247d89bbe upstream.
+
+Goto to the label put_dev instead of the label error to fix potential
+resource leak on path that the target index is invalid.
+
+Fixes: c4fbb6515a4d ("NFC: The core part should generate the target index")
+Signed-off-by: Pan Bian <bianpan2016@163.com>
+Link: https://lore.kernel.org/r/20210121152748.98409-1-bianpan2016@163.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ net/nfc/rawsock.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/net/nfc/rawsock.c
++++ b/net/nfc/rawsock.c
+@@ -117,7 +117,7 @@ static int rawsock_connect(struct socket
+       if (addr->target_idx > dev->target_next_idx - 1 ||
+           addr->target_idx < dev->target_next_idx - dev->n_targets) {
+               rc = -EINVAL;
+-              goto error;
++              goto put_dev;
+       }
+       rc = nfc_activate_target(dev, addr->target_idx, addr->nfc_protocol);
index 182bc53081d6175f2c91e899ea7da5ecee035a39..4e377cdf247525f1298179040bd71d09025cdb58 100644 (file)
@@ -28,3 +28,5 @@ mac80211-pause-tx-while-changing-interface-type.patch
 can-dev-prevent-potential-information-leak-in-can_fi.patch
 iommu-vt-d-gracefully-handle-dmar-units-with-no-supported-address-widths.patch
 iommu-vt-d-don-t-dereference-iommu_device-if-iommu_api-is-not-built.patch
+nfc-fix-resource-leak-when-target-index-is-invalid.patch
+nfc-fix-possible-resource-leak.patch