[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20080212.225908.92858029.davem@davemloft.net>
Date: Tue, 12 Feb 2008 22:59:08 -0800 (PST)
From: David Miller <davem@...emloft.net>
To: timo.teras@....fi
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH RESEND] [XFRM]: Speed up xfrm_policy and xfrm_state
walking
From: Timo_Teräs <timo.teras@....fi>
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 majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists