===== xfrm4_state.c 1.6 vs edited ===== --- 1.6/net/ipv4/xfrm4_state.c 2003-07-21 21:49:43 +10:00 +++ edited/xfrm4_state.c 2004-05-24 21:41:29 +10:00 @@ -83,9 +83,7 @@ break; } } - if (x0) { - xfrm_state_hold(x0); - } else if (create && (x0 = xfrm_state_alloc()) != NULL) { + if (!x0 && create && (x0 = xfrm_state_alloc()) != NULL) { x0->sel.daddr.a4 = daddr->a4; x0->sel.saddr.a4 = saddr->a4; x0->sel.prefixlen_d = 32; @@ -105,6 +103,8 @@ list_add_tail(&x0->bydst, xfrm4_state_afinfo.state_bydst+h); wake_up(&km_waitq); } + if (x0) + xfrm_state_hold(x0); return x0; } ===== xfrm6_state.c 1.8 vs edited ===== --- 1.8/net/ipv6/xfrm6_state.c 2003-07-21 21:49:43 +10:00 +++ edited/xfrm6_state.c 2004-05-24 21:44:06 +10:00 @@ -90,9 +90,7 @@ break; } } - if (x0) { - xfrm_state_hold(x0); - } else if (create && (x0 = xfrm_state_alloc()) != NULL) { + if (!x0 && create && (x0 = xfrm_state_alloc()) != NULL) { ipv6_addr_copy((struct in6_addr *)x0->sel.daddr.a6, (struct in6_addr *)daddr); ipv6_addr_copy((struct in6_addr *)x0->sel.saddr.a6, @@ -115,6 +113,8 @@ list_add_tail(&x0->bydst, xfrm6_state_afinfo.state_bydst+h); wake_up(&km_waitq); } + if (x0) + xfrm_state_hold(x0); return x0; }