[redhat-lspp] RE: [IPSEC] flow: Cache negative results

Eric Paris eparis at redhat.com
Tue Jan 16 19:30:39 UTC 2007


On Tue, 2007-01-16 at 13:07 -0600, Venkat Yekkirala wrote:
> > > > We jump to the fail without releasing the lock.
> > > > Instead of a "fail", how about just breaking from the loop
> > > > and falling through to release lock and return...
> > >
> > > Sure. That should work too. Thanks.
> >
> > Also, you would have to make sure pol is set to NULL
> > in this case.
> 
> I see lspp63 could use the following patch that does the
> above:
> 
> --- linux-2.6.18.i386.old/net/xfrm/xfrm_policy.c	2007-01-16
> 10:36:23.000000000 -0600
> +++ linux-2.6.18.i386/net/xfrm/xfrm_policy.c	2007-01-16
> 10:36:59.000000000 -0600
> @@ -627,9 +627,11 @@ static int xfrm_policy_lookup(struct flo
>  				xfrm_pol_hold(pol);
>  				break;
>  			} else if (ret == -ESRCH)
> -					ret = 0;
> -			else
> +				ret = 0;
> +			else {
> +				pol = NULL;
>  				break;
> +			}
>  		}
>  	}
>  	read_unlock_bh(&xfrm_policy_lock);

I haven't looked at the caller to xfrm_policy_lookup, but does it
actually use the value that might be set if it gets an error?   aka does
it really matter?   I'll check it in a bit.

-Eric




More information about the redhat-lspp mailing list