From nobody Sat May 18 06:50:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1662719082; cv=none; d=zohomail.com; s=zohoarc; b=ATjxZLOJsrCXY2r4E2XhtAgz5AuHGXl172E/tDvTCipVMfkeAH6VDsK1q3uK1Q3uUxouaEFzMhIY+7s6hVfFoCxjwsnrj+n24lIDu14znOF5oN+aUXSKDIBLRInvxEDdg1l+BkPP9k4nOPmb+gftAT/Y8AN0gVFNFHCUm71zY3Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662719082; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=sSUlAVYH6Gf8aAog2W5wHnm7zoNDnmFGQUM7teLNNsA=; b=fcZx/WkZ94gs1pw/CzTMd74UWW5KN7wIKjWThVQHiyFlKpBwtlItqAZdWaO3o7KxQHYREC62gqzuedKK2JkgcIcxXNKO/SVYv57pWN22qLbSN/Wx0FXijOgkQv1IcGfyjXXlgWYIRspzWo8JFzWkTiBiJaeP269IJ761PGBvuhg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1662719082964102.83440328130712; Fri, 9 Sep 2022 03:24:42 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.404144.646490 (Exim 4.92) (envelope-from ) id 1oWbBK-00026N-52; Fri, 09 Sep 2022 10:24:18 +0000 Received: by outflank-mailman (output) from mailman id 404144.646490; Fri, 09 Sep 2022 10:24:18 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oWbBK-00026G-2B; Fri, 09 Sep 2022 10:24:18 +0000 Received: by outflank-mailman (input) for mailman id 404144; Fri, 09 Sep 2022 10:24:16 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oWbBI-00026A-O7 for xen-devel@lists.xenproject.org; Fri, 09 Sep 2022 10:24:16 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [2001:67c:2178:6::1c]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 8de7793d-3029-11ed-a31c-8f8a9ae3403f; Fri, 09 Sep 2022 12:24:15 +0200 (CEST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E4D8A336C8; Fri, 9 Sep 2022 10:24:14 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A197A13A93; Fri, 9 Sep 2022 10:24:14 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ZjAhJk4UG2MudwAAMHmgww (envelope-from ); Fri, 09 Sep 2022 10:24:14 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 8de7793d-3029-11ed-a31c-8f8a9ae3403f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1662719054; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=sSUlAVYH6Gf8aAog2W5wHnm7zoNDnmFGQUM7teLNNsA=; b=kK8ne8O9mGwA4z53kWxhZoS9PSUcQ45HpFs2FwaeGfjDHuD3beA7KjPuNrWvkgnyiNyZWw ciW2A4z62DDvYWvuaR7p9LNaGvQmF/DYPAuJwjs8DUjUN1/YP+K0iZvxF8fspKbdOyMCx4 X4QYZdYyk5DOLmC3pI1jWkLdDjTuwxY= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Henry.Wang@arm.com, Juergen Gross , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [PATCH v2] xen/gnttab: fix gnttab_acquire_resource() Date: Fri, 9 Sep 2022 12:24:13 +0200 Message-Id: <20220909102413.2899-1-jgross@suse.com> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1662719085099100001 Content-Type: text/plain; charset="utf-8" Commit 9dc46386d89d ("gnttab: work around "may be used uninitialized" warning") was wrong, as vaddrs can legitimately be NULL in case XENMEM_resource_grant_table_id_status was specified for a grant table v1. This would result in crashes in debug builds due to ASSERT_UNREACHABLE() triggering. Check vaddrs only to be NULL in the rc =3D=3D 0 case. Fixes: 9dc46386d89d ("gnttab: work around "may be used uninitialized" warni= ng") Signed-off-by: Juergen Gross Release-acked-by: Henry Wang Reviewed-by: Jan Beulich --- Might be considered for backporting --- xen/common/grant_table.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c index ad773a6996..fba329dcc2 100644 --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -4140,7 +4140,7 @@ int gnttab_acquire_resource( * on non-error paths, and hence it needs setting to NULL at the top o= f the * function. Leave some runtime safety. */ - if ( !vaddrs ) + if ( !rc && !vaddrs ) { ASSERT_UNREACHABLE(); rc =3D -ENODATA; --=20 2.35.3