linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Pavel Skripkin <paskripkin@gmail.com>
Cc: Michael Straube <straube.linux@gmail.com>,
	Larry.Finger@lwfinger.net, phil@philpotter.co.uk,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 03/19] staging: r8188eu: release_firmware is not called if allocation fails
Date: Fri, 7 Jan 2022 12:25:25 +0100	[thread overview]
Message-ID: <YdgjJRwLjIBWVQvU@kroah.com> (raw)
In-Reply-To: <ca0548c0-b36c-98dc-3e49-b629b3d3fb6a@gmail.com>

On Fri, Jan 07, 2022 at 02:15:19PM +0300, Pavel Skripkin wrote:
> Hi Michael,
> 
> On 1/7/22 13:36, Michael Straube wrote:
> > In function load_firmware() release_firmware() is not called if the
> > allocation of pFirmware->szFwBuffer fails or if fw->size is greater
> > than FW_8188E_SIZE.
> > 
> > Move the call to release_firmware() to the exit label at the end of
> > the function to fix this.
> > 
> > Signed-off-by: Michael Straube <straube.linux@gmail.com>
> > ---
> >   drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c
> > index dc41682fd8d6..cfafbb6c42f7 100644
> > --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c
> > +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c
> > @@ -538,10 +538,10 @@ static int load_firmware(struct rt_firmware *pFirmware, struct device *device)
> >   	}
> >   	memcpy(pFirmware->szFwBuffer, fw->data, fw->size);
> >   	pFirmware->ulFwLength = fw->size;
> > -	release_firmware(fw);
> >   	dev_dbg(device, "!bUsedWoWLANFw, FmrmwareLen:%d+\n", pFirmware->ulFwLength);
> >   Exit:
> > +	release_firmware(fw);
> >   	return rtStatus;
> >   }
> 
> 
> This patch looks like a bug fix and it should go to stable kernels as well.
> The problem is this patch is made on top of 2 previous clean up patches, so
> it can't go to stable as is.
> 
> I think, the less painful way is to move this patch on the first place in
> this series. On the other hand you can just resend this one separately.
> 
> 
> Or, maybe, Greg knows some magic that will help here, we can wait him before
> you resend 20 patch series :)

It's just not worth it for this staging driver, and for an allocation
failure, to be backported here.  Allocation failures almost never happen
in real-world situations, and if they do, they are not alone, so this
would be the least of the problems happening here.

So no need to care about it, I can take this as-is.

thanks,

greg k-h

  reply	other threads:[~2022-01-07 11:25 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-07 10:36 [PATCH 00/19] staging: r8188eu: move firmware loading out of the hal layer Michael Straube
2022-01-07 10:36 ` [PATCH 01/19] staging: r8188eu: remove Firmware* from struct hal_data_8188e Michael Straube
2022-01-07 10:36 ` [PATCH 02/19] staging: r8188eu: remove rtl8188e_InitializeFirmwareVars() Michael Straube
2022-01-07 10:36 ` [PATCH 03/19] staging: r8188eu: release_firmware is not called if allocation fails Michael Straube
2022-01-07 11:15   ` Pavel Skripkin
2022-01-07 11:25     ` Greg KH [this message]
2022-01-07 11:26       ` Pavel Skripkin
2022-01-07 10:36 ` [PATCH 04/19] staging: r8188eu: rename Exit label in load_firmware() Michael Straube
2022-01-07 10:36 ` [PATCH 05/19] staging: r8188eu: rename rtStatus " Michael Straube
2022-01-07 10:36 ` [PATCH 06/19] staging: r8188eu: convert type of return variable " Michael Straube
2022-01-07 10:36 ` [PATCH 07/19] staging: r8188eu: rename parameter pFirmware of load_firmware() Michael Straube
2022-01-07 10:36 ` [PATCH 08/19] staging: r8188eu: rename fields of struct rt_firmware Michael Straube
2022-01-07 10:36 ` [PATCH 09/19] staging: r8188eu: use kmemdup instead of kzalloc and memcpy Michael Straube
2022-01-07 10:36 ` [PATCH 10/19] staging: r8188eu: rename fw related functions to avoid camel case Michael Straube
2022-01-07 10:36 ` [PATCH 11/19] staging: r8188eu: clean up rtw_reset_8051() Michael Straube
2022-01-07 10:36 ` [PATCH 12/19] staging: r8188eu: convert two functions from s32 to int Michael Straube
2022-01-07 10:36 ` [PATCH 13/19] staging: r8188eu: rename Exit label in rtl8188e_firmware_download() Michael Straube
2022-01-07 10:36 ` [PATCH 14/19] staging: r8188eu: rename rtSatus " Michael Straube
2022-01-07 10:36 ` [PATCH 15/19] staging: r8188eu: rename FWDL_ChkSum_rpt Michael Straube
2022-01-07 10:36 ` [PATCH 16/19] staging: r8188eu: rename writeFW_retry Michael Straube
2022-01-07 10:36 ` [PATCH 17/19] staging: r8188eu: rename pFwHdr in rtl8188e_firmware_download() Michael Straube
2022-01-07 10:36 ` [PATCH 18/19] staging: r8188eu: rename pFirmwareBuf and FirmwareLen Michael Straube
2022-01-07 10:36 ` [PATCH 19/19] staging: r8188eu: move firmware loading code out of the hal layer Michael Straube

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=YdgjJRwLjIBWVQvU@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=Larry.Finger@lwfinger.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=paskripkin@gmail.com \
    --cc=phil@philpotter.co.uk \
    --cc=straube.linux@gmail.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;
as well as URLs for NNTP newsgroup(s).