Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 159681
b: refs/heads/master
c: 1758c09
h: refs/heads/master
i:
  159679: 2258e45
v: v3
  • Loading branch information
Oliver Hartkopp authored and David S. Miller committed Aug 14, 2009
1 parent d707948 commit 10b4dbf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 49d4b8ba97034469b941d00d5ca1e3b897394e35
refs/heads/master: 1758c0947605211ef953cc91d6bbdf847a21b822
18 changes: 13 additions & 5 deletions trunk/net/can/af_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -651,12 +651,16 @@ static int can_rcv(struct sk_buff *skb, struct net_device *dev,
struct can_frame *cf = (struct can_frame *)skb->data;
int matches;

if (dev->type != ARPHRD_CAN || !net_eq(dev_net(dev), &init_net)) {
kfree_skb(skb);
return 0;
}
if (!net_eq(dev_net(dev), &init_net))
goto drop;

BUG_ON(skb->len != sizeof(struct can_frame) || cf->can_dlc > 8);
if (WARN_ONCE(dev->type != ARPHRD_CAN ||
skb->len != sizeof(struct can_frame) ||
cf->can_dlc > 8,
"PF_CAN: dropped non conform skbuf: "
"dev type %d, len %d, can_dlc %d\n",
dev->type, skb->len, cf->can_dlc))
goto drop;

/* update statistics */
can_stats.rx_frames++;
Expand All @@ -683,6 +687,10 @@ static int can_rcv(struct sk_buff *skb, struct net_device *dev,
}

return 0;

drop:
kfree_skb(skb);
return 0;
}

/*
Expand Down

0 comments on commit 10b4dbf

Please sign in to comment.