[dpdk-stable] patch 'kni: fix copy_from_user failure handling' has been queued to LTS release 18.11.3

Kevin Traynor ktraynor at redhat.com
Tue Aug 27 11:30:21 CEST 2019


Hi,

FYI, your patch has been queued to LTS release 18.11.3

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 09/03/19. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable-queue

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable-queue/commit/7597357d4a351a4a87d8441bf9e35571ab8bd19c

Thanks.

Kevin Traynor

---
>From 7597357d4a351a4a87d8441bf9e35571ab8bd19c Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen at networkplumber.org>
Date: Mon, 24 Jun 2019 09:47:11 -0700
Subject: [PATCH] kni: fix copy_from_user failure handling

[ upstream commit 21dde05a95bb301d485ac2c332a80271213e67c3 ]

The correct thing to return if user gives a bad data
is to return -EFAULT. Logging is also discouraged because
it could be used as a DoS attack.

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
Acked-by: Ferruh Yigit <ferruh.yigit at intel.com>
---
 kernel/linux/kni/kni_misc.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/kernel/linux/kni/kni_misc.c b/kernel/linux/kni/kni_misc.c
index b74e8a3a6..8bf0e2103 100644
--- a/kernel/linux/kni/kni_misc.c
+++ b/kernel/linux/kni/kni_misc.c
@@ -319,9 +319,6 @@ kni_ioctl_create(struct net *net, uint32_t ioctl_num,
 
 	/* Copy kni info from user space */
-	ret = copy_from_user(&dev_info, (void *)ioctl_param, sizeof(dev_info));
-	if (ret) {
-		pr_err("copy_from_user in kni_ioctl_create");
-		return -EIO;
-	}
+	if (copy_from_user(&dev_info, (void *)ioctl_param, sizeof(dev_info)))
+		return -EFAULT;
 
 	/* Check if name is zero-ended */
@@ -496,13 +493,10 @@ kni_ioctl_release(struct net *net, uint32_t ioctl_num,
 		return -EINVAL;
 
-	ret = copy_from_user(&dev_info, (void *)ioctl_param, sizeof(dev_info));
-	if (ret) {
-		pr_err("copy_from_user in kni_ioctl_release");
-		return -EIO;
-	}
+	if (copy_from_user(&dev_info, (void *)ioctl_param, sizeof(dev_info)))
+		return -EFAULT;
 
 	/* Release the network device according to its name */
 	if (strlen(dev_info.name) == 0)
-		return ret;
+		return -EINVAL;
 
 	down_write(&knet->kni_list_lock);
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2019-08-27 09:40:13.311807116 +0100
+++ 0044-kni-fix-copy_from_user-failure-handling.patch	2019-08-27 09:40:10.941143878 +0100
@@ -1 +1 @@
-From 21dde05a95bb301d485ac2c332a80271213e67c3 Mon Sep 17 00:00:00 2001
+From 7597357d4a351a4a87d8441bf9e35571ab8bd19c Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 21dde05a95bb301d485ac2c332a80271213e67c3 ]
+
@@ -17 +19 @@
-index b59cf24c2..be45f8234 100644
+index b74e8a3a6..8bf0e2103 100644
@@ -20 +22 @@
-@@ -302,9 +302,6 @@ kni_ioctl_create(struct net *net, uint32_t ioctl_num,
+@@ -319,9 +319,6 @@ kni_ioctl_create(struct net *net, uint32_t ioctl_num,
@@ -32 +34 @@
-@@ -428,13 +425,10 @@ kni_ioctl_release(struct net *net, uint32_t ioctl_num,
+@@ -496,13 +493,10 @@ kni_ioctl_release(struct net *net, uint32_t ioctl_num,


More information about the stable mailing list