kernel: deny swconfig set requests for unprivileged users
[openwrt/staging/wigyori.git] / target / linux / generic / files / drivers / net / phy / swconfig.c
index b556510aef2c557a2d44ac9276580f6f1be8e9a6..699abd33dd894bd143ea72b6acf928184c78dadd 100644 (file)
@@ -635,6 +635,9 @@ swconfig_set_attr(struct sk_buff *skb, struct genl_info *info)
        struct switch_val val;
        int err = -EINVAL;
 
+       if (!capable(CAP_NET_ADMIN))
+               return -EPERM;
+
        dev = swconfig_get_dev(info);
        if (!dev)
                return -EINVAL;