qeth: avoid crash in case of layer mismatch for VSWITCH
authorUrsula Braun <ursula.braun@de.ibm.com>
Mon, 5 Jan 2009 01:35:18 +0000 (17:35 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 5 Jan 2009 01:35:18 +0000 (17:35 -0800)
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 <ursula.braun@de.ibm.com>
Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/s390/net/qeth_core_main.c
drivers/s390/net/qeth_l2_main.c
drivers/s390/net/qeth_l3_main.c

index 89867bc43f7adb10d89697fa44a945f0f5895d87..ffe6960cb30a0c826dfdb1d2467737e5a0990b3e 100644 (file)
@@ -572,6 +572,10 @@ static void qeth_send_control_data_cb(struct qeth_channel *channel,
        card = CARD_FROM_CDEV(channel->ccwdev);
        if (qeth_check_idx_response(iob->data)) {
                qeth_clear_ipacmd_list(card);
+               if (((iob->data[2] & 0xc0) == 0xc0) && iob->data[4] == 0xf6)
+                       dev_err(&card->gdev->dev,
+                               "The qeth device is not configured "
+                               "for the OSI layer required by z/VM\n");
                qeth_schedule_recovery(card);
                goto out;
        }
index 2c48591ced444530448b01c1881109da4acc34d5..21627ba3093be6aec8d4718afba2ca4e91248b62 100644 (file)
@@ -1126,9 +1126,11 @@ static int qeth_l2_recover(void *ptr)
                dev_info(&card->gdev->dev,
                        "Device successfully recovered!\n");
        else {
-               rtnl_lock();
-               dev_close(card->dev);
-               rtnl_unlock();
+               if (card->dev) {
+                       rtnl_lock();
+                       dev_close(card->dev);
+                       rtnl_unlock();
+               }
                dev_warn(&card->gdev->dev, "The qeth device driver "
                        "failed to recover an error on the device\n");
        }
index cdd6ab9c894dcba54714c4341cf7d9f6dd30b66d..8f30085ef5b412408af9044ca5dd58c8d57d51f4 100644 (file)
@@ -2082,9 +2082,11 @@ static int qeth_l3_stop_card(struct qeth_card *card, int recovery_mode)
                if (recovery_mode)
                        qeth_l3_stop(card->dev);
                else {
-                       rtnl_lock();
-                       dev_close(card->dev);
-                       rtnl_unlock();
+                       if (card->dev) {
+                               rtnl_lock();
+                               dev_close(card->dev);
+                               rtnl_unlock();
+                       }
                }
                if (!card->use_hard_stop) {
                        rc = qeth_send_stoplan(card);