diff options
author | Bjørn Mork <bjorn@mork.no> | 2015-04-08 15:31:20 +0200 |
---|---|---|
committer | John Crispin <blogic@openwrt.org> | 2015-04-03 10:33:14 +0200 |
commit | 6cf812a3f769544cbc295239110f22f602abec28 (patch) | |
tree | 53a9aea816cca2ec8eaf00947d4875e5972e7018 | |
parent | c147486c7958d8f39cf279acf328359f55118c36 (diff) |
avoid parsing InformationBuffer unless status is "success"
The MBIM specification requires that the InformationBuffer
is empty unless the status field is MBIM_STATUS_SUCCESS,
except for 4 explicit combinations of status code and
command id.
Avoid calling the reply handler if the status code is
non-zero and the information buffer is empty.
Signed-off-by: Bjørn Mork <bjorn@mork.no>
-rw-r--r-- | mbim-dev.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -107,7 +107,10 @@ mbim_recv(struct uloop_fd *u, unsigned int events) case MBIM_MESSAGE_TYPE_COMMAND_DONE: if (verbose) printf(" status_code: %04X\n", le32toh(msg->status_code)); - return_code = current_handler->response(msg->buffer, le32toh(msg->buffer_length)); + if (msg->status_code && !msg->buffer_length) + return_code = -le32toh(msg->status_code); + else + return_code = current_handler->response(msg->buffer, le32toh(msg->buffer_length)); if (return_code < 0) no_close = 0; mbim_send_close_msg(); |