]> rtime.felk.cvut.cz Git - socketcan-devel.git/commitdiff
The hlist content ensured only CAN netdevices to be accessed by the
authorhartkopp <hartkopp@030b6a49-0b11-0410-94ab-b0dab22257f2>
Wed, 3 Feb 2010 17:55:16 +0000 (17:55 +0000)
committerhartkopp <hartkopp@030b6a49-0b11-0410-94ab-b0dab22257f2>
Wed, 3 Feb 2010 17:55:16 +0000 (17:55 +0000)
can_rx_(un)register() functions which accidently dropped away together with
the receive list access speedup in rev 1118 and rev 1119.

This patch re-introduces the check for CAN netdevices in can_rx_(un)register()
(not in the hot path!) for Kernels >= 2.6.26.

See upstream commit:
http://git.kernel.org/?p=linux/kernel/git/davem/net-next-2.6.git;a=commitdiff;h=8b64056dacf6ec81986d63dff96fca039fe95f6e

git-svn-id: svn://svn.berlios.de//socketcan/trunk@1122 030b6a49-0b11-0410-94ab-b0dab22257f2

kernel/2.6/net/can/af_can.c

index 14dbba5b51aa70ce25c9a6ab9ce45c7ba5567175..4d8479d744886778bae125a73b6d472a784a24ce 100644 (file)
@@ -537,6 +537,11 @@ int can_rx_register(struct net_device *dev, canid_t can_id, canid_t mask,
 
        /* insert new receiver  (dev,canid,mask) -> (func,data) */
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
+       if (dev && dev->type != ARPHRD_CAN)
+               return -ENODEV;
+#endif
+
        r = kmem_cache_alloc(rcv_cache, GFP_KERNEL);
        if (!r)
                return -ENOMEM;
@@ -610,6 +615,11 @@ void can_rx_unregister(struct net_device *dev, canid_t can_id, canid_t mask,
        struct hlist_node *next;
        struct dev_rcv_lists *d;
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
+       if (dev && dev->type != ARPHRD_CAN)
+               return;
+#endif
+
        spin_lock(&can_rcvlists_lock);
 
        d = find_dev_rcv_lists(dev);