From: hartkopp Date: Wed, 3 Feb 2010 17:55:16 +0000 (+0000) Subject: The hlist content ensured only CAN netdevices to be accessed by the X-Git-Url: http://rtime.felk.cvut.cz/gitweb/socketcan-devel.git/commitdiff_plain/2a58a9ce411877eed5df58dfe696137d5263ee87 The hlist content ensured only CAN netdevices to be accessed by the 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 --- diff --git a/kernel/2.6/net/can/af_can.c b/kernel/2.6/net/can/af_can.c index 14dbba5..4d8479d 100644 --- a/kernel/2.6/net/can/af_can.c +++ b/kernel/2.6/net/can/af_can.c @@ -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);