netdev
[Top] [All Lists]

Re: resend patch: xfrm policybyid

To: jamal <hadi@xxxxxxxxxx>
Subject: Re: resend patch: xfrm policybyid
From: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 6 May 2005 07:32:39 +1000
Cc: "David S. Miller" <davem@xxxxxxxxxxxxx>, netdev <netdev@xxxxxxxxxxx>
In-reply-to: <1115298877.7680.75.camel@xxxxxxxxxxxxxxxxxxxxx>
References: <1115298877.7680.75.camel@xxxxxxxxxxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mutt/1.5.6+20040907i
On Thu, May 05, 2005 at 09:14:36AM -0400, jamal wrote:
>
> +     if (policy->index)
> +             delpol = xfrm_policy_byid(dir, policy->index, 0);
> +     delpol2 = xfrm_policy_bysel(dir, &policy->selector, 0);
> +
> +     /* must be unique in both index and selector */
> +     if (delpol && delpol2) 
> +             if (delpol != delpol2) 
> +                     goto pol_err;
>  
> +     if (delpol) 
> +             delp = delpol;
> +     else 
> +             delp = delpol2;
> +                     
> +     if (delp && excl) { 
> +             ret = -EEXIST;
> +             goto pol_err;
> +     }
> +
> +     /* insert, sorted by prio*/
>       write_lock_bh(&xfrm_policy_lock);

This is still racy since delp can be killed by timers before you get
the lock.

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

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