if (!info->attrs[SWITCH_ATTR_OP_VLAN])
goto done;
val->port_vlan = nla_get_u32(info->attrs[SWITCH_ATTR_OP_VLAN]);
+ if (val->port_vlan >= dev->vlans)
+ goto done;
break;
case SWITCH_CMD_SET_PORT:
case SWITCH_CMD_GET_PORT:
if (!info->attrs[SWITCH_ATTR_OP_PORT])
goto done;
val->port_vlan = nla_get_u32(info->attrs[SWITCH_ATTR_OP_PORT]);
+ if (val->port_vlan >= dev->ports)
+ goto done;
break;
default:
WARN_ON(1);
memset(&val, 0, sizeof(val));
attr = swconfig_lookup_attr(dev, info, &val);
if (!attr || !attr->get)
- goto error_dev;
+ goto error;
if (attr->type == SWITCH_TYPE_PORTS) {
val.value.ports = dev->portbuf;
nla_put_failure:
if (msg)
nlmsg_free(msg);
-error_dev:
- swconfig_put_dev(dev);
error:
+ swconfig_put_dev(dev);
if (!err)
err = -ENOMEM;
return err;
NLA_PUT_STRING(msg, SWITCH_ATTR_DEV_NAME, dev->devname);
NLA_PUT_U32(msg, SWITCH_ATTR_VLANS, dev->vlans);
NLA_PUT_U32(msg, SWITCH_ATTR_PORTS, dev->ports);
+ NLA_PUT_U32(msg, SWITCH_ATTR_CPU_PORT, dev->cpu_port);
return genlmsg_end(msg, hdr);
nla_put_failure:
swconfig_lock();
list_del(&dev->dev_list);
swconfig_unlock();
+ spin_unlock(&dev->lock);
}
EXPORT_SYMBOL_GPL(unregister_switch);