libcldc: correct length checks in open_end_cb
PATCH 1/1 libcldc: correct length checks in open_end_cb
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]>
lib/cldc.c +6 -4
@@ -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; }
Jeff Garzik
AppliedQuoted 5 lines · Pete Zaitcev
Without this patch, open errors cannot be delivered to application and opens get stuck forever. Also, who added
-EINVALagain?! Stop doing that, the user wants to know what failed: syscall or CLD protocol.Signed-off-by Pete Zaitcev <[email protected]>
applied