[SRU][Cosmic][Bionic][PATCH 0/6] Fixes for LP1797367

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

[SRU][Cosmic][Bionic][PATCH 0/6] Fixes for LP1797367

Frank Heimes
BugLink: http://bugs.launchpad.net/bugs/1797367

== SRU Justification ==

While running a series of stress tests for network on a bond device on
Ubuntu 18.04.1 with kernel 4.15.0-36.39,
kernel panic is observed (btw. also on non-bond devices).
This looks like a race between disabling a qeth device and accessing debugfs.
This is critical and leads repeatedly to a crash (sooner or later).

== Fix ==

e19e5be8b4ca ("s390/qeth: sanitize strings in debug messages")

pre-reqs:
750b162 ("s390/qeth: reduce hard-coded access to ccw channels")
d857e11 ("s390/qeth: remove outdated portname debug msg")
9d0a58f ("s390/qeth: avoid using is_multicast_ether_addr_64bits on (u8 *)[6]")
8174aa8 ("s390/qeth: consolidate qeth MAC address helpers")
4641b02 ("s390/qeth: don't keep track of MAC address's cast type")

== Regression Potential ==

Low, because:
- limited to s390x
- and furthermore limited to qeth driver
- patches a problem identified during testing
- fix was tested by IBM before submitted

== Test Case ==

run:
   #!/bin/bash
   var=0
   while :
   do
        var=$((var + 1))
        echo "DBG count is $var"
        mkdir /tmp/DBGINFO
        dbginfo.sh -d /tmp/DBGINFO
        rm -rf /tmp/DBGINFO*
        echo "chzdev now is $var"
        chzdev -e <qeth device>
        chzdev -d <qeth device>
   done
and in avg. in less than 20 cycles a crash happens (usually < 10).

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[SRU][Cosmic][Bionic][PATCH 1/6] s390/qeth: sanitize strings in debug messages

Frank Heimes
From: Julian Wiedmann <[hidden email]>

BugLink: http://bugs.launchpad.net/bugs/1797367

s390/qeth: sanitize strings in debug messages

As Documentation/s390/s390dbf.txt states quite clearly, using any
pointer in sprinf-formatted s390dbf debug entries is dangerous.
The pointers are dereferenced whenever the trace file is read from.
So if the referenced data has a shorter life-time than the trace file,
any read operation can result in a use-after-free.

So rip out all hazardous use of indirect data, and replace any usage of
dev_name() and such by the Bus ID number.

Signed-off-by: Julian Wiedmann <[hidden email]>
Signed-off-by: David S. Miller <[hidden email]>
(cherry-picked from commit e19e5be8b4cafa8b3f8b0cd1b1dfe20fa0145b83)
Signed-off-by: Frank Heimes <[hidden email]>

---

diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h
index 6843bc7..884ba9d 100644
--- a/drivers/s390/net/qeth_core.h
+++ b/drivers/s390/net/qeth_core.h
@@ -87,6 +87,18 @@ struct qeth_dbf_info {
 #define SENSE_RESETTING_EVENT_BYTE 1
 #define SENSE_RESETTING_EVENT_FLAG 0x80

+static inline u32 qeth_get_device_id(struct ccw_device *cdev)
+{
+       struct ccw_dev_id dev_id;
+       u32 id;
+
+       ccw_device_get_id(cdev, &dev_id);
+       id = dev_id.devno;
+       id |= (u32) (dev_id.ssid << 16);
+
+       return id;
+}
+
 /*
  * Common IO related definitions
  */
@@ -97,7 +109,8 @@ struct qeth_dbf_info {
 #define CARD_RDEV_ID(card) dev_name(&card->read.ccwdev->dev)
 #define CARD_WDEV_ID(card) dev_name(&card->write.ccwdev->dev)
 #define CARD_DDEV_ID(card) dev_name(&card->data.ccwdev->dev)
-#define CHANNEL_ID(channel) dev_name(&channel->ccwdev->dev)
+#define CCW_DEVID(cdev)                (qeth_get_device_id(cdev))
+#define CARD_DEVID(card)       (CCW_DEVID(CARD_RDEV(card)))

 /**
  * card stuff
diff --git a/drivers/s390/net/qeth_core_main.c
b/drivers/s390/net/qeth_core_main.c
index 3274f13..639ac0a 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -554,8 +554,8 @@ static int __qeth_issue_next_read(struct qeth_card *card)
        if (!iob) {
                dev_warn(&card->gdev->dev, "The qeth device driver "
                        "failed to recover an error on the device\n");
-               QETH_DBF_MESSAGE(2, "%s issue_next_read failed: no iob "
-                       "available\n", dev_name(&card->gdev->dev));
+               QETH_DBF_MESSAGE(2, "issue_next_read on device %x
failed: no iob available\n",
+                                CARD_DEVID(card));
                return -ENOMEM;
        }
        qeth_setup_ccw(channel->ccw, CCW_CMD_READ, QETH_BUFSIZE, iob->data);
@@ -563,8 +563,8 @@ static int __qeth_issue_next_read(struct qeth_card *card)
        rc = ccw_device_start(channel->ccwdev, channel->ccw,
                              (addr_t) iob, 0, 0);
        if (rc) {
-               QETH_DBF_MESSAGE(2, "%s error in starting next read ccw! "
-                       "rc=%i\n", dev_name(&card->gdev->dev), rc);
+               QETH_DBF_MESSAGE(2, "error %i on device %x when
starting next read ccw!\n",
+                                rc, CARD_DEVID(card));
                atomic_set(&channel->irq_pending, 0);
                card->read_or_write_problem = 1;
                qeth_schedule_recovery(card);
@@ -613,16 +613,14 @@ static void qeth_issue_ipa_msg(struct
qeth_ipa_cmd *cmd, int rc,
        const char *ipa_name;
        int com = cmd->hdr.command;
        ipa_name = qeth_get_ipa_cmd_name(com);
+
        if (rc)
-               QETH_DBF_MESSAGE(2, "IPA: %s(x%X) for %s/%s returned "
-                               "x%X \"%s\"\n",
-                               ipa_name, com, dev_name(&card->gdev->dev),
-                               QETH_CARD_IFNAME(card), rc,
-                               qeth_get_ipa_msg(rc));
+               QETH_DBF_MESSAGE(2, "IPA: %s(%#x) for device %x
returned %#x \"%s\"\n",
+                                ipa_name, com, CARD_DEVID(card), rc,
+                                qeth_get_ipa_msg(rc));
        else
-               QETH_DBF_MESSAGE(5, "IPA: %s(x%X) for %s/%s succeeded\n",
-                               ipa_name, com, dev_name(&card->gdev->dev),
-                               QETH_CARD_IFNAME(card));
+               QETH_DBF_MESSAGE(5, "IPA: %s(%#x) for device %x succeeded\n",
+                                ipa_name, com, CARD_DEVID(card));
 }

 static struct qeth_ipa_cmd *qeth_check_ipa_data(struct qeth_card *card,
@@ -711,7 +709,7 @@ static int qeth_check_idx_response(struct qeth_card *card,

        QETH_DBF_HEX(CTRL, 2, buffer, QETH_DBF_CTRL_LEN);
        if ((buffer[2] & 0xc0) == 0xc0) {
-               QETH_DBF_MESSAGE(2, "received an IDX TERMINATE with
cause code %#02x\n",
+               QETH_DBF_MESSAGE(2, "received an IDX TERMINATE with
cause code %#04x\n",
                                 buffer[4]);
                QETH_CARD_TEXT(card, 2, "ckidxres");
                QETH_CARD_TEXT(card, 2, " idxterm");
@@ -972,8 +970,8 @@ static int qeth_get_problem(struct qeth_card
*card, struct ccw_device *cdev,
                QETH_CARD_TEXT(card, 2, "CGENCHK");
                dev_warn(&cdev->dev, "The qeth device driver "
                        "failed to recover an error on the device\n");
-               QETH_DBF_MESSAGE(2, "%s check on device dstat=x%x, cstat=x%x\n",
-                       dev_name(&cdev->dev), dstat, cstat);
+               QETH_DBF_MESSAGE(2, "check on channel %x with
dstat=%#x, cstat=%#x\n",
+                                CCW_DEVID(cdev), dstat, cstat);
                print_hex_dump(KERN_WARNING, "qeth: irb ", DUMP_PREFIX_OFFSET,
                                16, 1, irb, 64, 1);
                return 1;
@@ -1013,8 +1011,8 @@ static long qeth_check_irb_error(struct qeth_card *card,

        switch (PTR_ERR(irb)) {
        case -EIO:
-               QETH_DBF_MESSAGE(2, "%s i/o-error on device\n",
-                       dev_name(&cdev->dev));
+               QETH_DBF_MESSAGE(2, "i/o-error on channel %x\n",
+                                CCW_DEVID(cdev));
                QETH_CARD_TEXT(card, 2, "ckirberr");
                QETH_CARD_TEXT_(card, 2, "  rc%d", -EIO);
                break;
@@ -1031,8 +1029,8 @@ static long qeth_check_irb_error(struct qeth_card *card,
                }
                break;
        default:
-               QETH_DBF_MESSAGE(2, "%s unknown error %ld on device\n",
-                       dev_name(&cdev->dev), PTR_ERR(irb));
+               QETH_DBF_MESSAGE(2, "unknown error %ld on channel %x\n",
+                                PTR_ERR(irb), CCW_DEVID(cdev));
                QETH_CARD_TEXT(card, 2, "ckirberr");
                QETH_CARD_TEXT(card, 2, "  rc???");
        }
@@ -1114,9 +1112,9 @@ static void qeth_irq(struct ccw_device *cdev,
unsigned long intparm,
                        dev_warn(&channel->ccwdev->dev,
                                "The qeth device driver failed to recover "
                                "an error on the device\n");
-                       QETH_DBF_MESSAGE(2, "%s sense data available. cstat "
-                               "0x%X dstat 0x%X\n",
-                               dev_name(&channel->ccwdev->dev), cstat, dstat);
+                       QETH_DBF_MESSAGE(2, "sense data available on
channel %x: cstat %#X dstat %#X\n",
+                                        CCW_DEVID(channel->ccwdev), cstat,
+                                        dstat);
                        print_hex_dump(KERN_WARNING, "qeth: irb ",
                                DUMP_PREFIX_OFFSET, 16, 1, irb, 32, 1);
                        print_hex_dump(KERN_WARNING, "qeth: sense data ",
@@ -1890,8 +1888,8 @@ static int qeth_idx_activate_channel(struct
qeth_card *card,
        if (channel->state != CH_STATE_ACTIVATING) {
                dev_warn(&channel->ccwdev->dev, "The qeth device driver"
                        " failed to recover an error on the device\n");
-               QETH_DBF_MESSAGE(2, "%s IDX activate timed out\n",
-                       dev_name(&channel->ccwdev->dev));
+               QETH_DBF_MESSAGE(2, "IDX activate timed out on channel %x\n",
+                                CCW_DEVID(channel->ccwdev));
                QETH_DBF_TEXT_(SETUP, 2, "2err%d", -ETIME);
                return -ETIME;
        }
@@ -1926,17 +1924,15 @@ static void qeth_idx_write_cb(struct qeth_card *card,
                                "The adapter is used exclusively by another "
                                "host\n");
                else
-                       QETH_DBF_MESSAGE(2, "%s IDX_ACTIVATE on write channel:"
-                               " negative reply\n",
-                               dev_name(&channel->ccwdev->dev));
+                       QETH_DBF_MESSAGE(2, "IDX_ACTIVATE on channel
%x: negative reply\n",
+                                        CCW_DEVID(channel->ccwdev));
                goto out;
        }
        memcpy(&temp, QETH_IDX_ACT_FUNC_LEVEL(iob->data), 2);
        if ((temp & ~0x0100) != qeth_peer_func_level(card->info.func_level)) {
-               QETH_DBF_MESSAGE(2, "%s IDX_ACTIVATE on write channel: "
-                       "function level mismatch (sent: 0x%x, received: "
-                       "0x%x)\n", dev_name(&channel->ccwdev->dev),
-                       card->info.func_level, temp);
+               QETH_DBF_MESSAGE(2, "IDX_ACTIVATE on channel %x:
function level mismatch (sent: %#x, received: %#x)\n",
+                                CCW_DEVID(channel->ccwdev),
+                                card->info.func_level, temp);
                goto out;
        }
        channel->state = CH_STATE_UP;
@@ -1973,9 +1969,8 @@ static void qeth_idx_read_cb(struct qeth_card *card,
                                "insufficient authorization\n");
                        break;
                default:
-                       QETH_DBF_MESSAGE(2, "%s IDX_ACTIVATE on read channel:"
-                               " negative reply\n",
-                               dev_name(&channel->ccwdev->dev));
+                       QETH_DBF_MESSAGE(2, "IDX_ACTIVATE on channel
%x: negative reply\n",
+                                        CCW_DEVID(channel->ccwdev));
                }
                QETH_CARD_TEXT_(card, 2, "idxread%c",
                        QETH_IDX_ACT_CAUSE_CODE(iob->data));
@@ -1984,10 +1979,9 @@ static void qeth_idx_read_cb(struct qeth_card *card,

        memcpy(&temp, QETH_IDX_ACT_FUNC_LEVEL(iob->data), 2);
        if (temp != qeth_peer_func_level(card->info.func_level)) {
-               QETH_DBF_MESSAGE(2, "%s IDX_ACTIVATE on read channel: function "
-                       "level mismatch (sent: 0x%x, received: 0x%x)\n",
-                       dev_name(&channel->ccwdev->dev),
-                       card->info.func_level, temp);
+               QETH_DBF_MESSAGE(2, "IDX_ACTIVATE on channel %x:
function level mismatch (sent: %#x, received: %#x)\n",
+                                CCW_DEVID(channel->ccwdev),
+                                card->info.func_level, temp);
                goto out;
        }
        memcpy(&card->token.issuer_rm_r,
@@ -2096,9 +2090,8 @@ int qeth_send_control_data(struct qeth_card
*card, int len,
                                      (addr_t) iob, 0, 0, event_timeout);
        spin_unlock_irq(get_ccwdev_lock(channel->ccwdev));
        if (rc) {
-               QETH_DBF_MESSAGE(2, "%s qeth_send_control_data: "
-                       "ccw_device_start rc = %i\n",
-                       dev_name(&channel->ccwdev->dev), rc);
+               QETH_DBF_MESSAGE(2, "qeth_send_control_data on device
%x: ccw_device_start rc = %i\n",
+                                CARD_DEVID(card), rc);
                QETH_CARD_TEXT_(card, 2, " err%d", rc);
                spin_lock_irq(&card->lock);
                list_del_init(&reply->list);
@@ -2853,8 +2846,8 @@ struct qeth_cmd_buffer
*qeth_get_ipacmd_buffer(struct qeth_card *card,
        } else {
                dev_warn(&card->gdev->dev,
                         "The qeth driver ran out of channel command
buffers\n");
-               QETH_DBF_MESSAGE(1, "%s The qeth driver ran out of
channel command buffers",
-                                dev_name(&card->gdev->dev));
+               QETH_DBF_MESSAGE(1, "device %x ran out of channel
command buffers",
+                                CARD_DEVID(card));
        }

        return iob;
@@ -2989,10 +2982,9 @@ static int qeth_query_ipassists_cb(struct
qeth_card *card,
                return 0;
        default:
                if (cmd->hdr.return_code) {
-                       QETH_DBF_MESSAGE(1, "%s IPA_CMD_QIPASSIST: Unhandled "
-                                               "rc=%d\n",
-                                               dev_name(&card->gdev->dev),
-                                               cmd->hdr.return_code);
+                       QETH_DBF_MESSAGE(1, "IPA_CMD_QIPASSIST on
device %x: Unhandled rc=%#x\n",
+                                        CARD_DEVID(card),
+                                        cmd->hdr.return_code);
                        return 0;
                }
        }
@@ -3004,8 +2996,8 @@ static int qeth_query_ipassists_cb(struct qeth_card *card,
                card->options.ipa6.supported_funcs = cmd->hdr.ipa_supported;
                card->options.ipa6.enabled_funcs = cmd->hdr.ipa_enabled;
        } else
-               QETH_DBF_MESSAGE(1, "%s IPA_CMD_QIPASSIST: Flawed LIC detected"
-                                       "\n", dev_name(&card->gdev->dev));
+               QETH_DBF_MESSAGE(1, "IPA_CMD_QIPASSIST on device %x:
Flawed LIC detected\n",
+                                CARD_DEVID(card));
        return 0;
 }

@@ -4297,10 +4289,9 @@ static int
qeth_setadpparms_set_access_ctrl_cb(struct qeth_card *card,
                cmd->data.setadapterparms.hdr.return_code);
        if (cmd->data.setadapterparms.hdr.return_code !=
                                                SET_ACCESS_CTRL_RC_SUCCESS)
-               QETH_DBF_MESSAGE(3, "ERR:SET_ACCESS_CTRL(%s,%d)==%d\n",
-                               card->gdev->dev.kobj.name,
-                               access_ctrl_req->subcmd_code,
-                               cmd->data.setadapterparms.hdr.return_code);
+               QETH_DBF_MESSAGE(3, "ERR:SET_ACCESS_CTRL(%#x) on
device %x: %#x\n",
+                                access_ctrl_req->subcmd_code, CARD_DEVID(card),
+                                cmd->data.setadapterparms.hdr.return_code);
        switch (cmd->data.setadapterparms.hdr.return_code) {
        case SET_ACCESS_CTRL_RC_SUCCESS:
                if (card->options.isolation == ISOLATION_MODE_NONE) {
@@ -4312,14 +4303,14 @@ static int
qeth_setadpparms_set_access_ctrl_cb(struct qeth_card *card,
                }
                break;
        case SET_ACCESS_CTRL_RC_ALREADY_NOT_ISOLATED:
-               QETH_DBF_MESSAGE(2, "%s QDIO data connection isolation already "
-                               "deactivated\n", dev_name(&card->gdev->dev));
+               QETH_DBF_MESSAGE(2, "QDIO data connection isolation on
device %x already deactivated\n",
+                                CARD_DEVID(card));
                if (fallback)
                        card->options.isolation = card->options.prev_isolation;
                break;
        case SET_ACCESS_CTRL_RC_ALREADY_ISOLATED:
-               QETH_DBF_MESSAGE(2, "%s QDIO data connection isolation already"
-                               " activated\n", dev_name(&card->gdev->dev));
+               QETH_DBF_MESSAGE(2, "QDIO data connection isolation on
device %x already activated\n",
+                                CARD_DEVID(card));
                if (fallback)
                        card->options.isolation = card->options.prev_isolation;
                break;
@@ -4405,10 +4396,8 @@ int qeth_set_access_ctrl_online(struct
qeth_card *card, int fallback)
                rc = qeth_setadpparms_set_access_ctrl(card,
                        card->options.isolation, fallback);
                if (rc) {
-                       QETH_DBF_MESSAGE(3,
-                               "IPA(SET_ACCESS_CTRL,%s,%d) sent failed\n",
-                               card->gdev->dev.kobj.name,
-                               rc);
+                       QETH_DBF_MESSAGE(3, "IPA(SET_ACCESS_CTRL(%d)
on device %x: sent failed\n",
+                                        rc, CARD_DEVID(card));
                        rc = -EOPNOTSUPP;
                }
        } else if (card->options.isolation != ISOLATION_MODE_NONE) {
@@ -4634,8 +4623,8 @@ static int qeth_snmp_command(struct qeth_card
*card, char __user *udata)
        rc = qeth_send_ipa_snmp_cmd(card, iob, QETH_SETADP_BASE_LEN + req_len,
                                    qeth_snmp_command_cb, (void *)&qinfo);
        if (rc)
-               QETH_DBF_MESSAGE(2, "SNMP command failed on %s: (0x%x)\n",
-                          QETH_CARD_IFNAME(card), rc);
+               QETH_DBF_MESSAGE(2, "SNMP command failed on device %x: (%#x)\n",
+                                CARD_DEVID(card), rc);
        else {
                if (copy_to_user(udata, qinfo.udata, qinfo.udata_len))
                        rc = -EFAULT;
@@ -4869,8 +4858,8 @@ static void qeth_determine_capabilities(struct
qeth_card *card)

        rc = qeth_read_conf_data(card, (void **) &prcd, &length);
        if (rc) {
-               QETH_DBF_MESSAGE(2, "%s qeth_read_conf_data returned %i\n",
-                       dev_name(&card->gdev->dev), rc);
+               QETH_DBF_MESSAGE(2, "qeth_read_conf_data on device %x
returned %i\n",
+                                CARD_DEVID(card), rc);
                QETH_DBF_TEXT_(SETUP, 2, "5err%d", rc);
                goto out_offline;
        }
@@ -5096,8 +5085,8 @@ int qeth_core_hardsetup_card(struct qeth_card *card)
        qeth_update_from_chp_desc(card);
 retry:
        if (retries < 3)
-               QETH_DBF_MESSAGE(2, "%s Retrying to do IDX activates.\n",
-                       dev_name(&card->gdev->dev));
+               QETH_DBF_MESSAGE(2, "Retrying to do IDX activates on
device %x.\n",
+                                CARD_DEVID(card));
        rc = qeth_qdio_clear_card(card, card->info.type != QETH_CARD_TYPE_IQD);
        ccw_device_set_offline(CARD_DDEV(card));
        ccw_device_set_offline(CARD_WDEV(card));
@@ -5201,8 +5190,8 @@ int qeth_core_hardsetup_card(struct qeth_card *card)
 out:
        dev_warn(&card->gdev->dev, "The qeth device driver failed to recover "
                "an error on the device\n");
-       QETH_DBF_MESSAGE(2, "%s Initialization in hardsetup failed! rc=%d\n",
-               dev_name(&card->gdev->dev), rc);
+       QETH_DBF_MESSAGE(2, "Initialization for device %x failed in
hardsetup! rc=%d\n",
+                        CARD_DEVID(card), rc);
        return rc;
 }
 EXPORT_SYMBOL_GPL(qeth_core_hardsetup_card);
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index 23aaf37..5b67fd1 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -146,11 +146,11 @@ static int qeth_l2_write_mac(struct qeth_card
*card, u8 *mac)
        QETH_CARD_TEXT(card, 2, "L2Wmac");
        rc = qeth_l2_send_setdelmac(card, mac, cmd);
        if (rc == -EEXIST)
-               QETH_DBF_MESSAGE(2, "MAC %pM already registered on %s\n",
-                                mac, QETH_CARD_IFNAME(card));
+               QETH_DBF_MESSAGE(2, "MAC already registered on device %x\n",
+                                CARD_DEVID(card));
        else if (rc)
-               QETH_DBF_MESSAGE(2, "Failed to register MAC %pM on %s: %d\n",
-                                mac, QETH_CARD_IFNAME(card), rc);
+               QETH_DBF_MESSAGE(2, "Failed to register MAC on device %x: %d\n",
+                                CARD_DEVID(card), rc);
        return rc;
 }

@@ -163,8 +163,8 @@ static int qeth_l2_remove_mac(struct qeth_card
*card, u8 *mac)
        QETH_CARD_TEXT(card, 2, "L2Rmac");
        rc = qeth_l2_send_setdelmac(card, mac, cmd);
        if (rc)
-               QETH_DBF_MESSAGE(2, "Failed to delete MAC %pM on %s: %d\n",
-                                mac, QETH_CARD_IFNAME(card), rc);
+               QETH_DBF_MESSAGE(2, "Failed to delete MAC on device %u: %d\n",
+                                CARD_DEVID(card), rc);
        return rc;
 }

@@ -260,9 +260,9 @@ static int qeth_l2_send_setdelvlan_cb(struct
qeth_card *card,

        QETH_CARD_TEXT(card, 2, "L2sdvcb");
        if (cmd->hdr.return_code) {
-               QETH_DBF_MESSAGE(2, "Error in processing VLAN %i on
%s: 0x%x.\n",
+               QETH_DBF_MESSAGE(2, "Error in processing VLAN %u on
device %x: %#x.\n",
                                 cmd->data.setdelvlan.vlan_id,
-                                QETH_CARD_IFNAME(card), cmd->hdr.return_code);
+                                CARD_DEVID(card), cmd->hdr.return_code);
                QETH_CARD_TEXT_(card, 2, "L2VL%4x", cmd->hdr.command);
                QETH_CARD_TEXT_(card, 2, "err%d", cmd->hdr.return_code);
        }
@@ -455,8 +455,8 @@ static int qeth_l2_request_initial_mac(struct
qeth_card *card)
                rc = qeth_vm_request_mac(card);
                if (!rc)
                        goto out;
-               QETH_DBF_MESSAGE(2, "z/VM MAC Service failed on device
%s: x%x\n",
-                                CARD_BUS_ID(card), rc);
+               QETH_DBF_MESSAGE(2, "z/VM MAC Service failed on device
%x: %#x\n",
+                                CARD_DEVID(card), rc);
                QETH_DBF_TEXT_(SETUP, 2, "err%04x", rc);
                /* fall back to alternative mechanism: */
        }
@@ -468,8 +468,8 @@ static int qeth_l2_request_initial_mac(struct
qeth_card *card)
                rc = qeth_setadpparms_change_macaddr(card);
                if (!rc)
                        goto out;
-               QETH_DBF_MESSAGE(2, "READ_MAC Assist failed on device
%s: x%x\n",
-                                CARD_BUS_ID(card), rc);
+               QETH_DBF_MESSAGE(2, "READ_MAC Assist failed on device
%x: %#x\n",
+                                CARD_DEVID(card), rc);
                QETH_DBF_TEXT_(SETUP, 2, "1err%04x", rc);
                /* fall back once more: */
        }
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index 0b161cc..ffa2aa1 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -494,9 +494,8 @@ int qeth_l3_setrouting_v4(struct qeth_card *card)
                                  QETH_PROT_IPV4);
        if (rc) {
                card->options.route4.type = NO_ROUTER;
-               QETH_DBF_MESSAGE(2, "Error (0x%04x) while setting routing type"
-                       " on %s. Type set to 'no router'.\n", rc,
-                       QETH_CARD_IFNAME(card));
+               QETH_DBF_MESSAGE(2, "Error (%#06x) while setting
routing type on device %x. Type set to 'no router'.\n",
+                                rc, CARD_DEVID(card));
        }
        return rc;
 }
@@ -518,9 +517,8 @@ int qeth_l3_setrouting_v6(struct qeth_card *card)
                                  QETH_PROT_IPV6);
        if (rc) {
                card->options.route6.type = NO_ROUTER;
-               QETH_DBF_MESSAGE(2, "Error (0x%04x) while setting routing type"
-                       " on %s. Type set to 'no router'.\n", rc,
-                       QETH_CARD_IFNAME(card));
+               QETH_DBF_MESSAGE(2, "Error (%#06x) while setting
routing type on device %x. Type set to 'no router'.\n",
+                                rc, CARD_DEVID(card));
        }
        return rc;
 }
@@ -1070,8 +1068,8 @@ qeth_diags_trace_cb(struct qeth_card *card,
struct qeth_reply *reply,
                }
                break;
        default:
-               QETH_DBF_MESSAGE(2, "Unknown sniffer action (0x%04x) on %s\n",
-                       cmd->data.diagass.action, QETH_CARD_IFNAME(card));
+               QETH_DBF_MESSAGE(2, "Unknown sniffer action (%#06x) on
device %x\n",
+                                cmd->data.diagass.action, CARD_DEVID(card));
        }

        return 0;
@@ -1517,32 +1515,25 @@ static void qeth_l3_set_rx_mode(struct net_device *dev)
        qeth_l3_handle_promisc_mode(card);
 }

-static const char *qeth_l3_arp_get_error_cause(int *rc)
+static int qeth_l3_arp_makerc(int rc)
 {
-       switch (*rc) {
-       case QETH_IPA_ARP_RC_FAILED:
-               *rc = -EIO;
-               return "operation failed";
+       switch (rc) {
+       case IPA_RC_SUCCESS:
+               return 0;
        case QETH_IPA_ARP_RC_NOTSUPP:
-               *rc = -EOPNOTSUPP;
-               return "operation not supported";
-       case QETH_IPA_ARP_RC_OUT_OF_RANGE:
-               *rc = -EINVAL;
-               return "argument out of range";
        case QETH_IPA_ARP_RC_Q_NOTSUPP:
-               *rc = -EOPNOTSUPP;
-               return "query operation not supported";
+               return -EOPNOTSUPP;
+       case QETH_IPA_ARP_RC_OUT_OF_RANGE:
+               return -EINVAL;
        case QETH_IPA_ARP_RC_Q_NO_DATA:
-               *rc = -ENOENT;
-               return "no query data available";
+               return -ENOENT;
        default:
-               return "unknown error";
+               return -EIO;
        }
 }

 static int qeth_l3_arp_set_no_entries(struct qeth_card *card, int no_entries)
 {
-       int tmp;
        int rc;

        QETH_CARD_TEXT(card, 3, "arpstnoe");
@@ -1560,13 +1551,10 @@ static int qeth_l3_arp_set_no_entries(struct
qeth_card *card, int no_entries)
        rc = qeth_send_simple_setassparms(card, IPA_ARP_PROCESSING,
                                          IPA_CMD_ASS_ARP_SET_NO_ENTRIES,
                                          no_entries);
-       if (rc) {
-               tmp = rc;
-               QETH_DBF_MESSAGE(2, "Could not set number of ARP entries on "
-                       "%s: %s (0x%x/%d)\n", QETH_CARD_IFNAME(card),
-                       qeth_l3_arp_get_error_cause(&rc), tmp, tmp);
-       }
-       return rc;
+       if (rc)
+               QETH_DBF_MESSAGE(2, "Could not set number of ARP
entries on device %x: %#x\n",
+                                CARD_DEVID(card), rc);
+       return qeth_l3_arp_makerc(rc);
 }

 static __u32 get_arp_entry_size(struct qeth_card *card,
@@ -1716,7 +1704,6 @@ static int qeth_l3_query_arp_cache_info(struct
qeth_card *card,
 {
        struct qeth_cmd_buffer *iob;
        struct qeth_ipa_cmd *cmd;
-       int tmp;
        int rc;

        QETH_CARD_TEXT_(card, 3, "qarpipv%i", prot);
@@ -1735,15 +1722,10 @@ static int qeth_l3_query_arp_cache_info(struct
qeth_card *card,
        rc = qeth_l3_send_ipa_arp_cmd(card, iob,
                           QETH_SETASS_BASE_LEN+QETH_ARP_CMD_LEN,
                           qeth_l3_arp_query_cb, (void *)qinfo);
-       if (rc) {
-               tmp = rc;
-               QETH_DBF_MESSAGE(2,
-                       "Error while querying ARP cache on %s: %s "
-                       "(0x%x/%d)\n", QETH_CARD_IFNAME(card),
-                       qeth_l3_arp_get_error_cause(&rc), tmp, tmp);
-       }
-
-       return rc;
+       if (rc)
+               QETH_DBF_MESSAGE(2, "Error while querying ARP cache on
device %x: %#x\n",
+                                CARD_DEVID(card), rc);
+       return qeth_l3_arp_makerc(rc);
 }

 static int qeth_l3_arp_query(struct qeth_card *card, char __user *udata)
@@ -1797,8 +1779,6 @@ static int qeth_l3_arp_add_entry(struct qeth_card *card,
                                struct qeth_arp_cache_entry *entry)
 {
        struct qeth_cmd_buffer *iob;
-       char buf[16];
-       int tmp;
        int rc;

        QETH_CARD_TEXT(card, 3, "arpadent");
@@ -1824,14 +1804,10 @@ static int qeth_l3_arp_add_entry(struct qeth_card *card,
                                   sizeof(struct qeth_arp_cache_entry),
                                   (unsigned long) entry,
                                   qeth_setassparms_cb, NULL);
-       if (rc) {
-               tmp = rc;
-               qeth_l3_ipaddr4_to_string((u8 *)entry->ipaddr, buf);
-               QETH_DBF_MESSAGE(2, "Could not add ARP entry for address %s "
-                       "on %s: %s (0x%x/%d)\n", buf, QETH_CARD_IFNAME(card),
-                       qeth_l3_arp_get_error_cause(&rc), tmp, tmp);
-       }
-       return rc;
+       if (rc)
+               QETH_DBF_MESSAGE(2, "Could not add ARP entry on device
%x: %#x\n",
+                                CARD_DEVID(card), rc);
+       return qeth_l3_arp_makerc(rc);
 }

 static int qeth_l3_arp_remove_entry(struct qeth_card *card,
@@ -1839,7 +1815,6 @@ static int qeth_l3_arp_remove_entry(struct
qeth_card *card,
 {
        struct qeth_cmd_buffer *iob;
        char buf[16] = {0, };
-       int tmp;
        int rc;

        QETH_CARD_TEXT(card, 3, "arprment");
@@ -1864,21 +1839,15 @@ static int qeth_l3_arp_remove_entry(struct
qeth_card *card,
        rc = qeth_send_setassparms(card, iob,
                                   12, (unsigned long)buf,
                                   qeth_setassparms_cb, NULL);
-       if (rc) {
-               tmp = rc;
-               memset(buf, 0, 16);
-               qeth_l3_ipaddr4_to_string((u8 *)entry->ipaddr, buf);
-               QETH_DBF_MESSAGE(2, "Could not delete ARP entry for address %s"
-                       " on %s: %s (0x%x/%d)\n", buf, QETH_CARD_IFNAME(card),
-                       qeth_l3_arp_get_error_cause(&rc), tmp, tmp);
-       }
-       return rc;
+       if (rc)
+               QETH_DBF_MESSAGE(2, "Could not delete ARP entry on
device %x: %#x\n",
+                                CARD_DEVID(card), rc);
+       return qeth_l3_arp_makerc(rc);
 }

 static int qeth_l3_arp_flush_cache(struct qeth_card *card)
 {
        int rc;
-       int tmp;

        QETH_CARD_TEXT(card, 3, "arpflush");

@@ -1894,13 +1863,10 @@ static int qeth_l3_arp_flush_cache(struct
qeth_card *card)
        }
        rc = qeth_send_simple_setassparms(card, IPA_ARP_PROCESSING,
                                          IPA_CMD_ASS_ARP_FLUSH_CACHE, 0);
-       if (rc) {
-               tmp = rc;
-               QETH_DBF_MESSAGE(2, "Could not flush ARP cache on %s: %s "
-                       "(0x%x/%d)\n", QETH_CARD_IFNAME(card),
-                       qeth_l3_arp_get_error_cause(&rc), tmp, tmp);
-       }
-       return rc;
+       if (rc)
+               QETH_DBF_MESSAGE(2, "Could not flush ARP cache on
device %x: %#x\n",
+                                CARD_DEVID(card), rc);
+       return qeth_l3_arp_makerc(rc);
 }

 static int qeth_l3_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[SRU][Cosmic][Bionic][PATCH 2/6] s390/qeth: reduce hard-coded access to ccw channels

Frank Heimes
In reply to this post by Frank Heimes
From: Julian Wiedmann <[hidden email]>

BugLink: http://bugs.launchpad.net/bugs/1797367

s390/qeth: reduce hard-coded access to ccw channels

Where possible use accessor macros and local pointers to access the ccw
channels. This makes it less likely to miss a spot.

Signed-off-by: Julian Wiedmann <[hidden email]>
Signed-off-by: David S. Miller <[hidden email]>
(cherry-picked from commit 750b162598ec5b65cdb44d18f050b45cb7f8d31b)
Signed-off-by: Frank Heimes <[hidden email]>

---

diff --git a/drivers/s390/net/qeth_core_main.c
b/drivers/s390/net/qeth_core_main.c
index da9ac21..e459894 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -534,13 +534,14 @@ static inline int qeth_is_cq(struct qeth_card
*card, unsigned int queue)

 static int __qeth_issue_next_read(struct qeth_card *card)
 {
-       int rc;
+       struct qeth_channel *channel = &card->read;
        struct qeth_cmd_buffer *iob;
+       int rc;

        QETH_CARD_TEXT(card, 5, "issnxrd");
-       if (card->read.state != CH_STATE_UP)
+       if (channel->state != CH_STATE_UP)
                return -EIO;
-       iob = qeth_get_buffer(&card->read);
+       iob = qeth_get_buffer(channel);
        if (!iob) {
                dev_warn(&card->gdev->dev, "The qeth device driver "
                        "failed to recover an error on the device\n");
@@ -548,14 +549,14 @@ static int __qeth_issue_next_read(struct qeth_card *card)
                        "available\n", dev_name(&card->gdev->dev));
                return -ENOMEM;
        }
-       qeth_setup_ccw(&card->read, iob->data, QETH_BUFSIZE);
+       qeth_setup_ccw(channel, iob->data, QETH_BUFSIZE);
        QETH_CARD_TEXT(card, 6, "noirqpnd");
-       rc = ccw_device_start(card->read.ccwdev, &card->read.ccw,
+       rc = ccw_device_start(channel->ccwdev, &channel->ccw,
                              (addr_t) iob, 0, 0);
        if (rc) {
                QETH_DBF_MESSAGE(2, "%s error in starting next read ccw! "
                        "rc=%i\n", dev_name(&card->gdev->dev), rc);
-               atomic_set(&card->read.irq_pending, 0);
+               atomic_set(&channel->irq_pending, 0);
                card->read_or_write_problem = 1;
                qeth_schedule_recovery(card);
                wake_up(&card->wait_q);
@@ -1987,20 +1988,20 @@ static void qeth_idx_write_cb(struct
qeth_channel *channel,

        if (!(QETH_IS_IDX_ACT_POS_REPLY(iob->data))) {
                if (QETH_IDX_ACT_CAUSE_CODE(iob->data) == QETH_IDX_ACT_ERR_EXCL)
-                       dev_err(&card->write.ccwdev->dev,
+                       dev_err(&channel->ccwdev->dev,
                                "The adapter is used exclusively by another "
                                "host\n");
                else
                        QETH_DBF_MESSAGE(2, "%s IDX_ACTIVATE on write channel:"
                                " negative reply\n",
-                               dev_name(&card->write.ccwdev->dev));
+                               dev_name(&channel->ccwdev->dev));
                goto out;
        }
        memcpy(&temp, QETH_IDX_ACT_FUNC_LEVEL(iob->data), 2);
        if ((temp & ~0x0100) != qeth_peer_func_level(card->info.func_level)) {
                QETH_DBF_MESSAGE(2, "%s IDX_ACTIVATE on write channel: "
                        "function level mismatch (sent: 0x%x, received: "
-                       "0x%x)\n", dev_name(&card->write.ccwdev->dev),
+                       "0x%x)\n", dev_name(&channel->ccwdev->dev),
                        card->info.func_level, temp);
                goto out;
        }
@@ -2028,20 +2029,20 @@ static void qeth_idx_read_cb(struct
qeth_channel *channel,
        if (!(QETH_IS_IDX_ACT_POS_REPLY(iob->data))) {
                switch (QETH_IDX_ACT_CAUSE_CODE(iob->data)) {
                case QETH_IDX_ACT_ERR_EXCL:
-                       dev_err(&card->write.ccwdev->dev,
+                       dev_err(&channel->ccwdev->dev,
                                "The adapter is used exclusively by another "
                                "host\n");
                        break;
                case QETH_IDX_ACT_ERR_AUTH:
                case QETH_IDX_ACT_ERR_AUTH_USER:
-                       dev_err(&card->read.ccwdev->dev,
+                       dev_err(&channel->ccwdev->dev,
                                "Setting the device online failed because of "
                                "insufficient authorization\n");
                        break;
                default:
                        QETH_DBF_MESSAGE(2, "%s IDX_ACTIVATE on read channel:"
                                " negative reply\n",
-                               dev_name(&card->read.ccwdev->dev));
+                               dev_name(&channel->ccwdev->dev));
                }
                QETH_CARD_TEXT_(card, 2, "idxread%c",
                        QETH_IDX_ACT_CAUSE_CODE(iob->data));
@@ -2052,7 +2053,7 @@ static void qeth_idx_read_cb(struct qeth_channel *channel,
        if (temp != qeth_peer_func_level(card->info.func_level)) {
                QETH_DBF_MESSAGE(2, "%s IDX_ACTIVATE on read channel: function "
                        "level mismatch (sent: 0x%x, received: 0x%x)\n",
-                       dev_name(&card->read.ccwdev->dev),
+                       dev_name(&channel->ccwdev->dev),
                        card->info.func_level, temp);
                goto out;
        }
@@ -2069,7 +2070,7 @@ static void qeth_idx_read_cb(struct qeth_channel *channel,
 void qeth_prepare_control_data(struct qeth_card *card, int len,
                struct qeth_cmd_buffer *iob)
 {
-       qeth_setup_ccw(&card->write, iob->data, len);
+       qeth_setup_ccw(iob->channel, iob->data, len);
        iob->callback = qeth_release_buffer;

        memcpy(QETH_TRANSPORT_HEADER_SEQ_NO(iob->data),
@@ -2116,6 +2117,7 @@ int qeth_send_control_data(struct qeth_card
*card, int len,
                                unsigned long cb_cmd),
                void *reply_param)
 {
+       struct qeth_channel *channel = iob->channel;
        int rc;
        unsigned long flags;
        struct qeth_reply *reply = NULL;
@@ -2125,7 +2127,7 @@ int qeth_send_control_data(struct qeth_card
*card, int len,
        QETH_CARD_TEXT(card, 2, "sendctl");

        if (card->read_or_write_problem) {
-               qeth_release_buffer(iob->channel, iob);
+               qeth_release_buffer(channel, iob);
                return -EIO;
        }
        reply = qeth_alloc_reply(card);
@@ -2137,7 +2139,7 @@ int qeth_send_control_data(struct qeth_card
*card, int len,

        init_waitqueue_head(&reply->wait_q);

-       while (atomic_cmpxchg(&card->write.irq_pending, 0, 1)) ;
+       while (atomic_cmpxchg(&channel->irq_pending, 0, 1)) ;

        if (IS_IPA(iob->data)) {
                cmd = __ipa_cmd(iob);
@@ -2157,21 +2159,21 @@ int qeth_send_control_data(struct qeth_card
*card, int len,
        timeout = jiffies + event_timeout;

        QETH_CARD_TEXT(card, 6, "noirqpnd");
-       spin_lock_irqsave(get_ccwdev_lock(card->write.ccwdev), flags);
-       rc = ccw_device_start_timeout(CARD_WDEV(card), &card->write.ccw,
+       spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags);
+       rc = ccw_device_start_timeout(channel->ccwdev, &channel->ccw,
                                      (addr_t) iob, 0, 0, event_timeout);
-       spin_unlock_irqrestore(get_ccwdev_lock(card->write.ccwdev), flags);
+       spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags);
        if (rc) {
                QETH_DBF_MESSAGE(2, "%s qeth_send_control_data: "
                        "ccw_device_start rc = %i\n",
-                       dev_name(&card->write.ccwdev->dev), rc);
+                       dev_name(&channel->ccwdev->dev), rc);
                QETH_CARD_TEXT_(card, 2, " err%d", rc);
                spin_lock_irqsave(&card->lock, flags);
                list_del_init(&reply->list);
                qeth_put_reply(reply);
                spin_unlock_irqrestore(&card->lock, flags);
-               qeth_release_buffer(iob->channel, iob);
-               atomic_set(&card->write.irq_pending, 0);
+               qeth_release_buffer(channel, iob);
+               atomic_set(&channel->irq_pending, 0);
                wake_up(&card->wait_q);
                return rc;
        }
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index efb84a7..a86ba45 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -1239,25 +1239,26 @@ EXPORT_SYMBOL_GPL(qeth_l2_discipline);
 static int qeth_osn_send_control_data(struct qeth_card *card, int len,
                           struct qeth_cmd_buffer *iob)
 {
+       struct qeth_channel *channel = iob->channel;
        unsigned long flags;
        int rc = 0;

        QETH_CARD_TEXT(card, 5, "osndctrd");

        wait_event(card->wait_q,
-                  atomic_cmpxchg(&card->write.irq_pending, 0, 1) == 0);
+                  atomic_cmpxchg(&channel->irq_pending, 0, 1) == 0);
        qeth_prepare_control_data(card, len, iob);
        QETH_CARD_TEXT(card, 6, "osnoirqp");
-       spin_lock_irqsave(get_ccwdev_lock(card->write.ccwdev), flags);
-       rc = ccw_device_start_timeout(CARD_WDEV(card), &card->write.ccw,
+       spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags);
+       rc = ccw_device_start_timeout(channel->ccwdev, &channel->ccw,
                                      (addr_t) iob, 0, 0, QETH_IPA_TIMEOUT);
-       spin_unlock_irqrestore(get_ccwdev_lock(card->write.ccwdev), flags);
+       spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags);
        if (rc) {
                QETH_DBF_MESSAGE(2, "qeth_osn_send_control_data: "
                           "ccw_device_start rc = %i\n", rc);
                QETH_CARD_TEXT_(card, 2, " err%d", rc);
-               qeth_release_buffer(iob->channel, iob);
-               atomic_set(&card->write.irq_pending, 0);
+               qeth_release_buffer(channel, iob);
+               atomic_set(&channel->irq_pending, 0);
                wake_up(&card->wait_q);
        }
        return rc;

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[SRU][Cosmic][Bionic][PATCH 3/6] s390/qeth: remove outdated portname debug msg

Frank Heimes
In reply to this post by Frank Heimes
From: Julian Wiedmann <[hidden email]>

BugLink: http://bugs.launchpad.net/bugs/1797367

s390/qeth: remove outdated portname debug msg

The 'portname' attribute is deprecated and setting it has no effect.

Signed-off-by: Julian Wiedmann <[hidden email]>
Signed-off-by: David S. Miller <[hidden email]>
(cherry-picked from commit d857e11193a24d6623bb562e9b26cde582bd877f)
Signed-off-by: Frank Heimes <[hidden email]>

---

diff --git a/drivers/s390/net/qeth_core_main.c
b/drivers/s390/net/qeth_core_main.c
index d4cb0ee..d884b39 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -708,11 +708,8 @@ static int qeth_check_idx_response(struct qeth_card *card,

        QETH_DBF_HEX(CTRL, 2, buffer, QETH_DBF_CTRL_LEN);
        if ((buffer[2] & 0xc0) == 0xc0) {
-               QETH_DBF_MESSAGE(2, "received an IDX TERMINATE "
-                          "with cause code 0x%02x%s\n",
-                          buffer[4],
-                          ((buffer[4] == 0x22) ?
-                           " -- try another portname" : ""));
+               QETH_DBF_MESSAGE(2, "received an IDX TERMINATE with
cause code %#02x\n",
+                                buffer[4]);
                QETH_CARD_TEXT(card, 2, "ckidxres");
                QETH_CARD_TEXT(card, 2, " idxterm");
                QETH_CARD_TEXT_(card, 2, "  rc%d", -EIO);

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[SRU][Cosmic][Bionic][PATCH 4/6] s390/qeth: avoid using is_multicast_ether_addr_64bits on (u8 *)[6]

Frank Heimes
In reply to this post by Frank Heimes
From: Vasily Gorbik <[hidden email]>

BugLink: http://bugs.launchpad.net/bugs/1797367

s390/qeth: avoid using is_multicast_ether_addr_64bits on (u8 *)[6]

*ether_addr*_64bits functions have been introduced to optimize
performance critical paths, which access 6-byte ethernet address as u64
value to get "nice" assembly. A harmless hack works nicely on ethernet
addresses shoved into a structure or a larger buffer, until busted by
Kasan on smth like plain (u8 *)[6].

qeth_l2_set_mac_address calls qeth_l2_remove_mac passing
u8 old_addr[ETH_ALEN] as an argument.

Adding/removing macs for an ethernet adapter is not that performance
critical. Moreover is_multicast_ether_addr_64bits itself on s390 is not
faster than is_multicast_ether_addr:

is_multicast_ether_addr(%r2) -> %r2
llc %r2,0(%r2)
risbg       %r2,%r2,63,191,0

is_multicast_ether_addr_64bits(%r2) -> %r2
llgc        %r2,0(%r2)
risbg       %r2,%r2,63,191,0

So, let's just use is_multicast_ether_addr instead of
is_multicast_ether_addr_64bits.

Fixes: bcacfcbc82b4 ("s390/qeth: fix MAC address update sequence")
Reviewed-by: Julian Wiedmann <[hidden email]>
Signed-off-by: Vasily Gorbik <[hidden email]>
Signed-off-by: Julian Wiedmann <[hidden email]>
Signed-off-by: David S. Miller <[hidden email]>
(cherry-picked from commit 9d0a58fb9747afd27d490c02a97889a1b59f6be4)
Signed-off-by: Frank Heimes <[hidden email]>

---

diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index 7daf125..5464515 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -140,7 +140,7 @@ static int qeth_l2_send_setmac(struct qeth_card
*card, __u8 *mac)

 static int qeth_l2_write_mac(struct qeth_card *card, u8 *mac)
 {
-       enum qeth_ipa_cmds cmd = is_multicast_ether_addr_64bits(mac) ?
+       enum qeth_ipa_cmds cmd = is_multicast_ether_addr(mac) ?
                                        IPA_CMD_SETGMAC : IPA_CMD_SETVMAC;
        int rc;

@@ -157,7 +157,7 @@ static int qeth_l2_write_mac(struct qeth_card
*card, u8 *mac)

 static int qeth_l2_remove_mac(struct qeth_card *card, u8 *mac)
 {
-       enum qeth_ipa_cmds cmd = is_multicast_ether_addr_64bits(mac) ?
+       enum qeth_ipa_cmds cmd = is_multicast_ether_addr(mac) ?
                                        IPA_CMD_DELGMAC : IPA_CMD_DELVMAC;
        int rc;

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[SRU][Cosmic][Bionic][PATCH 5/6] s390/qeth: consolidate qeth MAC address helpers

Frank Heimes
In reply to this post by Frank Heimes
From: Julian Wiedmann <[hidden email]>

BugLink: http://bugs.launchpad.net/bugs/1797367

s390/qeth: consolidate qeth MAC address helpers

For adding/removing a MAC address, use just one helper each that
handles both unicast and multicast.
Saves one level of indirection for multicast addresses, while improving
the error reporting for unicast addresses.

Signed-off-by: Julian Wiedmann <[hidden email]>
Signed-off-by: David S. Miller <[hidden email]>
(cherry-picked from commit 8174aa8aceefd3f97aebe6cc428cc3fd7b6ac2fa)
Signed-off-by: Frank Heimes <[hidden email]>

---

diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index 88dd929..94079e2 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -156,48 +156,37 @@ static int qeth_l2_send_delmac(struct qeth_card
*card, __u8 *mac)
        return rc;
 }

-static int qeth_l2_send_setgroupmac(struct qeth_card *card, __u8 *mac)
+static int qeth_l2_write_mac(struct qeth_card *card, u8 *mac)
 {
+       enum qeth_ipa_cmds cmd = is_multicast_ether_addr_64bits(mac) ?
+                                       IPA_CMD_SETGMAC : IPA_CMD_SETVMAC;
        int rc;

-       QETH_CARD_TEXT(card, 2, "L2Sgmac");
-       rc = qeth_l2_send_setdelmac(card, mac, IPA_CMD_SETGMAC);
+       QETH_CARD_TEXT(card, 2, "L2Wmac");
+       rc = qeth_l2_send_setdelmac(card, mac, cmd);
        if (rc == -EEXIST)
-               QETH_DBF_MESSAGE(2, "Group MAC %pM already existing on %s\n",
-                       mac, QETH_CARD_IFNAME(card));
+               QETH_DBF_MESSAGE(2, "MAC %pM already registered on %s\n",
+                                mac, QETH_CARD_IFNAME(card));
        else if (rc)
-               QETH_DBF_MESSAGE(2, "Could not set group MAC %pM on %s: %d\n",
-                       mac, QETH_CARD_IFNAME(card), rc);
+               QETH_DBF_MESSAGE(2, "Failed to register MAC %pM on %s: %d\n",
+                                mac, QETH_CARD_IFNAME(card), rc);
        return rc;
 }

-static int qeth_l2_send_delgroupmac(struct qeth_card *card, __u8 *mac)
+static int qeth_l2_remove_mac(struct qeth_card *card, u8 *mac)
 {
+       enum qeth_ipa_cmds cmd = is_multicast_ether_addr_64bits(mac) ?
+                                       IPA_CMD_DELGMAC : IPA_CMD_DELVMAC;
        int rc;

-       QETH_CARD_TEXT(card, 2, "L2Dgmac");
-       rc = qeth_l2_send_setdelmac(card, mac, IPA_CMD_DELGMAC);
+       QETH_CARD_TEXT(card, 2, "L2Rmac");
+       rc = qeth_l2_send_setdelmac(card, mac, cmd);
        if (rc)
-               QETH_DBF_MESSAGE(2,
-                       "Could not delete group MAC %pM on %s: %d\n",
-                       mac, QETH_CARD_IFNAME(card), rc);
+               QETH_DBF_MESSAGE(2, "Failed to delete MAC %pM on %s: %d\n",
+                                mac, QETH_CARD_IFNAME(card), rc);
        return rc;
 }

-static int qeth_l2_write_mac(struct qeth_card *card, struct qeth_mac *mac)
-{
-       if (is_multicast_ether_addr_64bits(mac->mac_addr))
-               return qeth_l2_send_setgroupmac(card, mac->mac_addr);
-       return qeth_l2_send_setdelmac(card, mac->mac_addr, IPA_CMD_SETVMAC);
-}
-
-static int qeth_l2_remove_mac(struct qeth_card *card, struct qeth_mac *mac)
-{
-       if (is_multicast_ether_addr_64bits(mac->mac_addr))
-               return qeth_l2_send_delgroupmac(card, mac->mac_addr);
-       return qeth_l2_send_setdelmac(card, mac->mac_addr, IPA_CMD_DELVMAC);
-}
-
 static void qeth_l2_del_all_macs(struct qeth_card *card)
 {
        struct qeth_mac *mac;
@@ -639,12 +628,12 @@ static void qeth_l2_set_rx_mode(struct net_device *dev)

        hash_for_each_safe(card->mac_htable, i, tmp, mac, hnode) {
                if (mac->disp_flag == QETH_DISP_ADDR_DELETE) {
-                       qeth_l2_remove_mac(card, mac);
+                       qeth_l2_remove_mac(card, mac->mac_addr);
                        hash_del(&mac->hnode);
                        kfree(mac);

                } else if (mac->disp_flag == QETH_DISP_ADDR_ADD) {
-                       rc = qeth_l2_write_mac(card, mac);
+                       rc = qeth_l2_write_mac(card, mac->mac_addr);
                        if (rc) {
                                hash_del(&mac->hnode);
                                kfree(mac);

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[SRU][Cosmic][Bionic][PATCH 6/6] s390/qeth: don't keep track of MAC address's cast type

Frank Heimes
In reply to this post by Frank Heimes
From: Julian Wiedmann <[hidden email]>

BugLink: http://bugs.launchpad.net/bugs/1797367

s390/qeth: don't keep track of MAC address's cast type

Instead of tracking the uc/mc state in each MAC address object, just
check the multicast bit in the address itself.

Signed-off-by: Julian Wiedmann <[hidden email]>
Signed-off-by: David S. Miller <[hidden email]>
(cherry-picked from commit 4641b027f7c32ea51db3acd6dcf97435c2385970)
Signed-off-by: Frank Heimes <[hidden email]>

---

diff --git a/drivers/s390/net/qeth_l2.h b/drivers/s390/net/qeth_l2.h
index 09b1c4e..3223601 100644
--- a/drivers/s390/net/qeth_l2.h
+++ b/drivers/s390/net/qeth_l2.h
@@ -23,7 +23,6 @@ bool qeth_l2_vnicc_is_in_use(struct qeth_card *card);

 struct qeth_mac {
        u8 mac_addr[OSA_ADDR_LEN];
-       u8 is_uc:1;
        u8 disp_flag:2;
        struct hlist_node hnode;
 };
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index 5863ea1..88dd929 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -186,22 +186,16 @@ static int qeth_l2_send_delgroupmac(struct
qeth_card *card, __u8 *mac)

 static int qeth_l2_write_mac(struct qeth_card *card, struct qeth_mac *mac)
 {
-       if (mac->is_uc) {
-               return qeth_l2_send_setdelmac(card, mac->mac_addr,
-                                               IPA_CMD_SETVMAC);
-       } else {
+       if (is_multicast_ether_addr_64bits(mac->mac_addr))
                return qeth_l2_send_setgroupmac(card, mac->mac_addr);
-       }
+       return qeth_l2_send_setdelmac(card, mac->mac_addr, IPA_CMD_SETVMAC);
 }

 static int qeth_l2_remove_mac(struct qeth_card *card, struct qeth_mac *mac)
 {
-       if (mac->is_uc) {
-               return qeth_l2_send_setdelmac(card, mac->mac_addr,
-                                               IPA_CMD_DELVMAC);
-       } else {
+       if (is_multicast_ether_addr_64bits(mac->mac_addr))
                return qeth_l2_send_delgroupmac(card, mac->mac_addr);
-       }
+       return qeth_l2_send_setdelmac(card, mac->mac_addr, IPA_CMD_DELVMAC);
 }

 static void qeth_l2_del_all_macs(struct qeth_card *card)
@@ -597,27 +591,23 @@ static void qeth_promisc_to_bridge(struct qeth_card *card)
  * only if there is not in the hash table storage already
  *
 */
-static void qeth_l2_add_mac(struct qeth_card *card, struct netdev_hw_addr *ha,
-                           u8 is_uc)
+static void qeth_l2_add_mac(struct qeth_card *card, struct netdev_hw_addr *ha)
 {
        u32 mac_hash = get_unaligned((u32 *)(&ha->addr[2]));
        struct qeth_mac *mac;

        hash_for_each_possible(card->mac_htable, mac, hnode, mac_hash) {
-               if (is_uc == mac->is_uc &&
-                   !memcmp(ha->addr, mac->mac_addr, OSA_ADDR_LEN)) {
+               if (!memcmp(ha->addr, mac->mac_addr, OSA_ADDR_LEN)) {
                        mac->disp_flag = QETH_DISP_ADDR_DO_NOTHING;
                        return;
                }
        }

        mac = kzalloc(sizeof(struct qeth_mac), GFP_ATOMIC);
-
        if (!mac)
                return;

        memcpy(mac->mac_addr, ha->addr, OSA_ADDR_LEN);
-       mac->is_uc = is_uc;
        mac->disp_flag = QETH_DISP_ADDR_ADD;

        hash_add(card->mac_htable, &mac->hnode, mac_hash);
@@ -643,10 +633,9 @@ static void qeth_l2_set_rx_mode(struct net_device *dev)
        spin_lock_bh(&card->mclock);

        netdev_for_each_mc_addr(ha, dev)
-               qeth_l2_add_mac(card, ha, 0);
-
+               qeth_l2_add_mac(card, ha);
        netdev_for_each_uc_addr(ha, dev)
-               qeth_l2_add_mac(card, ha, 1);
+               qeth_l2_add_mac(card, ha);

        hash_for_each_safe(card->mac_htable, i, tmp, mac, hnode) {
                if (mac->disp_flag == QETH_DISP_ADDR_DELETE) {

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK/Cmnt: [SRU][Cosmic][Bionic][PATCH 0/6] Fixes for LP1797367

Stefan Bader-2
In reply to this post by Frank Heimes
On 07.11.18 19:20, Frank Heimes wrote:

> BugLink: http://bugs.launchpad.net/bugs/1797367
>
> == SRU Justification ==
>
> While running a series of stress tests for network on a bond device on
> Ubuntu 18.04.1 with kernel 4.15.0-36.39,
> kernel panic is observed (btw. also on non-bond devices).
> This looks like a race between disabling a qeth device and accessing debugfs.
> This is critical and leads repeatedly to a crash (sooner or later).
>
> == Fix ==
>
> e19e5be8b4ca ("s390/qeth: sanitize strings in debug messages")
>
> pre-reqs:
> 750b162 ("s390/qeth: reduce hard-coded access to ccw channels")
> d857e11 ("s390/qeth: remove outdated portname debug msg")
> 9d0a58f ("s390/qeth: avoid using is_multicast_ether_addr_64bits on (u8 *)[6]")
> 8174aa8 ("s390/qeth: consolidate qeth MAC address helpers")
> 4641b02 ("s390/qeth: don't keep track of MAC address's cast type")
>
> == Regression Potential ==
>
> Low, because:
> - limited to s390x
> - and furthermore limited to qeth driver
> - patches a problem identified during testing
> - fix was tested by IBM before submitted
>
> == Test Case ==
>
> run:
>    #!/bin/bash
>    var=0
>    while :
>    do
>         var=$((var + 1))
>         echo "DBG count is $var"
>         mkdir /tmp/DBGINFO
>         dbginfo.sh -d /tmp/DBGINFO
>         rm -rf /tmp/DBGINFO*
>         echo "chzdev now is $var"
>         chzdev -e <qeth device>
>         chzdev -d <qeth device>
>    done
> and in avg. in less than 20 cycles a crash happens (usually < 10).
>
And thanks for ASCII ;)

Acked-by: Stefan Bader <[hidden email]>


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [SRU][Cosmic][Bionic][PATCH 1/6] s390/qeth: sanitize strings in debug messages

Kleber Sacilotto de Souza
In reply to this post by Frank Heimes
On 11/07/18 19:22, Frank Heimes wrote:

> From: Julian Wiedmann <[hidden email]>
>
> BugLink: http://bugs.launchpad.net/bugs/1797367
>
> s390/qeth: sanitize strings in debug messages
>
> As Documentation/s390/s390dbf.txt states quite clearly, using any
> pointer in sprinf-formatted s390dbf debug entries is dangerous.
> The pointers are dereferenced whenever the trace file is read from.
> So if the referenced data has a shorter life-time than the trace file,
> any read operation can result in a use-after-free.
>
> So rip out all hazardous use of indirect data, and replace any usage of
> dev_name() and such by the Bus ID number.
>
> Signed-off-by: Julian Wiedmann <[hidden email]>
> Signed-off-by: David S. Miller <[hidden email]>
> (cherry-picked from commit e19e5be8b4cafa8b3f8b0cd1b1dfe20fa0145b83)
> Signed-off-by: Frank Heimes <[hidden email]>
>
> ---
>
> diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h
> index 6843bc7..884ba9d 100644
> --- a/drivers/s390/net/qeth_core.h
> +++ b/drivers/s390/net/qeth_core.h
> @@ -87,6 +87,18 @@ struct qeth_dbf_info {
>  #define SENSE_RESETTING_EVENT_BYTE 1
>  #define SENSE_RESETTING_EVENT_FLAG 0x80
>
> +static inline u32 qeth_get_device_id(struct ccw_device *cdev)
> +{
> +       struct ccw_dev_id dev_id;
> +       u32 id;
> +
> +       ccw_device_get_id(cdev, &dev_id);
> +       id = dev_id.devno;
> +       id |= (u32) (dev_id.ssid << 16);
> +
> +       return id;
> +}
> +
>  /*
>   * Common IO related definitions
>   */
> @@ -97,7 +109,8 @@ struct qeth_dbf_info {
>  #define CARD_RDEV_ID(card) dev_name(&card->read.ccwdev->dev)
>  #define CARD_WDEV_ID(card) dev_name(&card->write.ccwdev->dev)
>  #define CARD_DDEV_ID(card) dev_name(&card->data.ccwdev->dev)
> -#define CHANNEL_ID(channel) dev_name(&channel->ccwdev->dev)
> +#define CCW_DEVID(cdev)                (qeth_get_device_id(cdev))
> +#define CARD_DEVID(card)       (CCW_DEVID(CARD_RDEV(card)))
>
>  /**
>   * card stuff
> diff --git a/drivers/s390/net/qeth_core_main.c
> b/drivers/s390/net/qeth_core_main.c
> index 3274f13..639ac0a 100644
> --- a/drivers/s390/net/qeth_core_main.c
> +++ b/drivers/s390/net/qeth_core_main.c
> @@ -554,8 +554,8 @@ static int __qeth_issue_next_read(struct qeth_card *card)
>         if (!iob) {
>                 dev_warn(&card->gdev->dev, "The qeth device driver "
>                         "failed to recover an error on the device\n");
> -               QETH_DBF_MESSAGE(2, "%s issue_next_read failed: no iob "
> -                       "available\n", dev_name(&card->gdev->dev));
> +               QETH_DBF_MESSAGE(2, "issue_next_read on device %x
> failed: no iob available\n",

The above line shouldn't have been broken on the email, as it's a single
line on the original commit.

Also happened on a couple of addition lines below and on patch 3/6 at least.

Maybe your editor or email client is breaking lines with more than 80
columns?

Anyway we can probably cherry-pick the patches ourselves so no need to
resubmit for now.


Thanks,
Kleber


> +                                CARD_DEVID(card));
>                 return -ENOMEM;
>         }
>         qeth_setup_ccw(channel->ccw, CCW_CMD_READ, QETH_BUFSIZE, iob->data);
> @@ -563,8 +563,8 @@ static int __qeth_issue_next_read(struct qeth_card *card)
>         rc = ccw_device_start(channel->ccwdev, channel->ccw,
>                               (addr_t) iob, 0, 0);
>         if (rc) {
> -               QETH_DBF_MESSAGE(2, "%s error in starting next read ccw! "
> -                       "rc=%i\n", dev_name(&card->gdev->dev), rc);
> +               QETH_DBF_MESSAGE(2, "error %i on device %x when
> starting next read ccw!\n",
> +                                rc, CARD_DEVID(card));
>                 atomic_set(&channel->irq_pending, 0);
>                 card->read_or_write_problem = 1;
>                 qeth_schedule_recovery(card);
> @@ -613,16 +613,14 @@ static void qeth_issue_ipa_msg(struct
> qeth_ipa_cmd *cmd, int rc,
>         const char *ipa_name;
>         int com = cmd->hdr.command;
>         ipa_name = qeth_get_ipa_cmd_name(com);
> +
>         if (rc)
> -               QETH_DBF_MESSAGE(2, "IPA: %s(x%X) for %s/%s returned "
> -                               "x%X \"%s\"\n",
> -                               ipa_name, com, dev_name(&card->gdev->dev),
> -                               QETH_CARD_IFNAME(card), rc,
> -                               qeth_get_ipa_msg(rc));
> +               QETH_DBF_MESSAGE(2, "IPA: %s(%#x) for device %x
> returned %#x \"%s\"\n",
> +                                ipa_name, com, CARD_DEVID(card), rc,
> +                                qeth_get_ipa_msg(rc));
>         else
> -               QETH_DBF_MESSAGE(5, "IPA: %s(x%X) for %s/%s succeeded\n",
> -                               ipa_name, com, dev_name(&card->gdev->dev),
> -                               QETH_CARD_IFNAME(card));
> +               QETH_DBF_MESSAGE(5, "IPA: %s(%#x) for device %x succeeded\n",
> +                                ipa_name, com, CARD_DEVID(card));
>  }
>
>  static struct qeth_ipa_cmd *qeth_check_ipa_data(struct qeth_card *card,
> @@ -711,7 +709,7 @@ static int qeth_check_idx_response(struct qeth_card *card,
>
>         QETH_DBF_HEX(CTRL, 2, buffer, QETH_DBF_CTRL_LEN);
>         if ((buffer[2] & 0xc0) == 0xc0) {
> -               QETH_DBF_MESSAGE(2, "received an IDX TERMINATE with
> cause code %#02x\n",
> +               QETH_DBF_MESSAGE(2, "received an IDX TERMINATE with
> cause code %#04x\n",
>                                  buffer[4]);
>                 QETH_CARD_TEXT(card, 2, "ckidxres");
>                 QETH_CARD_TEXT(card, 2, " idxterm");
> @@ -972,8 +970,8 @@ static int qeth_get_problem(struct qeth_card
> *card, struct ccw_device *cdev,
>                 QETH_CARD_TEXT(card, 2, "CGENCHK");
>                 dev_warn(&cdev->dev, "The qeth device driver "
>                         "failed to recover an error on the device\n");
> -               QETH_DBF_MESSAGE(2, "%s check on device dstat=x%x, cstat=x%x\n",
> -                       dev_name(&cdev->dev), dstat, cstat);
> +               QETH_DBF_MESSAGE(2, "check on channel %x with
> dstat=%#x, cstat=%#x\n",
> +                                CCW_DEVID(cdev), dstat, cstat);
>                 print_hex_dump(KERN_WARNING, "qeth: irb ", DUMP_PREFIX_OFFSET,
>                                 16, 1, irb, 64, 1);
>                 return 1;
> @@ -1013,8 +1011,8 @@ static long qeth_check_irb_error(struct qeth_card *card,
>
>         switch (PTR_ERR(irb)) {
>         case -EIO:
> -               QETH_DBF_MESSAGE(2, "%s i/o-error on device\n",
> -                       dev_name(&cdev->dev));
> +               QETH_DBF_MESSAGE(2, "i/o-error on channel %x\n",
> +                                CCW_DEVID(cdev));
>                 QETH_CARD_TEXT(card, 2, "ckirberr");
>                 QETH_CARD_TEXT_(card, 2, "  rc%d", -EIO);
>                 break;
> @@ -1031,8 +1029,8 @@ static long qeth_check_irb_error(struct qeth_card *card,
>                 }
>                 break;
>         default:
> -               QETH_DBF_MESSAGE(2, "%s unknown error %ld on device\n",
> -                       dev_name(&cdev->dev), PTR_ERR(irb));
> +               QETH_DBF_MESSAGE(2, "unknown error %ld on channel %x\n",
> +                                PTR_ERR(irb), CCW_DEVID(cdev));
>                 QETH_CARD_TEXT(card, 2, "ckirberr");
>                 QETH_CARD_TEXT(card, 2, "  rc???");
>         }
> @@ -1114,9 +1112,9 @@ static void qeth_irq(struct ccw_device *cdev,
> unsigned long intparm,
>                         dev_warn(&channel->ccwdev->dev,
>                                 "The qeth device driver failed to recover "
>                                 "an error on the device\n");
> -                       QETH_DBF_MESSAGE(2, "%s sense data available. cstat "
> -                               "0x%X dstat 0x%X\n",
> -                               dev_name(&channel->ccwdev->dev), cstat, dstat);
> +                       QETH_DBF_MESSAGE(2, "sense data available on
> channel %x: cstat %#X dstat %#X\n",
> +                                        CCW_DEVID(channel->ccwdev), cstat,
> +                                        dstat);
>                         print_hex_dump(KERN_WARNING, "qeth: irb ",
>                                 DUMP_PREFIX_OFFSET, 16, 1, irb, 32, 1);
>                         print_hex_dump(KERN_WARNING, "qeth: sense data ",
> @@ -1890,8 +1888,8 @@ static int qeth_idx_activate_channel(struct
> qeth_card *card,
>         if (channel->state != CH_STATE_ACTIVATING) {
>                 dev_warn(&channel->ccwdev->dev, "The qeth device driver"
>                         " failed to recover an error on the device\n");
> -               QETH_DBF_MESSAGE(2, "%s IDX activate timed out\n",
> -                       dev_name(&channel->ccwdev->dev));
> +               QETH_DBF_MESSAGE(2, "IDX activate timed out on channel %x\n",
> +                                CCW_DEVID(channel->ccwdev));
>                 QETH_DBF_TEXT_(SETUP, 2, "2err%d", -ETIME);
>                 return -ETIME;
>         }
> @@ -1926,17 +1924,15 @@ static void qeth_idx_write_cb(struct qeth_card *card,
>                                 "The adapter is used exclusively by another "
>                                 "host\n");
>                 else
> -                       QETH_DBF_MESSAGE(2, "%s IDX_ACTIVATE on write channel:"
> -                               " negative reply\n",
> -                               dev_name(&channel->ccwdev->dev));
> +                       QETH_DBF_MESSAGE(2, "IDX_ACTIVATE on channel
> %x: negative reply\n",
> +                                        CCW_DEVID(channel->ccwdev));
>                 goto out;
>         }
>         memcpy(&temp, QETH_IDX_ACT_FUNC_LEVEL(iob->data), 2);
>         if ((temp & ~0x0100) != qeth_peer_func_level(card->info.func_level)) {
> -               QETH_DBF_MESSAGE(2, "%s IDX_ACTIVATE on write channel: "
> -                       "function level mismatch (sent: 0x%x, received: "
> -                       "0x%x)\n", dev_name(&channel->ccwdev->dev),
> -                       card->info.func_level, temp);
> +               QETH_DBF_MESSAGE(2, "IDX_ACTIVATE on channel %x:
> function level mismatch (sent: %#x, received: %#x)\n",
> +                                CCW_DEVID(channel->ccwdev),
> +                                card->info.func_level, temp);
>                 goto out;
>         }
>         channel->state = CH_STATE_UP;
> @@ -1973,9 +1969,8 @@ static void qeth_idx_read_cb(struct qeth_card *card,
>                                 "insufficient authorization\n");
>                         break;
>                 default:
> -                       QETH_DBF_MESSAGE(2, "%s IDX_ACTIVATE on read channel:"
> -                               " negative reply\n",
> -                               dev_name(&channel->ccwdev->dev));
> +                       QETH_DBF_MESSAGE(2, "IDX_ACTIVATE on channel
> %x: negative reply\n",
> +                                        CCW_DEVID(channel->ccwdev));
>                 }
>                 QETH_CARD_TEXT_(card, 2, "idxread%c",
>                         QETH_IDX_ACT_CAUSE_CODE(iob->data));
> @@ -1984,10 +1979,9 @@ static void qeth_idx_read_cb(struct qeth_card *card,
>
>         memcpy(&temp, QETH_IDX_ACT_FUNC_LEVEL(iob->data), 2);
>         if (temp != qeth_peer_func_level(card->info.func_level)) {
> -               QETH_DBF_MESSAGE(2, "%s IDX_ACTIVATE on read channel: function "
> -                       "level mismatch (sent: 0x%x, received: 0x%x)\n",
> -                       dev_name(&channel->ccwdev->dev),
> -                       card->info.func_level, temp);
> +               QETH_DBF_MESSAGE(2, "IDX_ACTIVATE on channel %x:
> function level mismatch (sent: %#x, received: %#x)\n",
> +                                CCW_DEVID(channel->ccwdev),
> +                                card->info.func_level, temp);
>                 goto out;
>         }
>         memcpy(&card->token.issuer_rm_r,
> @@ -2096,9 +2090,8 @@ int qeth_send_control_data(struct qeth_card
> *card, int len,
>                                       (addr_t) iob, 0, 0, event_timeout);
>         spin_unlock_irq(get_ccwdev_lock(channel->ccwdev));
>         if (rc) {
> -               QETH_DBF_MESSAGE(2, "%s qeth_send_control_data: "
> -                       "ccw_device_start rc = %i\n",
> -                       dev_name(&channel->ccwdev->dev), rc);
> +               QETH_DBF_MESSAGE(2, "qeth_send_control_data on device
> %x: ccw_device_start rc = %i\n",
> +                                CARD_DEVID(card), rc);
>                 QETH_CARD_TEXT_(card, 2, " err%d", rc);
>                 spin_lock_irq(&card->lock);
>                 list_del_init(&reply->list);
> @@ -2853,8 +2846,8 @@ struct qeth_cmd_buffer
> *qeth_get_ipacmd_buffer(struct qeth_card *card,
>         } else {
>                 dev_warn(&card->gdev->dev,
>                          "The qeth driver ran out of channel command
> buffers\n");
> -               QETH_DBF_MESSAGE(1, "%s The qeth driver ran out of
> channel command buffers",
> -                                dev_name(&card->gdev->dev));
> +               QETH_DBF_MESSAGE(1, "device %x ran out of channel
> command buffers",
> +                                CARD_DEVID(card));
>         }
>
>         return iob;
> @@ -2989,10 +2982,9 @@ static int qeth_query_ipassists_cb(struct
> qeth_card *card,
>                 return 0;
>         default:
>                 if (cmd->hdr.return_code) {
> -                       QETH_DBF_MESSAGE(1, "%s IPA_CMD_QIPASSIST: Unhandled "
> -                                               "rc=%d\n",
> -                                               dev_name(&card->gdev->dev),
> -                                               cmd->hdr.return_code);
> +                       QETH_DBF_MESSAGE(1, "IPA_CMD_QIPASSIST on
> device %x: Unhandled rc=%#x\n",
> +                                        CARD_DEVID(card),
> +                                        cmd->hdr.return_code);
>                         return 0;
>                 }
>         }
> @@ -3004,8 +2996,8 @@ static int qeth_query_ipassists_cb(struct qeth_card *card,
>                 card->options.ipa6.supported_funcs = cmd->hdr.ipa_supported;
>                 card->options.ipa6.enabled_funcs = cmd->hdr.ipa_enabled;
>         } else
> -               QETH_DBF_MESSAGE(1, "%s IPA_CMD_QIPASSIST: Flawed LIC detected"
> -                                       "\n", dev_name(&card->gdev->dev));
> +               QETH_DBF_MESSAGE(1, "IPA_CMD_QIPASSIST on device %x:
> Flawed LIC detected\n",
> +                                CARD_DEVID(card));
>         return 0;
>  }
>
> @@ -4297,10 +4289,9 @@ static int
> qeth_setadpparms_set_access_ctrl_cb(struct qeth_card *card,
>                 cmd->data.setadapterparms.hdr.return_code);
>         if (cmd->data.setadapterparms.hdr.return_code !=
>                                                 SET_ACCESS_CTRL_RC_SUCCESS)
> -               QETH_DBF_MESSAGE(3, "ERR:SET_ACCESS_CTRL(%s,%d)==%d\n",
> -                               card->gdev->dev.kobj.name,
> -                               access_ctrl_req->subcmd_code,
> -                               cmd->data.setadapterparms.hdr.return_code);
> +               QETH_DBF_MESSAGE(3, "ERR:SET_ACCESS_CTRL(%#x) on
> device %x: %#x\n",
> +                                access_ctrl_req->subcmd_code, CARD_DEVID(card),
> +                                cmd->data.setadapterparms.hdr.return_code);
>         switch (cmd->data.setadapterparms.hdr.return_code) {
>         case SET_ACCESS_CTRL_RC_SUCCESS:
>                 if (card->options.isolation == ISOLATION_MODE_NONE) {
> @@ -4312,14 +4303,14 @@ static int
> qeth_setadpparms_set_access_ctrl_cb(struct qeth_card *card,
>                 }
>                 break;
>         case SET_ACCESS_CTRL_RC_ALREADY_NOT_ISOLATED:
> -               QETH_DBF_MESSAGE(2, "%s QDIO data connection isolation already "
> -                               "deactivated\n", dev_name(&card->gdev->dev));
> +               QETH_DBF_MESSAGE(2, "QDIO data connection isolation on
> device %x already deactivated\n",
> +                                CARD_DEVID(card));
>                 if (fallback)
>                         card->options.isolation = card->options.prev_isolation;
>                 break;
>         case SET_ACCESS_CTRL_RC_ALREADY_ISOLATED:
> -               QETH_DBF_MESSAGE(2, "%s QDIO data connection isolation already"
> -                               " activated\n", dev_name(&card->gdev->dev));
> +               QETH_DBF_MESSAGE(2, "QDIO data connection isolation on
> device %x already activated\n",
> +                                CARD_DEVID(card));
>                 if (fallback)
>                         card->options.isolation = card->options.prev_isolation;
>                 break;
> @@ -4405,10 +4396,8 @@ int qeth_set_access_ctrl_online(struct
> qeth_card *card, int fallback)
>                 rc = qeth_setadpparms_set_access_ctrl(card,
>                         card->options.isolation, fallback);
>                 if (rc) {
> -                       QETH_DBF_MESSAGE(3,
> -                               "IPA(SET_ACCESS_CTRL,%s,%d) sent failed\n",
> -                               card->gdev->dev.kobj.name,
> -                               rc);
> +                       QETH_DBF_MESSAGE(3, "IPA(SET_ACCESS_CTRL(%d)
> on device %x: sent failed\n",
> +                                        rc, CARD_DEVID(card));
>                         rc = -EOPNOTSUPP;
>                 }
>         } else if (card->options.isolation != ISOLATION_MODE_NONE) {
> @@ -4634,8 +4623,8 @@ static int qeth_snmp_command(struct qeth_card
> *card, char __user *udata)
>         rc = qeth_send_ipa_snmp_cmd(card, iob, QETH_SETADP_BASE_LEN + req_len,
>                                     qeth_snmp_command_cb, (void *)&qinfo);
>         if (rc)
> -               QETH_DBF_MESSAGE(2, "SNMP command failed on %s: (0x%x)\n",
> -                          QETH_CARD_IFNAME(card), rc);
> +               QETH_DBF_MESSAGE(2, "SNMP command failed on device %x: (%#x)\n",
> +                                CARD_DEVID(card), rc);
>         else {
>                 if (copy_to_user(udata, qinfo.udata, qinfo.udata_len))
>                         rc = -EFAULT;
> @@ -4869,8 +4858,8 @@ static void qeth_determine_capabilities(struct
> qeth_card *card)
>
>         rc = qeth_read_conf_data(card, (void **) &prcd, &length);
>         if (rc) {
> -               QETH_DBF_MESSAGE(2, "%s qeth_read_conf_data returned %i\n",
> -                       dev_name(&card->gdev->dev), rc);
> +               QETH_DBF_MESSAGE(2, "qeth_read_conf_data on device %x
> returned %i\n",
> +                                CARD_DEVID(card), rc);
>                 QETH_DBF_TEXT_(SETUP, 2, "5err%d", rc);
>                 goto out_offline;
>         }
> @@ -5096,8 +5085,8 @@ int qeth_core_hardsetup_card(struct qeth_card *card)
>         qeth_update_from_chp_desc(card);
>  retry:
>         if (retries < 3)
> -               QETH_DBF_MESSAGE(2, "%s Retrying to do IDX activates.\n",
> -                       dev_name(&card->gdev->dev));
> +               QETH_DBF_MESSAGE(2, "Retrying to do IDX activates on
> device %x.\n",
> +                                CARD_DEVID(card));
>         rc = qeth_qdio_clear_card(card, card->info.type != QETH_CARD_TYPE_IQD);
>         ccw_device_set_offline(CARD_DDEV(card));
>         ccw_device_set_offline(CARD_WDEV(card));
> @@ -5201,8 +5190,8 @@ int qeth_core_hardsetup_card(struct qeth_card *card)
>  out:
>         dev_warn(&card->gdev->dev, "The qeth device driver failed to recover "
>                 "an error on the device\n");
> -       QETH_DBF_MESSAGE(2, "%s Initialization in hardsetup failed! rc=%d\n",
> -               dev_name(&card->gdev->dev), rc);
> +       QETH_DBF_MESSAGE(2, "Initialization for device %x failed in
> hardsetup! rc=%d\n",
> +                        CARD_DEVID(card), rc);
>         return rc;
>  }
>  EXPORT_SYMBOL_GPL(qeth_core_hardsetup_card);
> diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
> index 23aaf37..5b67fd1 100644
> --- a/drivers/s390/net/qeth_l2_main.c
> +++ b/drivers/s390/net/qeth_l2_main.c
> @@ -146,11 +146,11 @@ static int qeth_l2_write_mac(struct qeth_card
> *card, u8 *mac)
>         QETH_CARD_TEXT(card, 2, "L2Wmac");
>         rc = qeth_l2_send_setdelmac(card, mac, cmd);
>         if (rc == -EEXIST)
> -               QETH_DBF_MESSAGE(2, "MAC %pM already registered on %s\n",
> -                                mac, QETH_CARD_IFNAME(card));
> +               QETH_DBF_MESSAGE(2, "MAC already registered on device %x\n",
> +                                CARD_DEVID(card));
>         else if (rc)
> -               QETH_DBF_MESSAGE(2, "Failed to register MAC %pM on %s: %d\n",
> -                                mac, QETH_CARD_IFNAME(card), rc);
> +               QETH_DBF_MESSAGE(2, "Failed to register MAC on device %x: %d\n",
> +                                CARD_DEVID(card), rc);
>         return rc;
>  }
>
> @@ -163,8 +163,8 @@ static int qeth_l2_remove_mac(struct qeth_card
> *card, u8 *mac)
>         QETH_CARD_TEXT(card, 2, "L2Rmac");
>         rc = qeth_l2_send_setdelmac(card, mac, cmd);
>         if (rc)
> -               QETH_DBF_MESSAGE(2, "Failed to delete MAC %pM on %s: %d\n",
> -                                mac, QETH_CARD_IFNAME(card), rc);
> +               QETH_DBF_MESSAGE(2, "Failed to delete MAC on device %u: %d\n",
> +                                CARD_DEVID(card), rc);
>         return rc;
>  }
>
> @@ -260,9 +260,9 @@ static int qeth_l2_send_setdelvlan_cb(struct
> qeth_card *card,
>
>         QETH_CARD_TEXT(card, 2, "L2sdvcb");
>         if (cmd->hdr.return_code) {
> -               QETH_DBF_MESSAGE(2, "Error in processing VLAN %i on
> %s: 0x%x.\n",
> +               QETH_DBF_MESSAGE(2, "Error in processing VLAN %u on
> device %x: %#x.\n",
>                                  cmd->data.setdelvlan.vlan_id,
> -                                QETH_CARD_IFNAME(card), cmd->hdr.return_code);
> +                                CARD_DEVID(card), cmd->hdr.return_code);
>                 QETH_CARD_TEXT_(card, 2, "L2VL%4x", cmd->hdr.command);
>                 QETH_CARD_TEXT_(card, 2, "err%d", cmd->hdr.return_code);
>         }
> @@ -455,8 +455,8 @@ static int qeth_l2_request_initial_mac(struct
> qeth_card *card)
>                 rc = qeth_vm_request_mac(card);
>                 if (!rc)
>                         goto out;
> -               QETH_DBF_MESSAGE(2, "z/VM MAC Service failed on device
> %s: x%x\n",
> -                                CARD_BUS_ID(card), rc);
> +               QETH_DBF_MESSAGE(2, "z/VM MAC Service failed on device
> %x: %#x\n",
> +                                CARD_DEVID(card), rc);
>                 QETH_DBF_TEXT_(SETUP, 2, "err%04x", rc);
>                 /* fall back to alternative mechanism: */
>         }
> @@ -468,8 +468,8 @@ static int qeth_l2_request_initial_mac(struct
> qeth_card *card)
>                 rc = qeth_setadpparms_change_macaddr(card);
>                 if (!rc)
>                         goto out;
> -               QETH_DBF_MESSAGE(2, "READ_MAC Assist failed on device
> %s: x%x\n",
> -                                CARD_BUS_ID(card), rc);
> +               QETH_DBF_MESSAGE(2, "READ_MAC Assist failed on device
> %x: %#x\n",
> +                                CARD_DEVID(card), rc);
>                 QETH_DBF_TEXT_(SETUP, 2, "1err%04x", rc);
>                 /* fall back once more: */
>         }
> diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
> index 0b161cc..ffa2aa1 100644
> --- a/drivers/s390/net/qeth_l3_main.c
> +++ b/drivers/s390/net/qeth_l3_main.c
> @@ -494,9 +494,8 @@ int qeth_l3_setrouting_v4(struct qeth_card *card)
>                                   QETH_PROT_IPV4);
>         if (rc) {
>                 card->options.route4.type = NO_ROUTER;
> -               QETH_DBF_MESSAGE(2, "Error (0x%04x) while setting routing type"
> -                       " on %s. Type set to 'no router'.\n", rc,
> -                       QETH_CARD_IFNAME(card));
> +               QETH_DBF_MESSAGE(2, "Error (%#06x) while setting
> routing type on device %x. Type set to 'no router'.\n",
> +                                rc, CARD_DEVID(card));
>         }
>         return rc;
>  }
> @@ -518,9 +517,8 @@ int qeth_l3_setrouting_v6(struct qeth_card *card)
>                                   QETH_PROT_IPV6);
>         if (rc) {
>                 card->options.route6.type = NO_ROUTER;
> -               QETH_DBF_MESSAGE(2, "Error (0x%04x) while setting routing type"
> -                       " on %s. Type set to 'no router'.\n", rc,
> -                       QETH_CARD_IFNAME(card));
> +               QETH_DBF_MESSAGE(2, "Error (%#06x) while setting
> routing type on device %x. Type set to 'no router'.\n",
> +                                rc, CARD_DEVID(card));
>         }
>         return rc;
>  }
> @@ -1070,8 +1068,8 @@ qeth_diags_trace_cb(struct qeth_card *card,
> struct qeth_reply *reply,
>                 }
>                 break;
>         default:
> -               QETH_DBF_MESSAGE(2, "Unknown sniffer action (0x%04x) on %s\n",
> -                       cmd->data.diagass.action, QETH_CARD_IFNAME(card));
> +               QETH_DBF_MESSAGE(2, "Unknown sniffer action (%#06x) on
> device %x\n",
> +                                cmd->data.diagass.action, CARD_DEVID(card));
>         }
>
>         return 0;
> @@ -1517,32 +1515,25 @@ static void qeth_l3_set_rx_mode(struct net_device *dev)
>         qeth_l3_handle_promisc_mode(card);
>  }
>
> -static const char *qeth_l3_arp_get_error_cause(int *rc)
> +static int qeth_l3_arp_makerc(int rc)
>  {
> -       switch (*rc) {
> -       case QETH_IPA_ARP_RC_FAILED:
> -               *rc = -EIO;
> -               return "operation failed";
> +       switch (rc) {
> +       case IPA_RC_SUCCESS:
> +               return 0;
>         case QETH_IPA_ARP_RC_NOTSUPP:
> -               *rc = -EOPNOTSUPP;
> -               return "operation not supported";
> -       case QETH_IPA_ARP_RC_OUT_OF_RANGE:
> -               *rc = -EINVAL;
> -               return "argument out of range";
>         case QETH_IPA_ARP_RC_Q_NOTSUPP:
> -               *rc = -EOPNOTSUPP;
> -               return "query operation not supported";
> +               return -EOPNOTSUPP;
> +       case QETH_IPA_ARP_RC_OUT_OF_RANGE:
> +               return -EINVAL;
>         case QETH_IPA_ARP_RC_Q_NO_DATA:
> -               *rc = -ENOENT;
> -               return "no query data available";
> +               return -ENOENT;
>         default:
> -               return "unknown error";
> +               return -EIO;
>         }
>  }
>
>  static int qeth_l3_arp_set_no_entries(struct qeth_card *card, int no_entries)
>  {
> -       int tmp;
>         int rc;
>
>         QETH_CARD_TEXT(card, 3, "arpstnoe");
> @@ -1560,13 +1551,10 @@ static int qeth_l3_arp_set_no_entries(struct
> qeth_card *card, int no_entries)
>         rc = qeth_send_simple_setassparms(card, IPA_ARP_PROCESSING,
>                                           IPA_CMD_ASS_ARP_SET_NO_ENTRIES,
>                                           no_entries);
> -       if (rc) {
> -               tmp = rc;
> -               QETH_DBF_MESSAGE(2, "Could not set number of ARP entries on "
> -                       "%s: %s (0x%x/%d)\n", QETH_CARD_IFNAME(card),
> -                       qeth_l3_arp_get_error_cause(&rc), tmp, tmp);
> -       }
> -       return rc;
> +       if (rc)
> +               QETH_DBF_MESSAGE(2, "Could not set number of ARP
> entries on device %x: %#x\n",
> +                                CARD_DEVID(card), rc);
> +       return qeth_l3_arp_makerc(rc);
>  }
>
>  static __u32 get_arp_entry_size(struct qeth_card *card,
> @@ -1716,7 +1704,6 @@ static int qeth_l3_query_arp_cache_info(struct
> qeth_card *card,
>  {
>         struct qeth_cmd_buffer *iob;
>         struct qeth_ipa_cmd *cmd;
> -       int tmp;
>         int rc;
>
>         QETH_CARD_TEXT_(card, 3, "qarpipv%i", prot);
> @@ -1735,15 +1722,10 @@ static int qeth_l3_query_arp_cache_info(struct
> qeth_card *card,
>         rc = qeth_l3_send_ipa_arp_cmd(card, iob,
>                            QETH_SETASS_BASE_LEN+QETH_ARP_CMD_LEN,
>                            qeth_l3_arp_query_cb, (void *)qinfo);
> -       if (rc) {
> -               tmp = rc;
> -               QETH_DBF_MESSAGE(2,
> -                       "Error while querying ARP cache on %s: %s "
> -                       "(0x%x/%d)\n", QETH_CARD_IFNAME(card),
> -                       qeth_l3_arp_get_error_cause(&rc), tmp, tmp);
> -       }
> -
> -       return rc;
> +       if (rc)
> +               QETH_DBF_MESSAGE(2, "Error while querying ARP cache on
> device %x: %#x\n",
> +                                CARD_DEVID(card), rc);
> +       return qeth_l3_arp_makerc(rc);
>  }
>
>  static int qeth_l3_arp_query(struct qeth_card *card, char __user *udata)
> @@ -1797,8 +1779,6 @@ static int qeth_l3_arp_add_entry(struct qeth_card *card,
>                                 struct qeth_arp_cache_entry *entry)
>  {
>         struct qeth_cmd_buffer *iob;
> -       char buf[16];
> -       int tmp;
>         int rc;
>
>         QETH_CARD_TEXT(card, 3, "arpadent");
> @@ -1824,14 +1804,10 @@ static int qeth_l3_arp_add_entry(struct qeth_card *card,
>                                    sizeof(struct qeth_arp_cache_entry),
>                                    (unsigned long) entry,
>                                    qeth_setassparms_cb, NULL);
> -       if (rc) {
> -               tmp = rc;
> -               qeth_l3_ipaddr4_to_string((u8 *)entry->ipaddr, buf);
> -               QETH_DBF_MESSAGE(2, "Could not add ARP entry for address %s "
> -                       "on %s: %s (0x%x/%d)\n", buf, QETH_CARD_IFNAME(card),
> -                       qeth_l3_arp_get_error_cause(&rc), tmp, tmp);
> -       }
> -       return rc;
> +       if (rc)
> +               QETH_DBF_MESSAGE(2, "Could not add ARP entry on device
> %x: %#x\n",
> +                                CARD_DEVID(card), rc);
> +       return qeth_l3_arp_makerc(rc);
>  }
>
>  static int qeth_l3_arp_remove_entry(struct qeth_card *card,
> @@ -1839,7 +1815,6 @@ static int qeth_l3_arp_remove_entry(struct
> qeth_card *card,
>  {
>         struct qeth_cmd_buffer *iob;
>         char buf[16] = {0, };
> -       int tmp;
>         int rc;
>
>         QETH_CARD_TEXT(card, 3, "arprment");
> @@ -1864,21 +1839,15 @@ static int qeth_l3_arp_remove_entry(struct
> qeth_card *card,
>         rc = qeth_send_setassparms(card, iob,
>                                    12, (unsigned long)buf,
>                                    qeth_setassparms_cb, NULL);
> -       if (rc) {
> -               tmp = rc;
> -               memset(buf, 0, 16);
> -               qeth_l3_ipaddr4_to_string((u8 *)entry->ipaddr, buf);
> -               QETH_DBF_MESSAGE(2, "Could not delete ARP entry for address %s"
> -                       " on %s: %s (0x%x/%d)\n", buf, QETH_CARD_IFNAME(card),
> -                       qeth_l3_arp_get_error_cause(&rc), tmp, tmp);
> -       }
> -       return rc;
> +       if (rc)
> +               QETH_DBF_MESSAGE(2, "Could not delete ARP entry on
> device %x: %#x\n",
> +                                CARD_DEVID(card), rc);
> +       return qeth_l3_arp_makerc(rc);
>  }
>
>  static int qeth_l3_arp_flush_cache(struct qeth_card *card)
>  {
>         int rc;
> -       int tmp;
>
>         QETH_CARD_TEXT(card, 3, "arpflush");
>
> @@ -1894,13 +1863,10 @@ static int qeth_l3_arp_flush_cache(struct
> qeth_card *card)
>         }
>         rc = qeth_send_simple_setassparms(card, IPA_ARP_PROCESSING,
>                                           IPA_CMD_ASS_ARP_FLUSH_CACHE, 0);
> -       if (rc) {
> -               tmp = rc;
> -               QETH_DBF_MESSAGE(2, "Could not flush ARP cache on %s: %s "
> -                       "(0x%x/%d)\n", QETH_CARD_IFNAME(card),
> -                       qeth_l3_arp_get_error_cause(&rc), tmp, tmp);
> -       }
> -       return rc;
> +       if (rc)
> +               QETH_DBF_MESSAGE(2, "Could not flush ARP cache on
> device %x: %#x\n",
> +                                CARD_DEVID(card), rc);
> +       return qeth_l3_arp_makerc(rc);
>  }
>
>  static int qeth_l3_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
>


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK: [SRU][Cosmic][Bionic][PATCH 0/6] Fixes for LP1797367

Kleber Sacilotto de Souza
In reply to this post by Frank Heimes
On 11/07/18 19:20, Frank Heimes wrote:

> BugLink: http://bugs.launchpad.net/bugs/1797367
>
> == SRU Justification ==
>
> While running a series of stress tests for network on a bond device on
> Ubuntu 18.04.1 with kernel 4.15.0-36.39,
> kernel panic is observed (btw. also on non-bond devices).
> This looks like a race between disabling a qeth device and accessing debugfs.
> This is critical and leads repeatedly to a crash (sooner or later).
>
> == Fix ==
>
> e19e5be8b4ca ("s390/qeth: sanitize strings in debug messages")
>
> pre-reqs:
> 750b162 ("s390/qeth: reduce hard-coded access to ccw channels")
> d857e11 ("s390/qeth: remove outdated portname debug msg")
> 9d0a58f ("s390/qeth: avoid using is_multicast_ether_addr_64bits on (u8 *)[6]")
> 8174aa8 ("s390/qeth: consolidate qeth MAC address helpers")
> 4641b02 ("s390/qeth: don't keep track of MAC address's cast type")
>
> == Regression Potential ==
>
> Low, because:
> - limited to s390x
> - and furthermore limited to qeth driver
> - patches a problem identified during testing
> - fix was tested by IBM before submitted
>
> == Test Case ==
>
> run:
>    #!/bin/bash
>    var=0
>    while :
>    do
>         var=$((var + 1))
>         echo "DBG count is $var"
>         mkdir /tmp/DBGINFO
>         dbginfo.sh -d /tmp/DBGINFO
>         rm -rf /tmp/DBGINFO*
>         echo "chzdev now is $var"
>         chzdev -e <qeth device>
>         chzdev -d <qeth device>
>    done
> and in avg. in less than 20 cycles a crash happens (usually < 10).
>

Some of the patches won't probably apply because of bogus line-breaks as
I mentioned in one of the patches, so some extra care is needed when
applying the patches. We'll probably need to cherry-pick the original
commit and add the BugLink and the s-o-b.


Acked-by: Kleber Sacilotto de Souza <[hidden email]>


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

APPLIED/Cmnt: [SRU][Cosmic][Bionic][PATCH 0/6] Fixes for LP1797367

Stefan Bader-2
In reply to this post by Frank Heimes
On 07.11.18 19:20, Frank Heimes wrote:

> BugLink: http://bugs.launchpad.net/bugs/1797367
>
> == SRU Justification ==
>
> While running a series of stress tests for network on a bond device on
> Ubuntu 18.04.1 with kernel 4.15.0-36.39,
> kernel panic is observed (btw. also on non-bond devices).
> This looks like a race between disabling a qeth device and accessing debugfs.
> This is critical and leads repeatedly to a crash (sooner or later).
>
> == Fix ==
>
> e19e5be8b4ca ("s390/qeth: sanitize strings in debug messages")
>
> pre-reqs:
> 750b162 ("s390/qeth: reduce hard-coded access to ccw channels")
> d857e11 ("s390/qeth: remove outdated portname debug msg")
> 9d0a58f ("s390/qeth: avoid using is_multicast_ether_addr_64bits on (u8 *)[6]")
> 8174aa8 ("s390/qeth: consolidate qeth MAC address helpers")
> 4641b02 ("s390/qeth: don't keep track of MAC address's cast type")
>
> == Regression Potential ==
>
> Low, because:
> - limited to s390x
> - and furthermore limited to qeth driver
> - patches a problem identified during testing
> - fix was tested by IBM before submitted
>
> == Test Case ==
>
> run:
>    #!/bin/bash
>    var=0
>    while :
>    do
>         var=$((var + 1))
>         echo "DBG count is $var"
>         mkdir /tmp/DBGINFO
>         dbginfo.sh -d /tmp/DBGINFO
>         rm -rf /tmp/DBGINFO*
>         echo "chzdev now is $var"
>         chzdev -e <qeth device>
>         chzdev -d <qeth device>
>    done
> and in avg. in less than 20 cycles a crash happens (usually < 10).
>
For Bionic I had to invert the series to make it apply. The actual fix still
needed some adaption, so its again more a backport.
For Cosmic, there was only one of the pre-reqs was needed and the actual fix had
to ignore a bit of context.

Applied to bionic,cosmic/master-next. Thanks.

-Stefan


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team

signature.asc (836 bytes) Download Attachment