aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/can/gw.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/net/can/gw.c b/net/can/gw.c
index 88c8a39c173d..ac31891967da 100644
--- a/net/can/gw.c
+++ b/net/can/gw.c
@@ -839,21 +839,21 @@ static int cgw_create_job(struct sk_buff *skb, struct nlmsghdr *nlh)
839 if (!gwj->ccgw.src_idx || !gwj->ccgw.dst_idx) 839 if (!gwj->ccgw.src_idx || !gwj->ccgw.dst_idx)
840 goto out; 840 goto out;
841 841
842 gwj->src.dev = dev_get_by_index(&init_net, gwj->ccgw.src_idx); 842 gwj->src.dev = __dev_get_by_index(&init_net, gwj->ccgw.src_idx);
843 843
844 if (!gwj->src.dev) 844 if (!gwj->src.dev)
845 goto out; 845 goto out;
846 846
847 if (gwj->src.dev->type != ARPHRD_CAN) 847 if (gwj->src.dev->type != ARPHRD_CAN)
848 goto put_src_out; 848 goto out;
849 849
850 gwj->dst.dev = dev_get_by_index(&init_net, gwj->ccgw.dst_idx); 850 gwj->dst.dev = __dev_get_by_index(&init_net, gwj->ccgw.dst_idx);
851 851
852 if (!gwj->dst.dev) 852 if (!gwj->dst.dev)
853 goto put_src_out; 853 goto out;
854 854
855 if (gwj->dst.dev->type != ARPHRD_CAN) 855 if (gwj->dst.dev->type != ARPHRD_CAN)
856 goto put_src_dst_out; 856 goto out;
857 857
858 gwj->limit_hops = limhops; 858 gwj->limit_hops = limhops;
859 859
@@ -862,11 +862,6 @@ static int cgw_create_job(struct sk_buff *skb, struct nlmsghdr *nlh)
862 err = cgw_register_filter(gwj); 862 err = cgw_register_filter(gwj);
863 if (!err) 863 if (!err)
864 hlist_add_head_rcu(&gwj->list, &cgw_list); 864 hlist_add_head_rcu(&gwj->list, &cgw_list);
865
866put_src_dst_out:
867 dev_put(gwj->dst.dev);
868put_src_out:
869 dev_put(gwj->src.dev);
870out: 865out:
871 if (err) 866 if (err)
872 kmem_cache_free(cgw_cache, gwj); 867 kmem_cache_free(cgw_cache, gwj);