From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796015230; b=1DWkkEaASrvT9q0gTHBDg+Js6TOQHgFvgj1MKcj96J1jp93HvueBrrPueki1DFwM9+Cf 5qfU5RZBlvGyVHFFFVqtb/dnR+tqYPmNdutnd8cn9Pi6dk4u1Qp75lM7hRoY35e6kLlov pVznnQMihdv1t+biKmpsqMAxpVNIZgsrVws59hoC0k9Z1V6VwFkx9+CjnsMep+0t9jLqB YbF8M+n94XTsrfXwd5ryc2wvyzJJSRxJlKqUBOTkO5atV9X7J+jWPvHuHf0Aj/IFfSebz vNtfzT4B6XOhKfRZjhibbykAL6msvaSN7UJoWDNWK5z4TgHebswSZXCySeqEgMR9/VQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796015230; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=QQhj8oSYvPz7I1hmbFGv1kEnTdWI2eBY9Vpf7ajVMqY=; b=Jtcn1X1yWYwpJtD+lEEQrdqkOn2AxiELX3s4lSFfCOXtX8VwgyP0493hmtbdhKSlwyj9 cR7iXGZCEXiwpa1ZH/4pbDX2hhwXVAqQ04MdRhSmqTR8qzxa+jO/+wTDCybIkcD9PgKzW wX07ky7hYS6KJkovecZm5g4XMQctPXJYvMN9bh1JFYq30pTLYDvnG3TPqNF5JQZsrCgN5 0wj6ljgyJaBjvDn9wfGWV8hAJnixQkLMq82QUSv9hnlv707/HY3WxBFxMDMj1M+4aC3Wa 0MbTY81QIZeW+PCwCebNVxgjvR6Kes3Y/+uwRMDSFb5ZavgCVWxLtS6kDjjGoYBz6tQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Vu5xJvA7; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 38353606A31C for ; Mon, 30 Nov 2026 05:07:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Vu5xJvA7 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B8241F00897; Mon, 30 Nov 2026 05:07:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796015229; bh=QQhj8oSYvPz7I1hmbFGv1kEnTdWI2eBY9Vpf7ajVMqY=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=Vu5xJvA77s599vkkhWp84t1Jt9M6AegfbmSWp8xXO0ZdFKnPA3VnmFmlZmNofqGiv UsqP3vRETg6tAq68QnskEYtu6M8QkXUwHrQtiVw4DhTzrQeEc4pcqvbat+dfVokRo2 KPkFOig9fe7K/0zjUNlGhMiOAxSWJHnuzixjqpekH0M7sX2Sfan3J8pnxaG3FxuzhR zwstlcAjbIV/9H6YLSCwNGEFGekoAGHsmOgE2lyQE/KY2zDJIEdO+QFnntGe1KuDIP cKhQl41tA1mWhQlHLyPUpyLP8RZh6apWsmG3eYxEh6t2Mci0Ta1CYRgEr7FTop+4Rw 98Obu0u81gmJg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH net] vsock/virtio: Fix sock leak on close_timeout race with peer close Reply-To: sashiko-reviews@lists.linux.dev To: "Hu Xinyao" Cc: virtualization@lists.linux.dev, "Michael S. Tsirkin" , "Eugenio Perez" In-Reply-To: <580BB20747AD7900+1796014782.205252-1-huxinyao@kylinsec.com.cn> References: <580BB20747AD7900+1796014782.205252-1-huxinyao@kylinsec.com.cn> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 30 Nov 2026 05:07:08 +0000 X-Mailing-List: virtualization@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list > virtio_transport_close() takes a socket reference and schedules > vsk->close_work with vsk->close_work_scheduled set. >=20 > Once a worker dequeues close_work, WORK_STRUCT_PENDING_BIT is cleared > before virtio_transport_close_timeout() acquires lock_sock(sk). If a > peer RST or SHUTDOWN arrives while close_timeout is waiting for the > socket lock, virtio_transport_do_close(vsk, true) sets SOCK_DONE and > calls virtio_transport_cancel_close_work(vsk, true), where > cancel_delayed_work() returns false and skips releasing the close_work > socket reference and removing the socket. >=20 > When virtio_transport_close_timeout() then acquires lock_sock(sk), it > sees SOCK_DONE already set, skips virtio_transport_do_close(vsk, false), > and clears vsk->close_work_scheduled, permanently leaking the socket > reference (and on OP_RST, leaving the socket in the connected table). >=20 > Call virtio_transport_cancel_close_work(vsk, false) when SOCK_DONE is > already set so whichever side runs last completes the cleanup. >=20 > Found during a GLM-5.4-assisted code audit and verified manually against > mainline; compile-tested only (not triggered at runtime). >=20 > Fixes: 06a8fc78367d ("VSOCK: Introduce virtio_vsock_common.ko") > Cc: stable@vger.kernel.org > Signed-off-by: Hu Xinyao Sashiko has reviewed this patch and found no issues. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/580BB20747AD7900+17= 96014782.205252-1-huxinyao@kylinsec.com.cn?part=3D1