Re: [PATCH] netfilter: Fix potential use after free in ip6_route_me_harder()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 30, 2014 at 06:50:42PM +0200, Pablo Neira Ayuso wrote:
> From: Sergey Popovich <popovich_sergei@xxxxxxx>
> 
> [ Upstream commit a8951d5814e1373807a94f79f7ccec7041325470 ]
> 

Thank you, I'm queuing this for the 3.11 kernel as well.

Cheers,
--
Luís

> Dst is released one line before we access it again with dst->error.
> 
> Fixes: 58e35d147128 netfilter: ipv6: propagate routing errors from
> ip6_route_me_harder()
> 
> Cc: <stable@xxxxxxxxxxxxxxx> # 3.10.x
> Cc: <stable@xxxxxxxxxxxxxxx> # 3.12.x
> Cc: <stable@xxxxxxxxxxxxxxx> # 3.14.x
> Signed-off-by: Sergey Popovich <popovich_sergei@xxxxxxx>
> Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
> ---
>  net/ipv6/netfilter.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c
> index 95f3f1d..d38e6a8 100644
> --- a/net/ipv6/netfilter.c
> +++ b/net/ipv6/netfilter.c
> @@ -30,13 +30,15 @@ int ip6_route_me_harder(struct sk_buff *skb)
>  		.daddr = iph->daddr,
>  		.saddr = iph->saddr,
>  	};
> +	int err;
>  
>  	dst = ip6_route_output(net, skb->sk, &fl6);
> -	if (dst->error) {
> +	err = dst->error;
> +	if (err) {
>  		IP6_INC_STATS(net, ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES);
>  		LIMIT_NETDEBUG(KERN_DEBUG "ip6_route_me_harder: No more route.\n");
>  		dst_release(dst);
> -		return dst->error;
> +		return err;
>  	}
>  
>  	/* Drop old route. */
> -- 
> 1.7.10.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe stable" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]