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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 17 Jan 2012 10:37:13 -0800
From:	Joe Perches <joe@...ches.com>
To:	Michał Mirosław <mirq-linux@...e.qmqm.pl>
Cc:	"David S. Miller" <davem@...emloft.net>,
	LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH] vsprintf: Prevent NULL dereference using %pNF

Passing NULL to %pNF is done in skb_gso_segment
which could be dereferenced.

Add noinline_for_stack to function.
Make pointer argument the actual type.
Check pointer for NULL and use 0 when so.

Signed-off-by: Joe Perches <joe@...ches.com>
---
 lib/vsprintf.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 8e75003..0f1dfd9 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -777,16 +777,24 @@ char *uuid_string(char *buf, char *end, const u8 *addr,
 	return string(buf, end, uuid, spec);
 }
 
-static
-char *netdev_feature_string(char *buf, char *end, const u8 *addr,
-		      struct printf_spec spec)
+static noinline_for_stack
+char *netdev_feature_string(char *buf, char *end,
+			    const netdev_features_t *features,
+			    struct printf_spec spec)
 {
+	unsigned long long num;
+
+	if (features)
+		num = (unsigned long long)*features;
+	else
+		num = 0;
+
 	spec.flags |= SPECIAL | SMALL | ZEROPAD;
 	if (spec.field_width == -1)
 		spec.field_width = 2 + 2 * sizeof(netdev_features_t);
 	spec.base = 16;
 
-	return number(buf, end, *(const netdev_features_t *)addr, spec);
+	return number(buf, end, num, spec);
 }
 
 int kptr_restrict __read_mostly;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ