mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Martin Hundebøll" <mhu@silicom.dk>
To: Russ Weight <russell.h.weight@intel.com>,
	mdf@kernel.org, linux-fpga@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: trix@redhat.com, lgoncalv@redhat.com, yilun.xu@intel.com,
	hao.wu@intel.com, matthew.gerlach@intel.com
Subject: Re: [PATCH v6 2/7] fpga: sec-mgr: enable secure updates
Date: Thu, 26 Nov 2020 15:02:49 +0100	[thread overview]
Message-ID: <9dd75daf-eb73-4008-ca65-6f7ea3923e35@silicom.dk> (raw)
In-Reply-To: <20201106010905.11935-3-russell.h.weight@intel.com>

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

  parent reply	other threads:[~2020-11-26 14:03 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-06  1:08 [PATCH v6 0/7] FPGA Security Manager Class Driver Russ Weight
2020-11-06  1:08 ` [PATCH v6 1/7] fpga: sec-mgr: fpga security manager class driver Russ Weight
2020-11-15 23:03   ` Moritz Fischer
2020-11-20  2:39     ` Russ Weight
2020-11-20  6:26       ` Moritz Fischer
2020-11-06  1:09 ` [PATCH v6 2/7] fpga: sec-mgr: enable secure updates Russ Weight
2020-11-19  9:28   ` Martin Hundebøll
2020-11-26 14:02   ` Martin Hundebøll [this message]
2020-11-30 23:54     ` Russ Weight
2020-12-01  8:47       ` Martin Hundebøll
2020-12-01 23:30         ` Russ Weight
2020-12-02 13:40           ` Martin Hundebøll
2020-11-06  1:09 ` [PATCH v6 3/7] fpga: sec-mgr: expose sec-mgr update status Russ Weight
2020-11-06  1:09 ` [PATCH v6 4/7] fpga: sec-mgr: expose sec-mgr update errors Russ Weight
2020-11-06  1:09 ` [PATCH v6 5/7] fpga: sec-mgr: expose sec-mgr update size Russ Weight
2020-11-06  1:09 ` [PATCH v6 6/7] fpga: sec-mgr: enable cancel of secure update Russ Weight
2020-11-06  1:09 ` [PATCH v6 7/7] fpga: sec-mgr: expose hardware error info Russ Weight

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9dd75daf-eb73-4008-ca65-6f7ea3923e35@silicom.dk \
    --to=mhu@silicom.dk \
    --cc=hao.wu@intel.com \
    --cc=lgoncalv@redhat.com \
    --cc=linux-fpga@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew.gerlach@intel.com \
    --cc=mdf@kernel.org \
    --cc=russell.h.weight@intel.com \
    --cc=trix@redhat.com \
    --cc=yilun.xu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®