Skip to contentSkip to conversation

s390/qeth: fix error handling in checksum cmd callback

PATCH In review Julian Wiedmann 2 participants 2 messages Dec 20, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390/qeth: fix error handling in checksum cmd callback

Make sure to check both return code fields before processing the response. Otherwise we risk operating on invalid data.

Fixes c9475369bd2b ("s390/qeth: rework RX/TX checksum offload")
---
 drivers/s390/net/qeth_core_main.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/s390/net/qeth_core_main.c +8 -1
index 6c815207f4f5..3614df68830f 100644
@@ -5386,6 +5386,13 @@ int qeth_poll(struct napi_struct *napi, int budget)
 }
 EXPORT_SYMBOL_GPL(qeth_poll);
 
+static int qeth_setassparms_inspect_rc(struct qeth_ipa_cmd *cmd)
+{
+	if (!cmd->hdr.return_code)
+		cmd->hdr.return_code = cmd->data.setassparms.hdr.return_code;
+	return cmd->hdr.return_code;
+}
+
 int qeth_setassparms_cb(struct qeth_card *card,
 			struct qeth_reply *reply, unsigned long data)
 {
@@ -6242,7 +6249,7 @@ static int qeth_ipa_checksum_run_cmd_cb(struct qeth_card *card,
 				(struct qeth_checksum_cmd *)reply->param;
 
 	QETH_CARD_TEXT(card, 4, "chkdoccb");
-	if (cmd->hdr.return_code)
+	if (qeth_setassparms_inspect_rc(cmd))
 		return 0;
 
 	memset(chksum_cb, 0, sizeof(*chksum_cb));
Signature · 1 line
2.13.5
maintainer
#1 lore raw

From: Julian Wiedmann <[email protected]>
Date: Wed, 20 Dec 2017 18:07:18 +0100

Quoted 5 lines

Make sure to check both return code fields before processing the response. Otherwise we risk operating on invalid data.

Fixes c9475369bd2b ("s390/qeth: rework RX/TX checksum offload")

Applied and queued up for -stable, thanks Julian.