[SRU][Trusty][PATCH 3/5] rtnl/do_setlink(): set modified when IFLA_LINKMODE is updated

Joseph Salisbury joseph.salisbury at canonical.com
Fri Jun 2 15:19:42 UTC 2017


From: Nicolas Dichtel <nicolas.dichtel at 6wind.com>

BugLink: http://bugs.launchpad.net/bugs/1690094

The only effect of this patch is to print a warning if IFLA_LINKMODE is updated
and a following change fails.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel at 6wind.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
(cherry picked from commit 1889b0e7efe8373793069bd3deb7702a51e6f2a5)
Signed-off-by: Joseph Salisbury <joseph.salisbury at canonical.com>
---
 net/core/rtnetlink.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 6b48fca..6448d35 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1595,8 +1595,12 @@ static int do_setlink(const struct sk_buff *skb,
 		set_operstate(dev, nla_get_u8(tb[IFLA_OPERSTATE]));
 
 	if (tb[IFLA_LINKMODE]) {
+		unsigned char value = nla_get_u8(tb[IFLA_LINKMODE]);
+
 		write_lock_bh(&dev_base_lock);
-		dev->link_mode = nla_get_u8(tb[IFLA_LINKMODE]);
+		if (dev->link_mode ^ value)
+			modified = 1;
+		dev->link_mode = value;
 		write_unlock_bh(&dev_base_lock);
 	}
 
-- 
2.7.4





More information about the kernel-team mailing list