]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
staging: r8188eu: release_firmware is not called if allocation fails
authorMichael Straube <straube.linux@gmail.com>
Fri, 7 Jan 2022 10:36:04 +0000 (11:36 +0100)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 20 May 2022 12:39:18 +0000 (14:39 +0200)
BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 39850edf2befe27bcb3d6c37b6ee76d2ee4df903 ]

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.

Fixes: 8cd574e6af54 ("staging: r8188eu: introduce new hal dir for RTL8188eu driver")
Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220107103620.15648-4-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 7a68abde36e1480fa4ad08a3229bb8d6a5355d47)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/staging/r8188eu/hal/rtl8188e_hal_init.c

index a677b2049ef3e2b5e44e7a38c2376c5e52fe790d..9f2b86f9b6604beec67d8eb10cb2832d3eec8c8f 100644 (file)
@@ -572,10 +572,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;
 }