From patchwork Tue Jun 18 05:28:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Ruffell X-Patchwork-Id: 1948941 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W3FfN1sM5z20XR for ; Tue, 18 Jun 2024 15:28:43 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1sJROQ-0005s4-7R; Tue, 18 Jun 2024 05:28:30 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1sJROO-0005rr-It for kernel-team@lists.ubuntu.com; Tue, 18 Jun 2024 05:28:28 +0000 Received: from mail-oi1-f199.google.com (mail-oi1-f199.google.com [209.85.167.199]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 531B63F2B2 for ; Tue, 18 Jun 2024 05:28:28 +0000 (UTC) Received: by mail-oi1-f199.google.com with SMTP id 5614622812f47-3d282e7887aso4998152b6e.0 for ; Mon, 17 Jun 2024 22:28:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718688507; x=1719293307; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dFfQBDL1zItno0BEfgNug9N+rn60ZJ72txQkAdyWxPY=; b=NM8lAo9EUKac2BgZ5fA2Rk+vbPUcAWXoyw6fnIAhfDaTp4A8mrZN1OY6DJ09JJdgni XklOU2aVgSYEPULZsiYmLPojaNFIHH7RYh9dR+FNaoHa7+oJUJC2U3VSyWxlyHEtEJ8D /DFDCU72NyEXVGbtayM4/xd1sOWuhogqXx20Gw9iN/uVwvGIaxqtJteqXlEa/flsUsz9 19HI7jNl8r4Qvtb1AHdrKm7Ofs7xKOMkewDL1wtGjvo5wc22M0LHC7HxtxuVTyIRCvxV 7SsPET4X3ySqfAl6uxswDbopOjj6B7TCD/+BGaSsf+IBd7EthnnW5UmKDCrEmWue8ikF +6Vg== X-Gm-Message-State: AOJu0YzNAfIY2D84dcrXYAktKOxUffb+IyJxB7hf2t6npWJhwAm1ykcD XYmS5gAT1YXTNdpv6zmhByB/y2w2DrVetKDd1Smj+gCOkWyMR2LdspX1tUCW8pi88LMAWzlTP29 HSPWpU+xBJDJOZP9+rR0YkSXoL7XWNpTPTJGCIfLcpd1P8Esxocf+BaYiq+L0MWsxIOrpYBwAj3 K5X/hj13ZkAA== X-Received: by 2002:a05:6808:2183:b0:3d2:1839:a5a8 with SMTP id 5614622812f47-3d24e9dc76amr14809552b6e.50.1718688507111; Mon, 17 Jun 2024 22:28:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFC9nRnPVC4xSMjn8wwM5Ka8bJNHi2TaoL4/K8A3pvZzYvDwOk4OJNpKGjLvqEuoak7nVK5IA== X-Received: by 2002:a05:6808:2183:b0:3d2:1839:a5a8 with SMTP id 5614622812f47-3d24e9dc76amr14809538b6e.50.1718688506692; Mon, 17 Jun 2024 22:28:26 -0700 (PDT) Received: from ThinkPad-X1.. (222-154-76-179-fibre.sparkbb.co.nz. [222.154.76.179]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-705ccb91b62sm8196865b3a.203.2024.06.17.22.28.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jun 2024 22:28:26 -0700 (PDT) From: Matthew Ruffell To: kernel-team@lists.ubuntu.com Subject: [SRU][Noble][PATCH 1/1] virtio-pci: Check if is_avq is NULL Date: Tue, 18 Jun 2024 17:28:18 +1200 Message-Id: <20240618052818.38993-2-matthew.ruffell@canonical.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240618052818.38993-1-matthew.ruffell@canonical.com> References: <20240618052818.38993-1-matthew.ruffell@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Li Zhang BugLink: https://bugs.launchpad.net/bugs/2067862 [bug] In the virtio_pci_common.c function vp_del_vqs, vp_dev->is_avq is involved to determine whether it is admin virtqueue, but this function vp_dev->is_avq may be empty. For installations, virtio_pci_legacy does not assign a value to vp_dev->is_avq. [fix] Check whether it is vp_dev->is_avq before use. [test] Test with virsh Attach device Before this patch, the following command would crash the guest system After applying the patch, everything seems to be working fine. Signed-off-by: Li Zhang Message-Id: <1710566754-3532-1-git-send-email-zhanglikernel@gmail.com> Signed-off-by: Michael S. Tsirkin (cherry picked from commit c8fae27d141a32a1624d0d0d5419d94252824498) Signed-off-by: Matthew Ruffell --- drivers/virtio/virtio_pci_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/virtio_pci_common.c index b655fccaf773..3c18fc14cd66 100644 --- a/drivers/virtio/virtio_pci_common.c +++ b/drivers/virtio/virtio_pci_common.c @@ -236,7 +236,7 @@ void vp_del_vqs(struct virtio_device *vdev) int i; list_for_each_entry_safe(vq, n, &vdev->vqs, list) { - if (vp_dev->is_avq(vdev, vq->index)) + if (vp_dev->is_avq && vp_dev->is_avq(vdev, vq->index)) continue; if (vp_dev->per_vq_vectors) {