From: Timo_Teräs <[EMAIL PROTECTED]>
Date: Fri, 01 Feb 2008 16:58:04 +0200
> @@ -1780,6 +1786,7 @@ static int check_reqid(struct xfrm_policy *xp, int dir,
> int count, void *ptr)
>
> static u32 gen_reqid(void)
> {
> + struct xfrm_policy_walk walk;
> u32 start;
> static u32 reqid = IPSEC_MANUAL_REQID_MAX;
>
> @@ -1788,9 +1795,10 @@ static u32 gen_reqid(void)
> ++reqid;
> if (reqid == 0)
> reqid = IPSEC_MANUAL_REQID_MAX+1;
> - if (xfrm_policy_walk(XFRM_POLICY_TYPE_MAIN, check_reqid,
> - (void*)&reqid) != -EEXIST)
> + xfrm_policy_walk_init(&walk, XFRM_POLICY_TYPE_MAIN);
> + if (xfrm_policy_walk(&walk, check_reqid, (void*)&reqid) !=
> -EEXIST)
> return reqid;
> + xfrm_policy_walk_done(&walk);
> } while (reqid != start);
> return 0;
> }
This will potentially leak walk->policy in the != -EEXIST case.
I think what needs to happen is we invoke xfrm_policy_walk_done()
unconditionally, then we'll potentially return reqid.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html