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=1796303024; b=4WoYP3zyy8EAs9aEnqL4czhFJSdcdB51aUKgpepEW+3+imVuTIQGxsimLcyFTE9m2xh1 NyKcR7IAbbk8z8BSVA89AOPLWvxWqi996m9koHjY7scaQKQWFbeHsD5Xpeo2cJAIMxhJt TR4T4nGgU88UdPix4McfDChxnB+76fOiq6HGV/oQRvfFxHPdFLQvEZPX+oh9X9pU0D+1T I0lXJfPgew/5FnUvHIIVoFc+/yaOqORNGJxVeMOxGH5X8rdrWUCEuqv6lBMx6mzGbvXv8 wfOYYXdO/9k2gouUgHCLs2iBqcVZ+877MeaznFcS+05QcSPsn1ZTBAbsXDbn9q8PGHw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796303024; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=HZzvwZx1illAQwFd6/gmltwjwDSoFrQ2UOMjsbvePjA=; b=LCB9yDfvpCmh+Z9z1VA2LSszlW4PHyW1lVCcDIapY97kLIQN//QRgIZlxZU20wPd0CSQ 104eFtWX0a15e6StKaQaH5tdnGgvN9DzSpK/TQ65DFdIIGjCGATdtpCwFrHl0bJkMOlYk n/yu4hmAdr3+McgwB1VsWkoeXgEabFPizbxyxjuuW8zCZc1ICxru45tSsQtI/oiMrTolp dtiHFFW2V1E9HGgcBy4WW2OoiyMZuIuUAy1lnWt6OtszfQ1K/trXuSnxEpOCvaLRJ2z0h NRPj63qMMwZIGzbSNUttJptfNPODgIw1tQqi/4+LN+m4wYUnxULdr2KcAVX4fL/5kqA== 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=hiyan7Av; 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 EDFAA606A32D for ; Thu, 3 Dec 2026 13:03:43 +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=hiyan7Av Received: by smtp.kernel.org (Postfix) with ESMTPSA id 782C01F000C1; Thu, 3 Dec 2026 13:03:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796303023; bh=HZzvwZx1illAQwFd6/gmltwjwDSoFrQ2UOMjsbvePjA=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=hiyan7AvvI3mCztAiN+IOZ1GgToWEF3gdttj2CdHgLpoNCnfiQkH4mJuatwpL+Ux6 aciZhSefw402VKztAlXz053wmuRKQI1fgzlt4mFyscBq3juVattjmgvdSaUgsgQS3H CsrDPOFqKAmjTxyf+1mOuTN6wVkW5RtR0Z+c6dKLXePxmRfT87asC0oTNrarT26jS/ UzCcZ8j9yQt0QPlNjiHRW4BiS5XE2GUvkaUciOKMmcafYYvko21zpWEDUR63TG17wo MaaiO5C01UYJzfAu0F3J3zqcF2vQQy5+AAS0WBlmKpzMbI0md69eNdPhze7bvI1YHY diBKOsPJdh2Zw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] virtio_console: prevent double free in init_vqs() Reply-To: sashiko-reviews@lists.linux.dev To: "Thomas Fourier" Cc: =?utf-8?b?b3BlbiBsaXN0OlZJUlRJTyBDT05TT0xFIERSSVZFUg==?= , "Michael S. Tsirkin" , "Eugenio Perez" In-Reply-To: <20261203125120.404546-1-fourier.thomas@gmail.com> References: <20261203125120.404546-1-fourier.thomas@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 13:03:43 +0000 X-Mailing-List: virtualization@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list > When init_vqs() fails, it frees portdev->in_vqs and portdev->out_vqs > but leaves both pointers set. In the probe path this does not matter, > because the probe fails. virtcons_restore() also calls init_vqs(), and > if it fails there the device stays bound to the driver. When the > device is later removed, virtcons_remove() calls remove_vqs(), which > frees both arrays a second time. >=20 > Set both pointers to NULL after freeing them in init_vqs(). >=20 > Fixes: 2b8f41d84699 ("virtio: console: Add freeze and restore handlers to= support S4") > Signed-off-by: Thomas Fourier Sashiko has reviewed this patch and found no issues. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203125120.4045= 46-1-fourier.thomas@gmail.com?part=3D1