From: Christophe JAILLET Date: Mon, 15 May 2023 19:09:11 +0000 (+0200) Subject: cassini: Fix a memory leak in the error handling path of cas_init_one() X-Git-Tag: baikal/aarch64/sdk5.10~85 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=9065fcb5dbad0a8b20b19321087e7154ff85b02d;p=kernel.git cassini: Fix a memory leak in the error handling path of cas_init_one() [ Upstream commit 412cd77a2c24b191c65ea53025222418db09817c ] cas_saturn_firmware_init() allocates some memory using vmalloc(). This memory is freed in the .remove() function but not it the error handling path of the probe. Add the missing vfree() to avoid a memory leak, should an error occur. Fixes: c4897a27ebe9 ("cassini: use request_firmware") Signed-off-by: Christophe JAILLET Reviewed-by: Pavan Chebbi Reviewed-by: Simon Horman Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- diff --git a/drivers/net/ethernet/sun/cassini.c b/drivers/net/ethernet/sun/cassini.c index 6e78a33aa5e47..ecaa9beee76eb 100644 --- a/drivers/net/ethernet/sun/cassini.c +++ b/drivers/net/ethernet/sun/cassini.c @@ -5138,6 +5138,8 @@ err_out_iounmap: cas_shutdown(cp); mutex_unlock(&cp->pm_mutex); + vfree(cp->fw_data); + pci_iounmap(pdev, cp->regs);