lkml.org 
[lkml]   [2022]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 03/19] staging: r8188eu: release_firmware is not called if allocation fails
    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

    \
     
     \ /
      Last update: 2022-01-07 12:26    [W:3.144 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site