Skip to content

Commit c5bceb9

Browse files
cris-masudeep-holla
authored andcommitted
firmware: arm_scmi: Fix handling of unexpected delayed responses
Upon reception of an unexpected bogus delayed response, clear the channel and bail-out safely. Link: https://lore.kernel.org/r/[email protected] Fixes: 4d09852 ("firmware: arm_scmi: Add support for notifications message processing") Signed-off-by: Cristian Marussi <[email protected]> Signed-off-by: Sudeep Holla <[email protected]>
1 parent d04fb2b commit c5bceb9

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

drivers/firmware/arm_scmi/driver.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,21 @@ static void scmi_handle_response(struct scmi_chan_info *cinfo,
247247
}
248248

249249
xfer = &minfo->xfer_block[xfer_id];
250+
/*
251+
* Even if a response was indeed expected on this slot at this point,
252+
* a buggy platform could wrongly reply feeding us an unexpected
253+
* delayed response we're not prepared to handle: bail-out safely
254+
* blaming firmware.
255+
*/
256+
if (unlikely(msg_type == MSG_TYPE_DELAYED_RESP && !xfer->async_done)) {
257+
dev_err(dev,
258+
"Delayed Response for %d not expected! Buggy F/W ?\n",
259+
xfer_id);
260+
info->desc->ops->clear_channel(cinfo);
261+
/* It was unexpected, so nobody will clear the xfer if not us */
262+
__scmi_xfer_put(minfo, xfer);
263+
return;
264+
}
250265

251266
scmi_dump_header_dbg(dev, &xfer->hdr);
252267

0 commit comments

Comments
 (0)