Skip to content

Commit

Permalink
net: caif: replace BUG_ON with recovery code
Browse files Browse the repository at this point in the history
In caif_xmit, there is a crash if the ptr dev is NULL. However, by
returning the error to the callers, the error can be handled. The
patch fixes this issue.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Aditya Pakki authored and davem330 committed Dec 17, 2019
1 parent bbd20c9 commit c5dea81
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/caif/caif_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,9 @@ static int caif_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct ser_device *ser;

BUG_ON(dev == NULL);
if (WARN_ON(!dev))
return -EINVAL;

ser = netdev_priv(dev);

/* Send flow off once, on high water mark */
Expand Down

0 comments on commit c5dea81

Please sign in to comment.