xen/xenbus: Reject replies with payload > XENSTORE_PAYLOAD_MAX.
[linux-block.git] / drivers / xen / xenbus / xenbus_xs.c
index b3b8f2f3ad106aea4b4f33c9f61bf7eb01919563..6f0121e3be69f84e294af73c9ccb4b6df16a8f6c 100644 (file)
@@ -810,6 +810,12 @@ static int process_msg(void)
                goto out;
        }
 
+       if (msg->hdr.len > XENSTORE_PAYLOAD_MAX) {
+               kfree(msg);
+               err = -EINVAL;
+               goto out;
+       }
+
        body = kmalloc(msg->hdr.len + 1, GFP_NOIO | __GFP_HIGH);
        if (body == NULL) {
                kfree(msg);