]> Pileus Git - ~andy/linux/commitdiff
xenbus_dev: add missing error check to watch handling
authorJan Beulich <JBeulich@suse.com>
Tue, 24 Jan 2012 13:52:42 +0000 (13:52 +0000)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Fri, 3 Feb 2012 21:07:05 +0000 (16:07 -0500)
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 <jbeulich@suse.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
drivers/xen/xenbus/xenbus_dev_frontend.c

index 527dc2a3b89f167cd35cc919bf0da1442c49d238..89f76252a16f20e2638ee578faf4e3cbb4a316c6 100644 (file)
@@ -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);