aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2018-02-09 14:30:23 -0500
committerDavid S. Miller <davem@davemloft.net>2018-02-09 14:30:23 -0500
commit7b30d51a8f830bd1c1103d31d0314ea6f1106707 (patch)
tree577be160ca8f5a410d2d10eeb911c0c7286eb36a
parent0bf7800f1799b5b1fd7d4f024e9ece53ac489011 (diff)
parent1c5b2216fbb973a9410e0b06389740b5c1289171 (diff)
Merge branch 's390-qeth-fixes'
Julian Wiedmann says: ==================== s390/qeth: fixes 2018-02-09 please apply the following two qeth patches for 4.16 and stable. One restricts a command quirk to the intended commandd type, while the other fixes an off-by-one during data transmission that can cause qeth to build malformed buffer descriptors. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/s390/net/qeth_core.h7
-rw-r--r--drivers/s390/net/qeth_core_main.c14
2 files changed, 14 insertions, 7 deletions
diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h
index db42107bf2f5..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
594static 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 */
@@ -846,7 +851,7 @@ struct qeth_trap_id {
846 */ 851 */
847static inline int qeth_get_elements_for_range(addr_t start, addr_t end) 852static inline int qeth_get_elements_for_range(addr_t start, addr_t end)
848{ 853{
849 return PFN_UP(end - 1) - PFN_DOWN(start); 854 return PFN_UP(end) - PFN_DOWN(start);
850} 855}
851 856
852static inline int qeth_get_micros(void) 857static inline int qeth_get_micros(void)
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;