Skip to content

Commit

Permalink
ipmi:devintf: Return a proper error when recv buffer too small
Browse files Browse the repository at this point in the history
The right error message wasn't being set in one location, and it would
return success on a failure.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
  • Loading branch information
Corey Minyard committed Oct 5, 2021
1 parent b36eb5e commit 17a4262
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/char/ipmi/ipmi_devintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,13 @@ static int handle_recv(struct ipmi_file_private *priv,

if (msg->msg.data_len > 0) {
if (rsp->msg.data_len < msg->msg.data_len) {
rv2 = -EMSGSIZE;
if (trunc)
if (trunc) {
rv2 = -EMSGSIZE;
msg->msg.data_len = rsp->msg.data_len;
else
} else {
rv = -EMSGSIZE;
goto recv_putback_on_err;
}
}

if (copy_to_user(rsp->msg.data,
Expand Down

0 comments on commit 17a4262

Please sign in to comment.