]>
Commit | Line | Data |
---|---|---|
08ef39ec GKH |
1 | From b5bf0f5b16b9c316c34df9f31d4be8729eb86845 Mon Sep 17 00:00:00 2001 |
2 | From: Mahesh Bandewar <maheshb@google.com> | |
3 | Date: Mon, 27 Mar 2017 11:37:37 -0700 | |
4 | Subject: bonding: correctly update link status during mii-commit phase | |
5 | ||
6 | From: Mahesh Bandewar <maheshb@google.com> | |
7 | ||
8 | commit b5bf0f5b16b9c316c34df9f31d4be8729eb86845 upstream. | |
9 | ||
10 | bond_miimon_commit() marks the link UP after attempting to get the speed | |
11 | and duplex settings for the link. There is a possibility that | |
12 | bond_update_speed_duplex() could fail. This is another place where it | |
13 | could result into an inconsistent bonding link state. | |
14 | ||
15 | With this patch the link will be marked UP only if the speed and duplex | |
16 | values retrieved have sane values and processed further. | |
17 | ||
18 | Signed-off-by: Mahesh Bandewar <maheshb@google.com> | |
19 | Signed-off-by: David S. Miller <davem@davemloft.net> | |
20 | Cc: Nate Clark <nate@neworld.us> | |
21 | Signed-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; |