Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3013451rwb; Mon, 15 Aug 2022 16:09:12 -0700 (PDT) X-Google-Smtp-Source: AA6agR6K4wypC8gb1PWoC3qrpird8Hrb/G+E53qaEQ/yJUhA9Yyq2Ou5ApD6tGO9kYSxDVt5UPLG X-Received: by 2002:a17:907:69b0:b0:730:a1f0:63e7 with SMTP id ra48-20020a17090769b000b00730a1f063e7mr11460117ejc.364.1660604952475; Mon, 15 Aug 2022 16:09:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660604952; cv=none; d=google.com; s=arc-20160816; b=itzmgOoTzMFO5GVR6GyAqLTIhmqhZzL2ODKQBYjPJzLlNGLfy5RgkWvuDt8ElJnMVT RTVxmTE0+AAJ9O+YmAEZmnKlYWJuGD1Do5TKTL3hXxyYasAEgog1LfUJDuLAnae4zRR0 /OFj6PH6OOZIF4UDyP6eHdMfhkQuzzCANrhzLnNe/B3wSPJt7QHKknv2+kc8DDWuF5RF E0qPQs8+TZUrxpwnOpJ7hds6DBv7XYKP/iyrD1eUm74Dq8F0+oFmG15lA6LG553fosDv CRe11vFuoWSrxIuxfm6uRSWQePqOdcqiejyE8vtYfF2EdMVPru+Tyw6WYfrUgMR0uu7k 9aaA== 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=dYfSBLS7A8Wga14JtXDfJ0W7IRifxrPS7G8FbGDqxBI=; b=cS2LIEMoNb6Xl39Kbw6+asTYvM55v01gumkpCbUkIGshYhQr2ym+iWA+doUItz7uio KNlwuTpZreWD+yEcbfie6P+Azu4wWtySunhzL04itF7yrbolcCwQ9bxWvDDPLBnNSn+h A0lQ5EPUH8O8WYMvw21JptlqCv+OpMbHua1ntpeuoq9UgMkmzrL5TW0U/6MqBhjcinT5 kKsDjdBnhpGZgk/qFacofqTJoe6kd0HSURmRpmp8+MhN7geFajlp+E/Q5nRgj++WZld+ t2Q053mvs4DQH99aC4A1uMkJCSEVu1YaUyBLWaVemDWHn1TvpAOAnze6haUiLbEqlCnr 6iJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tDtR42bB; 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 du22-20020a17090772d600b0072b749835e9si8675732ejc.850.2022.08.15.16.08.34; Mon, 15 Aug 2022 16:09:12 -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=tDtR42bB; 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 S1350470AbiHOWbw (ORCPT + 99 others); Mon, 15 Aug 2022 18:31:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350228AbiHOW0a (ORCPT ); Mon, 15 Aug 2022 18:26:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21CA9128EC6; Mon, 15 Aug 2022 12:45:12 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 94F3061222; Mon, 15 Aug 2022 19:45:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C411C43140; Mon, 15 Aug 2022 19:45:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592711; bh=GoIK9W5tFF1ThOTmt9iGmRMGayudum/t1PMhPQgfubw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tDtR42bB7zSmpLIWurUL9CscBs8PSxD6eW/iyaHnRsWM8hMUcib8giUEOqsZTgr7i kHTMrEM4/xJgN+daIoAFEbJploEOec5K1Aq5b+04QDpU6dzmJU15RDwwsIZzj1Z/Mh rRhWDSSQuPZHpzdLe/CQ3OrA3zhgvQXxSyEFsDws= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiri Slaby , Sasha Levin Subject: [PATCH 5.18 0834/1095] serial: pic32: free up irq names correctly Date: Mon, 15 Aug 2022 20:03:53 +0200 Message-Id: <20220815180503.829667712@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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: Jiri Slaby [ Upstream commit fe36fa18ca77ca3ca9f90aab6cf39031416e432b ] struct pic32_sport contains built-up names for irqs. These are freed only in error path of pic32_uart_startup(). And even there, the freeing happens before free_irq(). So fix this by: * moving frees after free_irq(), and * add frees to pic32_uart_shutdown() -- the opposite of pic32_uart_startup(). Signed-off-by: Jiri Slaby Link: https://lore.kernel.org/r/20220503063122.20957-11-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/pic32_uart.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/pic32_uart.c b/drivers/tty/serial/pic32_uart.c index b7a3a1b959b1..e3535bd8c8a2 100644 --- a/drivers/tty/serial/pic32_uart.c +++ b/drivers/tty/serial/pic32_uart.c @@ -493,14 +493,14 @@ static int pic32_uart_startup(struct uart_port *port) return 0; out_t: - kfree(sport->irq_tx_name); free_irq(sport->irq_tx, port); + kfree(sport->irq_tx_name); out_r: - kfree(sport->irq_rx_name); free_irq(sport->irq_rx, port); + kfree(sport->irq_rx_name); out_f: - kfree(sport->irq_fault_name); free_irq(sport->irq_fault, port); + kfree(sport->irq_fault_name); out_done: return ret; } @@ -519,8 +519,11 @@ static void pic32_uart_shutdown(struct uart_port *port) /* free all 3 interrupts for this UART */ free_irq(sport->irq_fault, port); + kfree(sport->irq_fault_name); free_irq(sport->irq_tx, port); + kfree(sport->irq_tx_name); free_irq(sport->irq_rx, port); + kfree(sport->irq_rx_name); } /* serial core request to change current uart setting */ -- 2.35.1