]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ipmi:devintf: Return a proper error when recv buffer too small
authorCorey Minyard <cminyard@mvista.com>
Thu, 30 Sep 2021 21:12:55 +0000 (16:12 -0500)
committerCorey Minyard <cminyard@mvista.com>
Tue, 5 Oct 2021 11:54:16 +0000 (06:54 -0500)
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>
drivers/char/ipmi/ipmi_devintf.c

index 3dd1d5abb298ac4f708585810fa2d3968bbb9326..d160fa4c73fec836ba7680b2babe69a0844f168b 100644 (file)
@@ -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,