diff options
author | David S. Miller <davem@davemloft.net> | 2008-06-12 17:47:58 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-06-12 19:34:34 -0400 |
commit | f23d60de719e639690b2dc5c2d0e4243ff614b7a (patch) | |
tree | 39e8083b98c476978ce45f0a4fc4de111554f786 /net | |
parent | 24e3fcefb9cc61acce59ed54c00c4e4c32537de7 (diff) |
ipv6: Fix duplicate initialization of rawv6_prot.destroy
In changeset 22dd485022f3d0b162ceb5e67d85de7c3806aa20
("raw: Raw socket leak.") code was added so that we
flush pending frames on raw sockets to avoid leaks.
The ipv4 part was fine, but the ipv6 part was not
done correctly. Unlike the ipv4 side, the ipv6 code
already has a .destroy method for rawv6_prot.
So now there were two assignments to this member, and
what the compiler does is use the last one, effectively
making the ipv6 parts of that changeset a NOP.
Fix this by removing the:
.destroy = inet6_destroy_sock,
line, and adding an inet6_destroy_sock() call to the
end of raw6_destroy().
Noticed by Al Viro.
Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv6/raw.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 8fee9a15b2d3..3aee12310d94 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -1169,7 +1169,8 @@ static int raw6_destroy(struct sock *sk) | |||
1169 | lock_sock(sk); | 1169 | lock_sock(sk); |
1170 | ip6_flush_pending_frames(sk); | 1170 | ip6_flush_pending_frames(sk); |
1171 | release_sock(sk); | 1171 | release_sock(sk); |
1172 | return 0; | 1172 | |
1173 | return inet6_destroy_sock(sk); | ||
1173 | } | 1174 | } |
1174 | 1175 | ||
1175 | static int rawv6_init_sk(struct sock *sk) | 1176 | static int rawv6_init_sk(struct sock *sk) |
@@ -1200,7 +1201,6 @@ struct proto rawv6_prot = { | |||
1200 | .disconnect = udp_disconnect, | 1201 | .disconnect = udp_disconnect, |
1201 | .ioctl = rawv6_ioctl, | 1202 | .ioctl = rawv6_ioctl, |
1202 | .init = rawv6_init_sk, | 1203 | .init = rawv6_init_sk, |
1203 | .destroy = inet6_destroy_sock, | ||
1204 | .setsockopt = rawv6_setsockopt, | 1204 | .setsockopt = rawv6_setsockopt, |
1205 | .getsockopt = rawv6_getsockopt, | 1205 | .getsockopt = rawv6_getsockopt, |
1206 | .sendmsg = rawv6_sendmsg, | 1206 | .sendmsg = rawv6_sendmsg, |