From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A6CF4908A9; Sat, 12 Sep 2026 18:40:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789238434; cv=none; b=OXmEXGoZ4+bUi2eFzSAtNpGp8Po/KD35g4zrDwZVVl4KZM9ZD5tPneIdeR0VLkafd+N689jeajTmkpfy52XMT5CNM5c0YGRj4Ntqw9wipZ8UKqnfWvtlgr0iazIvJDwslvE9s01/7RkDuSZg6AEnQajkpyvI6S/jvv9++yRASjY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789238434; c=relaxed/simple; bh=uKKjUsGwqRLnaOse+0h7oKk+AWr0ZXoUF22Pe2WQMWY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qyeEWQ8JGRwFi1r/29CybMrxW3gRB6AMDtRK+dBW5uhp2kMJqNgXvD21+SnS0pBOVdZfxxG1uXjcfDmMVIfmBCrnBOF95KoUbO9HNe5VwMY3WDs0x1/iH4jmLdimSZjKWXL/qV7464OP1NMrY3Hg3ocz6u5EI0fIGsprULh/fbM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=wyFcR6kj; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="wyFcR6kj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CBC9E1F00893; Sat, 12 Sep 2026 18:40:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789238423; bh=byiXRj3ArOIBIEJ/MfQeUtLFmRuGo6izZSgUnThIBBk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=wyFcR6kjJ7kmig4mY3L0MeUD1eiVNXGHDjeR7z+W7yy0pMx4JjZ5nU1BZ9CeiRx9i ZgpO1HlsLCHhQx1QWF6NYKUxmqf7DO1xaRBLXX6ghahoTMLTO0jHJwECb6TF2SeGGc om91Pj+VhOXbZozN+qWM3YrvoBnZKrR9sL+mj3Vc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zilin Guan , Dawei Feng , Dan Carpenter , Sasha Levin Subject: [PATCH 5.15 460/935] staging: rtl8723bs: fix mismatched free of HalData in rtw_sdio_if1_init() Date: Sat, 12 Sep 2026 08:58:10 +0200 Message-ID: <20260912065537.375952357@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065526.833703348@linuxfoundation.org> References: <20260912065526.833703348@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dawei Feng [ Upstream commit 264676418b726baca7be49171e306b6aa05cceb0 ] padapter->HalData is allocated via vzalloc(), but incorrectly freed using kfree() in the rtw_sdio_if1_init() error path. Using kfree() to release this vmalloc-backed buffer can lead to memory corruption. Use rtw_hal_data_deinit() to pair the free correctly and free HalData with vfree(). The bug was first flagged by an experimental static analysis tool we are developing for kernel memory-management bugs. Manual inspection confirms that the issue is still present in current mainline. An x86_64 allyesconfig build showed no new warnings. As we do not have suitable RTL8723BS SDIO hardware to test with, no runtime testing was able to be performed. Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver") Signed-off-by: Zilin Guan Signed-off-by: Dawei Feng Reviewed-by: Dan Carpenter Link: https://patch.msgid.link/20260525091836.812565-1-dawei.feng@seu.edu.cn Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c index 335e6002df70f..3b5a6f685bce5 100644 --- a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c +++ b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c @@ -310,8 +310,8 @@ static struct adapter *rtw_sdio_if1_init(struct dvobj_priv *dvobj, const struct status = _SUCCESS; free_hal_data: - if (status != _SUCCESS && padapter->HalData) - kfree(padapter->HalData); + if (status != _SUCCESS) + rtw_hal_data_deinit(padapter); if (status != _SUCCESS) { rtw_wdev_unregister(padapter->rtw_wdev); -- 2.53.0