Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp4299519pxb; Tue, 19 Apr 2022 23:24:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJziTPN4SYaZhj4yedsTbE47DgslgGR76pWdkuIAL63WsG581qAc1TKmVPOPsP9zHX9foDYH X-Received: by 2002:a63:1921:0:b0:3aa:3256:16e8 with SMTP id z33-20020a631921000000b003aa325616e8mr6857605pgl.26.1650435878629; Tue, 19 Apr 2022 23:24:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650435878; cv=none; d=google.com; s=arc-20160816; b=EdLQ7ILGRwk7BZB6aJi9qJQoNDXjVy17/nNdty5M6JbRjYQm0k7KX/HlEH33vmJLP2 Ne1tlmZy/BPJ3h/UaHjhcuBkDzmvQU6VqrYUnll6wHpsMsVMMNCBUb87+ATmkPNSd1/0 GXmh0UgkIPE9zcgs2RwrAGUUWuonBuGgam3SjuYAj2Ba+Yh7QJ4hc574o/Tbsz6gkFyt g9wTKL8ufPq1QKycwCwWkapyGa06ME9AVhcDUlj9cvwwG4cs+Pko+2ytkbOafCOgniyM 7I1uDxmf7+RIwAkmDMTH6OIZXvhqu82YxPw6upJ7ZBFyM72ObAfGfnHQ5LGAx/nMXDtM dz8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FbaVmV6qJlINCFY8qoM24lCEXjTk4x6SEnxaIpeLpDo=; b=cEDc3FbzfSziZ/3VLZig7xd3k2VB/9Ep9FyAD/ib0w2gUosrFHf0y6KZ0yYvsqVey9 jUcBeHMxeRtZmeVkwSKGBVeSrDODt9IWmkUNy7DmsXSMHbNfQ8Q2zjXCbpgcWmbZTKq/ Ag/CiE8pUP2pzuopIrRI/gzwhCkhBo2kZo5L9bIlD4NilZYc1RHk95JZUfbPde5rr96h P0aFgngk4S6T0/8izR1fjImS3z43o1JLBf4Gkw5QJ/LdCUQBariUDjJRxJ5ajtSL1/0b 2WTBFbQPP8l4XUgoZhXBPenOdAAWgsJVIds8j54oD45q/nX2KBGx15Z7MhuNn2ZBPkR8 Bb6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1XcLq9jf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kb8-20020a17090ae7c800b001d2c6c93948si1571500pjb.80.2022.04.19.23.24.23; Tue, 19 Apr 2022 23:24:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1XcLq9jf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240403AbiDRMjJ (ORCPT + 99 others); Mon, 18 Apr 2022 08:39:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239734AbiDRMdW (ORCPT ); Mon, 18 Apr 2022 08:33:22 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACFFC1DA55; Mon, 18 Apr 2022 05:25:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 1680CCE106E; Mon, 18 Apr 2022 12:25:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3C6FC385A7; Mon, 18 Apr 2022 12:25:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650284723; bh=ZHMZnOit5c8zTbyxv8NwyQI3YVinWF2OZ+PTUpwGha4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1XcLq9jfJMMcTzkAEGyI/I03hxWa/w1edK9f6sAU8Z8eES7sQ7BiDrAKJPNR7N/4X Qfz1rAQiTGeWBIXbTX9haSevrvzcZ+srJdbTJRTTaZz5TLQ5m4K0shShscQ+1nt+AF l4kJtgyqhHfahbh1MGFSUILFmdks7fmJr8E6Oofg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Alexander Sverdlin , Arnd Bergmann Subject: [PATCH 5.17 206/219] ep93xx: clock: Fix UAF in ep93xx_clk_register_gate() Date: Mon, 18 Apr 2022 14:12:55 +0200 Message-Id: <20220418121212.634259061@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121203.462784814@linuxfoundation.org> References: <20220418121203.462784814@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexander Sverdlin commit 3b68b08885217abd9c57ff9b3bb3eb173eee02a9 upstream. arch/arm/mach-ep93xx/clock.c:154:2: warning: Use of memory after it is freed [clang-analyzer-unix.Malloc] arch/arm/mach-ep93xx/clock.c:151:2: note: Taking true branch if (IS_ERR(clk)) ^ arch/arm/mach-ep93xx/clock.c:152:3: note: Memory is released kfree(psc); ^~~~~~~~~~ arch/arm/mach-ep93xx/clock.c:154:2: note: Use of memory after it is freed return &psc->hw; ^ ~~~~~~~~ Fixes: 9645ccc7bd7a ("ep93xx: clock: convert in-place to COMMON_CLK") Reported-by: kernel test robot Signed-off-by: Alexander Sverdlin Cc: stable@vger.kernel.org Link: https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org/thread/B5YCO2NJEXINCYE26Y255LCVMO55BGWW/ Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- arch/arm/mach-ep93xx/clock.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/arch/arm/mach-ep93xx/clock.c +++ b/arch/arm/mach-ep93xx/clock.c @@ -148,8 +148,10 @@ static struct clk_hw *ep93xx_clk_registe psc->lock = &clk_lock; clk = clk_register(NULL, &psc->hw); - if (IS_ERR(clk)) + if (IS_ERR(clk)) { kfree(psc); + return ERR_CAST(clk); + } return &psc->hw; }