* [6/7] usb: typec: ucsi: add check for supported vendor
@ 2019-01-18 1:13 Ajay Gupta
0 siblings, 0 replies; 3+ messages in thread
From: Ajay Gupta @ 2019-01-18 1:13 UTC (permalink / raw)
To: heikki.krogerus; +Cc: linux-usb, Ajay Gupta
Added check to see the currently flashed or new firmware being
flashed is from a supported vendor.
Signed-off-by: Ajay Gupta <ajayg@nvidia.com>
---
drivers/usb/typec/ucsi/ucsi_ccg.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/drivers/usb/typec/ucsi/ucsi_ccg.c b/drivers/usb/typec/ucsi/ucsi_ccg.c
index 6069a9f60d1e..1aa6ede764b5 100644
--- a/drivers/usb/typec/ucsi/ucsi_ccg.c
+++ b/drivers/usb/typec/ucsi/ucsi_ccg.c
@@ -775,6 +775,30 @@ static int ccg_cmd_validate_fw(struct ucsi_ccg *uc, unsigned int fwid)
return 0;
}
+static bool ccg_check_vendor_version(struct ucsi_ccg *uc,
+ struct version_format *app,
+ struct fw_config_table *fw_cfg)
+{
+ struct device *dev = uc->dev;
+
+ /* Check if the fw build is for supported vendors.
+ * Add all supported vendors here.
+ */
+ if (app->build != (('n' << 8) | 'v')) {
+ dev_info(dev, "current fw is not from supported vendor\n");
+ return false;
+ }
+
+ /* Check if the new fw build is for supported vendors
+ * Add all supported vendors here.
+ */
+ if (fw_cfg->app.build != (('n' << 8) | 'v')) {
+ dev_info(dev, "new fw is not from supported vendor\n");
+ return false;
+ }
+ return true;
+}
+
static bool ccg_check_fw_version(struct ucsi_ccg *uc, const char *fw_name,
struct version_format *app)
{
@@ -814,6 +838,9 @@ static bool ccg_check_fw_version(struct ucsi_ccg *uc, const char *fw_name,
dev_dbg(dev, "compare current %08x and new version %08x\n",
cur_version, new_version);
+ if (!ccg_check_vendor_version(uc, app, &fw_cfg))
+ goto not_supported_version;
+
if (new_version > cur_version) {
dev_dbg(dev, "new firmware file version is later\n");
is_later = true;
@@ -821,6 +848,7 @@ static bool ccg_check_fw_version(struct ucsi_ccg *uc, const char *fw_name,
dev_dbg(dev, "new firmware file version is same or earlier\n");
}
+not_supported_version:
not_signed_fw:
release_firmware(fw);
return is_later;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [6/7] usb: typec: ucsi: add check for supported vendor
@ 2019-01-18 15:29 Heikki Krogerus
0 siblings, 0 replies; 3+ messages in thread
From: Heikki Krogerus @ 2019-01-18 15:29 UTC (permalink / raw)
To: Ajay Gupta; +Cc: linux-usb
On Thu, Jan 17, 2019 at 05:13:02PM -0800, Ajay Gupta wrote:
> Added check to see the currently flashed or new firmware being
> flashed is from a supported vendor.
Why separate patch for this?
thanks,
^ permalink raw reply [flat|nested] 3+ messages in thread
* [6/7] usb: typec: ucsi: add check for supported vendor
@ 2019-01-24 18:04 Ajay Gupta
0 siblings, 0 replies; 3+ messages in thread
From: Ajay Gupta @ 2019-01-24 18:04 UTC (permalink / raw)
To: Heikki Krogerus; +Cc: linux-usb@vger.kernel.org
Hi Heikki,
> From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Sent: Friday, January 18, 2019 7:30 AM
> To: Ajay Gupta <ajayg@nvidia.com>
> Cc: linux-usb@vger.kernel.org
> Subject: Re: [PATCH 6/7] usb: typec: ucsi: add check for supported vendor
>
> On Thu, Jan 17, 2019 at 05:13:02PM -0800, Ajay Gupta wrote:
> > Added check to see the currently flashed or new firmware being flashed
> > is from a supported vendor.
>
> Why separate patch for this?
I thought its vendor specific changes; so added separately, looks like need to
merge to patch 5/7.
Thanks
> nvpublic
> thanks,
>
> --
> heikki
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-01-24 18:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-18 15:29 [6/7] usb: typec: ucsi: add check for supported vendor Heikki Krogerus
-- strict thread matches above, loose matches on Subject: below --
2019-01-24 18:04 Ajay Gupta
2019-01-18 1:13 Ajay Gupta
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).