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 11D6825634 for ; Thu, 8 Aug 2024 08:49:32 +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=1723106973; cv=none; b=qrC4miuN7vDtgyveBrSjqDfZxvCoL/Nbnqoyl9qA9EbF2hOtv7h4XmAQfzUzxgr6OxkX0hK9GKXxzLdoYAxsVZzlBy0+Weii+dHNhwV+GVBWfb15W7+/HPRjbSE6DD+28dnjhFIvhevtp4z3knEYNypbGdh0281b7dh5ddQBfcw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723106973; c=relaxed/simple; bh=jWZlnl90ypqym6DcBvQqjWp4mgE3oded/fIEoUUz7wo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=t3NaSOREcFqgMnBuk07Op4Zbvpi4Q4BA3vhvBp4cPNqgCmF7gRbZmuHxmKO9WCu/Mvsv6VYKyKrka0n7cmqFMEGonOifo8ERzanUsuWuLkFRXF0wJY5zHA4fTM0hjPiRJzevM1n6iuN5vYgua2SLcl8FfJw1jxdEOK6zvXU368s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=eo7FYhWI; 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="eo7FYhWI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2929EC32782; Thu, 8 Aug 2024 08:49:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1723106972; bh=jWZlnl90ypqym6DcBvQqjWp4mgE3oded/fIEoUUz7wo=; h=From:To:Cc:Subject:Date:Reply-to:From; b=eo7FYhWI5MM/npTE4FCXx+pBiJ3EfjYQXo8dr9rq80emiF5OHktu+mAHnvKw81lKs GqoeRhj6VmrsO4xDmqu6UOT6iK5YXp7TQ9U+IJlh8Dapvjs82tXjJEgX8Bf/f/x1er qUfi0wLg73l+f9kWIeeof3gooc70l8LJBFqK5Ohw= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-42256: cifs: Fix server re-repick on subrequest retry Date: Thu, 8 Aug 2024 10:49:22 +0200 Message-ID: <2024080820-CVE-2024-42256-afbb@gregkh> X-Mailer: git-send-email 2.46.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=2997; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=jWZlnl90ypqym6DcBvQqjWp4mgE3oded/fIEoUUz7wo=; b=owGbwMvMwCRo6H6F97bub03G02pJDGlb2ib8zWw6bfIr5P7ymyEZW6sW7pX9eftR6bG8VYdzr t4/de+4REcsC4MgE4OsmCLLl208R/dXHFL0MrQ9DTOHlQlkCAMXpwBMZDITw4Jlbx9b1V7osjz6 Zeoi97OdOlN396kxLFgRavbZMu2B0MFPMvcyhLJzDtWu3AYA 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: cifs: Fix server re-repick on subrequest retry When a subrequest is marked for needing retry, netfs will call cifs_prepare_write() which will make cifs repick the server for the op before renegotiating credits; it then calls cifs_issue_write() which invokes smb2_async_writev() - which re-repicks the server. If a different server is then selected, this causes the increment of server->in_flight to happen against one record and the decrement to happen against another, leading to misaccounting. Fix this by just removing the repick code in smb2_async_writev(). As this is only called from netfslib-driven code, cifs_prepare_write() should always have been called first, and so server should never be NULL and the preparatory step is repeated in the event that we do a retry. The problem manifests as a warning looking something like: WARNING: CPU: 4 PID: 72896 at fs/smb/client/smb2ops.c:97 smb2_add_credits+0x3f0/0x9e0 [cifs] ... RIP: 0010:smb2_add_credits+0x3f0/0x9e0 [cifs] ... smb2_writev_callback+0x334/0x560 [cifs] cifs_demultiplex_thread+0x77a/0x11b0 [cifs] kthread+0x187/0x1d0 ret_from_fork+0x34/0x60 ret_from_fork_asm+0x1a/0x30 Which may be triggered by a number of different xfstests running against an Azure server in multichannel mode. generic/249 seems the most repeatable, but generic/215, generic/249 and generic/308 may also show it. The Linux kernel CVE team has assigned CVE-2024-42256 to this issue. Affected and fixed versions =========================== Issue introduced in 6.10 with commit 3ee1a1fc3981 and fixed in 6.10.1 with commit b1d0a566769b Issue introduced in 6.10 with commit 3ee1a1fc3981 and fixed in 6.11-rc1 with commit de40579b9038 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-2024-42256 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: fs/smb/client/smb2pdu.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/b1d0a566769b6fb3795b5289fc1daf9e0638d97a https://git.kernel.org/stable/c/de40579b903883274fe203865f29d66b168b7236