From: Jan Beulich Date: Tue, 24 Jan 2012 13:52:42 +0000 (+0000) Subject: xenbus_dev: add missing error check to watch handling X-Git-Tag: upstream/snapshot3+hdmi~8087^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a43a5ccdfa5bd5b2f00aa9b2321df268c2e5d6e2;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git xenbus_dev: add missing error check to watch handling So far only the watch path was checked to be zero terminated, while the watch token was merely assumed to be. Signed-off-by: Jan Beulich Signed-off-by: Konrad Rzeszutek Wilk --- diff --git a/drivers/xen/xenbus/xenbus_dev_frontend.c b/drivers/xen/xenbus/xenbus_dev_frontend.c index 527dc2a..89f7625 100644 --- a/drivers/xen/xenbus/xenbus_dev_frontend.c +++ b/drivers/xen/xenbus/xenbus_dev_frontend.c @@ -369,6 +369,10 @@ static int xenbus_write_watch(unsigned msg_type, struct xenbus_file_priv *u) goto out; } token++; + if (memchr(token, 0, u->u.msg.len - (token - path)) == NULL) { + rc = -EILSEQ; + goto out; + } if (msg_type == XS_WATCH) { watch = alloc_watch_adapter(path, token);