Subject: Re: [IPSEC]: Kill nested read lock by deleting xfrm_init_tempsel

From: Patrick McHardy <[email-masked]>
Date: Tue, 05 Apr 2005 22:01:38 +0200

Herbert Xu wrote:
> On Sun, Apr 03, 2005 at 06:48:17PM +0200, Patrick McHardy wrote:
> 
>>Agreed. There is also a bug in my patch, tmpl->daddr can be 0 in which
>>case the daddr passed as an argument to xfrm_state_find() will be used.
>>My patch only checked tmpl->daddr, this patch fixes it. It also uses
> 
> 
> Why not just use daddr? It's always guaranteed to be correct.

Good idea, I didn't think of this. This patch is without replacement of
xfrm_init_tempsel(), it caused an "unused function" warning and, as I
mentioned before, I still need the function.

Regards
Patrick
===== net/xfrm/xfrm_state.c 1.60 vs edited =====
--- 1.60/net/xfrm/xfrm_state.c	2005-04-01 07:19:54 +02:00
+++ edited/net/xfrm/xfrm_state.c	2005-04-05 21:58:08 +02:00
@@ -357,7 +357,7 @@
 
 	x = best;
 	if (!x && !error && !acquire_in_progress) {
-		x0 = afinfo->state_lookup(&tmpl->id.daddr, tmpl->id.spi, tmpl->id.proto);
+		x0 = afinfo->state_lookup(daddr, tmpl->id.spi, tmpl->id.proto);
 		if (x0 != NULL) {
 			xfrm_state_put(x0);
 			error = -EEXIST;