rpms/kernel/F-9 linux-2.6-netlink-fix-parse-of-nested-attributes.patch, NONE, 1.1 kernel.spec, 1.655, 1.656

Chuck Ebbert (cebbert) fedora-extras-commits at redhat.com
Wed May 28 01:49:37 UTC 2008


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-9
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv20819

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6-netlink-fix-parse-of-nested-attributes.patch 
Log Message:
* Tue May 28 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.25.4-37
- Fix parsing of netlink messages (#447812)


linux-2.6-netlink-fix-parse-of-nested-attributes.patch:

--- NEW FILE linux-2.6-netlink-fix-parse-of-nested-attributes.patch ---
From: Thomas Graf <tgraf at suug.ch>
Date: Thu, 22 May 2008 17:48:59 +0000 (-0700)
Subject: netlink: Fix nla_parse_nested_compat() to call nla_parse() directly
X-Git-Tag: v2.6.26-rc4~7^2~2
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=b9a2f2e450b0f770bb4347ae8d48eb2dea701e24

netlink: Fix nla_parse_nested_compat() to call nla_parse() directly

The purpose of nla_parse_nested_compat() is to parse attributes which
contain a struct followed by a stream of nested attributes.  So far,
it called nla_parse_nested() to parse the stream of nested attributes
which was wrong, as nla_parse_nested() expects a container attribute
as data which holds the attribute stream.  It needs to call
nla_parse() directly while pointing at the next possible alignment
point after the struct in the beginning of the attribute.

With this patch, I can no longer reproduce the reported leftover
warnings.

Signed-off-by: Thomas Graf <tgraf at suug.ch>
Acked-by: Patrick McHardy <kaber at trash.net>
Signed-off-by: David S. Miller <davem at davemloft.net>
---

diff --git a/include/net/netlink.h b/include/net/netlink.h
index a5506c4..112dcdf 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -772,12 +772,13 @@ static inline int __nla_parse_nested_compat(struct nlattr *tb[], int maxtype,
 					    const struct nla_policy *policy,
 					    int len)
 {
-	if (nla_len(nla) < len)
+	int nested_len = nla_len(nla) - NLA_ALIGN(len);
+
+	if (nested_len < 0)
 		return -1;
-	if (nla_len(nla) >= NLA_ALIGN(len) + sizeof(struct nlattr))
-		return nla_parse_nested(tb, maxtype,
-					nla_data(nla) + NLA_ALIGN(len),
-					policy);
+	if (nested_len >= nla_attr_size(0))
+		return nla_parse(tb, maxtype, nla_data(nla) + NLA_ALIGN(len),
+				 nested_len, policy);
 	memset(tb, 0, sizeof(struct nlattr *) * (maxtype + 1));
 	return 0;
 }


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-9/kernel.spec,v
retrieving revision 1.655
retrieving revision 1.656
diff -u -r1.655 -r1.656
--- kernel.spec	27 May 2008 22:58:44 -0000	1.655
+++ kernel.spec	28 May 2008 01:48:43 -0000	1.656
@@ -620,6 +620,8 @@
 
 Patch430: linux-2.6-net-silence-noisy-printks.patch
 Patch431: linux-2.6-net-iptables-add-xt_iprange-aliases.patch
+Patch432: linux-2.6-netlink-fix-parse-of-nested-attributes.patch
+
 Patch450: linux-2.6-input-kill-stupid-messages.patch
 Patch451: linux-2.6-input-fix_fn_key_on_macbookpro_4_1_and_mb_air.patch
 Patch460: linux-2.6-serial-460800.patch
@@ -1157,6 +1159,8 @@
 ApplyPatch linux-2.6-net-silence-noisy-printks.patch
 # fix firewall scripts using iprange (#446827)
 ApplyPatch linux-2.6-net-iptables-add-xt_iprange-aliases.patch
+# fix parse of netlink messages
+ApplyPatch linux-2.6-netlink-fix-parse-of-nested-attributes.patch
 
 # Misc fixes
 # The input layer spews crap no-one cares about.
@@ -1841,6 +1845,9 @@
 %kernel_variant_files -a /%{image_install_path}/xen*-%{KVERREL}.xen -e /etc/ld.so.conf.d/kernelcap-%{KVERREL}.xen.conf %{with_xen} xen
 
 %changelog
+* Tue May 28 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.25.4-37
+- Fix parsing of netlink messages (#447812)
+
 * Tue May 27 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.25.4-36
 - Fix two hard-to-reproduce x86 bugs:
   x86: fix sched_clock when calibrated against PIT




More information about the fedora-extras-commits mailing list