summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorArvid Brodin <arvid.brodin@alten.se>2014-07-04 23:42:00 +0200
committerDavid S. Miller <davem@davemloft.net>2014-07-08 11:35:31 -0700
commita718dcc5e56546a62d00f57cc875faac2f42c8bf (patch)
tree35ea41cdc4e877c852fba2f82077964e1458dfe5 /net
parentf266a683a4804dc499efc6c2206ef68efed029d0 (diff)
downloadop-kernel-dev-a718dcc5e56546a62d00f57cc875faac2f42c8bf.zip
op-kernel-dev-a718dcc5e56546a62d00f57cc875faac2f42c8bf.tar.gz
net/hsr: Fix NULL pointer dereference on incomplete hsr_newlink() params.
If none of the slave interfaces are specified, struct nlattr *data[] may be NULL. Make sure to check for that. While I'm at it, fix the horrible error messages displayed when only one of the slave interfaces isn't specified. Signed-off-by: Arvid Brodin <arvid.brodin@alten.se> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/hsr/hsr_netlink.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/net/hsr/hsr_netlink.c b/net/hsr/hsr_netlink.c
index fbdf53f..a2c7e4c 100644
--- a/net/hsr/hsr_netlink.c
+++ b/net/hsr/hsr_netlink.c
@@ -37,13 +37,17 @@ static int hsr_newlink(struct net *src_net, struct net_device *dev,
struct net_device *link[2];
unsigned char multicast_spec;
+ if (!data) {
+ netdev_info(dev, "HSR: No slave devices specified\n");
+ return -EINVAL;
+ }
if (!data[IFLA_HSR_SLAVE1]) {
- netdev_info(dev, "IFLA_HSR_SLAVE1 missing!\n");
+ netdev_info(dev, "HSR: Slave1 device not specified\n");
return -EINVAL;
}
link[0] = __dev_get_by_index(src_net, nla_get_u32(data[IFLA_HSR_SLAVE1]));
if (!data[IFLA_HSR_SLAVE2]) {
- netdev_info(dev, "IFLA_HSR_SLAVE2 missing!\n");
+ netdev_info(dev, "HSR: Slave2 device not specified\n");
return -EINVAL;
}
link[1] = __dev_get_by_index(src_net, nla_get_u32(data[IFLA_HSR_SLAVE2]));
OpenPOWER on IntegriCloud