From nobody Fri May 17 11:28:42 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=1663252333; cv=none; d=zohomail.com; s=zohoarc; b=epL35wPuzh6t13gHIywOHh8sa7rJxwFuAScuaokZycqepuvRW7+6lThnjjFqRpP4TVW6jWAQkgrfw5fkVJ6nDJgYWlG2Q8JsHS4ZL1K4unMeU1f+ChBZ04UOEJdteqIjNBbH05uAgqWo1gJ1Mn+WRH99Or5tVjMt9JSiyPt+ni8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663252333; 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=dzoAgu6mheUOzlynwIyePFbncbuBp9hucJwC4AGAEMg=; b=Poticn55YwLnLHHaOTrWNQ2v67S6aDLqtaHC5O7hNWp96/eEOP/2bU6T+mVXAmTGYXrNLQP1W0LHcL7FqHLv2su0/RVI0u212cSmucl9/dm6I2jVnSA9sfkWG8B2OrdY4CUQIu3iQ4e+IYoj+VWu/229FLTUkeTzPjn39oSDFNU= 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 166325233353055.79594196464143; Thu, 15 Sep 2022 07:32:13 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.407446.649976 (Exim 4.92) (envelope-from ) id 1oYpu4-0003i1-Cf; Thu, 15 Sep 2022 14:31:44 +0000 Received: by outflank-mailman (output) from mailman id 407446.649976; Thu, 15 Sep 2022 14:31:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oYpu4-0003hu-9m; Thu, 15 Sep 2022 14:31:44 +0000 Received: by outflank-mailman (input) for mailman id 407446; Thu, 15 Sep 2022 14:31:42 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oYpu2-0003hV-Kh for xen-devel@lists.xenproject.org; Thu, 15 Sep 2022 14:31:42 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 1d4e6c5c-3503-11ed-9761-273f2230c3a0; Thu, 15 Sep 2022 16:31:41 +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-out2.suse.de (Postfix) with ESMTPS id D1CD31F8AF; Thu, 15 Sep 2022 14:31:40 +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 9DA73133B6; Thu, 15 Sep 2022 14:31:40 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id DRsmJUw3I2OVegAAMHmgww (envelope-from ); Thu, 15 Sep 2022 14:31:40 +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: 1d4e6c5c-3503-11ed-9761-273f2230c3a0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1663252300; 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=dzoAgu6mheUOzlynwIyePFbncbuBp9hucJwC4AGAEMg=; b=cBu5DlTCREcpIg2AL2xFilshrjAlZTvrjdO687YcesK9GrOmCA581P3FxwwuYLrZ+YkHpE Sf7gTfCFQhBDBDudEhF0MI7TmSLcA60AMgyUI28s9e2hH5T3IFxj25WBCY7sZwFQXroC3E yL1W20RErwozixvr7renhuJpHHkbSjI= From: Juergen Gross To: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org Cc: Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko , stable@vger.kernel.org, Sander Eikelenboom Subject: [PATCH] xen/xenbus: fix xenbus_setup_ring() Date: Thu, 15 Sep 2022 16:31:37 +0200 Message-Id: <20220915143137.1763-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: 1663252336160100001 Content-Type: text/plain; charset="utf-8" Commit 4573240f0764 ("xen/xenbus: eliminate xenbus_grant_ring()") introduced an error for initialization of multi-page rings. Cc: stable@vger.kernel.org Fixes: 4573240f0764 ("xen/xenbus: eliminate xenbus_grant_ring()") Reported-by: Sander Eikelenboom Signed-off-by: Juergen Gross Reviewed-by: Jan Beulich Reviewed-by: Oleksandr Tyshchenko --- drivers/xen/xenbus/xenbus_client.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus= _client.c index d5f3f763717e..caa5c5c32f8e 100644 --- a/drivers/xen/xenbus/xenbus_client.c +++ b/drivers/xen/xenbus/xenbus_client.c @@ -382,9 +382,10 @@ int xenbus_setup_ring(struct xenbus_device *dev, gfp_t= gfp, void **vaddr, unsigned long ring_size =3D nr_pages * XEN_PAGE_SIZE; grant_ref_t gref_head; unsigned int i; + void *addr; int ret; =20 - *vaddr =3D alloc_pages_exact(ring_size, gfp | __GFP_ZERO); + addr =3D *vaddr =3D alloc_pages_exact(ring_size, gfp | __GFP_ZERO); if (!*vaddr) { ret =3D -ENOMEM; goto err; @@ -401,13 +402,15 @@ int xenbus_setup_ring(struct xenbus_device *dev, gfp_= t gfp, void **vaddr, unsigned long gfn; =20 if (is_vmalloc_addr(*vaddr)) - gfn =3D pfn_to_gfn(vmalloc_to_pfn(vaddr[i])); + gfn =3D pfn_to_gfn(vmalloc_to_pfn(addr)); else - gfn =3D virt_to_gfn(vaddr[i]); + gfn =3D virt_to_gfn(addr); =20 grefs[i] =3D gnttab_claim_grant_reference(&gref_head); gnttab_grant_foreign_access_ref(grefs[i], dev->otherend_id, gfn, 0); + + addr +=3D PAGE_SIZE; } =20 return 0; --=20 2.35.3