netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* key: Free dumping state on socket close
@ 2008-09-26  6:08 Timo Teräs
  2008-10-04 14:17 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Timo Teräs @ 2008-09-26  6:08 UTC (permalink / raw)
  To: netdev

Fix a xfrm_{state,policy}_walk leak if pfkey socket is closed while
dumping is on-going.

Signed-off-by: Timo Teras <timo.teras@iki.fi>
---
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(-)

diff --git a/net/key/af_key.c b/net/key/af_key.c
index d628df9..97007de 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -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)) {
-- 
1.5.4.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: key: Free dumping state on socket close
  2008-09-26  6:08 key: Free dumping state on socket close Timo Teräs
@ 2008-10-04 14:17 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2008-10-04 14:17 UTC (permalink / raw)
  To: Timo Ter??s; +Cc: netdev, davem

Timo Ter??s <timo.teras@iki.fi> wrote:
> Fix a xfrm_{state,policy}_walk leak if pfkey socket is closed while
> dumping is on-going.
> 
> Signed-off-by: Timo Teras <timo.teras@iki.fi>
> ---
> 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(-)
> 
> diff --git a/net/key/af_key.c b/net/key/af_key.c
> index d628df9..97007de 100644
> --- a/net/key/af_key.c
> +++ b/net/key/af_key.c
> @@ -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)) {

Acked-by: Herbert Xu <herbert@gondor.apana.org.au>

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-10-04 14:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-26  6:08 key: Free dumping state on socket close Timo Teräs
2008-10-04 14:17 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).