Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6359101ybi; Mon, 8 Jul 2019 01:47:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqyPI5ZUsDwAis1TDCi8AVjXeGQHjdluASQ7suZ8JrG17NNP8USj1het96wU5D3WqJT07We2 X-Received: by 2002:a65:41c6:: with SMTP id b6mr21912651pgq.269.1562575628219; Mon, 08 Jul 2019 01:47:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562575628; cv=none; d=google.com; s=arc-20160816; b=IeAbytb1QyvtrZT/BvnptHvlZU9Rkg6c8splTxU8AfaI4QMF78Qru+tFn+yd6Gc1LA 9LbSx4SV4hiL5fw59dS/EdtJY1D0uslcssx0fjMgjUqP513sgiHEY9aSlPm7cjt6lgE8 eUmKLf/f2tTEUJAqJi882LSL5NXqB9b8EUQLiqW5dTrPh27BRD4UJlJe/dvO6d/8kLug IzDiFJf6yra5Q1d+/CKmKsB4z8jfPCG8N3z6clzi8W2oPjl7U/ajqRa1ZrVhNgyCQo5E agqEE26BUUzRsmmj+BKN2A87DOxzfIWX05YiYTQnJnyYghFI8ftOM8oDgIIHPZUEMNTw ltNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=ZVomXEQUFhgEvjhKDc1jUBg5qImU49X3svYvuKY8x2o=; b=SY7d2L7x8hYViKiRreiWDdOMySawa1Wm4gpVPJuTpAiFVb1Ysh6ST9jBRUG7GsZvxS W0tYNvFA95/zLsbdE4EyTkV86PVHt8PeWuAaAKYynKxVDGtY5Wwzqps6wY1pjpuFI779 cKgnhIN/EdJFRD02CPWC0hrFDIgTycZxoovSSwZE0vkSPEJvUJ0LSM8C580jJGi53BtA KoIJxs8YpyW3NYhCJp90x3bGeciEp5a7jmSI0VmU9GOATLzoMa3imhupiMmWasMHeiJZ o7QlD0dMGUSmoZyA8siux7dgpDk22xUmPlqevvGFA6aR9GKyUDJcpLVrYBClm3QAdHKH GHHA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c1si17808689pld.418.2019.07.08.01.46.54; Mon, 08 Jul 2019 01:47:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729070AbfGHG1Z (ORCPT + 99 others); Mon, 8 Jul 2019 02:27:25 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:40642 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728474AbfGHG1Z (ORCPT ); Mon, 8 Jul 2019 02:27:25 -0400 X-IronPort-AV: E=Sophos;i="5.63,465,1557180000"; d="scan'208";a="390824413" Received: from abo-12-105-68.mrs.modulonet.fr (HELO hadrien) ([85.68.105.12]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jul 2019 08:27:22 +0200 Date: Mon, 8 Jul 2019 08:27:22 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Wen Yang cc: linux-kernel@vger.kernel.org, xue.zhihong@zte.com.cn, wang.yi59@zte.com.cn, cheng.shengyu@zte.com.cn, Herbert Xu , "David S. Miller" , Thomas Gleixner , Greg Kroah-Hartman , Allison Randal , Armijn Hemel , Julia Lawall , linux-crypto@vger.kernel.org Subject: Re: [PATCH] crypto: crypto4xx: fix a potential double free in ppc4xx_trng_probe In-Reply-To: <1562566745-7447-2-git-send-email-wen.yang99@zte.com.cn> Message-ID: References: <1562566745-7447-1-git-send-email-wen.yang99@zte.com.cn> <1562566745-7447-2-git-send-email-wen.yang99@zte.com.cn> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Mon, 8 Jul 2019, Wen Yang wrote: > There is a possible double free issue in ppc4xx_trng_probe(): > > 85: dev->trng_base = of_iomap(trng, 0); > 86: of_node_put(trng); ---> released here > 87: if (!dev->trng_base) > 88: goto err_out; > ... > 110: ierr_out: > 111: of_node_put(trng); ---> double released here > ... > > This issue was detected by using the Coccinelle software. > We fix it by removing the unnecessary of_node_put(). > > Fixes: 5343e674f32 ("crypto4xx: integrate ppc4xx-rng into crypto4xx") > Signed-off-by: Wen Yang > Cc: Herbert Xu > Cc: "David S. Miller" > Cc: Thomas Gleixner > Cc: Greg Kroah-Hartman > Cc: Allison Randal > Cc: Armijn Hemel > Cc: Julia Lawall > Cc: linux-crypto@vger.kernel.org > Cc: linux-kernel@vger.kernel.org Acked-by: Julia Lawall > --- > drivers/crypto/amcc/crypto4xx_trng.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/drivers/crypto/amcc/crypto4xx_trng.c b/drivers/crypto/amcc/crypto4xx_trng.c > index 02a6bed3..f10a87e 100644 > --- a/drivers/crypto/amcc/crypto4xx_trng.c > +++ b/drivers/crypto/amcc/crypto4xx_trng.c > @@ -108,7 +108,6 @@ void ppc4xx_trng_probe(struct crypto4xx_core_device *core_dev) > return; > > err_out: > - of_node_put(trng); > iounmap(dev->trng_base); > kfree(rng); > dev->trng_base = NULL; > -- > 2.9.5 > >