diff options
author | Oliver Hartkopp <oliver@hartkopp.net> | 2010-02-02 10:21:34 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-02 10:21:34 -0500 |
commit | 8b64056dacf6ec81986d63dff96fca039fe95f6e (patch) | |
tree | 80119c42025a48ab9dacd90906794d8c2df05164 /net/can | |
parent | 44298ec0f20c45b9be96e181976aef1152d373b2 (diff) |
can: deny filterlist access on non-CAN interfaces
In commit 20dd3850bcf860561496827b711fa10fecf6e787 "can: Speed up CAN frame
receiption by using ml_priv" the formerly used hlist of receiver lists for
each CAN netdevice has been replaced.
The hlist content ensured only CAN netdevices to be accessed by the
can_rx_(un)register() functions which accidently dropped away together with
the hlist receiver implementation.
This patch re-introduces the check for CAN netdevices in can_rx_(un)register().
Signed-off-by: Oliver Hartkopp <oliver@hartkopp.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/can')
-rw-r--r-- | net/can/af_can.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/net/can/af_can.c b/net/can/af_can.c index bc18b084ffdb..702be5a2c956 100644 --- a/net/can/af_can.c +++ b/net/can/af_can.c | |||
@@ -415,6 +415,9 @@ int can_rx_register(struct net_device *dev, canid_t can_id, canid_t mask, | |||
415 | 415 | ||
416 | /* insert new receiver (dev,canid,mask) -> (func,data) */ | 416 | /* insert new receiver (dev,canid,mask) -> (func,data) */ |
417 | 417 | ||
418 | if (dev && dev->type != ARPHRD_CAN) | ||
419 | return -ENODEV; | ||
420 | |||
418 | r = kmem_cache_alloc(rcv_cache, GFP_KERNEL); | 421 | r = kmem_cache_alloc(rcv_cache, GFP_KERNEL); |
419 | if (!r) | 422 | if (!r) |
420 | return -ENOMEM; | 423 | return -ENOMEM; |
@@ -478,6 +481,9 @@ void can_rx_unregister(struct net_device *dev, canid_t can_id, canid_t mask, | |||
478 | struct hlist_node *next; | 481 | struct hlist_node *next; |
479 | struct dev_rcv_lists *d; | 482 | struct dev_rcv_lists *d; |
480 | 483 | ||
484 | if (dev && dev->type != ARPHRD_CAN) | ||
485 | return; | ||
486 | |||
481 | spin_lock(&can_rcvlists_lock); | 487 | spin_lock(&can_rcvlists_lock); |
482 | 488 | ||
483 | d = find_dev_rcv_lists(dev); | 489 | d = find_dev_rcv_lists(dev); |