summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAditya Pakki <pakki001@umn.edu>2019-12-15 11:51:30 -0600
committerDavid S. Miller <davem@davemloft.net>2019-12-16 16:29:05 -0800
commitc5dea815834c7d2e9fc633785455bc428b7a1956 (patch)
tree2c08e289a64bad2408aac3b508e1599785161ec6
parentbbd20c939c8aa3f27fa30e86691af250bf92973a (diff)
downloadlinux-c5dea815834c7d2e9fc633785455bc428b7a1956.tar.bz2
net: caif: replace BUG_ON with recovery code
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>
-rw-r--r--drivers/net/caif/caif_serial.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/caif/caif_serial.c b/drivers/net/caif/caif_serial.c
index bd40b114d6cd..d737ceb61203 100644
--- a/drivers/net/caif/caif_serial.c
+++ b/drivers/net/caif/caif_serial.c
@@ -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 */