diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-06-25 06:27:29 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-06-25 06:27:29 -0400 |
commit | 5ce001b0e56638c726270d4f9e05d46d4250dfbb (patch) | |
tree | c21cf007ddef99d5e8b23dde9621bd9152e676a8 /include/net/netlink.h | |
parent | 7c9f8861e6c9c839f913e49b98c3854daca18f27 (diff) | |
parent | 543cf4cb3fe6f6cae3651ba918b9c56200b257d0 (diff) |
Merge branch 'linus' into stackprotector
Diffstat (limited to 'include/net/netlink.h')
-rw-r--r-- | include/net/netlink.h | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/include/net/netlink.h b/include/net/netlink.h index a5506c42f03c..dfc3701dfcc3 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h | |||
@@ -556,14 +556,12 @@ static inline void *nlmsg_get_pos(struct sk_buff *skb) | |||
556 | * @skb: socket buffer the message is stored in | 556 | * @skb: socket buffer the message is stored in |
557 | * @mark: mark to trim to | 557 | * @mark: mark to trim to |
558 | * | 558 | * |
559 | * Trims the message to the provided mark. Returns -1. | 559 | * Trims the message to the provided mark. |
560 | */ | 560 | */ |
561 | static inline int nlmsg_trim(struct sk_buff *skb, const void *mark) | 561 | static inline void nlmsg_trim(struct sk_buff *skb, const void *mark) |
562 | { | 562 | { |
563 | if (mark) | 563 | if (mark) |
564 | skb_trim(skb, (unsigned char *) mark - skb->data); | 564 | skb_trim(skb, (unsigned char *) mark - skb->data); |
565 | |||
566 | return -1; | ||
567 | } | 565 | } |
568 | 566 | ||
569 | /** | 567 | /** |
@@ -572,11 +570,11 @@ static inline int nlmsg_trim(struct sk_buff *skb, const void *mark) | |||
572 | * @nlh: netlink message header | 570 | * @nlh: netlink message header |
573 | * | 571 | * |
574 | * Removes the complete netlink message including all | 572 | * Removes the complete netlink message including all |
575 | * attributes from the socket buffer again. Returns -1. | 573 | * attributes from the socket buffer again. |
576 | */ | 574 | */ |
577 | static inline int nlmsg_cancel(struct sk_buff *skb, struct nlmsghdr *nlh) | 575 | static inline void nlmsg_cancel(struct sk_buff *skb, struct nlmsghdr *nlh) |
578 | { | 576 | { |
579 | return nlmsg_trim(skb, nlh); | 577 | nlmsg_trim(skb, nlh); |
580 | } | 578 | } |
581 | 579 | ||
582 | /** | 580 | /** |
@@ -772,12 +770,13 @@ static inline int __nla_parse_nested_compat(struct nlattr *tb[], int maxtype, | |||
772 | const struct nla_policy *policy, | 770 | const struct nla_policy *policy, |
773 | int len) | 771 | int len) |
774 | { | 772 | { |
775 | if (nla_len(nla) < len) | 773 | int nested_len = nla_len(nla) - NLA_ALIGN(len); |
776 | return -1; | 774 | |
777 | if (nla_len(nla) >= NLA_ALIGN(len) + sizeof(struct nlattr)) | 775 | if (nested_len < 0) |
778 | return nla_parse_nested(tb, maxtype, | 776 | return -EINVAL; |
779 | nla_data(nla) + NLA_ALIGN(len), | 777 | if (nested_len >= nla_attr_size(0)) |
780 | policy); | 778 | return nla_parse(tb, maxtype, nla_data(nla) + NLA_ALIGN(len), |
779 | nested_len, policy); | ||
781 | memset(tb, 0, sizeof(struct nlattr *) * (maxtype + 1)); | 780 | memset(tb, 0, sizeof(struct nlattr *) * (maxtype + 1)); |
782 | return 0; | 781 | return 0; |
783 | } | 782 | } |
@@ -1079,11 +1078,11 @@ static inline int nla_nest_compat_end(struct sk_buff *skb, struct nlattr *start) | |||
1079 | * @start: container attribute | 1078 | * @start: container attribute |
1080 | * | 1079 | * |
1081 | * Removes the container attribute and including all nested | 1080 | * Removes the container attribute and including all nested |
1082 | * attributes. Returns -1. | 1081 | * attributes. Returns -EMSGSIZE |
1083 | */ | 1082 | */ |
1084 | static inline int nla_nest_cancel(struct sk_buff *skb, struct nlattr *start) | 1083 | static inline void nla_nest_cancel(struct sk_buff *skb, struct nlattr *start) |
1085 | { | 1084 | { |
1086 | return nlmsg_trim(skb, start); | 1085 | nlmsg_trim(skb, start); |
1087 | } | 1086 | } |
1088 | 1087 | ||
1089 | /** | 1088 | /** |