From patchwork Wed Jun 29 00:02:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Linton X-Patchwork-Id: 585788 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2429CCA479 for ; Wed, 29 Jun 2022 00:02:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229974AbiF2ACp (ORCPT ); Tue, 28 Jun 2022 20:02:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229703AbiF2ACn (ORCPT ); Tue, 28 Jun 2022 20:02:43 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1C21937A23; Tue, 28 Jun 2022 17:02:43 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1E5A81691; Tue, 28 Jun 2022 17:02:43 -0700 (PDT) Received: from mammon-tx2.austin.arm.com (mammon-tx2.austin.arm.com [10.118.28.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id AEEE63F792; Tue, 28 Jun 2022 17:02:42 -0700 (PDT) From: Jeremy Linton To: linux-serial@vger.kernel.org Cc: andriy.shevchenko@linux.intel.com, gregkh@linuxfoundation.org, jirislaby@kernel.org, miquel.raynal@bootlin.com, phil.edworthy@renesas.com, kernel@esmil.dk, linux-kernel@vger.kernel.org, Jeremy Linton Subject: [PATCH 2/2] serial: 8250: dw: Fix NULL pointer dereference Date: Tue, 28 Jun 2022 19:02:32 -0500 Message-Id: <20220629000232.3440704-3-jeremy.linton@arm.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220629000232.3440704-1-jeremy.linton@arm.com> References: <20220629000232.3440704-1-jeremy.linton@arm.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Similarly to e6a08c6949cb, ACPI machines don't have a pdata setup, leading to a null pointer dereference when dw8250_handle_irq runs. Fixes: aa63d786cea2 ("serial: 8250: dw: Add support for DMA flow controlling devices") Signed-off-by: Jeremy Linton --- drivers/tty/serial/8250/8250_dw.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c index 53e488beb8c2..06f80090cbb9 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c @@ -237,10 +237,13 @@ static int dw8250_handle_irq(struct uart_port *p) struct dw8250_data *d = to_dw8250_data(p->private_data); unsigned int iir = p->serial_in(p, UART_IIR); bool rx_timeout = (iir & 0x3f) == UART_IIR_RX_TIMEOUT; - unsigned int quirks = d->pdata->quirks; + unsigned int quirks = 0; unsigned int status; unsigned long flags; + if (d->pdata) + quirks = d->pdata->quirks; + /* * There are ways to get Designware-based UARTs into a state where * they are asserting UART_IIR_RX_TIMEOUT but there is no actual