Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 42830f7f authored by Viresh Kumar's avatar Viresh Kumar Committed by Greg Kroah-Hartman
Browse files

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: default avatarViresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 880bc0a4
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -250,6 +250,13 @@ static u32 gb_manifest_parse_cports(struct gb_bundle *bundle)
		if (cport_id > CPORT_ID_MAX)
		if (cport_id > CPORT_ID_MAX)
			goto exit;
			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
		 * Found one, move it to our temporary list after checking for
		 * duplicates.
		 * duplicates.