Message ID | 20220802095010.3330793-4-alex.bennee@linaro.org |
---|---|
State | Superseded |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a05:7000:b345:0:0:0:0 with SMTP id w5csp4196079maz; Tue, 2 Aug 2022 02:53:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR4TTj/CuBtX0i33MNIjMhF8d6wJWaNjivcjJjFi2U3rxtV0/qnqQ1xmreCjvFYpLJ+PTwmL X-Received: by 2002:a05:6214:2aa7:b0:474:62ce:3e70 with SMTP id js7-20020a0562142aa700b0047462ce3e70mr17736606qvb.79.1659434022270; Tue, 02 Aug 2022 02:53:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659434022; cv=none; d=google.com; s=arc-20160816; b=aIFMs6isoFJMJ8LaUZlONhn3+o3SZSAvFeVRRxkZYga9xzt/qrafrFcKJ/qHd74eoU 7BaHeH0YFXj9sV8UXBjNEAoRfiOp7ykn3/DaJR4znLrt4n6OLUer7VhLfHePLFWbsZL+ kaeESDmPeLnkMUtrh8uSfYjtb+LnweEuEq5FRTCImEU12bHvZ6egnA/WnDYiNwmriw0m hJQ7VzYpaeLRhaBtpseh1WG8KH1bEig61MB8OBK7oGB7V/b5AAGYdnLVF3KlSW3Kmric N6HJvJbFOqxrsQV00742cg6IZVPLUfEaTLtBKNrF6Jqv7KJla+Cki4YQXonsFV2ZrAbx 76QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qn9sIffAzV9IF+yjjzIzifr78tit+1ZOBIt0UyqO2Rk=; b=xfwjWMWPsaE+sO1vZEVzlkG+I15gBhEKT3FuKOVQeodt71SS87PnvSrKMQ520Rq2os ggKH8B9PeuetjwjjXzEAOj6Yk44Qe/gpKdrM5RefYtfz4EnWxt+JBKSS+tnAvk08pZeQ h2nmGmAB3Dhmtaa+qN0xDYoOt1UZnSgUUi5kkUCWvpoqX591sQ5KwrYmLYSfl5Okko++ tcmz1rnI8ckqmgB3taLb87l9HWXf/VqiWN3zr/VImtu5oAB6xYvNu3ZJhK5EUh5S+F44 cOr+KmR9Ommry0XImlTOBhHc0AefZKyNllnNeMuXgS1L7r8cGZVBI/GagOHc5NvxMGkd 7Lsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=efF1G23J; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: <qemu-devel-bounces+patch=linaro.org@nongnu.org> Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id dt35-20020a05620a47a300b006b5d3382524si8505696qkb.79.2022.08.02.02.53.42 for <patch@linaro.org> (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Aug 2022 02:53:42 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=efF1G23J; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49070 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <qemu-devel-bounces+patch=linaro.org@nongnu.org>) id 1oIoar-0006dM-RN for patch@linaro.org; Tue, 02 Aug 2022 05:53:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33378) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <alex.bennee@linaro.org>) id 1oIoXc-0001HL-Ct for qemu-devel@nongnu.org; Tue, 02 Aug 2022 05:50:22 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:43918) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <alex.bennee@linaro.org>) id 1oIoXa-0002ND-QD for qemu-devel@nongnu.org; Tue, 02 Aug 2022 05:50:20 -0400 Received: by mail-wr1-x42a.google.com with SMTP id bk11so7303294wrb.10 for <qemu-devel@nongnu.org>; Tue, 02 Aug 2022 02:50:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=qn9sIffAzV9IF+yjjzIzifr78tit+1ZOBIt0UyqO2Rk=; b=efF1G23JZGBcKIp6YkFQGGk2fqRXWagTopKygNR1po59PbUd4t45kjdbsNpQhdOIp9 rN4irGKpt3YfkzxMTiDaMJ1gRkwHo5wHg4a+OVZVXS3SN8lu3nr5N0pl7t3szYTXZwOM /rQAm8SdInJ9UZ+MW0XKnCUhAybH98awbs0Q8X99VLNlAyPMZL3UIOdA9RHfmmKWfw8I HWV/UOlnuNz21LKpw/rHYto1QW+w/hm4IVU02VKdWQ99bCT6EdzCDERwei6OuUmIeSvQ PsFwuzZ+xjrcOXyyiaJtJ/ZaU9qmhkaaKDf1PfQcrEnxIEXz7W3C49pzS+k4GC68xNiS XbZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=qn9sIffAzV9IF+yjjzIzifr78tit+1ZOBIt0UyqO2Rk=; b=MqciDGsmCi3P6IDoIwBr/03QBlHpEm0ihyczULxavqclrkp8iF/6z6AeZGP0GXehFI lZui+GZZzpwthTStKoXlbH2ctG1EkrTLortkHq48G3j7GvYboRrp0dDFEMR9qWJ4mKr8 HiaPky4Beirv6gqadIXBdAjqF/HjFBjOOK2J7ojItcwOy2dER5gPZXbA0oiLHosPP3cz gBksLLRIzE+sTtXC4XtAqkJ1iCzl8Gj5/M09lEVgvb9gLnPGHLAzHxuahx2/TWG2PfKw ADG19A6OesABejUf1Dz01BtfCPi8u1LBYEXhMY7BMgvHROxh2auD+AL3LWEJRxLY59o0 PtfA== X-Gm-Message-State: ACgBeo0yA5c0cZvB1fUZHKOEfY7Cw6UoXfmF6cbAhDmw67eiypoexg3B W0/VHkiH8U2vQWR/ASlR+fGsyA== X-Received: by 2002:a5d:6e89:0:b0:21e:ad87:ab24 with SMTP id k9-20020a5d6e89000000b0021ead87ab24mr12832977wrz.259.1659433817294; Tue, 02 Aug 2022 02:50:17 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id d10-20020a5d6dca000000b0021b956da1dcsm14528615wrz.113.2022.08.02.02.50.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Aug 2022 02:50:11 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id ECB611FFBB; Tue, 2 Aug 2022 10:50:10 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= <alex.bennee@linaro.org> To: qemu-devel@nongnu.org Cc: slp@redhat.com, mst@redhat.com, marcandre.lureau@redhat.com, stefanha@redhat.com, mathieu.poirier@linaro.org, viresh.kumar@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= <alex.bennee@linaro.org> Subject: [PATCH v4 03/22] hw/virtio: handle un-configured shutdown in virtio-pci Date: Tue, 2 Aug 2022 10:49:51 +0100 Message-Id: <20220802095010.3330793-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220802095010.3330793-1-alex.bennee@linaro.org> References: <20220802095010.3330793-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" <qemu-devel-bounces+patch=linaro.org@nongnu.org> |
Series |
virtio-gpio and various virtio cleanups
|
expand
|
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 45327f0b31..5ce61f9b45 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -996,9 +996,14 @@ static int virtio_pci_set_guest_notifiers(DeviceState *d, int nvqs, bool assign) nvqs = MIN(nvqs, VIRTIO_QUEUE_MAX); - /* When deassigning, pass a consistent nvqs value - * to avoid leaking notifiers. + /* + * When deassigning, pass a consistent nvqs value to avoid leaking + * notifiers. But first check we've actually been configured, exit + * early if we haven't. */ + if (!assign && !proxy->nvqs_with_notifiers) { + return 0; + } assert(assign || nvqs == proxy->nvqs_with_notifiers); proxy->nvqs_with_notifiers = nvqs;
The assert() protecting against leakage is a little aggressive and causes needless crashes if a device is shutdown without having been configured. In this case no descriptors are lost because none have been assigned. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20220726192150.2435175-9-alex.bennee@linaro.org> --- hw/virtio/virtio-pci.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)