diff options
author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2005-06-13 17:59:44 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-06-13 17:59:44 -0400 |
commit | 84427d533076a08137779b3182a71c37bf000b27 (patch) | |
tree | 248f7bbcebe0be59bc9b520b8611133b870a5c71 /net/ipv6 | |
parent | 979b6c135fc4d466a39d8e3ec05583e5ee30261a (diff) |
[IPV6]: Ensure to use icmpv6_socket in non-preemptive context.
We saw following trace several times:
|BUG: using smp_processor_id() in preemptible [00000001] code: httpd/30137
|caller is icmpv6_send+0x23/0x540
| [<c01ad63b>] smp_processor_id+0x9b/0xb8
| [<c02993e7>] icmpv6_send+0x23/0x540
This is because of icmpv6_socket, which is the only one user of
smp_processor_id() in icmpv6_send(), AFAIK.
Since it should be used in non-preemptive context,
let's defer the dereference after disabling preemption
(by icmpv6_xmit_lock()).
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/icmp.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index 8e0f569b883e..ff3ec9822e36 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c | |||
@@ -277,8 +277,8 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info, | |||
277 | { | 277 | { |
278 | struct inet6_dev *idev = NULL; | 278 | struct inet6_dev *idev = NULL; |
279 | struct ipv6hdr *hdr = skb->nh.ipv6h; | 279 | struct ipv6hdr *hdr = skb->nh.ipv6h; |
280 | struct sock *sk = icmpv6_socket->sk; | 280 | struct sock *sk; |
281 | struct ipv6_pinfo *np = inet6_sk(sk); | 281 | struct ipv6_pinfo *np; |
282 | struct in6_addr *saddr = NULL; | 282 | struct in6_addr *saddr = NULL; |
283 | struct dst_entry *dst; | 283 | struct dst_entry *dst; |
284 | struct icmp6hdr tmp_hdr; | 284 | struct icmp6hdr tmp_hdr; |
@@ -358,6 +358,9 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info, | |||
358 | if (icmpv6_xmit_lock()) | 358 | if (icmpv6_xmit_lock()) |
359 | return; | 359 | return; |
360 | 360 | ||
361 | sk = icmpv6_socket->sk; | ||
362 | np = inet6_sk(sk); | ||
363 | |||
361 | if (!icmpv6_xrlim_allow(sk, type, &fl)) | 364 | if (!icmpv6_xrlim_allow(sk, type, &fl)) |
362 | goto out; | 365 | goto out; |
363 | 366 | ||
@@ -423,9 +426,9 @@ out: | |||
423 | 426 | ||
424 | static void icmpv6_echo_reply(struct sk_buff *skb) | 427 | static void icmpv6_echo_reply(struct sk_buff *skb) |
425 | { | 428 | { |
426 | struct sock *sk = icmpv6_socket->sk; | 429 | struct sock *sk; |
427 | struct inet6_dev *idev; | 430 | struct inet6_dev *idev; |
428 | struct ipv6_pinfo *np = inet6_sk(sk); | 431 | struct ipv6_pinfo *np; |
429 | struct in6_addr *saddr = NULL; | 432 | struct in6_addr *saddr = NULL; |
430 | struct icmp6hdr *icmph = (struct icmp6hdr *) skb->h.raw; | 433 | struct icmp6hdr *icmph = (struct icmp6hdr *) skb->h.raw; |
431 | struct icmp6hdr tmp_hdr; | 434 | struct icmp6hdr tmp_hdr; |
@@ -454,6 +457,9 @@ static void icmpv6_echo_reply(struct sk_buff *skb) | |||
454 | if (icmpv6_xmit_lock()) | 457 | if (icmpv6_xmit_lock()) |
455 | return; | 458 | return; |
456 | 459 | ||
460 | sk = icmpv6_socket->sk; | ||
461 | np = inet6_sk(sk); | ||
462 | |||
457 | if (!fl.oif && ipv6_addr_is_multicast(&fl.fl6_dst)) | 463 | if (!fl.oif && ipv6_addr_is_multicast(&fl.fl6_dst)) |
458 | fl.oif = np->mcast_oif; | 464 | fl.oif = np->mcast_oif; |
459 | 465 | ||