Skip to content

Commit 7b30d51

Browse files
committed
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 <[email protected]>
2 parents 0bf7800 + 1c5b221 commit 7b30d51

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

drivers/s390/net/qeth_core.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,11 @@ struct qeth_cmd_buffer {
591591
void (*callback) (struct qeth_channel *, struct qeth_cmd_buffer *);
592592
};
593593

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+
594599
/**
595600
* definition of a qeth channel, used for read and write
596601
*/
@@ -846,7 +851,7 @@ struct qeth_trap_id {
846851
*/
847852
static inline int qeth_get_elements_for_range(addr_t start, addr_t end)
848853
{
849-
return PFN_UP(end - 1) - PFN_DOWN(start);
854+
return PFN_UP(end) - PFN_DOWN(start);
850855
}
851856

852857
static inline int qeth_get_micros(void)

drivers/s390/net/qeth_core_main.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2120,7 +2120,7 @@ int qeth_send_control_data(struct qeth_card *card, int len,
21202120
unsigned long flags;
21212121
struct qeth_reply *reply = NULL;
21222122
unsigned long timeout, event_timeout;
2123-
struct qeth_ipa_cmd *cmd;
2123+
struct qeth_ipa_cmd *cmd = NULL;
21242124

21252125
QETH_CARD_TEXT(card, 2, "sendctl");
21262126

@@ -2146,10 +2146,13 @@ int qeth_send_control_data(struct qeth_card *card, int len,
21462146
while (atomic_cmpxchg(&card->write.irq_pending, 0, 1)) ;
21472147
qeth_prepare_control_data(card, len, iob);
21482148

2149-
if (IS_IPA(iob->data))
2149+
if (IS_IPA(iob->data)) {
2150+
cmd = __ipa_cmd(iob);
21502151
event_timeout = QETH_IPA_TIMEOUT;
2151-
else
2152+
} else {
21522153
event_timeout = QETH_TIMEOUT;
2154+
}
2155+
21532156
timeout = jiffies + event_timeout;
21542157

21552158
QETH_CARD_TEXT(card, 6, "noirqpnd");
@@ -2174,9 +2177,8 @@ int qeth_send_control_data(struct qeth_card *card, int len,
21742177

21752178
/* we have only one long running ipassist, since we can ensure
21762179
process context of this command we can sleep */
2177-
cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
2178-
if ((cmd->hdr.command == IPA_CMD_SETIP) &&
2179-
(cmd->hdr.prot_version == QETH_PROT_IPV4)) {
2180+
if (cmd && cmd->hdr.command == IPA_CMD_SETIP &&
2181+
cmd->hdr.prot_version == QETH_PROT_IPV4) {
21802182
if (!wait_event_timeout(reply->wait_q,
21812183
atomic_read(&reply->received), event_timeout))
21822184
goto time_err;

0 commit comments

Comments
 (0)