netdev
[Top] [All Lists]

[IPSEC] Fix xfrm_tunnel leak

To: "David S. Miller" <davem@xxxxxxxxxx>, netdev@xxxxxxxxxxx
Subject: [IPSEC] Fix xfrm_tunnel leak
From: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 1 Jun 2004 22:25:59 +1000
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mutt/1.5.5.1+cvs20040105i
Hi Dave:

I recently managed to create a mode=tunnel state that I couldn't get rid
of:

192.168.0.6 192.168.0.178 
        unspec mode=tunnel spi=3232235526(0xc0a80006) reqid=0(0x00000000)
        seq=0x00000000 replay=0 flags=0x00000000 state=mature 
        created: May 29 13:20:10 2004   current: Jun  1 22:23:15 2004
        diff: 291785(s) hard: 0(s)      soft: 0(s)
        last:                           hard: 0(s)      soft: 0(s)
        current: 0(bytes)       hard: 0(bytes)  soft: 0(bytes)
        allocated: 0    hard: 0 soft: 0
        sadb_seq=0 pid=19776 refcnt=0

Turns out that the IPIP tunnel used by IPCOMP states are only freed
if the IPCOMP state is deleted by xfrm_state_delete.

This is not the case for all states.  For example, an immature IPCOMP
state that dies in add_sa will not go through xfrm_state_delete.

The following patch moves the delete_tunnel call into IPCOMP's
destructor.  I think it makes more sense there as IPCOMP is the
only user of the tunnel anyway.

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

Attachment: p
Description: Text document

<Prev in Thread] Current Thread [Next in Thread>