Skip to content

Commit fc9c246

Browse files
braunudavem330
authored andcommitted
qeth: avoid crash in case of layer mismatch for VSWITCH
For z/VM GuestLAN or VSWITCH devices the transport layer is configured in z/VM. The layer2 attribute of a participating Linux device has to match the z/VM definition. In case of a mismatch Linux currently crashes in qeth recovery due to a reference to the not yet existing net_device. Solution: add a check for existence of net_device and add a message pointing to the mismatch of layer definitions in Linux and z/VM. Signed-off-by: Ursula Braun <[email protected]> Signed-off-by: Frank Blaschka <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent fe94e2e commit fc9c246

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

drivers/s390/net/qeth_core_main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,10 @@ static void qeth_send_control_data_cb(struct qeth_channel *channel,
572572
card = CARD_FROM_CDEV(channel->ccwdev);
573573
if (qeth_check_idx_response(iob->data)) {
574574
qeth_clear_ipacmd_list(card);
575+
if (((iob->data[2] & 0xc0) == 0xc0) && iob->data[4] == 0xf6)
576+
dev_err(&card->gdev->dev,
577+
"The qeth device is not configured "
578+
"for the OSI layer required by z/VM\n");
575579
qeth_schedule_recovery(card);
576580
goto out;
577581
}

drivers/s390/net/qeth_l2_main.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,9 +1126,11 @@ static int qeth_l2_recover(void *ptr)
11261126
dev_info(&card->gdev->dev,
11271127
"Device successfully recovered!\n");
11281128
else {
1129-
rtnl_lock();
1130-
dev_close(card->dev);
1131-
rtnl_unlock();
1129+
if (card->dev) {
1130+
rtnl_lock();
1131+
dev_close(card->dev);
1132+
rtnl_unlock();
1133+
}
11321134
dev_warn(&card->gdev->dev, "The qeth device driver "
11331135
"failed to recover an error on the device\n");
11341136
}

drivers/s390/net/qeth_l3_main.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2082,9 +2082,11 @@ static int qeth_l3_stop_card(struct qeth_card *card, int recovery_mode)
20822082
if (recovery_mode)
20832083
qeth_l3_stop(card->dev);
20842084
else {
2085-
rtnl_lock();
2086-
dev_close(card->dev);
2087-
rtnl_unlock();
2085+
if (card->dev) {
2086+
rtnl_lock();
2087+
dev_close(card->dev);
2088+
rtnl_unlock();
2089+
}
20882090
}
20892091
if (!card->use_hard_stop) {
20902092
rc = qeth_send_stoplan(card);

0 commit comments

Comments
 (0)