Commit e19e5be8 authored by Julian Wiedmann's avatar Julian Wiedmann Committed by David S. Miller

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