Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp5212976ybi; Tue, 30 Jul 2019 16:15:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqztEh1J6d0TzuO5o3mK8nWuw+oxTZBXoPpjuE9px7KBcncwTJ08auvFunceKN4o/wqstZW3 X-Received: by 2002:a17:90a:c20e:: with SMTP id e14mr79528566pjt.0.1564528543294; Tue, 30 Jul 2019 16:15:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564528543; cv=none; d=google.com; s=arc-20160816; b=NfD6ZBHNCApUeff9H0R393B6p9Ac1wOyaNfDCo9Fe6HHnoZ8V9JNgzcwM3ulF9WUKf lEKIZ6ubksg72Zf3X5tl6GtQ4Ey9j+2fhpbxZoGmA2Jgq2cMHtDRsRmW8cZ8RNv3/bcW VlyGpu8gIJUVyqUfDSZuP1YVBSCzkkK692qphQYYgqNf+aIKFcUmqXxd7E1avokbIol5 DRrXhI0cUVpPf15gHM0fGuqqHpqqAxyIbRKr+g0S55Kk+InrVL85av3gy1M7LEmWuLJv 44YvGsPBFlptiVyx7od8ulFiDmILwWf8Q+lo9qvXPxLIwqZ5ARQg9f8ySuuTPRzZocJ2 m4uA== 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:dkim-signature; bh=OThpbHHUC3Uzer47hD7L3j/FRmubmQM25l1ctW+M5BU=; b=qzn/RAUD/+2qFUgSRhPCcISlKa7IHsj7XKw9DlmJZVBjtj+XbKky+OaY1CJFJEDABA KYJMfWcnK4dWd75/FxGW1aUWpjjx0pF5LgFRXlbQURuZvUtjwlrts4YuegpJ1W+GV5Z2 SWkzIRRdiE2TwJhBwr8IfCXnKWTVbutb27cTkJxY31Mh+wzlQCHYYsJi2sDjPIsCOEag XGTICye6zPRRkIKVy8YOd6FCPYDUBstKJ8Lam0gA8UGUXVINf2Z/8N0r1dxIY8smRpfz QpiSzDp/fyi/71ezikfIYDRv98mbsXFhFPZUK468Kd44lnWZUJLJSGJ9rlhNJb7dT/Cg oSTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r8dUP1oL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j62si30428839pgd.170.2019.07.30.16.15.28; Tue, 30 Jul 2019 16:15:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r8dUP1oL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387426AbfG3USo (ORCPT + 99 others); Tue, 30 Jul 2019 16:18:44 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:46196 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387415AbfG3USo (ORCPT ); Tue, 30 Jul 2019 16:18:44 -0400 Received: by mail-pf1-f194.google.com with SMTP id c3so7276507pfa.13 for ; Tue, 30 Jul 2019 13:18:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OThpbHHUC3Uzer47hD7L3j/FRmubmQM25l1ctW+M5BU=; b=r8dUP1oLoX0rI48nRr1wJzR/hiT/S/F2zl9Bq+7xNScYAqfJx8N3acI3fd/F8rohVa GXDj71uXTTj2xTlKFLwVcf6xa8TbbPYVWd8rCCL2gXHooMQM+/OR4GpDKKfZPmdj7cxd WIAnWQFero52o3ektOrPJFRzte1MaZobdhlpCz8F2QsuRogS/uqKLcWtICfDyTXRF4W2 VcyXIGBJgyRIcmONu3tKMwiDG7fa5pxs4motMKoFwH7ZBu6MARvmKRR/siAHqTbiDl5X rTIFtdvXX4i6PDi7SHuySl9gZGIl6gO6MztR2nwWiS3ev78DY0Q1iDKB/yQpoj58S/W7 u0vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=OThpbHHUC3Uzer47hD7L3j/FRmubmQM25l1ctW+M5BU=; b=YTi1smuAv0o9vKTzYOvLg9uMOZd4bzb9wX+66rgO5QGaDsZe3v2Me3FsEzdqp8/B/m tUG0wvEKq9VA7r+pVt4OHqsSujOx8JcGMJDZKOiIJyiewnp2jt+ejpIiYxdjk1lWcwDl mjG5z2oizJPKMi6zQT+z0ezZw1Tadoq2sV9UFgFtg3HmFcWfLfAVKLPGl5lb0WRDk0M5 DqC5IiEg4hUrP5YJxIVD2c/VQz1qaF73SYmi4pVJlWq1y4IxgWEDw9Ekg+rXXmfC/Gw+ ZcZ98IDa7yQKTc4Syu872sg1Bz7ZfyaXN1w1sJr04dxEZS94gaP1fxY9Xq9SZVFQkaqN 9oBQ== X-Gm-Message-State: APjAAAUtASrkGPO9UCE1oQ07NUGGA81XQ4bZX1GgQYnIL0EPch/dkA84 2qQSkG1cw2gp+8+KTn1Q74hAsVhWKDg= X-Received: by 2002:a62:3c3:: with SMTP id 186mr43545291pfd.21.1564517923708; Tue, 30 Jul 2019 13:18:43 -0700 (PDT) Received: from localhost.localdomain ([49.207.49.136]) by smtp.gmail.com with ESMTPSA id r75sm88113177pfc.18.2019.07.30.13.18.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 30 Jul 2019 13:18:42 -0700 (PDT) From: Amit Pundir To: Greg KH Cc: Stable , Wen Yang , "David S. Miller" , Thomas Gleixner , Allison Randal , Armijn Hemel , Julia Lawall , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, Herbert Xu Subject: [PATCH for-4.14.y 3/3] crypto: crypto4xx - fix a potential double free in ppc4xx_trng_probe Date: Wed, 31 Jul 2019 01:48:33 +0530 Message-Id: <1564517913-17164-3-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1564517913-17164-1-git-send-email-amit.pundir@linaro.org> References: <1564517913-17164-1-git-send-email-amit.pundir@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wen Yang commit 95566aa75cd6b3b404502c06f66956b5481194b3 upstream. 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: 5343e674f32f ("crypto4xx: integrate ppc4xx-rng into crypto4xx") Signed-off-by: Wen Yang Cc: 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 Signed-off-by: Herbert Xu Signed-off-by: Amit Pundir --- Cleanly apply on 4.9.y as well. 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 368c5599515e..a194ee0ddbb6 100644 --- a/drivers/crypto/amcc/crypto4xx_trng.c +++ b/drivers/crypto/amcc/crypto4xx_trng.c @@ -111,7 +111,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.7.4