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 36A913FB88 for ; Wed, 19 Jun 2024 14:58:27 +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=1718809107; cv=none; b=VZH+i3fCQWXmfeSpYY/nRgsPoYXYbP4YExiJcKSdlyYqWm1lE1FKXjPfrBrknSw32Zubcz4Ecka6xnN2j43q5YoHSZ3g7j5K97q0UeSY6SWqs5zm98zkNOHK1EUsP5wRO9JaH1IhwLGtzHsM6eY5CTv1E9cl2aAmv+xjohk7fxQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718809107; c=relaxed/simple; bh=ZUgrUNG6caLXHE8vwGLuU+aoaIRzzX7KO6zvhWx7sHk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=roSDocJ/o+M5zLiCQnOkqZmAosqGiyXk9B03ezTAFsMwY6mn9ByyDREoewHgi0tM/K0MEH3/LcGt9X5l/V0U7/mhsop9CEnRb/kHiMfW/0dTI179ms+YcdYVZ3wA52eNQaiNDC7cmgHh8TeehnEisByWRGrNiQ9iiaW3x1JkA2A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=d+HX4buH; 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="d+HX4buH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6C47C2BBFC; Wed, 19 Jun 2024 14:58:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1718809107; bh=ZUgrUNG6caLXHE8vwGLuU+aoaIRzzX7KO6zvhWx7sHk=; h=From:To:Cc:Subject:Date:Reply-to:From; b=d+HX4buHdx7B/pQPSWdKWcP5xbuH6Q+9pWVuptzE7899ra/U/H6uCOBaptNcw9H7b xd4oQReXNEX1xwIwEmTDYuurajMF9b0zZ6+55JPtg+UA2HyDM3JS3DgwiZPsy3hWlf z3P+sYrywBbk3sSLTPajCtlDLGOFjkRn9E+1L37M= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2021-47613: i2c: virtio: fix completion handling Date: Wed, 19 Jun 2024 16:58:12 +0200 Message-ID: <2024061908-CVE-2021-47613-47d5@gregkh> X-Mailer: git-send-email 2.45.2 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=2948; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=ZUgrUNG6caLXHE8vwGLuU+aoaIRzzX7KO6zvhWx7sHk=; b=owGbwMvMwCRo6H6F97bub03G02pJDGlFnxiOPn11dmtHQ+zVDPZjyjPepMcHf3/2ZLbP0p9h+ uXnur6Yd8SyMAgyMciKKbJ82cZzdH/FIUUvQ9vTMHNYmUCGMHBxCsBEJhcwLNhbF3qpv4hvxZcj nw7a7QlTL4/MWcewYNvUjq+mc6MvLxMonVLRtuAY39qiZQA= 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: i2c: virtio: fix completion handling The driver currently assumes that the notify callback is only received when the device is done with all the queued buffers. However, this is not true, since the notify callback could be called without any of the queued buffers being completed (for example, with virtio-pci and shared interrupts) or with only some of the buffers being completed (since the driver makes them available to the device in multiple separate virtqueue_add_sgs() calls). This can lead to incorrect data on the I2C bus or memory corruption in the guest if the device operates on buffers which are have been freed by the driver. (The WARN_ON in the driver is also triggered.) BUG kmalloc-128 (Tainted: G W ): Poison overwritten First byte 0x0 instead of 0x6b Allocated in i2cdev_ioctl_rdwr+0x9d/0x1de age=243 cpu=0 pid=28 memdup_user+0x2e/0xbd i2cdev_ioctl_rdwr+0x9d/0x1de i2cdev_ioctl+0x247/0x2ed vfs_ioctl+0x21/0x30 sys_ioctl+0xb18/0xb41 Freed in i2cdev_ioctl_rdwr+0x1bb/0x1de age=68 cpu=0 pid=28 kfree+0x1bd/0x1cc i2cdev_ioctl_rdwr+0x1bb/0x1de i2cdev_ioctl+0x247/0x2ed vfs_ioctl+0x21/0x30 sys_ioctl+0xb18/0xb41 Fix this by calling virtio_get_buf() from the notify handler like other virtio drivers and by actually waiting for all the buffers to be completed. The Linux kernel CVE team has assigned CVE-2021-47613 to this issue. Affected and fixed versions =========================== Issue introduced in 5.15 with commit 3cfc88380413 and fixed in 5.15.10 with commit 9cbb957441ed Issue introduced in 5.15 with commit 3cfc88380413 and fixed in 5.16 with commit b503de239f62 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-47613 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/i2c/busses/i2c-virtio.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/9cbb957441ed8873577d7d313a3d79d69f1dad5c https://git.kernel.org/stable/c/b503de239f62eca898cfb7e820d9a35499137d22