[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c6dc2edb-9639-9c4f-c065-18cade768fb6@intel.com>
Date: Mon, 30 Nov 2020 15:54:50 -0800
From: Russ Weight <russell.h.weight@...el.com>
To: Martin Hundebøll <mhu@...icom.dk>, mdf@...nel.org,
linux-fpga@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: trix@...hat.com, lgoncalv@...hat.com, yilun.xu@...el.com,
hao.wu@...el.com, matthew.gerlach@...el.com
Subject: Re: [PATCH v6 2/7] fpga: sec-mgr: enable secure updates
Thanks Martin. I'll work on a fix for this.
- Russ
On 11/26/20 6:02 AM, Martin Hundebøll wrote:
> Hi Russ,
>
> I found another thing while testing this...
>
> On 06/11/2020 02.09, Russ Weight wrote:
>
> <snip>
>
>> +static ssize_t filename_store(struct device *dev, struct device_attribute *attr,
>> + const char *buf, size_t count)
>> +{
>> + struct fpga_sec_mgr *smgr = to_sec_mgr(dev);
>> + int ret = count;
>> +
>> + if (count == 0 || count >= PATH_MAX)
>> + return -EINVAL;
>> +
>> + mutex_lock(&smgr->lock);
>> + if (smgr->driver_unload || smgr->progress != FPGA_SEC_PROG_IDLE) {
>> + ret = -EBUSY;
>> + goto unlock_exit;
>> + }
>> +
>> + smgr->filename = kstrndup(buf, count - 1, GFP_KERNEL);
>
> The `count - 1` is meant to remove a trailing newline, but opae-sdk writes the filename without newline, so better do it conditionally...
>
>> + if (!smgr->filename) {
>> + ret = -ENOMEM;
>> + goto unlock_exit;
>> + }
>> +
>> + smgr->err_code = FPGA_SEC_ERR_NONE;
>> + smgr->progress = FPGA_SEC_PROG_READING;
>> + reinit_completion(&smgr->update_done);
>> + schedule_work(&smgr->work);
>> +
>> +unlock_exit:
>> + mutex_unlock(&smgr->lock);
>> + return ret;
>> +}
>> +static DEVICE_ATTR_WO(filename);
>> +
>> +static struct attribute *sec_mgr_update_attrs[] = {
>> + &dev_attr_filename.attr,
>> + NULL,
>> +};
>
> Thanks,
> Martin
Powered by blists - more mailing lists