netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtnetlink: Mask the rta_type when range checking
@ 2013-03-13 14:18 Vlad Yasevich
  2013-03-13 15:36 ` Stephen Hemminger
  0 siblings, 1 reply; 8+ messages in thread
From: Vlad Yasevich @ 2013-03-13 14:18 UTC (permalink / raw)
  To: netdev; +Cc: davem, Vlad Yasevich

Range/validity checks on rta_type in rtnetlink_rcv_msg() do
not account for flags that may be set.  This causes the function
to return -EINVAL when flags are set on the type (for example
NLA_F_NESTED).

Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
---
 net/core/rtnetlink.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 1868625..dc5edf1 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -2538,7 +2538,7 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
 		struct rtattr *attr = (void *)nlh + NLMSG_ALIGN(min_len);
 
 		while (RTA_OK(attr, attrlen)) {
-			unsigned int flavor = attr->rta_type;
+			unsigned int flavor = attr->rta_type & NLA_TYPE_MASK;
 			if (flavor) {
 				if (flavor > rta_max[sz_idx])
 					return -EINVAL;
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-03-17 15:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-13 14:18 [PATCH] rtnetlink: Mask the rta_type when range checking Vlad Yasevich
2013-03-13 15:36 ` Stephen Hemminger
2013-03-13 15:41   ` Vlad Yasevich
2013-03-14 17:40   ` Vlad Yasevich
2013-03-14 21:28     ` Thomas Graf
2013-03-15  0:30       ` Vlad Yasevich
2013-03-15  8:51         ` Thomas Graf
2013-03-17 15:44           ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).