>> > Please let me know if this looks ok and I am not
>> > jumping the gun. This only applies to our lspp kernel 
>> > and was built against lspp62 kernel.
>
>Actually, you would also want propagate non-ESRCH errors back
>up the chain as shown in the below:
>
>@@ -609,7 +609,7 @@ static int xfrm_policy_lookup(struct flo
>                               void **objp, atomic_t **obj_refp)
> {
>        struct xfrm_policy *pol;
>-       int ret = -ESRCH;
>+       int ret = 0;
> 
>        read_lock_bh(&xfrm_policy_lock);
>        for (pol = xfrm_policy_list[dir]; pol; pol = pol->next) {
>@@ -626,12 +626,16 @@ static int xfrm_policy_lookup(struct flo
>                        if (!ret) {
>                                xfrm_pol_hold(pol);
>                                break;
>-                       }
>+                       } else if (ret == -ESRCH)
>+                               ret = 0;
>+                       else
>+                               goto fail;
>                }
>        }
>        read_unlock_bh(&xfrm_policy_lock);
>        if ((*objp = (void *) pol) != NULL)
>                *obj_refp = &pol->refcnt;
>+fail:
>        return ret;
> }

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...


Joy

diff -urpN linux-2.6.18.ppc64.orig/net/xfrm/xfrm_policy.c 
linux-2.6.18.ppc64/net/xfrm/xfrm_policy.c
--- linux-2.6.18.ppc64.orig/net/xfrm/xfrm_policy.c      2007-01-11 
15:56:23.000000000 -0600
+++ linux-2.6.18.ppc64/net/xfrm/xfrm_policy.c   2007-01-15 10:36:30.000000000 
-0600
@@ -609,7 +609,7 @@ static int xfrm_policy_lookup(struct flo
                               void **objp, atomic_t **obj_refp)
 {
        struct xfrm_policy *pol;
-       int ret = -ESRCH;
+       int ret = 0;
 
        read_lock_bh(&xfrm_policy_lock);
        for (pol = xfrm_policy_list[dir]; pol; pol = pol->next) {
@@ -626,7 +626,10 @@ static int xfrm_policy_lookup(struct flo
                        if (!ret) {
                                xfrm_pol_hold(pol);
                                break;
-                       }
+                       } else if (ret == -ESRCH)
+                                       ret = 0;
+                       else
+                               break;
                }
        }
        read_unlock_bh(&xfrm_policy_lock);

--
redhat-lspp mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/redhat-lspp

Reply via email to