Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6357813ybi; Mon, 8 Jul 2019 01:45:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqxZVNmCFdSSo+x4NrtTRdDJQwN5Wtkvb2GMeLma6giyfiENc+PM2AgGjKCZWZlDy0fZuZ70 X-Received: by 2002:a63:5107:: with SMTP id f7mr21748506pgb.266.1562575534820; Mon, 08 Jul 2019 01:45:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562575534; cv=none; d=google.com; s=arc-20160816; b=Dcwq7Tr9YU5rpnDhtWiNxAEzEVMTMD3NoUnPsh9892VnyfLGRrVU6l1RYfMXAZd5X3 +AtEwkUn53Z6eTJgkiCgQdgGxwOiDu78sG0+xGk7UKLa6wamrdNvvP7/xsgRu38LWGPI WAMubxT6LPCzR3Kd7b2eUNUP86pIt/F9bRzUboTQdvV2W49+FQJCHHfAzqlP3pXCFDra xrDHK8eREoFCfsSRFz/SNyXsvjKKV0ooG9b8yiu7en55q2pIUmUDN9VPO/u1Nn/yqJUS yo04y/YEkv1Y/MgAwjxCUnUMZoc39UaPrq/v40OCwlpbvSXPOGYRNdvjPEjIpuAsPXtQ aWvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=BvQrDH6spatKzD0JdEGYDqiijI9eRAgfEd0yjy1DQQk=; b=aevOs7lytQf+M+hp0tio+Kcpx05wrWdqTeX1gf2E1T7bHTK/SGsCK8g7B2PjdslAOM gviPGamKj380md1D3UIcaDNZEDbP6HIHjG+1QYO5axK/y9jDWSORBhHrwULVDULDA/oR OlvDhi7vYXUgFnE8Q4V5mzJnG9kkkE+tz/cUntK6GWDLsIWJy6i8tv4Uiw27gXgn837S 1Frzp2f31Rp8x1ApPaTPhOx1iGJ31AZ98mnXXA2MC6wGZpgvZtVA/WBcwOjq9H+7OO8+ 7ZZQrWwURt9f5/cG+HE1aXJnPNALJMT5ccGNhJB9TFy1XU+B6oSHY+E3DKXxrFKAGZEe uX7g== 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 u185si15854071pgd.561.2019.07.08.01.45.12; Mon, 08 Jul 2019 01:45:34 -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 S1729073AbfGHGVS (ORCPT + 99 others); Mon, 8 Jul 2019 02:21:18 -0400 Received: from mxhk.zte.com.cn ([63.217.80.70]:24398 "EHLO mxhk.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727218AbfGHGVR (ORCPT ); Mon, 8 Jul 2019 02:21:17 -0400 Received: from mse-fl2.zte.com.cn (unknown [10.30.14.239]) by Forcepoint Email with ESMTPS id 1146F7C42D795FFB758E; Mon, 8 Jul 2019 14:21:16 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse-fl2.zte.com.cn with ESMTP id x686KmPG049233; Mon, 8 Jul 2019 14:20:48 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019070814205197-2164427 ; Mon, 8 Jul 2019 14:20:51 +0800 From: Wen Yang To: linux-kernel@vger.kernel.org Cc: xue.zhihong@zte.com.cn, wang.yi59@zte.com.cn, cheng.shengyu@zte.com.cn, Wen Yang , Herbert Xu , "David S. Miller" , Thomas Gleixner , Greg Kroah-Hartman , Allison Randal , Armijn Hemel , Julia Lawall , linux-crypto@vger.kernel.org Subject: [PATCH] crypto: crypto4xx: fix a potential double free in ppc4xx_trng_probe Date: Mon, 8 Jul 2019 14:19:03 +0800 Message-Id: <1562566745-7447-2-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1562566745-7447-1-git-send-email-wen.yang99@zte.com.cn> References: <1562566745-7447-1-git-send-email-wen.yang99@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-07-08 14:20:52, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-07-08 14:20:49, Serialize complete at 2019-07-08 14:20:49 X-MAIL: mse-fl2.zte.com.cn x686KmPG049233 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org 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 --- 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