From nobody Tue Feb 10 16:58:03 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1691588460998861.047261968564; Wed, 9 Aug 2023 06:41:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qTjPH-0002lZ-O0; Wed, 09 Aug 2023 09:39:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qTjPF-0002k0-IB; Wed, 09 Aug 2023 09:39:21 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qTjPC-0002hL-Vh; Wed, 09 Aug 2023 09:39:21 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id CC8315C012C; Wed, 9 Aug 2023 09:39:15 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Wed, 09 Aug 2023 09:39:15 -0400 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Aug 2023 09:39:14 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irrelevant.dk; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1691588355; x= 1691674755; bh=wCay5dbNnQDqO2GlNeVpeAedGu4LOH6JZR1cxTrIzyY=; b=P jXgM+BNUORCR7XZW1uoPtoA7CZv80QiotoAapW6yqyhZsSYW8nyZuCKN/gr1PzRK auPSyS8kqcM7xSzkAUqoZ6ArJc5MYmsv0eqPH6wsDd+waSeQddafsP4e6i3r/p5r d6eRj5QECAB2Nt/reqgUv/M02BpTHBYo6CTLCG0Jqo5icL0NP7yPH9w0xQhLNfZb AJOboLJeKK0PwhHDKBtBBZyyCiE8QwRtpoDljj1D4JuuT/KnTQKMTeZBYFDZs4iK ilzbvmIIx3oDZIpDBku6IclphHrbw8C/jn0sQl8lmYaBN/K0q7o6iF5wZAp5Ul/0 j3t4bNHZkFJPYBYLuPLcQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1691588355; x= 1691674755; bh=wCay5dbNnQDqO2GlNeVpeAedGu4LOH6JZR1cxTrIzyY=; b=N ZXIMeBzNXLurO1TD0+OMF6T87uDv72v6Q/GX7vUeoHhuO2e3kHopcz+2Y5kzYggn 0KMfq0hRc01N08BiNfMgie/AhD/dftCnve7A/UMATztcTzumoYnBTMBD+L/zNZsv iG27m+G01SoFvrEv5rOBl3YMDIo1Ku0mGBqHRPtZE1n2YGF8SMc/jCxO013X7GLf siANLLuu6AxC2CWBYa8dpfZbd0Q/GB1nnORNPvn13iE6BPvQVO+13SzCOgYwHxgo bMFubYxyu0TOJzzyfcMk75wUQdrvHGvKHb/Koh1AFlUDDNEB2TG0TcWmm0edyFdv agSkSww6u+wij9igXbkmg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrleeggdeihecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefmlhgruhhs ucflvghnshgvnhcuoehithhssehirhhrvghlvghvrghnthdrughkqeenucggtffrrghtth gvrhhnpeefheetgeehffefgeekgffhgeeijeekveffhfejveefkeduieeiveehteeludej udenucffohhmrghinhepghhithhlrggsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepihhtshesihhrrhgvlhgvvhgrnhhtrdgukh X-ME-Proxy: Feedback-ID: idc91472f:Fastmail From: Klaus Jensen To: Richard Henderson , qemu-devel@nongnu.org Cc: Klaus Jensen , qemu-block@nongnu.org, Keith Busch , Klaus Jensen , qemu-stable@nongnu.org, Jesper Wendel Devantier Subject: [PULL 1/2] hw/nvme: fix null pointer access in directive receive Date: Wed, 9 Aug 2023 15:39:11 +0200 Message-ID: <20230809133909.45818-5-its@irrelevant.dk> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230809133909.45818-4-its@irrelevant.dk> References: <20230809133909.45818-4-its@irrelevant.dk> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1180; i=k.jensen@samsung.com; h=from:subject; bh=8zxP4G6hW0k+nMxUcpBk6P+QkGbwFl0Xn43SbCWW3Fw=; b=owJ4nAFtAZL+kA0DAAoBTeGvMW1PDekByyZiAGTTlv6M3bujKrYRAAelElbz+RSpdsCkbpD/8 Htl+/pVtzWFmokBMwQAAQoAHRYhBFIoM6p14tzmokdmwE3hrzFtTw3pBQJk05b+AAoJEE3hrzFt Tw3pIg4H/1B6mIfmHeDCDOrNVWd/+vyzbZaGWL/HyrAalRJDMJnjD2U4c2J2JwU5EWil0EiL/Pu sy8oZ/AQQw0qo+Vm2/GwG+1hYo0OIr091dZR36gZieouoL4QrfQsBHyTmE+SGzLPubJuEqU6oew Va76YjX/Ge+sj3OTRWxJ11ASaXPyGduPXfP4ClaXoN6wCzOZIRCXqZcg47EQM9AxJ1RNabFPmw9 f2wJR+Ucwf2JbPds1DgrrjcOXp5HKvSLJDlRFUe6UYH3Mg4LaP9dXWYLjVFxGPyaWsQXs3KBuvu Uqdntnf1pjWqG4U637sscHqbsMxPwSnMMbkTr9KBKvBkPBqb0yan5KtC X-Developer-Key: i=k.jensen@samsung.com; a=openpgp; fpr=DDCA4D9C9EF931CC3468427263D56FC5E55DA838 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=66.111.4.29; envelope-from=its@irrelevant.dk; helo=out5-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1691588462715100003 Content-Type: text/plain; charset="utf-8" From: Klaus Jensen nvme_directive_receive() does not check if an endurance group has been configured (set) prior to testing if flexible data placement is enabled or not. Fix this. Cc: qemu-stable@nongnu.org Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1815 Fixes: 73064edfb864 ("hw/nvme: flexible data placement emulation") Reviewed-by: Jesper Wendel Devantier Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index d217ae91b506..e5b5c7034d2b 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -6900,7 +6900,7 @@ static uint16_t nvme_directive_receive(NvmeCtrl *n, N= vmeRequest *req) case NVME_DIRECTIVE_IDENTIFY: switch (doper) { case NVME_DIRECTIVE_RETURN_PARAMS: - if (ns->endgrp->fdp.enabled) { + if (ns->endgrp && ns->endgrp->fdp.enabled) { id.supported |=3D 1 << NVME_DIRECTIVE_DATA_PLACEMENT; id.enabled |=3D 1 << NVME_DIRECTIVE_DATA_PLACEMENT; id.persistent |=3D 1 << NVME_DIRECTIVE_DATA_PLACEMENT; --=20 2.41.0