summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2016-06-11 08:01:01 +0530
committerGreg Kroah-Hartman <gregkh@google.com>2016-06-15 23:57:20 -0700
commit42830f7f63c7db6422467d6c5c4480b2948b63ef (patch)
tree5526034988bb208978bd4815fa28403139150b2c
parent880bc0a4afa66e36f62e5687bef464a751781d55 (diff)
downloadlinux-42830f7f63c7db6422467d6c5c4480b2948b63ef.tar.gz
linux-42830f7f63c7db6422467d6c5c4480b2948b63ef.tar.bz2
linux-42830f7f63c7db6422467d6c5c4480b2948b63ef.zip
greybus: manifest: Disallow reuse of control cport
We should be checking if any of the bundles contains a CPort with its id set to the special value of '0', which is reserved for control CPort. Discard the bundle in that case. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
-rw-r--r--drivers/staging/greybus/manifest.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/staging/greybus/manifest.c b/drivers/staging/greybus/manifest.c
index 529a984db992..3d1592fc94ea 100644
--- a/drivers/staging/greybus/manifest.c
+++ b/drivers/staging/greybus/manifest.c
@@ -250,6 +250,13 @@ static u32 gb_manifest_parse_cports(struct gb_bundle *bundle)
if (cport_id > CPORT_ID_MAX)
goto exit;
+ /* Nothing else should have its cport_id as control cport id */
+ if (cport_id == GB_CONTROL_CPORT_ID) {
+ dev_err(&bundle->dev, "invalid cport id found (%02u)\n",
+ cport_id);
+ goto exit;
+ }
+
/*
* Found one, move it to our temporary list after checking for
* duplicates.