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 BA8E518B1A for ; Wed, 22 May 2024 06:23:35 +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=1716359015; cv=none; b=Aq9OXK3wlM7AeHYmayq30Xbcdrj98qsHOor5e3qUreZDWGrF4lvtF2jOZMkPuhdxUaxeGVEdjdPMuin95n0BPBFXL9XsQqL+fLMsVjnzzBumdMU84ftulX661PQttCuY6dFSsQzQfKni8eOFoQIqK8zsXWkFO+NfiTish3QoS8Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716359015; c=relaxed/simple; bh=0CbuyIjy9AEsvgtxBGQgC0E5i4AKxIUUcXt1qOFUcE8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=AGOzuHxsrolRqS8x/rCkIBBjwz8HmnRFl3TD0OER6GUeaixP3RRxxh0m87cGyUT0JDjnJmcAPFDUhZ9n8hQfUFfsNqQ5RRMj6RT8b1gSxInQ5slaw4XfskpVTljLFtnk65H/wWzZPo1Ux3T52mqj6XVpmwy+NZd+NtjIDgojRDo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=JixIDskz; 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="JixIDskz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05F2AC2BD11; Wed, 22 May 2024 06:23:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1716359015; bh=0CbuyIjy9AEsvgtxBGQgC0E5i4AKxIUUcXt1qOFUcE8=; h=From:To:Cc:Subject:Date:Reply-to:From; b=JixIDskzNZqOabJqnuAuyLtRGUU5nu5VR/8PlMaS22fsPhKp4tq22NykKxXI/uVd/ 6PzaEeSnsuo4m3Smv+I72wQWiBfyAzvdcZ6+MgKpEpKvtLL+S5wbTb6DT6j7gQ0aSa 5coJs++P8lxdSnDuC6ih6inD0z5icuvqh/azdYxA= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2021-47459: can: j1939: j1939_netdev_start(): fix UAF for rx_kref of j1939_priv Date: Wed, 22 May 2024 08:23:25 +0200 Message-ID: <2024052224-CVE-2021-47459-4f79@gregkh> X-Mailer: git-send-email 2.45.1 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=3044; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=0CbuyIjy9AEsvgtxBGQgC0E5i4AKxIUUcXt1qOFUcE8=; b=owGbwMvMwCRo6H6F97bub03G02pJDGm+/bGCunmzF/reiY9zup1lLHNl1abU42e/tfjO0FquW r51g1pMRywLgyATg6yYIsuXbTxH91ccUvQytD0NM4eVCWQIAxenAEzkRwHDgp33/P0/JS+cZZ7o t256zg+OzNY4HoZ52gr7aiZlaSWnfPo+Vy2he2N6eLw3AA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: can: j1939: j1939_netdev_start(): fix UAF for rx_kref of j1939_priv It will trigger UAF for rx_kref of j1939_priv as following. cpu0 cpu1 j1939_sk_bind(socket0, ndev0, ...) j1939_netdev_start j1939_sk_bind(socket1, ndev0, ...) j1939_netdev_start j1939_priv_set j1939_priv_get_by_ndev_locked j1939_jsk_add ..... j1939_netdev_stop kref_put_lock(&priv->rx_kref, ...) kref_get(&priv->rx_kref, ...) REFCOUNT_WARN("addition on 0;...") ==================================================== refcount_t: addition on 0; use-after-free. WARNING: CPU: 1 PID: 20874 at lib/refcount.c:25 refcount_warn_saturate+0x169/0x1e0 RIP: 0010:refcount_warn_saturate+0x169/0x1e0 Call Trace: j1939_netdev_start+0x68b/0x920 j1939_sk_bind+0x426/0xeb0 ? security_socket_bind+0x83/0xb0 The rx_kref's kref_get() and kref_put() should use j1939_netdev_lock to protect. The Linux kernel CVE team has assigned CVE-2021-47459 to this issue. Affected and fixed versions =========================== Issue introduced in 5.4 with commit 9d71dd0c7009 and fixed in 5.4.156 with commit a0e47d2833b4 Issue introduced in 5.4 with commit 9d71dd0c7009 and fixed in 5.10.76 with commit 864e77771a24 Issue introduced in 5.4 with commit 9d71dd0c7009 and fixed in 5.14.15 with commit 6e8811707e2d Issue introduced in 5.4 with commit 9d71dd0c7009 and fixed in 5.15 with commit d9d52a3ebd28 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-2021-47459 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: net/can/j1939/main.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/a0e47d2833b4f65e6c799f28c6b636d36b8b936d https://git.kernel.org/stable/c/864e77771a24c877aaf53aee019f78619cbcd668 https://git.kernel.org/stable/c/6e8811707e2df0c6ba920f0cad3a3bca7b42132f https://git.kernel.org/stable/c/d9d52a3ebd284882f5562c88e55991add5d01586