rpms/kernel/F-8 linux-2.6-netlink-fix-parse-of-nested-attributes.patch, NONE, 1.1 kernel.spec, 1.461, 1.462

Chuck Ebbert (cebbert) fedora-extras-commits at redhat.com
Mon Jun 9 22:13:21 UTC 2008


Author: cebbert

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

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6-netlink-fix-parse-of-nested-attributes.patch 
Log Message:
* Mon Jun 09 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.25.6-22
- Copy netlink message parsing bug fix from Fedora 9.


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-8/kernel.spec,v
retrieving revision 1.461
retrieving revision 1.462
diff -u -r1.461 -r1.462
--- kernel.spec	9 Jun 2008 21:32:32 -0000	1.461
+++ kernel.spec	9 Jun 2008 22:12:37 -0000	1.462
@@ -618,6 +618,8 @@
 Patch425: linux-2.6-nfs-client-mounts-hang.patch
 
 Patch430: linux-2.6-net-silence-noisy-printks.patch
+Patch431: linux-2.6-netlink-fix-parse-of-nested-attributes.patch
+
 Patch440: linux-2.6-sha_alignment.patch
 Patch450: linux-2.6-input-kill-stupid-messages.patch
 Patch460: linux-2.6-serial-460800.patch
@@ -1091,6 +1093,8 @@
 # Networking
 # Disable easy to trigger printk's.
 ApplyPatch linux-2.6-net-silence-noisy-printks.patch
+# fix netlink message parsing
+ApplyPatch linux-2.6-netlink-fix-parse-of-nested-attributes.patch
 
 # Misc fixes
 # Fix SHA1 alignment problem on ia64
@@ -1808,6 +1812,9 @@
 
 
 %changelog
+* Mon Jun 09 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.25.6-22
+- Copy netlink message parsing bug fix from Fedora 9.
+
 * Mon Jun 09 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.25.6-21
 - Fix hang with audigy2 sound card (#326411)
 




More information about the fedora-extras-commits mailing list