From: Raju Lakkaraju <raju.lakkar...@microsemi.com>

Adding validation support for the ETHTOOL_PHY_DOWNSHIFT. Functional
implementation needs to be done in the individual PHY drivers.

Signed-off-by: Raju Lakkaraju <raju.lakkar...@microsemi.com>
Signed-off-by: Allan W. Nielsen <allan.niel...@microsemi.com>
---
 net/core/ethtool.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 75f19ab..1a66faa 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -2425,6 +2425,11 @@ static int ethtool_set_per_queue(struct net_device *dev, 
void __user *useraddr)
 static int ethtool_phy_tunable_valid(const struct ethtool_tunable *tuna)
 {
        switch (tuna->id) {
+       case ETHTOOL_PHY_DOWNSHIFT:
+               if (tuna->len != sizeof(u8) ||
+                   tuna->type_id != ETHTOOL_TUNABLE_U8)
+                       return -EINVAL;
+               break;
        default:
                return -EINVAL;
        }
-- 
2.7.3

Reply via email to