summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2018-11-24 15:03:02 +0000
committerDavid S. Miller <davem@davemloft.net>2018-11-24 17:40:35 -0800
commit3c18aa1464f9232d6abac8d7b4540f61b0658d62 (patch)
treef0a0602eebf761b741426a62a03450ca6d95a6eb /drivers
parent21ab664aece634ade40ad9d1cca589895e9f9174 (diff)
downloadlinux-3c18aa1464f9232d6abac8d7b4540f61b0658d62.tar.gz
linux-3c18aa1464f9232d6abac8d7b4540f61b0658d62.tar.bz2
linux-3c18aa1464f9232d6abac8d7b4540f61b0658d62.zip
net: qualcomm: rmnet: move null check on dev before dereferecing it
Currently dev is dereferenced by the call dev_net(dev) before dev is null checked. Fix this by null checking dev before the potential null pointer dereference. Detected by CoverityScan, CID#1462955 ("Dereference before null check") Fixes: 23790ef12082 ("net: qualcomm: rmnet: Allow to configure flags for existing devices") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
index 5f4e447c5dce..b8bbee645f51 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
@@ -301,10 +301,13 @@ static int rmnet_changelink(struct net_device *dev, struct nlattr *tb[],
struct rmnet_port *port;
u16 mux_id;
+ if (!dev)
+ return -ENODEV;
+
real_dev = __dev_get_by_index(dev_net(dev),
nla_get_u32(tb[IFLA_LINK]));
- if (!real_dev || !dev || !rmnet_is_real_dev_registered(real_dev))
+ if (!real_dev || !rmnet_is_real_dev_registered(real_dev))
return -ENODEV;
port = rmnet_get_port_rtnl(real_dev);