Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 CD0F02E1C7E for ; Tue, 7 Oct 2025 15:19:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759850394; cv=none; b=LlyeCHlDGXsZGRj8nqUF7JtqajXSnTf7a7hrUgzQfcs9BRT7s7mauVXUGp9x121zqZ3R/zOGrs6ur4ftGiM38Q6dQz+24eWrwZHno8xrsfYlwChu9VrjWbxhRZVekOhP2eAzZHc/kxIZOk+r3+oNhNGDiYiMMPUOd1qNlLLb4kE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759850394; c=relaxed/simple; bh=H2bgz9mthMzn6VVifsTzwey1GMr6QAt4olyzyb51QGw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=hSHDr3qU7WsRsT0cmOpMY2XnONXAv3dH1GpaejyAAwYueRQDkdR5bU97EKRd5SwuQRy3PEaSv8sluXmcV9jgpywfYG8D9M/GLsSdWCtLSMyyKBDfr6fC67WS4Yg2VmEGA/WaoMFB60aigP1My+/yJazMYIIYjevdgCY/JV5ApP8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=cOT9ZGY4; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="cOT9ZGY4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09006C4CEFE; Tue, 7 Oct 2025 15:19:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1759850394; bh=H2bgz9mthMzn6VVifsTzwey1GMr6QAt4olyzyb51QGw=; h=From:To:Cc:Subject:Date:Reply-to:From; b=cOT9ZGY4pviTl8cFTwZtmBN02BbHoflLUBKQIiMmYZ0T7KcFn3Ze+7e/rHrY0wZ6E QjidoodBeVkUru0M+opwj8wjUB4wpQ4e6GCbha2D2LFUQnr5gVYHYpNynPBpPTFr29 1Ajea4wGw2jP13W7dLuTyTURJmGkHTXNXuuQSDaI= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-50513: staging: rtl8723bs: fix a potential memory leak in rtw_init_cmd_priv() Date: Tue, 7 Oct 2025 17:19:00 +0200 Message-ID: <2025100702-CVE-2022-50513-8fee@gregkh> X-Mailer: git-send-email 2.51.0 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=2780; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=BmpMq6pnsAcFMKeUK5SEPlla97v8mKAU8vmDhoijEMs=; b=owGbwMvMwCRo6H6F97bub03G02pJDBlP9dO8wj63H7DlOx4x1X6xoJv93gcZViq8wRc6vNgF3 HMD/zt0xLIwCDIxyIopsnzZxnN0f8UhRS9D29Mwc1iZQIYwcHEKwETOLGSYnx5VuKnhyhOrd76P F2RxuG9VfXR6DsOCdXxrpsg8OhoUM2vzh1VZ7WZtpnqGAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: staging: rtl8723bs: fix a potential memory leak in rtw_init_cmd_priv() In rtw_init_cmd_priv(), if `pcmdpriv->rsp_allocated_buf` is allocated in failure, then `pcmdpriv->cmd_allocated_buf` will be not properly released. Besides, considering there are only two error paths and the first one can directly return, so we do not need implicitly jump to the `exit` tag to execute the error handler. So this patch added `kfree(pcmdpriv->cmd_allocated_buf);` on the error path to release the resource and simplified the return logic of rtw_init_cmd_priv(). As there is no proper device to test with, no runtime testing was performed. The Linux kernel CVE team has assigned CVE-2022-50513 to this issue. Affected and fixed versions =========================== Fixed in 5.4.220 with commit e5d8f05edb36fc4ab15beec62cb6ab62f5a60fe2 Fixed in 5.10.150 with commit e6cc39db24a63f68314473621020ed8cad7be423 Fixed in 5.15.75 with commit 39bef9c6a91bbb790d04c1347cfeae584541fb6a Fixed in 5.19.17 with commit a5be64ff6d21f7805a91e6d81f53fc19cd9f0fae Fixed in 6.0.3 with commit 8db6ca84eee0ac258706f3fca54f7c021cb159ef Fixed in 6.1 with commit 708056fba733a73d926772ea4ce9a42d240345da Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2022-50513 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: drivers/staging/rtl8723bs/core/rtw_cmd.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/e5d8f05edb36fc4ab15beec62cb6ab62f5a60fe2 https://git.kernel.org/stable/c/e6cc39db24a63f68314473621020ed8cad7be423 https://git.kernel.org/stable/c/39bef9c6a91bbb790d04c1347cfeae584541fb6a https://git.kernel.org/stable/c/a5be64ff6d21f7805a91e6d81f53fc19cd9f0fae https://git.kernel.org/stable/c/8db6ca84eee0ac258706f3fca54f7c021cb159ef https://git.kernel.org/stable/c/708056fba733a73d926772ea4ce9a42d240345da