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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 3EAB4C433DB for ; Mon, 8 Feb 2021 06:35:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1510164DDF for ; Mon, 8 Feb 2021 06:35:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229889AbhBHGf3 (ORCPT ); Mon, 8 Feb 2021 01:35:29 -0500 Received: from mail-bn8nam12on2044.outbound.protection.outlook.com ([40.107.237.44]:52641 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229978AbhBHGcq (ORCPT ); Mon, 8 Feb 2021 01:32:46 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A0MeycSjEcihybovgr9lFXx4d7uu3svIiywKCg4DnGsSNVMMkfFTEVGUgk4UXNn2FH/h6Yqft0HAUymyeFp2wiCU0VaxpnNaGOdHwt9QqBOmKMiAai6WBm9qL7Q6sTs7+QOKnKBZS+g+9L6Y9NLzcwCk2g/ZWYM+k7ZqW0aSZrrAohbqiJ9r8Z6cLR6/tey43irgjCC9jtS4rpMkfoDOwxzHig2wV+2tKuzAqejfab5t5smjcFeBx+2ZF2KkarjRgKKwzAjyC71COZJlGeeqbOLnh2EMKllNvR92XiUcSw2G5GRUPzcTuDF7W8y5Wr+gRbE6I+x0k7lCuUXYTzWHxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=asuG7+yF/wcSpX10jX9mP1QK8+4OEu2dGcLGBaqOWpg=; b=Y0+Jqe0EkLZscTSIdRt1ChgpPkkTwn7ewEHExQz12KPMijBLUaDZSjcZ7KjEYnMJAfmh68hhZOPBhnCVk3ut5/3+QUjerhc7aMhklrz03pf13elsUrcrzXqFAVeYGUmKuoMbSz6pXHmutEtmvX2N613Yf6AG2nZ4r5gI8iOFsECvik9lLScDr15o+6xG3mUyPwgh0mCwbEy41anLlMlafT/AccOWkpdz4I/auKh8IWBK5kXS9B7esVltDmJGucWCJ4WL0aqZhypyR03FTWgLl2n/gGVgBrqTGMr2Q2VTCdIPt36DiSfkIF8+CeQQg3ewkDu3Yv0cvhvL9QZlhj4wWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=lists.infradead.org smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=asuG7+yF/wcSpX10jX9mP1QK8+4OEu2dGcLGBaqOWpg=; b=jjcZX6UEeLGb8A46W0DRJJn8ioi1+KsJVcNNvTTuNbJA3sgM+/X3vuT7e9lx/MNVOMIlQLCgmeycHQbiGc3QSXWop6qMPOQ39XS8zOPIFIy9bFxffrGKdpfjhFIcSHmlrNo/19A7vhevk7UsXZ3ijWy1q+KqmE60XWeLOfAq4RQ= Received: from CY4PR03CA0009.namprd03.prod.outlook.com (2603:10b6:903:33::19) by BN6PR02MB2420.namprd02.prod.outlook.com (2603:10b6:404:56::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.17; Mon, 8 Feb 2021 06:31:53 +0000 Received: from CY1NAM02FT033.eop-nam02.prod.protection.outlook.com (2603:10b6:903:33:cafe::29) by CY4PR03CA0009.outlook.office365.com (2603:10b6:903:33::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.17 via Frontend Transport; Mon, 8 Feb 2021 06:31:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; lists.infradead.org; dkim=none (message not signed) header.d=none;lists.infradead.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by CY1NAM02FT033.mail.protection.outlook.com (10.152.75.179) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3784.12 via Frontend Transport; Mon, 8 Feb 2021 06:31:53 +0000 Received: from xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Sun, 7 Feb 2021 22:31:52 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Sun, 7 Feb 2021 22:31:52 -0800 Envelope-to: amit.sunil.dhamne@xilinx.com, michal.simek@xilinx.com, tejas.patel@xilinx.com, rajan.vaja@xilinx.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Received: from [172.19.2.91] (port=33868 helo=xsjjollys50.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1l905Q-0004xt-Jd; Sun, 07 Feb 2021 22:31:52 -0800 From: Rajan Vaja To: , CC: , , Tejas Patel , Rajan Vaja Subject: [PATCH] drivers: firmware: xilinx: Fix dereferencing freed memory Date: Sun, 7 Feb 2021 22:31:23 -0800 Message-ID: <1612765883-22018-1-git-send-email-rajan.vaja@xilinx.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1b1cfd5f-1b94-4c2c-97e4-08d8cbfb3960 X-MS-TrafficTypeDiagnostic: BN6PR02MB2420: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:913; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: a9zAZiAVLNMyCGumoUzYbbRFyUlKVTzl63+B0FTlapwqleZI4sbn8reX5+HoqxtGUSA31K4u1dX6mtBW/zWVrCkFiPpIuvWTVXcjx3VBJ01IA2jQgx9WPq5qPTfFk2dc2L2kwccxI+UnB/ANZaxkrw9OA9xJTlgN5GNLWcPeZfKRaEdO3Z67d9MFVtcuB664IZSQ52g36JKRCrUysIBxM5Bi/svu14SPEwy6qrOXT77+qTMOk4fnOGzASWQzVQbAcWxIvBmFq9qX6D2t2g/3DZMQ5ePRPtr1eqkial/j66mZbVQ8grTdznEjyh3GVGul24XZo6idf1kTM4yruZ6YyqT4wEPZhpNAwaodxCQnqFWAIk5Y7fgGmFzJJJJT5g/jPacNhZFdPunxPTmYbaTSY4k70MGUdsLaDoOSuLh1XPDWAbajxnkIIQZFBTxsUGSqSRs4/148Ox+8rTVDj4DN/uA+HnTmCsqpXorxmyKY3L70Ht0qxvpOzWtREoZ2yAT3k5KL9Bw3NXA+LmqdNKnlx9ko3MbIg0B8xA9oDBcjSUKvEMtoJsyHwzuJxbUmOuiUZem56EnJZuOU0GT7by2jF3hXt+tgumyfsG3XTkDPCiTPc2BdJX4cfyL+PJiIXh1Y1HTQGlV6DZFL7AMFbXMybmd5/D1kCJ4KecltgGARR/D7zhlDTuLWWts/pWddWqnN X-Forefront-Antispam-Report: CIP:149.199.62.198;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:xsj-pvapexch02.xlnx.xilinx.com;PTR:unknown-62-198.xilinx.com;CAT:NONE;SFS:(4636009)(376002)(39850400004)(346002)(396003)(136003)(36840700001)(46966006)(82740400003)(186003)(8936002)(107886003)(6636002)(47076005)(7636003)(26005)(356005)(9786002)(478600001)(6666004)(5660300002)(82310400003)(4326008)(36756003)(54906003)(2906002)(8676002)(110136005)(70206006)(36860700001)(70586007)(316002)(7696005)(2616005)(44832011)(36906005)(83380400001)(336012)(426003)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2021 06:31:53.2166 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1b1cfd5f-1b94-4c2c-97e4-08d8cbfb3960 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.62.198];Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: CY1NAM02FT033.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR02MB2420 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tejas Patel Fix smatch warning: drivers/firmware/xilinx/zynqmp.c:1288 zynqmp_firmware_remove() error: dereferencing freed memory 'feature_data' Use hash_for_each_safe for safe removal of hash entry. Fixes: acfdd18591ea ("firmware: xilinx: Use hash-table for api feature check") Reported-by: kernel test robot Reported-by: Dan Carpenter Signed-off-by: Tejas Patel Signed-off-by: Rajan Vaja --- drivers/firmware/xilinx/zynqmp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c index 7eb9958..83082e2 100644 --- a/drivers/firmware/xilinx/zynqmp.c +++ b/drivers/firmware/xilinx/zynqmp.c @@ -2,7 +2,7 @@ /* * Xilinx Zynq MPSoC Firmware layer * - * Copyright (C) 2014-2020 Xilinx, Inc. + * Copyright (C) 2014-2021 Xilinx, Inc. * * Michal Simek * Davorin Mista @@ -1280,12 +1280,13 @@ static int zynqmp_firmware_probe(struct platform_device *pdev) static int zynqmp_firmware_remove(struct platform_device *pdev) { struct pm_api_feature_data *feature_data; + struct hlist_node *tmp; int i; mfd_remove_devices(&pdev->dev); zynqmp_pm_api_debugfs_exit(); - hash_for_each(pm_api_features_map, i, feature_data, hentry) { + hash_for_each_safe(pm_api_features_map, i, tmp, feature_data, hentry) { hash_del(&feature_data->hentry); kfree(feature_data); } -- 2.7.4 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=-17.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT 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 ED882C433DB for ; Mon, 8 Feb 2021 06:33:11 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 86AE564DDF for ; Mon, 8 Feb 2021 06:33:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 86AE564DDF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=2ZAuq687SpOBP3SmkJcFaV9C5U9BEprtLmxNuk0bwc8=; b=hSHZ5uI4l2bRj7k8DIgQREoYtv stnsWzLKtwOlee9IZ4ldIxFledExqz9Nwfhc4j2FWvNMW2IVThs4EVaAWPBb9n4oY6Mok3PU5lOPg /zGA4djfsdmSgCYHnxa8GgvZYml0i4Uz+99KVhyQUvtRSqWb0Z80YbN0EQkY928majUimaiHNyK5W ijkvkCcBKbDAHVZRTSGaJc/UIoI0UU4YONyMGHkyPppbGu/XGpQr/gAivI31D9knsB3LylxE8uPz2 vuoRhXbmgXXKO/xzOW/sZvHWbXHxcd2+Sv2lq9tB9bWc7Lozv5xjaxi0ZNCQKNDWigrol7C2hAVgp cMMCsolw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l905W-0006pH-U9; Mon, 08 Feb 2021 06:31:58 +0000 Received: from mail-bn8nam12on2054.outbound.protection.outlook.com ([40.107.237.54] helo=NAM12-BN8-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l905U-0006oV-6e for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 06:31:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A0MeycSjEcihybovgr9lFXx4d7uu3svIiywKCg4DnGsSNVMMkfFTEVGUgk4UXNn2FH/h6Yqft0HAUymyeFp2wiCU0VaxpnNaGOdHwt9QqBOmKMiAai6WBm9qL7Q6sTs7+QOKnKBZS+g+9L6Y9NLzcwCk2g/ZWYM+k7ZqW0aSZrrAohbqiJ9r8Z6cLR6/tey43irgjCC9jtS4rpMkfoDOwxzHig2wV+2tKuzAqejfab5t5smjcFeBx+2ZF2KkarjRgKKwzAjyC71COZJlGeeqbOLnh2EMKllNvR92XiUcSw2G5GRUPzcTuDF7W8y5Wr+gRbE6I+x0k7lCuUXYTzWHxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=asuG7+yF/wcSpX10jX9mP1QK8+4OEu2dGcLGBaqOWpg=; b=Y0+Jqe0EkLZscTSIdRt1ChgpPkkTwn7ewEHExQz12KPMijBLUaDZSjcZ7KjEYnMJAfmh68hhZOPBhnCVk3ut5/3+QUjerhc7aMhklrz03pf13elsUrcrzXqFAVeYGUmKuoMbSz6pXHmutEtmvX2N613Yf6AG2nZ4r5gI8iOFsECvik9lLScDr15o+6xG3mUyPwgh0mCwbEy41anLlMlafT/AccOWkpdz4I/auKh8IWBK5kXS9B7esVltDmJGucWCJ4WL0aqZhypyR03FTWgLl2n/gGVgBrqTGMr2Q2VTCdIPt36DiSfkIF8+CeQQg3ewkDu3Yv0cvhvL9QZlhj4wWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=lists.infradead.org smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=asuG7+yF/wcSpX10jX9mP1QK8+4OEu2dGcLGBaqOWpg=; b=jjcZX6UEeLGb8A46W0DRJJn8ioi1+KsJVcNNvTTuNbJA3sgM+/X3vuT7e9lx/MNVOMIlQLCgmeycHQbiGc3QSXWop6qMPOQ39XS8zOPIFIy9bFxffrGKdpfjhFIcSHmlrNo/19A7vhevk7UsXZ3ijWy1q+KqmE60XWeLOfAq4RQ= Received: from CY4PR03CA0009.namprd03.prod.outlook.com (2603:10b6:903:33::19) by BN6PR02MB2420.namprd02.prod.outlook.com (2603:10b6:404:56::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.17; Mon, 8 Feb 2021 06:31:53 +0000 Received: from CY1NAM02FT033.eop-nam02.prod.protection.outlook.com (2603:10b6:903:33:cafe::29) by CY4PR03CA0009.outlook.office365.com (2603:10b6:903:33::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.17 via Frontend Transport; Mon, 8 Feb 2021 06:31:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; lists.infradead.org; dkim=none (message not signed) header.d=none;lists.infradead.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by CY1NAM02FT033.mail.protection.outlook.com (10.152.75.179) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3784.12 via Frontend Transport; Mon, 8 Feb 2021 06:31:53 +0000 Received: from xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Sun, 7 Feb 2021 22:31:52 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Sun, 7 Feb 2021 22:31:52 -0800 Received: from [172.19.2.91] (port=33868 helo=xsjjollys50.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1l905Q-0004xt-Jd; Sun, 07 Feb 2021 22:31:52 -0800 From: Rajan Vaja To: , Subject: [PATCH] drivers: firmware: xilinx: Fix dereferencing freed memory Date: Sun, 7 Feb 2021 22:31:23 -0800 Message-ID: <1612765883-22018-1-git-send-email-rajan.vaja@xilinx.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1b1cfd5f-1b94-4c2c-97e4-08d8cbfb3960 X-MS-TrafficTypeDiagnostic: BN6PR02MB2420: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:913; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: a9zAZiAVLNMyCGumoUzYbbRFyUlKVTzl63+B0FTlapwqleZI4sbn8reX5+HoqxtGUSA31K4u1dX6mtBW/zWVrCkFiPpIuvWTVXcjx3VBJ01IA2jQgx9WPq5qPTfFk2dc2L2kwccxI+UnB/ANZaxkrw9OA9xJTlgN5GNLWcPeZfKRaEdO3Z67d9MFVtcuB664IZSQ52g36JKRCrUysIBxM5Bi/svu14SPEwy6qrOXT77+qTMOk4fnOGzASWQzVQbAcWxIvBmFq9qX6D2t2g/3DZMQ5ePRPtr1eqkial/j66mZbVQ8grTdznEjyh3GVGul24XZo6idf1kTM4yruZ6YyqT4wEPZhpNAwaodxCQnqFWAIk5Y7fgGmFzJJJJT5g/jPacNhZFdPunxPTmYbaTSY4k70MGUdsLaDoOSuLh1XPDWAbajxnkIIQZFBTxsUGSqSRs4/148Ox+8rTVDj4DN/uA+HnTmCsqpXorxmyKY3L70Ht0qxvpOzWtREoZ2yAT3k5KL9Bw3NXA+LmqdNKnlx9ko3MbIg0B8xA9oDBcjSUKvEMtoJsyHwzuJxbUmOuiUZem56EnJZuOU0GT7by2jF3hXt+tgumyfsG3XTkDPCiTPc2BdJX4cfyL+PJiIXh1Y1HTQGlV6DZFL7AMFbXMybmd5/D1kCJ4KecltgGARR/D7zhlDTuLWWts/pWddWqnN X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(376002)(39850400004)(346002)(396003)(136003)(36840700001)(46966006)(82740400003)(186003)(8936002)(107886003)(6636002)(47076005)(7636003)(26005)(356005)(9786002)(478600001)(6666004)(5660300002)(82310400003)(4326008)(36756003)(54906003)(2906002)(8676002)(110136005)(70206006)(36860700001)(70586007)(316002)(7696005)(2616005)(44832011)(36906005)(83380400001)(336012)(426003)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2021 06:31:53.2166 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1b1cfd5f-1b94-4c2c-97e4-08d8cbfb3960 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: CY1NAM02FT033.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR02MB2420 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_013156_407898_DE8DE88D X-CRM114-Status: UNSURE ( 9.41 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tejas Patel , Rajan Vaja , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Tejas Patel Fix smatch warning: drivers/firmware/xilinx/zynqmp.c:1288 zynqmp_firmware_remove() error: dereferencing freed memory 'feature_data' Use hash_for_each_safe for safe removal of hash entry. Fixes: acfdd18591ea ("firmware: xilinx: Use hash-table for api feature check") Reported-by: kernel test robot Reported-by: Dan Carpenter Signed-off-by: Tejas Patel Signed-off-by: Rajan Vaja --- drivers/firmware/xilinx/zynqmp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c index 7eb9958..83082e2 100644 --- a/drivers/firmware/xilinx/zynqmp.c +++ b/drivers/firmware/xilinx/zynqmp.c @@ -2,7 +2,7 @@ /* * Xilinx Zynq MPSoC Firmware layer * - * Copyright (C) 2014-2020 Xilinx, Inc. + * Copyright (C) 2014-2021 Xilinx, Inc. * * Michal Simek * Davorin Mista @@ -1280,12 +1280,13 @@ static int zynqmp_firmware_probe(struct platform_device *pdev) static int zynqmp_firmware_remove(struct platform_device *pdev) { struct pm_api_feature_data *feature_data; + struct hlist_node *tmp; int i; mfd_remove_devices(&pdev->dev); zynqmp_pm_api_debugfs_exit(); - hash_for_each(pm_api_features_map, i, feature_data, hentry) { + hash_for_each_safe(pm_api_features_map, i, tmp, feature_data, hentry) { hash_del(&feature_data->hentry); kfree(feature_data); } -- 2.7.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel