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 038C612D1F4 for ; Fri, 24 May 2024 15:11:47 +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=1716563507; cv=none; b=hysMvrDVYxw1aAp8flLttNxYz+V1aP4haYMi+T/hGBBtVA9/nVybM/PQP5begkIIMHqO+qwX7qaQUsuwZ7rJ4DIHeZb37XkLmFKuDBci+ZGcGsjLJY4L7mNxTliFlef5wBNEtjEQAPywgQ6dNJK4mJ+3VCCAjZZz5sV2z2R+P1Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716563507; c=relaxed/simple; bh=KFYR7jWsF2f4dUn5FSBp5zS6rQ0z4ki5+sLd8v1xFRE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=J/RQte3A4T1z/wjbQlKWA0LqueSzdNBVlb7zYWqWRBTVO7X1K7jZhT1i5gGfVNuFM8f+RQGnJ62jNzdodQyc/rSFMmF7kq63UBCmawHvarCoYzax0mjXJVFxZmpiyQn+J0WT+QeTZ/xRJCRwNbXAJ+44+vlexOE97hXEbXuKszY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=CylcfFOC; 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="CylcfFOC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80FF5C4AF0C; Fri, 24 May 2024 15:11:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1716563506; bh=KFYR7jWsF2f4dUn5FSBp5zS6rQ0z4ki5+sLd8v1xFRE=; h=From:To:Cc:Subject:Date:Reply-to:From; b=CylcfFOCO2sBcLu5px9IVsdfqS1QWc3HLqgujJ/FkSw3ytGxNmJjUcGSyuARXU3Ly f0z0IMeOZ/YLlRkccYumIqRkQ5Nb+5ltFfCOwa78gjvjNgQvJ9U99uolZjSKIa93YW O9v4EKHSCeLAnpCJcw3auYnaZVPp0ElXOM8mvXxg= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2021-47555: net: vlan: fix underflow for the real_dev refcnt Date: Fri, 24 May 2024 17:10:15 +0200 Message-ID: <2024052443-CVE-2021-47555-3043@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=2974; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=KFYR7jWsF2f4dUn5FSBp5zS6rQ0z4ki5+sLd8v1xFRE=; b=owGbwMvMwCRo6H6F97bub03G02pJDGkBa7ff73750Le3KMKsJ7b/R4ppy21DqTeNny+8/2+fF 7U1//jVjlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZjIVC2GefZHTnkGzTfIadRv m5z9Y9UO7fCqaob5xS8mWYnd9Nd2F3/maya04jvzuz5rAA== 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: net: vlan: fix underflow for the real_dev refcnt Inject error before dev_hold(real_dev) in register_vlan_dev(), and execute the following testcase: ip link add dev dummy1 type dummy ip link add name dummy1.100 link dummy1 type vlan id 100 ip link del dev dummy1 When the dummy netdevice is removed, we will get a WARNING as following: ======================================================================= refcount_t: decrement hit 0; leaking memory. WARNING: CPU: 2 PID: 0 at lib/refcount.c:31 refcount_warn_saturate+0xbf/0x1e0 and an endless loop of: ======================================================================= unregister_netdevice: waiting for dummy1 to become free. Usage count = -1073741824 That is because dev_put(real_dev) in vlan_dev_free() be called without dev_hold(real_dev) in register_vlan_dev(). It makes the refcnt of real_dev underflow. Move the dev_hold(real_dev) to vlan_dev_init() which is the call-back of ndo_init(). That makes dev_hold() and dev_put() for vlan's real_dev symmetrical. The Linux kernel CVE team has assigned CVE-2021-47555 to this issue. Affected and fixed versions =========================== Issue introduced in 5.4.160 with commit 700602b662d7 and fixed in 5.4.163 with commit 5e44178864b3 Issue introduced in 5.10.80 with commit e04a7a84bb77 and fixed in 5.10.83 with commit 6e800ee43218 Issue introduced in 5.15.3 with commit 21032425c36f and fixed in 5.15.6 with commit f7fc72a508cf Issue introduced in 5.14.19 with commit fca96b3f852a 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-47555 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/8021q/vlan.c net/8021q/vlan_dev.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/5e44178864b38dd70b877985abd7d86fdb95f27d https://git.kernel.org/stable/c/6e800ee43218a56acc93676bbb3d93b74779e555 https://git.kernel.org/stable/c/f7fc72a508cf115c273a7a29350069def1041890 https://git.kernel.org/stable/c/01d9cc2dea3fde3bad6d27f464eff463496e2b00