lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1401760236.14007.180.camel@deadeye.wl.decadent.org.uk>
Date:	Tue, 03 Jun 2014 02:50:36 +0100
From:	Ben Hutchings <ben@...adent.org.uk>
To:	David Miller <davem@...emloft.net>
Cc:	netdev <netdev@...r.kernel.org>,
	Venkat Duvvuru <VenkatKumar.Duvvuru@...lex.com>
Subject: [PATCH net-next 1/8] ethtool: Return immediately on error in
 ethtool_copy_validate_indir()

We must return -EFAULT immediately rather than continuing into
the loop.

Similarly, we may as well return -EINVAL directly.

Signed-off-by: Ben Hutchings <ben@...adent.org.uk>
---
 net/core/ethtool.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index aa8978a..c834cb2 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -561,19 +561,17 @@ static int ethtool_copy_validate_indir(u32 *indir, void __user *useraddr,
 					struct ethtool_rxnfc *rx_rings,
 					u32 size)
 {
-	int ret = 0, i;
+	int i;
 
 	if (copy_from_user(indir, useraddr, size * sizeof(indir[0])))
-		ret = -EFAULT;
+		return -EFAULT;
 
 	/* Validate ring indices */
-	for (i = 0; i < size; i++) {
-		if (indir[i] >= rx_rings->data) {
-			ret = -EINVAL;
-			break;
-		}
-	}
-	return ret;
+	for (i = 0; i < size; i++)
+		if (indir[i] >= rx_rings->data)
+			return -EINVAL;
+
+	return 0;
 }
 
 static noinline_for_stack int ethtool_get_rxfh_indir(struct net_device *dev,


-- 
Ben Hutchings
If more than one person is responsible for a bug, no one is at fault.

Download attachment "signature.asc" of type "application/pgp-signature" (829 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ