]> rtime.felk.cvut.cz Git - lisovros/linux_canprio.git/commitdiff
can/gw: Fix sleep in atomic context bug
authorMichal Sojka <sojkam1@fel.cvut.cz>
Sun, 5 Dec 2010 11:04:12 +0000 (12:04 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Sun, 5 Dec 2010 11:04:12 +0000 (12:04 +0100)
net/can/gw.c

index 94ba3f1bafce6fde2639193613d22946e24bb126..7779ca6481989eb844ec7dc2b19c8b533b709073 100644 (file)
@@ -822,11 +822,14 @@ static int cgw_create_job(struct sk_buff *skb,  struct nlmsghdr *nlh,
        if (gwj->dst.dev->type != ARPHRD_CAN)
                goto put_src_dst_out;
                
-       spin_lock(&cgw_list_lock);
 
        err = cgw_register_filter(gwj);
-       if (!err)
-               hlist_add_head_rcu(&gwj->list, &cgw_list);
+       if (err)
+               goto put_src_dst_out;
+
+       spin_lock(&cgw_list_lock);
+
+       hlist_add_head_rcu(&gwj->list, &cgw_list);
 
        spin_unlock(&cgw_list_lock);