]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
[XFRM]: fix softirq-unsafe xfrm typemap->lock use
authorIngo Molnar <mingo@elte.hu>
Fri, 28 Apr 2006 22:23:59 +0000 (15:23 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Sun, 30 Apr 2006 01:33:18 +0000 (18:33 -0700)
xfrm typemap->lock may be used in softirq context, so all write_lock()
uses must be softirq-safe.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/xfrm/xfrm_policy.c

index c3725fe2a8fbae8057f5e772bd9582a795b4c7c7..e5b0afc94f1eeeb04091102d9995cfe01e7e5397 100644 (file)
@@ -57,12 +57,12 @@ int xfrm_register_type(struct xfrm_type *type, unsigned short family)
                return -EAFNOSUPPORT;
        typemap = afinfo->type_map;
 
-       write_lock(&typemap->lock);
+       write_lock_bh(&typemap->lock);
        if (likely(typemap->map[type->proto] == NULL))
                typemap->map[type->proto] = type;
        else
                err = -EEXIST;
-       write_unlock(&typemap->lock);
+       write_unlock_bh(&typemap->lock);
        xfrm_policy_put_afinfo(afinfo);
        return err;
 }
@@ -78,12 +78,12 @@ int xfrm_unregister_type(struct xfrm_type *type, unsigned short family)
                return -EAFNOSUPPORT;
        typemap = afinfo->type_map;
 
-       write_lock(&typemap->lock);
+       write_lock_bh(&typemap->lock);
        if (unlikely(typemap->map[type->proto] != type))
                err = -ENOENT;
        else
                typemap->map[type->proto] = NULL;
-       write_unlock(&typemap->lock);
+       write_unlock_bh(&typemap->lock);
        xfrm_policy_put_afinfo(afinfo);
        return err;
 }