linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xenbus_dev: add missing error check to watch handling
@ 2012-01-24 13:52 Jan Beulich
  0 siblings, 0 replies; only message in thread
From: Jan Beulich @ 2012-01-24 13:52 UTC (permalink / raw)
  To: konrad, Jeremy Fitzhardinge, Konrad Rzeszutek Wilk
  Cc: xen-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 674 bytes --]

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>

---
 drivers/xen/xenbus/xenbus_dev_frontend.c |    4 ++++
 1 file changed, 4 insertions(+)

--- 3.3-rc1/drivers/xen/xenbus/xenbus_dev_frontend.c
+++ 3.3-rc1-xenbus-dev-write-watch/drivers/xen/xenbus/xenbus_dev_frontend.c
@@ -369,6 +369,10 @@ static int xenbus_write_watch(unsigned m
 		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);




[-- Attachment #2: linux-3.3-rc1-xenbus-dev-write-watch.patch --]
[-- Type: text/plain, Size: 725 bytes --]

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 <jbeulich@suse.com>

---
 drivers/xen/xenbus/xenbus_dev_frontend.c |    4 ++++
 1 file changed, 4 insertions(+)

--- 3.3-rc1/drivers/xen/xenbus/xenbus_dev_frontend.c
+++ 3.3-rc1-xenbus-dev-write-watch/drivers/xen/xenbus/xenbus_dev_frontend.c
@@ -369,6 +369,10 @@ static int xenbus_write_watch(unsigned m
 		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);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-01-24 13:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-24 13:52 [PATCH] xenbus_dev: add missing error check to watch handling Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).