Without this patch, open errors cannot be delivered to application
and opens get stuck forever. Also, who added -EINVAL again?! Stop
doing that, the user wants to know what failed: syscall or CLD protocol.

Signed-Off-By: Pete Zaitcev <[email protected]>

diff --git a/lib/cldc.c b/lib/cldc.c
index 072c995..6e1d826 100644
--- a/lib/cldc.c
+++ b/lib/cldc.c
@@ -1001,15 +1001,17 @@ static ssize_t open_end_cb(struct cldc_msg *msg, const 
void *resp_p,
        struct cldc_fh *fh = msg->cb_private;
        enum cle_err_codes resp_rc = CLE_OK;
 
-       if (resp_len < sizeof(*resp))
-               return -EINVAL;
-
        if (!ok)
                resp_rc = CLE_TIMEOUT;
-       else
+       else {
+               if (resp_len < sizeof(resp->resp))
+                       return -1009;
                resp_rc = le32_to_cpu(resp->resp.code);
+       }
 
        if (resp_rc == CLE_OK) {
+               if (resp_len < sizeof(*resp))
+                       return -1010;
                fh->fh_le = resp->fh;
                fh->valid = true;
        }
--
To unsubscribe from this list: send the line "unsubscribe hail-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to