Commit f41bb6ed authored by Eric Dumazet's avatar Eric Dumazet Committed by Ben Hutchings

ipv6: sctp: fix lockdep splat in sctp_v6_get_dst()

commit 69ce6487 upstream.

While cooking the sctp np->opt rcu fixes, I forgot to move
one rcu_read_unlock() after the added rcu_dereference() in
sctp_v6_get_dst()

This gave lockdep warnings reported by Dave Jones.

Fixes: c836a8ba ("ipv6: sctp: add rcu protection around np->opt")
Reported-by: default avatarDave Jones <davej@codemonkey.org.uk>
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent f911e974
...@@ -314,14 +314,13 @@ static void sctp_v6_get_dst(struct sctp_transport *t, union sctp_addr *saddr, ...@@ -314,14 +314,13 @@ static void sctp_v6_get_dst(struct sctp_transport *t, union sctp_addr *saddr,
} }
} }
} }
rcu_read_unlock();
if (baddr) { if (baddr) {
ipv6_addr_copy(&fl6->saddr, &baddr->v6.sin6_addr); ipv6_addr_copy(&fl6->saddr, &baddr->v6.sin6_addr);
fl6->fl6_sport = baddr->v6.sin6_port; fl6->fl6_sport = baddr->v6.sin6_port;
final_p = fl6_update_dst(fl6, np->opt, &final); final_p = fl6_update_dst(fl6, np->opt, &final);
dst = ip6_dst_lookup_flow(sk, fl6, final_p, false); dst = ip6_dst_lookup_flow(sk, fl6, final_p, false);
} }
rcu_read_unlock();
out: out:
if (!IS_ERR(dst)) { if (!IS_ERR(dst)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment