diff options
author | Julian Wiedmann <jwi@linux.vnet.ibm.com> | 2018-02-09 05:03:50 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-02-09 14:30:23 -0500 |
commit | 1c5b2216fbb973a9410e0b06389740b5c1289171 (patch) | |
tree | 577be160ca8f5a410d2d10eeb911c0c7286eb36a | |
parent | 89271c65edd599207dd982007900506283c90ae3 (diff) |
s390/qeth: fix SETIP command handling
send_control_data() applies some special handling to SETIP v4 IPA
commands. But current code parses *all* command types for the SETIP
command code. Limit the command code check to IPA commands.
Fixes: 5b54e16f1a54 ("qeth: do not spin for SETIP ip assist command")
Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/s390/net/qeth_core.h | 5 | ||||
-rw-r--r-- | drivers/s390/net/qeth_core_main.c | 14 |
2 files changed, 13 insertions, 6 deletions
diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h index c33fbc4c2e91..959c65cf75d9 100644 --- a/drivers/s390/net/qeth_core.h +++ b/drivers/s390/net/qeth_core.h | |||
@@ -591,6 +591,11 @@ struct qeth_cmd_buffer { | |||
591 | void (*callback) (struct qeth_channel *, struct qeth_cmd_buffer *); | 591 | void (*callback) (struct qeth_channel *, struct qeth_cmd_buffer *); |
592 | }; | 592 | }; |
593 | 593 | ||
594 | static inline struct qeth_ipa_cmd *__ipa_cmd(struct qeth_cmd_buffer *iob) | ||
595 | { | ||
596 | return (struct qeth_ipa_cmd *)(iob->data + IPA_PDU_HEADER_SIZE); | ||
597 | } | ||
598 | |||
594 | /** | 599 | /** |
595 | * definition of a qeth channel, used for read and write | 600 | * definition of a qeth channel, used for read and write |
596 | */ | 601 | */ |
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index 6abd3bc285e4..ca72f3311004 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c | |||
@@ -2120,7 +2120,7 @@ int qeth_send_control_data(struct qeth_card *card, int len, | |||
2120 | unsigned long flags; | 2120 | unsigned long flags; |
2121 | struct qeth_reply *reply = NULL; | 2121 | struct qeth_reply *reply = NULL; |
2122 | unsigned long timeout, event_timeout; | 2122 | unsigned long timeout, event_timeout; |
2123 | struct qeth_ipa_cmd *cmd; | 2123 | struct qeth_ipa_cmd *cmd = NULL; |
2124 | 2124 | ||
2125 | QETH_CARD_TEXT(card, 2, "sendctl"); | 2125 | QETH_CARD_TEXT(card, 2, "sendctl"); |
2126 | 2126 | ||
@@ -2146,10 +2146,13 @@ int qeth_send_control_data(struct qeth_card *card, int len, | |||
2146 | while (atomic_cmpxchg(&card->write.irq_pending, 0, 1)) ; | 2146 | while (atomic_cmpxchg(&card->write.irq_pending, 0, 1)) ; |
2147 | qeth_prepare_control_data(card, len, iob); | 2147 | qeth_prepare_control_data(card, len, iob); |
2148 | 2148 | ||
2149 | if (IS_IPA(iob->data)) | 2149 | if (IS_IPA(iob->data)) { |
2150 | cmd = __ipa_cmd(iob); | ||
2150 | event_timeout = QETH_IPA_TIMEOUT; | 2151 | event_timeout = QETH_IPA_TIMEOUT; |
2151 | else | 2152 | } else { |
2152 | event_timeout = QETH_TIMEOUT; | 2153 | event_timeout = QETH_TIMEOUT; |
2154 | } | ||
2155 | |||
2153 | timeout = jiffies + event_timeout; | 2156 | timeout = jiffies + event_timeout; |
2154 | 2157 | ||
2155 | QETH_CARD_TEXT(card, 6, "noirqpnd"); | 2158 | QETH_CARD_TEXT(card, 6, "noirqpnd"); |
@@ -2174,9 +2177,8 @@ int qeth_send_control_data(struct qeth_card *card, int len, | |||
2174 | 2177 | ||
2175 | /* we have only one long running ipassist, since we can ensure | 2178 | /* we have only one long running ipassist, since we can ensure |
2176 | process context of this command we can sleep */ | 2179 | process context of this command we can sleep */ |
2177 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); | 2180 | if (cmd && cmd->hdr.command == IPA_CMD_SETIP && |
2178 | if ((cmd->hdr.command == IPA_CMD_SETIP) && | 2181 | cmd->hdr.prot_version == QETH_PROT_IPV4) { |
2179 | (cmd->hdr.prot_version == QETH_PROT_IPV4)) { | ||
2180 | if (!wait_event_timeout(reply->wait_q, | 2182 | if (!wait_event_timeout(reply->wait_q, |
2181 | atomic_read(&reply->received), event_timeout)) | 2183 | atomic_read(&reply->received), event_timeout)) |
2182 | goto time_err; | 2184 | goto time_err; |