summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/rocker/rocker.c
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2014-11-28 16:34:31 +0300
committerDavid S. Miller <davem@davemloft.net>2014-12-03 07:01:26 +0300
commite75605822e3190a1bd7935599e93f13ab1ba7c9d (patch)
tree1ea08ca69687bf29eab075438fcf8739af64ad33 /drivers/net/ethernet/rocker/rocker.c
parent5111f80cbc759bed12941678bd029fca76512815 (diff)
downloadlinux-e75605822e3190a1bd7935599e93f13ab1ba7c9d.tar.xz
rocker: Add proper validation of Netlink attributes
Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: Scott Feldman <sfeldma@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/rocker/rocker.c')
-rw-r--r--drivers/net/ethernet/rocker/rocker.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/net/ethernet/rocker/rocker.c b/drivers/net/ethernet/rocker/rocker.c
index 61cfdbffdb7a..30687bf1143f 100644
--- a/drivers/net/ethernet/rocker/rocker.c
+++ b/drivers/net/ethernet/rocker/rocker.c
@@ -3712,6 +3712,9 @@ static int rocker_port_bridge_setlink(struct net_device *dev,
if (afspec) {
attr = nla_find_nested(afspec, IFLA_BRIDGE_MODE);
if (attr) {
+ if (nla_len(attr) < sizeof(mode))
+ return -EINVAL;
+
mode = nla_get_u16(attr);
if (mode != BRIDGE_MODE_SWDEV)
return -EINVAL;
@@ -3721,6 +3724,9 @@ static int rocker_port_bridge_setlink(struct net_device *dev,
if (protinfo) {
attr = nla_find_nested(protinfo, IFLA_BRPORT_LEARNING);
if (attr) {
+ if (nla_len(attr) < sizeof(u8))
+ return -EINVAL;
+
if (nla_get_u8(attr))
rocker_port->brport_flags |= BR_LEARNING;
else
@@ -3731,6 +3737,9 @@ static int rocker_port_bridge_setlink(struct net_device *dev,
}
attr = nla_find_nested(protinfo, IFLA_BRPORT_LEARNING_SYNC);
if (attr) {
+ if (nla_len(attr) < sizeof(u8))
+ return -EINVAL;
+
if (nla_get_u8(attr))
rocker_port->brport_flags |= BR_LEARNING_SYNC;
else