key: Free dumping state on socket close
Subsystems (3)
Fix a xfrm_{state,policy}_walk leak if pfkey socket is closed while dumping is on-going.
Signed-off-by Timo Teras <[email protected]>
---
Checked netlink code and the dumper clean up is done in there in netlink_sock_destruct.
I'll update the "put dumpers on dump list" patch by making the state release a function since there's the skb to free too.
net/key/af_key.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
net/key/af_key.c +8 -0
@@ -89,6 +89,14 @@ static int pfkey_do_dump(struct pfkey_sock *pfk)static void pfkey_sock_destruct (struct sock *sk) { +struct pfkey_sock *pfk =pfkey_sk (sk); + +if (pfk->dump.dump) { + pfk->dump.done (pfk); + pfk->dump.dump =NULL ; + pfk->dump.done =NULL ; + } +skb_queue_purge (&sk->sk_receive_queue);if (!sock_flag (sk,SOCK_DEAD )) {
Signature · 1 line
1.5.4.3
Quoted 23 lines · Timo Ter??s
Fix a xfrm_{state,policy}_walk leak if pfkey socket is closed while dumping is on-going.
Signed-off-by Timo Teras <[email protected]>---
Checked netlink code and the dumper clean up is done in there innetlink_sock_destruct.I'll update the "put dumpers on dump list" patch by making the state release a function since there's the skb to free too.
net/key/af_key.c| 8 ++++++++1 files changed, 8 insertions(+), 0 deletions(-)net/key/af_key.c +1
-0@@ -89,6 +89,14 @@ static int pfkey_do_dump(struct pfkey_sock *pfk)static void pfkey_sock_destruct (struct sock *sk) { +struct pfkey_sock *pfk =pfkey_sk (sk);
net/key/af_key.c static int pfkey_do_dump(struct pfkey_sock *pfk) · line 102
Quoted 10 lines
net/key/af_key.c +7
-0+ +if (pfk->dump.dump) { + pfk->dump.done (pfk); + pfk->dump.dump =NULL ; + pfk->dump.done =NULL ; + } +skb_queue_purge (&sk->sk_receive_queue);if (!sock_flag (sk,SOCK_DEAD )) {
Acked-by Herbert Xu <[email protected]>
Thanks,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt