Skip to content

Commit

Permalink
can: ems_usb: don't touch skb after netif_rx()
Browse files Browse the repository at this point in the history
There is no guarantee that the skb is in the same state after calling
net_receive_skb() or netif_rx(). It might be freed or reused. Not really
harmful as its a read access, except you turn on the proper debugging options
which catch a use after free.

Cc: Gerhard Uttenthaler <[email protected]>
Signed-off-by: Marc Kleine-Budde <[email protected]>
  • Loading branch information
marckleinebudde committed Jul 15, 2015
1 parent 296decb commit 43c021e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/net/can/usb/ems_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,9 @@ static void ems_usb_rx_can_msg(struct ems_usb *dev, struct ems_cpc_msg *msg)
cf->data[i] = msg->msg.can_msg.msg[i];
}

netif_rx(skb);

stats->rx_packets++;
stats->rx_bytes += cf->can_dlc;
netif_rx(skb);
}

static void ems_usb_rx_err(struct ems_usb *dev, struct ems_cpc_msg *msg)
Expand Down Expand Up @@ -400,10 +399,9 @@ static void ems_usb_rx_err(struct ems_usb *dev, struct ems_cpc_msg *msg)
stats->rx_errors++;
}

netif_rx(skb);

stats->rx_packets++;
stats->rx_bytes += cf->can_dlc;
netif_rx(skb);
}

/*
Expand Down

0 comments on commit 43c021e

Please sign in to comment.