From f03ab214adbaf02561b5820395256c3ca66c7d7b Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Apr 20 2023 11:00:26 +0000 Subject: niu: Fix missing unwind goto in niu_alloc_channels() (bsc#1012628). --- diff --git a/patches.kernel.org/6.2.12-050-niu-Fix-missing-unwind-goto-in-niu_alloc_chann.patch b/patches.kernel.org/6.2.12-050-niu-Fix-missing-unwind-goto-in-niu_alloc_chann.patch new file mode 100644 index 0000000..a7753a5 --- /dev/null +++ b/patches.kernel.org/6.2.12-050-niu-Fix-missing-unwind-goto-in-niu_alloc_chann.patch @@ -0,0 +1,43 @@ +From: Harshit Mogalapalli +Date: Wed, 5 Apr 2023 23:31:18 -0700 +Subject: [PATCH] niu: Fix missing unwind goto in niu_alloc_channels() +References: bsc#1012628 +Patch-mainline: 6.2.12 +Git-commit: 8ce07be703456acb00e83d99f3b8036252c33b02 + +[ Upstream commit 8ce07be703456acb00e83d99f3b8036252c33b02 ] + +Smatch reports: drivers/net/ethernet/sun/niu.c:4525 + niu_alloc_channels() warn: missing unwind goto? + +If niu_rbr_fill() fails, then we are directly returning 'err' without +freeing the channels. + +Fix this by changing direct return to a goto 'out_err'. + +Fixes: a3138df9f20e ("[NIU]: Add Sun Neptune ethernet driver.") +Signed-off-by: Harshit Mogalapalli +Reviewed-by: Simon Horman +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +Signed-off-by: Jiri Slaby +--- + drivers/net/ethernet/sun/niu.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c +index e6144d96..4bbf011d 100644 +--- a/drivers/net/ethernet/sun/niu.c ++++ b/drivers/net/ethernet/sun/niu.c +@@ -4522,7 +4522,7 @@ static int niu_alloc_channels(struct niu *np) + + err = niu_rbr_fill(np, rp, GFP_KERNEL); + if (err) +- return err; ++ goto out_err; + } + + tx_rings = kcalloc(num_tx_rings, sizeof(struct tx_ring_info), +-- +2.35.3 + diff --git a/series.conf b/series.conf index 811982f..9baafe6 100644 --- a/series.conf +++ b/series.conf @@ -2277,6 +2277,7 @@ patches.kernel.org/6.2.12-047-9p-xen-Fix-use-after-free-bug-in-xen_9pfs_fron.patch patches.kernel.org/6.2.12-048-bpf-arm64-Fixed-a-BTI-error-on-returning-to-pa.patch patches.kernel.org/6.2.12-049-KVM-arm64-Advertise-ID_AA64PFR0_EL1.CSV2-3-to-.patch + patches.kernel.org/6.2.12-050-niu-Fix-missing-unwind-goto-in-niu_alloc_chann.patch ######################################################## # Build fixes that apply to the vanilla kernel too.