From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hillf Danton Subject: [patch 1/2] xen/arm: Free p2m entry if fail to add it to RB tree Date: Tue, 30 Apr 2019 13:31:46 +0800 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2639545842258205581==" Return-path: Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hLLMz-0002Pi-8e for xen-devel@lists.xenproject.org; Tue, 30 Apr 2019 05:31:57 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" To: "xen-devel@lists.xenproject.org" Cc: "Stefano Stabellini " List-Id: xen-devel@lists.xenproject.org --===============2639545842258205581== Content-Type: multipart/alternative; boundary="_253F6C7A-9E51-4DD6-A5AD-72DE243D1479_" --_253F6C7A-9E51-4DD6-A5AD-72DE243D1479_ Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Release the newly allocated p2m entry if we detect a duplicate in the RB tr= ee. Cc: Stefano Stabellini Signed-off-by: Hillf Danton --- --- a/arch/arm/xen/p2m.c 2019-04-30 12:32:05.363768200 +0800 +++ b/arch/arm/xen/p2m.c 2019-04-30 12:41:29.774041800 +0800 @@ -156,6 +156,7 @@ bool __set_phys_to_machine_multi(unsigne rc =3D xen_add_phys_to_mach_entry(p2m_entry); if (rc < 0) { write_unlock_irqrestore(&p2m_lock, irqflags); + kfree(p2m_entry); return false; } write_unlock_irqrestore(&p2m_lock, irqflags); -- --_253F6C7A-9E51-4DD6-A5AD-72DE243D1479_ Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset="utf-8"

Release the newly allocated p2m entry if we det= ect a duplicate in the RB tree.

 

Cc: Stefano Stabellini <sstabellini@kernel.org>

Signed-off-by: Hillf Danton <hdanton@sin= a.com>

---

<= p class=3DMsoNormal> 

--- a/arch/arm/xen/p2m.c 2019-04-30 12:32:0= 5.363768200 +0800

+++ b/a= rch/arm/xen/p2m.c=C2=A0=C2=A0=C2=A0 2019-04-30 12:41:29.774041800 +0800

@@ -156,6 +156,7 @@ bool __s= et_phys_to_machine_multi(unsigne

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 rc =3D xen_add_phys_to_mach_e= ntry(p2m_entry);

=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (rc < 0) {

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 write_unlock_irqrestore(&p2m_lock, irqflags);

+=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 kfree(p2m_entry);

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 return false;

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 write_unlo= ck_irqrestore(&p2m_lock, irqflags);

--=

 <= /span>

= --_253F6C7A-9E51-4DD6-A5AD-72DE243D1479_-- --===============2639545842258205581== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVucHJvamVjdC5vcmcKaHR0cHM6Ly9saXN0 cy54ZW5wcm9qZWN0Lm9yZy9tYWlsbWFuL2xpc3RpbmZvL3hlbi1kZXZlbA== --===============2639545842258205581==-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2581DC43219 for ; Tue, 30 Apr 2019 05:34:33 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ECC282075E for ; Tue, 30 Apr 2019 05:34:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ECC282075E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hLLPA-0002T5-LA; Tue, 30 Apr 2019 05:34:12 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hLLMz-0002Pi-8e for xen-devel@lists.xenproject.org; Tue, 30 Apr 2019 05:31:57 +0000 X-Inumbo-ID: 424304b2-6b09-11e9-a134-33d201d1d3c3 Received: from mail3-167.sinamail.sina.com.cn (unknown [202.108.3.167]) by us1-amaz-eas2.inumbo.com (Halon) with SMTP id 424304b2-6b09-11e9-a134-33d201d1d3c3; Tue, 30 Apr 2019 05:31:53 +0000 (UTC) Received: from unknown (HELO [IPv6:::ffff:192.168.199.155])([222.131.69.26]) by sina.com with ESMTP id 5CC7DDC400007A6F; Tue, 30 Apr 2019 13:31:50 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com X-SMAIL-MID: 170313394052 MIME-Version: 1.0 To: "xen-devel@lists.xenproject.org" From: Hillf Danton Date: Tue, 30 Apr 2019 13:31:46 +0800 Importance: normal X-Priority: 3 X-Mailman-Approved-At: Tue, 30 Apr 2019 05:34:11 +0000 Subject: [Xen-devel] [patch 1/2] xen/arm: Free p2m entry if fail to add it to RB tree X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: "Stefano Stabellini " Content-Type: multipart/mixed; boundary="===============2639545842258205581==" Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Message-Id: Message-ID: <20190430053146.-pz0q9jaWa0hBD0Ee6PCQwvNOxq02WswfLPCZ7VVzk4@z> --===============2639545842258205581== Content-Type: multipart/alternative; boundary="_253F6C7A-9E51-4DD6-A5AD-72DE243D1479_" --_253F6C7A-9E51-4DD6-A5AD-72DE243D1479_ Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Release the newly allocated p2m entry if we detect a duplicate in the RB tr= ee. Cc: Stefano Stabellini Signed-off-by: Hillf Danton --- --- a/arch/arm/xen/p2m.c 2019-04-30 12:32:05.363768200 +0800 +++ b/arch/arm/xen/p2m.c 2019-04-30 12:41:29.774041800 +0800 @@ -156,6 +156,7 @@ bool __set_phys_to_machine_multi(unsigne rc =3D xen_add_phys_to_mach_entry(p2m_entry); if (rc < 0) { write_unlock_irqrestore(&p2m_lock, irqflags); + kfree(p2m_entry); return false; } write_unlock_irqrestore(&p2m_lock, irqflags); -- --_253F6C7A-9E51-4DD6-A5AD-72DE243D1479_ Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset="utf-8"

Release the newly allocated p2m entry if we det= ect a duplicate in the RB tree.

 

Cc: Stefano Stabellini <sstabellini@kernel.org>

Signed-off-by: Hillf Danton <hdanton@sin= a.com>

---

<= p class=3DMsoNormal> 

--- a/arch/arm/xen/p2m.c 2019-04-30 12:32:0= 5.363768200 +0800

+++ b/a= rch/arm/xen/p2m.c=C2=A0=C2=A0=C2=A0 2019-04-30 12:41:29.774041800 +0800

@@ -156,6 +156,7 @@ bool __s= et_phys_to_machine_multi(unsigne

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 rc =3D xen_add_phys_to_mach_e= ntry(p2m_entry);

=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (rc < 0) {

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 write_unlock_irqrestore(&p2m_lock, irqflags);

+=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 kfree(p2m_entry);

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 return false;

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 write_unlo= ck_irqrestore(&p2m_lock, irqflags);

--=

 <= /span>

= --_253F6C7A-9E51-4DD6-A5AD-72DE243D1479_-- --===============2639545842258205581== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVucHJvamVjdC5vcmcKaHR0cHM6Ly9saXN0 cy54ZW5wcm9qZWN0Lm9yZy9tYWlsbWFuL2xpc3RpbmZvL3hlbi1kZXZlbA== --===============2639545842258205581==--