From patchwork Wed Nov 17 07:26:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 12692856 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8933CC433EF for ; Wed, 17 Nov 2021 07:28:41 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 3E20A61544 for ; Wed, 17 Nov 2021 07:28:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3E20A61544 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:Cc:To: From:Date: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=NAu+anS4LjWEhk3nBzxivecVvtdUyxCIF7qTssBUOsg=; b=xIp3RsZEJ4mS0X D3dpRYP3GZZjviRiVR1iCdoGdjnt9Tw/JkmV2zkte4nRzLP5NLvC3PkdsNHWYPwnPa7QYllzuycHR qesctAr5UYjCQSYykHp1ua9dzsjZ++h6/9UHZnxmlyZ/eAQbm+B8X08xK2NFxeHatuft1xOSVFZZN JjSbskV0JUCyRhgKA3Qtva9iR5tfDQPmSxRWR3QHVN5U63VAzUI+A9sdc7oxDWXJgnt+ruBcmDT5Z LBXFezFmSMk8JfVtoOFJI4BjG9qwm09dbx4Zklg7likgqoqeLxxO9KJ1GJrD2M/5RXLxXDOoyf826 2zydHonVEe2ETExyAPTA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mnFL4-003meN-Lt; Wed, 17 Nov 2021 07:26:40 +0000 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mnFKu-003maS-7z for linux-arm-kernel@lists.infradead.org; Wed, 17 Nov 2021 07:26:29 +0000 Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1AH6c1BB002109; Wed, 17 Nov 2021 07:26:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : content-type : mime-version; s=corp-2021-07-09; bh=V7QjXsBk3obCISUV1AIjX1z1XBytOs1ascS9vbGJEbg=; b=MDHIfAZSmecyhakpFqdU2rZbp9OJ3RQ4rkYrQSR32cllHHAjrv4BjkPBEZCkv976U5wl MXJoPqzm5obCGM7fMreK/Lr2O9+7+Pc5MBCzidy88sdzxrg5x6T0LqfELP+tDjXss6W+ CmfzM/Xmis0OOYb8ImSymCQM9HxgqDk81qZt/fCCep4s1877WoGjR/uKW2wOvG4He5A7 wtG7NWnELtD50zieg0wok+wJ80HY1XazAIOZ3uQAwBMuNwY7cJcaGKGxWyORWgF9SMma cTughBwvlb9gjtDD2Q3MIfGfFG/6hyNsXvFgSygm2Z1vcXMXuSr8ehomael9pzNxhprK UA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by mx0b-00069f02.pphosted.com with ESMTP id 3cbhtvwcs5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Nov 2021 07:26:19 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 1AH7KRmf124735; Wed, 17 Nov 2021 07:26:18 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2175.outbound.protection.outlook.com [104.47.57.175]) by aserp3030.oracle.com with ESMTP id 3ccccpqttx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Nov 2021 07:26:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a0Hv4fcUqMxV3cZoqIZKwFah9lLQ9FVyt4dubUc96YKckSTjUhtvHItdYNvYO1rHU6u5hAKeJpMGNJVG0e0lj6RS5+pJcNG241nuHuTYfMXxH8zdQw/A2tqUxBO1C0AuNzjsYMXFPvEdbQXAsaJbISYs/OQn7NvYGcrRVRYdGk6nLW6tBnF/Duy20xDh2eRZrAJoI8wVIwVWOkya9p7zNK1vRMIFAcCBEC//lLLw1CkdYQSesSDvQOIo+okUCvQTp095QvJYLCGIpmzZgt/MUnZD1IRvqPOK0vqDwWkn7wG44mv0XTGsqkKoZ5zWOTksL3ftYO7chDLETpg4C1iIaw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=V7QjXsBk3obCISUV1AIjX1z1XBytOs1ascS9vbGJEbg=; b=keFCDgmYw/tEaXjTbutHhBkpqpwqfy9TqRIg+byqYLWEGCdTdp2wBXoe8pKqyqTkIZWS3BrKbeaL+RPq68bU7gvcO6F9wb+YIBEoGDSlkzNKY1B8F3UGgbtnfiER1wPcB8COcSuyo98KZmbXVKLitJ/L6eWxDdn97cAFbqVpbMXcgInohnzPlrnUXWfhrPe1nqASL6XRvHPBnw5rZy1G5Vb5Lr0ZSaiOBtZgBk1BsjSmkVoWs94aL4L89A5tBrAenEr+v3CfQU8bCYfObDXcclrBghngYGE686pRnScZenNEMVE76kzL0TX8qNUy2Ru+L+GkOiJPBU7SyPOC/LPTcw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=V7QjXsBk3obCISUV1AIjX1z1XBytOs1ascS9vbGJEbg=; b=w4EU7vyFR4IwkP9ZQWsbwD8cxiOsra5Ld7MDtoikUxC+jcrc7Hao69WLb3wv4D3tTKPJvionPQ/Wr1HNI/DXKKDhstHxnpJluBOuXdYNFJGFAzu05JsQobrnV5EBLoJXnWXjHHx8dXNanAS3gq1Fy2pBhaXC13rmoGas1pD+NiA= Received: from MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) by MWHPR10MB1950.namprd10.prod.outlook.com (2603:10b6:300:10d::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.25; Wed, 17 Nov 2021 07:26:16 +0000 Received: from MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::d409:11b5:5eb2:6be9]) by MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::d409:11b5:5eb2:6be9%5]) with mapi id 15.20.4690.016; Wed, 17 Nov 2021 07:26:16 +0000 Date: Wed, 17 Nov 2021 10:26:05 +0300 From: Dan Carpenter To: Linus Walleij , Rob Herring Cc: Michael Turquette , Stephen Boyd , linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] clk: versatile: clk-icst: use after free on error path Message-ID: <20211117072604.GC5237@kili> Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: Mutt/1.10.1 (2018-07-13) X-ClientProxiedBy: ZR0P278CA0079.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:22::12) To MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) MIME-Version: 1.0 Received: from kili (102.222.70.114) by ZR0P278CA0079.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:22::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19 via Frontend Transport; Wed, 17 Nov 2021 07:26:12 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c4b341f2-6444-4dbc-4e23-08d9a99b8a9d X-MS-TrafficTypeDiagnostic: MWHPR10MB1950: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3826; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MN0fmwBY9XMP0O5Ma2REwNE4fGvPDyedj4T09/CIb6x3UET0DhAZO6W79iw4H9cukb73w2tRZku6nCLz3YjqeGihJMTrb9Yzp6Nv6x+tvErntM1MppPfiud4sDJ1xtf06HEmdfR9Zjlwy4+7N0HQSLUIPmoI7q8ZuwFKBuwC+DiBlpzIMaL8aWq6K9pHwB1r/tY1TapCR72lOZhJx1WkgllZt8Oc4wNW05VDtqYo961wZToqvTUjoeAA4POMsj7/LPRxkiMe1M1Eym8Ls7La0CwEdSLJ7QFHk0kYJ9KVyb4onJWc9eL+zv30mggBEdLQNQRwAGrxX63qrSlN8oqJIHKaBustcqg1panO/JqR3wNPTZ7EekAddtUYSfCfl4oHS2O191/+GEa3T1JyACsvBFEzsUx68NNRY2zR6AvFAT1Yg6yoJc+1sRHshoTqDN2OtS4s29EVOscqS+xEM3F9447yJyUIonBgBUjPCX01DgMEflnFAm/eVKXqIU9+Q9oNZxMEi5S1SPVFO3euaUoBmiUHT9KF0CZhnDuxW4wXUombtX2eWbZXjnqDBE23zGykwmuznW5hn2rqHFVfBD5BjVUZK826lfWHltxaM7krxSwB5gqrHtdVjINmU39YJ5Zgrkv1tWzZ6o8xocXrbXb9pl8JX+T56CXwveDLrlj+3AfggcTf9aNnuh7Z/owocgqNolI1MXvFxz7kY5u74KX1mg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2365.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(33716001)(86362001)(8676002)(54906003)(110136005)(186003)(316002)(9576002)(83380400001)(52116002)(66946007)(956004)(1076003)(508600001)(6496006)(55016002)(5660300002)(6666004)(38100700002)(33656002)(8936002)(38350700002)(9686003)(26005)(66476007)(2906002)(66556008)(4744005)(44832011)(4326008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SXDHaLvzSYGXsPxnZOgcqDjCYIDL/HcpFz51SgBRD5AITMvoirLSUy2vK/N2enKZPIx4sW5VH2rUVENwlhUBk/oyapLPj/K8RMRKQUNPOZx5yNybj4tG3iV4Lp1aP1lxCxs/GOeG2JCjY4rWvM3mrxpPKDo0nJ4wzdjqE/oBwC+vyLcTY8aEMxANOb2n2n+qJTwcMe224VehCbJfI9M4mzmBr8V5n4CL/8lRqGHzZxOmWVAe4yN7k7tgDp6pyFstvOjLRvXGrje0S+ieWPD73px3m9FcsO5pn/1lZ0Ffi2qZkfQ3sg0QbkMS86EV3JssRUwGQhPmdSCCGjgQtDJ/cistuzCZa3ySYIgmpZVHHguJfLNsyxI+JyP/74cKDwtZKRQYdM0I34Jhq3sN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/Lk2MpJ5PRsSMjCKtc60G/aD8etjYrmKWzP8Zzg9D5hfqnwHGpWuIReBwgDA6hXXU+P7PnCo8+VmiPoNBYhtJHO47W5qf7kqilWcRAOTq1t0cB5qgmJ2mjggC6k9q/PFkv8NwiLuNEgaQ2QMKXIyRETqwE3Adlw+ngw8iJiY+2Mpabpn58Z9uqXvfbvWxiPUVPJ2Z0/rg4k/Oeo6YT633lXz674RgvfCTANQOEnwQ85Zkiw= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c4b341f2-6444-4dbc-4e23-08d9a99b8a9d X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2365.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 07:26:16.2974 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9BtOlIHgxHpwSMdTm6UqZmqQVb0uGnfLKIupXfg3cXVGZC6QUlN7Uk9cZC5KHjwzYDQio/25HV1xemr1lzXD8nuku2/H5mea8vasre8TB58= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR10MB1950 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10170 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 bulkscore=0 adultscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2111170034 X-Proofpoint-GUID: AnikpdN0Po0ayteJNU2Fa_zaitSh2Tcd X-Proofpoint-ORIG-GUID: AnikpdN0Po0ayteJNU2Fa_zaitSh2Tcd X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211116_232628_337130_321C4012 X-CRM114-Status: GOOD ( 17.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This frees "name" and then tries to display in as part of the error message on the next line. Swap the order. Fixes: 1b2189f3aa50 ("clk: versatile: clk-icst: Ensure clock names are unique") Signed-off-by: Dan Carpenter Reviewed-by: Linus Walleij --- drivers/clk/versatile/clk-icst.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/versatile/clk-icst.c b/drivers/clk/versatile/clk-icst.c index d52f976dc875..d5cb372f0901 100644 --- a/drivers/clk/versatile/clk-icst.c +++ b/drivers/clk/versatile/clk-icst.c @@ -543,8 +543,8 @@ static void __init of_syscon_icst_setup(struct device_node *np) regclk = icst_clk_setup(NULL, &icst_desc, name, parent_name, map, ctype); if (IS_ERR(regclk)) { - kfree(name); pr_err("error setting up syscon ICST clock %s\n", name); + kfree(name); return; } of_clk_add_provider(np, of_clk_src_simple_get, regclk);