]> rtime.felk.cvut.cz Git - socketcan-devel.git/blobdiff - kernel/2.6/net/can/gw.c
Beautify check for valid CAN netdevices.
[socketcan-devel.git] / kernel / 2.6 / net / can / gw.c
index 5e2a459869f1b44e47f08fb955f0f11848f4f556..d7257ccbcb1439336914242d8991f5e9a4512659 100644 (file)
@@ -821,10 +821,8 @@ static int cgw_create_job(struct sk_buff *skb,  struct nlmsghdr *nlh,
        if (!gwj->src.dev)
                goto out;
 
-       if (gwj->src.dev->type != ARPHRD_CAN)
-               goto put_src_out;
-
-       if (gwj->src.dev->header_ops)
+       /* check for CAN netdev not using header_ops - see gw_rcv() */
+       if (gwj->src.dev->type != ARPHRD_CAN || gwj->src.dev->header_ops)
                goto put_src_out;
 
        gwj->dst.dev = dev_get_by_index(&init_net, gwj->ccgw.dst_idx);
@@ -832,10 +830,8 @@ static int cgw_create_job(struct sk_buff *skb,  struct nlmsghdr *nlh,
        if (!gwj->dst.dev)
                goto put_src_out;
 
-       if (gwj->dst.dev->type != ARPHRD_CAN)
-               goto put_src_dst_out;
-
-       if (gwj->dst.dev->header_ops)
+       /* check for CAN netdev not using header_ops - see gw_rcv() */
+       if (gwj->dst.dev->type != ARPHRD_CAN || gwj->dst.dev->header_ops)
                goto put_src_dst_out;
 
        ASSERT_RTNL();