]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.9.109/bonding-correctly-update-link-status-during-mii-commit-phase.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.9.109 / bonding-correctly-update-link-status-during-mii-commit-phase.patch
CommitLineData
08ef39ec
GKH
1From b5bf0f5b16b9c316c34df9f31d4be8729eb86845 Mon Sep 17 00:00:00 2001
2From: Mahesh Bandewar <maheshb@google.com>
3Date: Mon, 27 Mar 2017 11:37:37 -0700
4Subject: bonding: correctly update link status during mii-commit phase
5
6From: Mahesh Bandewar <maheshb@google.com>
7
8commit b5bf0f5b16b9c316c34df9f31d4be8729eb86845 upstream.
9
10bond_miimon_commit() marks the link UP after attempting to get the speed
11and duplex settings for the link. There is a possibility that
12bond_update_speed_duplex() could fail. This is another place where it
13could result into an inconsistent bonding link state.
14
15With this patch the link will be marked UP only if the speed and duplex
16values retrieved have sane values and processed further.
17
18Signed-off-by: Mahesh Bandewar <maheshb@google.com>
19Signed-off-by: David S. Miller <davem@davemloft.net>
20Cc: Nate Clark <nate@neworld.us>
21Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22
23---
24 drivers/net/bonding/bond_main.c | 7 ++++++-
25 1 file changed, 6 insertions(+), 1 deletion(-)
26
27--- a/drivers/net/bonding/bond_main.c
28+++ b/drivers/net/bonding/bond_main.c
29@@ -2140,7 +2140,12 @@ static void bond_miimon_commit(struct bo
30 continue;
31
32 case BOND_LINK_UP:
33- bond_update_speed_duplex(slave);
34+ if (bond_update_speed_duplex(slave)) {
35+ netdev_warn(bond->dev,
36+ "failed to get link speed/duplex for %s\n",
37+ slave->dev->name);
38+ continue;
39+ }
40 bond_set_slave_link_state(slave, BOND_LINK_UP,
41 BOND_SLAVE_NOTIFY_NOW);
42 slave->last_link_up = jiffies;