Skip to content

Commit 2fe8a23

Browse files
SandyWinterPaolo Abeni
authored andcommitted
s390/qeth: Fix potential loss of L3-IP@ in case of network issues
Symptom: In case of a bad cable connection (e.g. dirty optics) a fast sequence of network DOWN-UP-DOWN-UP could happen. UP triggers recovery of the qeth interface. In case of a second DOWN while recovery is still ongoing, it can happen that the IP@ of a Layer3 qeth interface is lost and will not be recovered by the second UP. Problem: When registration of IP addresses with Layer 3 qeth devices fails, (e.g. because of bad address format) the respective IP address is deleted from its hash-table in the driver. If registration fails because of a ENETDOWN condition, the address should stay in the hashtable, so a subsequent recovery can restore it. 3caa4af ("qeth: keep ip-address after LAN_OFFLINE failure") fixes this for registration failures during normal operation, but not during recovery. Solution: Keep L3-IP address in case of ENETDOWN in qeth_l3_recover_ip(). For consistency with qeth_l3_add_ip() we also keep it in case of EADDRINUSE, i.e. for some reason the card already/still has this address registered. Fixes: 4a71df5 ("qeth: new qeth device driver") Cc: stable@vger.kernel.org Signed-off-by: Alexandra Winter <wintera@linux.ibm.com> Link: https://lore.kernel.org/r/20240206085849.2902775-1-wintera@linux.ibm.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent db010ff commit 2fe8a23

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

drivers/s390/net/qeth_l3_main.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,10 @@ static void qeth_l3_clear_ip_htable(struct qeth_card *card, int recover)
255255
if (!recover) {
256256
hash_del(&addr->hnode);
257257
kfree(addr);
258-
continue;
258+
} else {
259+
/* prepare for recovery */
260+
addr->disp_flag = QETH_DISP_ADDR_ADD;
259261
}
260-
addr->disp_flag = QETH_DISP_ADDR_ADD;
261262
}
262263

263264
mutex_unlock(&card->ip_lock);
@@ -278,9 +279,11 @@ static void qeth_l3_recover_ip(struct qeth_card *card)
278279
if (addr->disp_flag == QETH_DISP_ADDR_ADD) {
279280
rc = qeth_l3_register_addr_entry(card, addr);
280281

281-
if (!rc) {
282+
if (!rc || rc == -EADDRINUSE || rc == -ENETDOWN) {
283+
/* keep it in the records */
282284
addr->disp_flag = QETH_DISP_ADDR_DO_NOTHING;
283285
} else {
286+
/* bad address */
284287
hash_del(&addr->hnode);
285288
kfree(addr);
286289
}

0 commit comments

Comments
 (0)