[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20110428.135226.242113407.davem@davemloft.net>
Date: Thu, 28 Apr 2011 13:52:26 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: eric.dumazet@...il.com
Cc: herbert@...dor.apana.org.au, netdev@...r.kernel.org
Subject: Re: [PATCH] inet: add RCU protection to inet->opt
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.
--
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