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 BFC8A7E for ; Sun, 22 Jan 2023 15:11:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 457B5C433EF; Sun, 22 Jan 2023 15:11:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1674400282; bh=FPLbrvIr0sJlCYZ/5az/WTaLEeHg/wZDDnYcNICvEGU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mc9kZMeUw0vNRRYNCa8smmYQETziOxDvNWRpIg2krh4hUHAXNArqCUxwUmsfSINA4 c/UfaxMXDaqipvZBV/krEROb7ziuSs5xN5lUbPBeh+2rP9hliGNROwjt61Q4qK1pCr Wf51CZtG+e9GSRIu/HULgQoiMGdPrwqWLI4Pa69c= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Ricardo=20Ca=C3=B1uelo?= , "Michael S. Tsirkin" , Xuan Zhuo , Sasha Levin Subject: [PATCH 5.10 04/98] tools/virtio: initialize spinlocks in vring_test.c Date: Sun, 22 Jan 2023 16:03:20 +0100 Message-Id: <20230122150229.565008149@linuxfoundation.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230122150229.351631432@linuxfoundation.org> References: <20230122150229.351631432@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Ricardo Cañuelo [ Upstream commit c262f75cb6bb5a63828e72ce3b8fe808e5029479 ] The virtio_device vqs_list spinlocks must be initialized before use to prevent functions that manipulate the device virtualqueues, such as vring_new_virtqueue(), from blocking indefinitely. Signed-off-by: Ricardo Cañuelo Message-Id: <20221012062949.1526176-1-ricardo.canuelo@collabora.com> Signed-off-by: Michael S. Tsirkin Reviewed-by: Xuan Zhuo Signed-off-by: Sasha Levin --- tools/virtio/vringh_test.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/virtio/vringh_test.c b/tools/virtio/vringh_test.c index fa87b58bd5fa..98ff808d6f0c 100644 --- a/tools/virtio/vringh_test.c +++ b/tools/virtio/vringh_test.c @@ -308,6 +308,7 @@ static int parallel_test(u64 features, gvdev.vdev.features = features; INIT_LIST_HEAD(&gvdev.vdev.vqs); + spin_lock_init(&gvdev.vdev.vqs_list_lock); gvdev.to_host_fd = to_host[1]; gvdev.notifies = 0; @@ -455,6 +456,7 @@ int main(int argc, char *argv[]) getrange = getrange_iov; vdev.features = 0; INIT_LIST_HEAD(&vdev.vqs); + spin_lock_init(&vdev.vqs_list_lock); while (argv[1]) { if (strcmp(argv[1], "--indirect") == 0) -- 2.35.1