From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83988C433F5 for ; Tue, 5 Oct 2021 17:12:22 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 24217610C7 for ; Tue, 5 Oct 2021 17:12:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 24217610C7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:59964 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXnzI-0007Bh-UO for qemu-devel@archiver.kernel.org; Tue, 05 Oct 2021 13:12:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48060) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXmvH-00024y-Od for qemu-devel@nongnu.org; Tue, 05 Oct 2021 12:04:08 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:25132) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXmvF-00071P-NU for qemu-devel@nongnu.org; Tue, 05 Oct 2021 12:04:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633449843; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hoAsOcICaDiNobBhDkgg+vqDQALYK1r5xTzLqWDdXc8=; b=fpCsK1K9P6JcKiwYHrL3vyNyQctv3aH3CGehscoJEQZqhNA4UarKVP39ngwvT2OWMSE9KV W5B+cNH8PSKrmKJP6wqgINAX7/DXlsG4l9ADu1gz4FqDG8r8W8lkAGsSLI/XrlqNisrqce pBYXnEvT5ktns9Bm4zaHFvhjSVjg1ow= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-417-F-PQp7nTPx2NO8L-WlC8hg-1; Tue, 05 Oct 2021 12:00:50 -0400 X-MC-Unique: F-PQp7nTPx2NO8L-WlC8hg-1 Received: by mail-wm1-f72.google.com with SMTP id f11-20020a7bcd0b000000b0030d72d5d0bcso1456566wmj.7 for ; Tue, 05 Oct 2021 09:00:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=hoAsOcICaDiNobBhDkgg+vqDQALYK1r5xTzLqWDdXc8=; b=8ANKtxedP4ICn4sHkLcAVA7BvtxkFiigWiuJ3rkFJ7FU7ES+0khLjcApHY4toaBmos G1Oslif0ae8L8PkU+E33Uxa8kq7UkfXto8KslZRer8FbOu8/Cpu/z/aA61t3hDbIkh3q u7pH3roMDT4ETQVmYTf0LCyVqjc3wKLt789Jcb0EpvKz+zUqZHebj8R1/D36drf615Qn pPF2YgtSD764OYfpyT0FoNs9f9SE+g5Hz1O4izj6VKYbU1q8uUn+FD0I8Bw5S90E2UkH aGVZ70IL4md4z8hJV29c+fhVlWKhvq5R04OefWWfmgp/zM5sTMSpezMtLFTy7b1v/CJm E7rA== X-Gm-Message-State: AOAM530I3sWbozD0lMzsdl53fu7B7NYuzoCR9cEjS57/dSTgEb0PM0l3 WWoBckMCmnw7GzpLQXfxSiAGn0pHs72niUt/ekQgrijlqm/HUWt7knNYa/FHzXYpEg0sIdRv+Gl 0hJ4T6NNQezz0j1sbA9leV1hoOAOVFgjCubXWu2urQghQeEu4SIRlLfkl7Nln X-Received: by 2002:adf:bb88:: with SMTP id q8mr22588686wrg.390.1633449648660; Tue, 05 Oct 2021 09:00:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFG7i0LBhWZa/z8FAcj0xfdN1o7vTaWNSUy+TbtzAR44YMmhJVZ+hKI2U83zOosTh6Xvw3sA== X-Received: by 2002:adf:bb88:: with SMTP id q8mr22588639wrg.390.1633449648315; Tue, 05 Oct 2021 09:00:48 -0700 (PDT) Received: from redhat.com ([2.55.147.134]) by smtp.gmail.com with ESMTPSA id b19sm299483wmb.1.2021.10.05.09.00.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Oct 2021 09:00:47 -0700 (PDT) Date: Tue, 5 Oct 2021 12:00:45 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 01/57] hw/virtio: Acquire RCU read lock in virtqueue_packed_drop_all() Message-ID: <20211005155946.513818-2-mst@redhat.com> References: <20211005155946.513818-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211005155946.513818-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=216.205.24.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -9 X-Spam_score: -1.0 X-Spam_bar: - X-Spam_report: (-1.0 / 5.0 requ) DKIMWL_WL_HIGH=-0.066, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Stefano Garzarella Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé vring_get_region_caches() must be called with the RCU read lock acquired. virtqueue_packed_drop_all() does not, and uses the 'caches' pointer. Fix that by using the RCU_READ_LOCK_GUARD() macro. Reported-by: Stefano Garzarella Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210906104318.1569967-3-philmd@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Stefano Garzarella --- hw/virtio/virtio.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 240759ff0b..dd0ab433b8 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -1703,6 +1703,8 @@ static unsigned int virtqueue_packed_drop_all(VirtQueue *vq) VirtIODevice *vdev = vq->vdev; VRingPackedDesc desc; + RCU_READ_LOCK_GUARD(); + caches = vring_get_region_caches(vq); if (!caches) { return 0; -- MST