summaryrefslogtreecommitdiffstats
path: root/drivers/net/can/rx-offload.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2018-08-23 01:43:34 +0200
committerDavid S. Miller <davem@davemloft.net>2018-09-10 19:06:54 +0200
commit6effee6840af7d1adfde296f987b3d3213b3037d (patch)
treee378db8ce667317888636d2ea2b1c3492e9d190f /drivers/net/can/rx-offload.c
parentnet: Add and use skb_list_del_init(). (diff)
downloadlinux-6effee6840af7d1adfde296f987b3d3213b3037d.tar.xz
linux-6effee6840af7d1adfde296f987b3d3213b3037d.zip
can: Remove SKB list assumptions in rx-offload.c
Eliminate code which assumes that SKBs and skb_queue_head objects can be cast to eachother during list processing. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/can/rx-offload.c')
-rw-r--r--drivers/net/can/rx-offload.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/net/can/rx-offload.c b/drivers/net/can/rx-offload.c
index d94dae216820..c7d05027a7a0 100644
--- a/drivers/net/can/rx-offload.c
+++ b/drivers/net/can/rx-offload.c
@@ -79,7 +79,7 @@ static int can_rx_offload_napi_poll(struct napi_struct *napi, int quota)
static inline void __skb_queue_add_sort(struct sk_buff_head *head, struct sk_buff *new,
int (*compare)(struct sk_buff *a, struct sk_buff *b))
{
- struct sk_buff *pos, *insert = (struct sk_buff *)head;
+ struct sk_buff *pos, *insert = NULL;
skb_queue_reverse_walk(head, pos) {
const struct can_rx_offload_cb *cb_pos, *cb_new;
@@ -99,8 +99,10 @@ static inline void __skb_queue_add_sort(struct sk_buff_head *head, struct sk_buf
insert = pos;
break;
}
-
- __skb_queue_after(head, insert, new);
+ if (!insert)
+ __skb_queue_head(head, new);
+ else
+ __skb_queue_after(head, insert, new);
}
static int can_rx_offload_compare(struct sk_buff *a, struct sk_buff *b)