Commit 8b64056dacf6ec81986d63dff96fca039fe95f6e

Authored by Oliver Hartkopp
Committed by David S. Miller
1 parent 44298ec0f2

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>

Showing 1 changed file with 6 additions and 0 deletions Side-by-side Diff

... ... @@ -415,6 +415,9 @@
415 415  
416 416 /* insert new receiver (dev,canid,mask) -> (func,data) */
417 417  
  418 + if (dev && dev->type != ARPHRD_CAN)
  419 + return -ENODEV;
  420 +
418 421 r = kmem_cache_alloc(rcv_cache, GFP_KERNEL);
419 422 if (!r)
420 423 return -ENOMEM;
... ... @@ -477,6 +480,9 @@
477 480 struct hlist_head *rl;
478 481 struct hlist_node *next;
479 482 struct dev_rcv_lists *d;
  483 +
  484 + if (dev && dev->type != ARPHRD_CAN)
  485 + return;
480 486  
481 487 spin_lock(&can_rcvlists_lock);
482 488