greybus: manifest: make sure manifest_descs list is empty before parsing manifest
authorViresh Kumar <viresh.kumar@linaro.org>
Fri, 14 Nov 2014 11:55:03 +0000 (17:25 +0530)
committerGreg Kroah-Hartman <greg@kroah.com>
Fri, 14 Nov 2014 21:32:27 +0000 (13:32 -0800)
Just an extra check to make sure the list isn't corrupted.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/staging/greybus/manifest.c

index d1357a2..4b85c53 100644 (file)
@@ -332,6 +332,10 @@ bool gb_manifest_parse(struct gb_module *gmod, void *data, size_t size)
        u32 found = 0;
        bool result;
 
+       /* Manifest descriptor list should be empty here */
+       if (WARN_ON(!list_empty(&manifest_descs)))
+               return false;
+
        /* we have to have at _least_ the manifest header */
        if (size <= sizeof(manifest->header)) {
                pr_err("short manifest (%zu)\n", size);