From mboxrd@z Thu Jan 1 00:00:00 1970 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 2F99F3D546 for ; Fri, 1 Mar 2024 21:16:23 +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=1709327783; cv=none; b=dwHTqUznkqZZr+J3hKF5jyGMgN1/s1ZB3C98J7qrlJ9yaGVDIrgxQCK9j42Bdhc45EYe9tHP05GIMChF+z2MTUaq7IJJ9VnklwC6O8EAXeAQti3VtKTkv1QvpJUdlXbRUXMuppjLErlRXoNURSFA5P5IfuDSkEQzMovt3pzbQRI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709327783; c=relaxed/simple; bh=9UqpSmXI2zLKEn+aaE4eMbCse7MYdZpyhHyPUN28kdY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=ZlmHVT1SdbUBoYjv7J73DA0vnzTCgyHhDOGONTBtaY+JFZeRBbnmoh4cfHabxJRaBc4nGqyJMLQ7/3Z9NXVzscYuZDKrq7qVShaibchS6tNZ9Dhz1VaztP0m54Nrx2tIO/4USWLWYhm76W92kuOR57HUoIRpO0VacboPfJegPx4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=l25dadua; 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="l25dadua" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F392C433F1; Fri, 1 Mar 2024 21:16:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1709327783; bh=9UqpSmXI2zLKEn+aaE4eMbCse7MYdZpyhHyPUN28kdY=; h=From:To:Cc:Subject:Date:Reply-to:From; b=l25dadua1QbQXTAvpjE8QuY6kfHkX6Ggrddw1p/7+poYo7zg3Nc3nUdR8q4cHd5sH vRDrw+pHo7l4PedHmO6UQgk7v68tBKhPdTRkkTVUJUK1gofFxJmWX3o1yW2wKiA71x 6Ky0V1nG8IinEBNDruVDrPCbp5aUChizjF9zozXY= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2021-47081: habanalabs/gaudi: Fix a potential use after free in gaudi_memset_device_memory Date: Fri, 1 Mar 2024 22:15:54 +0100 Message-ID: <2024030143-CVE-2021-47081-e590@gregkh> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: habanalabs/gaudi: Fix a potential use after free in gaudi_memset_device_memory Our code analyzer reported a uaf. In gaudi_memset_device_memory, cb is get via hl_cb_kernel_create() with 2 refcount. If hl_cs_allocate_job() failed, the execution runs into release_cb branch. One ref of cb is dropped by hl_cb_put(cb) and could be freed if other thread also drops one ref. Then cb is used by cb->id later, which is a potential uaf. My patch add a variable 'id' to accept the value of cb->id before the hl_cb_put(cb) is called, to avoid the potential uaf. The Linux kernel CVE team has assigned CVE-2021-47081 to this issue. Affected and fixed versions =========================== Issue introduced in 5.12 with commit 423815bf02e25 and fixed in 5.12.7 with commit b49f5af30b0e Issue introduced in 5.12 with commit 423815bf02e25 and fixed in 5.13 with commit 115726c5d312 Please see https://www.kernel.org or 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-2021-47081 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/misc/habanalabs/gaudi/gaudi.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/b49f5af30b0e4064fbd91e83823a4bfcb2c7a3e7 https://git.kernel.org/stable/c/115726c5d312b462c9d9931ea42becdfa838a076