lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1304024136.2954.9.camel@edumazet-laptop>
Date:	Thu, 28 Apr 2011 22:55:36 +0200
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	David Miller <davem@...emloft.net>
Cc:	herbert@...dor.apana.org.au, netdev@...r.kernel.org
Subject: Re: [PATCH] inet: add RCU protection to inet->opt

Le jeudi 28 avril 2011 à 13:52 -0700, David Miller a écrit :
> From: Eric Dumazet <eric.dumazet@...il.com>
> Date: Thu, 28 Apr 2011 22:49:19 +0200
> 
> > Are you sure socket is locked at this point ? ( by a priori call to
> > lock_sock())
> 
> Ugh, it's not, I'll commit this fix which is safe because we're only
> peeking at inet_opt to fetch the faddr value then we never reference
> it again:
> 
> diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c
> index 962a607..e13c166 100644
> --- a/net/l2tp/l2tp_ip.c
> +++ b/net/l2tp/l2tp_ip.c
> @@ -472,13 +472,15 @@ static int l2tp_ip_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m
>  	if (rt == NULL) {
>  		struct ip_options_rcu *inet_opt;
>  
> -		inet_opt = rcu_dereference_protected(inet->inet_opt,
> -						     sock_owned_by_user(sk));
> +		rcu_read_lock();
> +		inet_opt = rcu_dereference(inet->inet_opt);
>  
>  		/* Use correct destination address if we have options. */
>  		if (inet_opt && inet_opt->opt.srr)
>  			daddr = inet_opt->opt.faddr;
>  
> +		rcu_read_unlock();
> +
>  		/* If this fails, retransmit mechanism of transport layer will
>  		 * keep trying until route appears or the connection times
>  		 * itself out.


Thats perfect, thanks !


--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ