mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Xu Yilun <yilun.xu@intel.com>
Cc: Russ Weight <russell.h.weight@intel.com>,
	Moritz Fischer <mdf@kernel.org>, Wu Hao <hao.wu@intel.com>,
	Tom Rix <trix@redhat.com>,
	linux-fpga@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	Matthew Gerlach <matthew.gerlach@linux.intel.com>,
	Marco Pagani <marpagan@redhat.com>
Subject: Re: [PATCH v2 1/1] fpga: m10bmc-sec: Fix probe rollback
Date: Mon, 26 Dec 2022 19:57:51 +0200 (EET)	[thread overview]
Message-ID: <d435beb-f076-5212-ae7a-b3dedcb654e@linux.intel.com> (raw)
In-Reply-To: <Y6kZfHOCb18qmaeP@yilunxu-OptiPlex-7050>

[-- Attachment #1: Type: text/plain, Size: 2243 bytes --]

On Mon, 26 Dec 2022, Xu Yilun wrote:

> On 2022-12-14 at 16:49:52 +0200, Ilpo Järvinen wrote:
> > Handle probe error rollbacks properly to avoid leaks.
> > 
> > Fixes: 5cd339b370e2 ("fpga: m10bmc-sec: add max10 secure update functions")
> > Reviewed-by: Matthew Gerlach <matthew.gerlach@linux.intel.com>
> > Reviewed-by: Russ Weight <russell.h.weight@intel.com>
> > Reviewed-by: Marco Pagani <marpagan@redhat.com>
> > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> 
> I assume this should be in stable kernel, so
>  
>  Cc: stable@vger.kernel.org
> 
> If OK, I could add it myself.

Yes, it should have been there but I forgot it.

Please add it like you suggested. Thanks.

-- 
 i.

> > ---
> > I don't know if the previous one fell through cracks so resending this.
> > 
> > v2:
> > - Resending v1 with Marco's Rev-by
> > 
> >  drivers/fpga/intel-m10-bmc-sec-update.c | 17 ++++++++++++-----
> >  1 file changed, 12 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/fpga/intel-m10-bmc-sec-update.c b/drivers/fpga/intel-m10-bmc-sec-update.c
> > index 79d48852825e..03f1bd81c434 100644
> > --- a/drivers/fpga/intel-m10-bmc-sec-update.c
> > +++ b/drivers/fpga/intel-m10-bmc-sec-update.c
> > @@ -574,20 +574,27 @@ static int m10bmc_sec_probe(struct platform_device *pdev)
> >  	len = scnprintf(buf, SEC_UPDATE_LEN_MAX, "secure-update%d",
> >  			sec->fw_name_id);
> >  	sec->fw_name = kmemdup_nul(buf, len, GFP_KERNEL);
> > -	if (!sec->fw_name)
> > -		return -ENOMEM;
> > +	if (!sec->fw_name) {
> > +		ret = -ENOMEM;
> > +		goto fw_name_fail;
> > +	}
> >  
> >  	fwl = firmware_upload_register(THIS_MODULE, sec->dev, sec->fw_name,
> >  				       &m10bmc_ops, sec);
> >  	if (IS_ERR(fwl)) {
> >  		dev_err(sec->dev, "Firmware Upload driver failed to start\n");
> > -		kfree(sec->fw_name);
> > -		xa_erase(&fw_upload_xa, sec->fw_name_id);
> > -		return PTR_ERR(fwl);
> > +		ret = PTR_ERR(fwl);
> > +		goto fw_uploader_fail;
> >  	}
> >  
> >  	sec->fwl = fwl;
> >  	return 0;
> > +
> > +fw_uploader_fail:
> > +	kfree(sec->fw_name);
> > +fw_name_fail:
> > +	xa_erase(&fw_upload_xa, sec->fw_name_id);
> > +	return ret;
> >  }
> >  
> >  static int m10bmc_sec_remove(struct platform_device *pdev)
> > -- 
> > 2.30.2
> > 
> 

      reply	other threads:[~2022-12-26 17:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-14 14:49 Ilpo Järvinen
2022-12-16  8:26 ` Xu Yilun
2022-12-26  3:48 ` Xu Yilun
2022-12-26 17:57   ` Ilpo Järvinen [this message]

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=d435beb-f076-5212-ae7a-b3dedcb654e@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=hao.wu@intel.com \
    --cc=linux-fpga@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marpagan@redhat.com \
    --cc=matthew.gerlach@linux.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®