[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87vbid99gw.fsf@x220.int.ebiederm.org>
Date: Fri, 06 Mar 2015 14:06:39 -0600
From: ebiederm@...ssion.com (Eric W. Biederman)
To: Robert Shearman <rshearma@...cade.com>
Cc: David Miller <davem@...emloft.net>, <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next] mpls: Properly validate RTA_VIA payload length
Robert Shearman <rshearma@...cade.com> writes:
> If the nla length is less than 2 then the nla data could be accessed
> beyond the accessible bounds. So ensure that the nla is big enough to
> at least read the via_family before doing so. Replace magic value of
> 2.
>
Acked-by: "Eric W. Biederman" <ebiederm@...ssion.com>
> Fixes: 03c0566542f4 ("mpls: Basic support for adding and removing routes")
> Cc: Eric W. Biederman <ebiederm@...ssion.com>
> Signed-off-by: Robert Shearman <rshearma@...cade.com>
> ---
> net/mpls/af_mpls.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
> index 23e51d1..4ce39f6 100644
> --- a/net/mpls/af_mpls.c
> +++ b/net/mpls/af_mpls.c
> @@ -585,8 +585,11 @@ static int rtm_to_route_config(struct sk_buff *skb, struct nlmsghdr *nlh,
> case RTA_VIA:
> {
> struct rtvia *via = nla_data(nla);
> + if (nla_len(nla) < offsetof(struct rtvia, rtvia_addr))
> + goto errout;
> cfg->rc_via_family = via->rtvia_family;
> - cfg->rc_via_alen = nla_len(nla) - 2;
> + cfg->rc_via_alen = nla_len(nla) -
> + offsetof(struct rtvia, rtvia_addr);
> if (cfg->rc_via_alen > MAX_VIA_ALEN)
> goto errout;
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists