Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp133805iob; Tue, 17 May 2022 21:22:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZCeXommSYi20lraibq7EtDRSvFC8DVH/6sGjCSt1vdJ4lW5pzwl64oyCFurzwrya/ofka X-Received: by 2002:a65:5c07:0:b0:3db:aa0c:1c45 with SMTP id u7-20020a655c07000000b003dbaa0c1c45mr19181614pgr.446.1652847778272; Tue, 17 May 2022 21:22:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652847778; cv=none; d=google.com; s=arc-20160816; b=lKZwuMhRkLzknfu3dHWNub4U0vJsIjq2cjL1wO10555hRM4a0n/NP18sRwc7/cCudv XRtfOpfEslHWABnehT5rL/J8hAraQ00+HYYMUOG4bTV9xgw29iHDq2L8cERtbTm3tHhX UGPCQ0ErjcDXLJyC+RtA0ncdVedlNb0K5FQsbFN2js9Byhg1IZRUM808ruIPHTolFP8S qd2bXGfTj1AGBa3wZeYPYEgdImwbCXfGI/9oRPSSHwiL19kvF01oL0qYR1hcCc+GbvUN /h2i4gYvAVlQbupRo8s5SNSrF5gXHBjGrzXGDzVrbnOVSwBdTxbK0C5O0z2d83rC0hAK dAYQ== 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=DzCEfpGM85+oiUWVw8QvokAH+QaT/0gI5RJmEuQ2AUs=; b=zAR0cUOIDK2tfyvx2fSNTCZe4QwwXeDTm4CMLC0+E39G/SR4vKqEqFwDePRWqm24t9 WpqrHz89ib0xhheyyVjV5yNDmiG/kK7IG/NodAi6ANrqF0KnISD+FrcGF0ZRpvgqJYno QFWE6PX+iq1Wn7dYJPT0nql2F4Z7Q63PCtvFoG3f3YiIvoYYlFGbuA5320yMPbIeFA2j uwozEiWcBR9zs1RYVwqeQqExk65ukuwt3RJwvW6qWixcDm1/W4JepFELIrHFp+Llzxos 4RAcTpzoLw4KCEo5fndcbrndZUs3wEu8Ha/jmEItR/mvv3zHfkQUIzZ1W111munEDM1N lWIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="S/89c5Ph"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id r138-20020a632b90000000b003ab211aa308si1105704pgr.726.2022.05.17.21.22.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 21:22:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="S/89c5Ph"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3B5A549C95; Tue, 17 May 2022 20:47:49 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348236AbiEPUfy (ORCPT + 99 others); Mon, 16 May 2022 16:35:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351116AbiEPUCC (ORCPT ); Mon, 16 May 2022 16:02:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 535C72BE; Mon, 16 May 2022 12:59:14 -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 ams.source.kernel.org (Postfix) with ESMTPS id 0088BB81613; Mon, 16 May 2022 19:59:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6310DC385AA; Mon, 16 May 2022 19:59:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1652731151; bh=f2hGEdwI5KESCq279unJLIm61lGflU5bE9/b18+OZzw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S/89c5PhfSpOQrFsyL6GqaeYi3EH5BOEobIP6SQTZvclPlXbC7qS1ZCDpKrUOwpmI l4n4u1/GcDFi4iB6NtjqTObBVVKEiQK1Jfki8IhNFXqzoyPqiARuOo1V6RjWThbaHi 0MRn868D6XqjAmOEpl9JIxtZ7BbJnZjR+jz2b6BQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Indan Zupancic Subject: [PATCH 5.17 088/114] fsl_lpuart: Dont enable interrupts too early Date: Mon, 16 May 2022 21:37:02 +0200 Message-Id: <20220516193628.005676316@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220516193625.489108457@linuxfoundation.org> References: <20220516193625.489108457@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=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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: Indan Zupancic commit 401fb66a355eb0f22096cf26864324f8e63c7d78 upstream. If an irq is pending when devm_request_irq() is called, the irq handler will cause a NULL pointer access because initialisation is not done yet. Fixes: 9d7ee0e28da59 ("tty: serial: lpuart: avoid report NULL interrupt") Cc: stable Signed-off-by: Indan Zupancic Link: https://lore.kernel.org/r/20220505114750.45423-1-Indan.Zupancic@mep-info.com Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/fsl_lpuart.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -2658,6 +2658,7 @@ static int lpuart_probe(struct platform_ struct device_node *np = pdev->dev.of_node; struct lpuart_port *sport; struct resource *res; + irq_handler_t handler; int ret; sport = devm_kzalloc(&pdev->dev, sizeof(*sport), GFP_KERNEL); @@ -2735,17 +2736,11 @@ static int lpuart_probe(struct platform_ if (lpuart_is_32(sport)) { lpuart_reg.cons = LPUART32_CONSOLE; - ret = devm_request_irq(&pdev->dev, sport->port.irq, lpuart32_int, 0, - DRIVER_NAME, sport); + handler = lpuart32_int; } else { lpuart_reg.cons = LPUART_CONSOLE; - ret = devm_request_irq(&pdev->dev, sport->port.irq, lpuart_int, 0, - DRIVER_NAME, sport); + handler = lpuart_int; } - - if (ret) - goto failed_irq_request; - ret = uart_add_one_port(&lpuart_reg, &sport->port); if (ret) goto failed_attach_port; @@ -2767,13 +2762,18 @@ static int lpuart_probe(struct platform_ sport->port.rs485_config(&sport->port, &sport->port.rs485); + ret = devm_request_irq(&pdev->dev, sport->port.irq, handler, 0, + DRIVER_NAME, sport); + if (ret) + goto failed_irq_request; + return 0; +failed_irq_request: failed_get_rs485: failed_reset: uart_remove_one_port(&lpuart_reg, &sport->port); failed_attach_port: -failed_irq_request: lpuart_disable_clks(sport); failed_clock_enable: failed_out_of_range: