Commit e7560582 authored by Thomas Graf's avatar Thomas Graf Committed by David S. Miller

rocker: Add proper validation of Netlink attributes

Signed-off-by: default avatarThomas Graf <tgraf@suug.ch>
Signed-off-by: default avatarJiri Pirko <jiri@resnulli.us>
Signed-off-by: default avatarScott Feldman <sfeldma@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5111f80c
...@@ -3712,6 +3712,9 @@ static int rocker_port_bridge_setlink(struct net_device *dev, ...@@ -3712,6 +3712,9 @@ static int rocker_port_bridge_setlink(struct net_device *dev,
if (afspec) { if (afspec) {
attr = nla_find_nested(afspec, IFLA_BRIDGE_MODE); attr = nla_find_nested(afspec, IFLA_BRIDGE_MODE);
if (attr) { if (attr) {
if (nla_len(attr) < sizeof(mode))
return -EINVAL;
mode = nla_get_u16(attr); mode = nla_get_u16(attr);
if (mode != BRIDGE_MODE_SWDEV) if (mode != BRIDGE_MODE_SWDEV)
return -EINVAL; return -EINVAL;
...@@ -3721,6 +3724,9 @@ static int rocker_port_bridge_setlink(struct net_device *dev, ...@@ -3721,6 +3724,9 @@ static int rocker_port_bridge_setlink(struct net_device *dev,
if (protinfo) { if (protinfo) {
attr = nla_find_nested(protinfo, IFLA_BRPORT_LEARNING); attr = nla_find_nested(protinfo, IFLA_BRPORT_LEARNING);
if (attr) { if (attr) {
if (nla_len(attr) < sizeof(u8))
return -EINVAL;
if (nla_get_u8(attr)) if (nla_get_u8(attr))
rocker_port->brport_flags |= BR_LEARNING; rocker_port->brport_flags |= BR_LEARNING;
else else
...@@ -3731,6 +3737,9 @@ static int rocker_port_bridge_setlink(struct net_device *dev, ...@@ -3731,6 +3737,9 @@ static int rocker_port_bridge_setlink(struct net_device *dev,
} }
attr = nla_find_nested(protinfo, IFLA_BRPORT_LEARNING_SYNC); attr = nla_find_nested(protinfo, IFLA_BRPORT_LEARNING_SYNC);
if (attr) { if (attr) {
if (nla_len(attr) < sizeof(u8))
return -EINVAL;
if (nla_get_u8(attr)) if (nla_get_u8(attr))
rocker_port->brport_flags |= BR_LEARNING_SYNC; rocker_port->brport_flags |= BR_LEARNING_SYNC;
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment