* [Patch] libcldc: correct length checks in open_end_cb
@ 2009-08-12 5:28 Pete Zaitcev
2009-08-12 10:05 ` Jeff Garzik
0 siblings, 1 reply; 2+ messages in thread
From: Pete Zaitcev @ 2009-08-12 5:28 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Project Hail List
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 <zaitcev@redhat.com>
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;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Patch] libcldc: correct length checks in open_end_cb
2009-08-12 5:28 [Patch] libcldc: correct length checks in open_end_cb Pete Zaitcev
@ 2009-08-12 10:05 ` Jeff Garzik
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Garzik @ 2009-08-12 10:05 UTC (permalink / raw)
To: Pete Zaitcev; +Cc: Project Hail List
Pete Zaitcev wrote:
> 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 <zaitcev@redhat.com>
applied
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-08-12 10:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-12 5:28 [Patch] libcldc: correct length checks in open_end_cb Pete Zaitcev
2009-08-12 10:05 ` Jeff Garzik
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.