From mboxrd@z Thu Jan 1 00:00:00 1970 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 A1126C7EE30 for ; Sun, 7 May 2023 00:38:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232012AbjEGAil (ORCPT ); Sat, 6 May 2023 20:38:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232273AbjEGAiO (ORCPT ); Sat, 6 May 2023 20:38:14 -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 C69EA2E05D; Sat, 6 May 2023 17:36:37 -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 709B76151C; Sun, 7 May 2023 00:36:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDCA0C433EF; Sun, 7 May 2023 00:36:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683419765; bh=61nXFMZeqAJnP6wU2NPz4bAlVGf6xyOVH8pnGCgjejU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZBdLn7+cjzQ0fOszQlCMaGnNP1euLXlLKu7N2BROnVNid8fyq7X5hFoefYRMTq9yp nW7fH1tS8vutYYE0UYsGiHaxAF1FepqUYG1yjhYWpREY934g2R65Jg2CmvkIqqPRnY Vy5z+ID3b3OmLwv1TVu5/0tAAzbd/BgbJw0eVMH0cJghim/y03QLYjyUECY2GhU16h AnxqwiqluqYHS1vuteXuWWVFykWGe9peS+Fs0hx+outsBBQ4J27cMzKBs/q3UFYnoP MDIFDivoJ1bf48BQWZrNUkR2wW6QMWiZWNanMQW1tUps+/BX9jSOV9THVVzZGv8xGp G3fQIaXARus0w== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Tony Lindgren , Greg Kroah-Hartman , Sasha Levin , jirislaby@kernel.org, ilpo.jarvinen@linux.intel.com, andriy.shevchenko@linux.intel.com, pmladek@suse.com, john.ogness@linutronix.de, linux-serial@vger.kernel.org Subject: [PATCH AUTOSEL 5.10 8/9] serial: 8250: Reinit port->pm on port specific driver unbind Date: Sat, 6 May 2023 20:35:44 -0400 Message-Id: <20230507003545.4078941-8-sashal@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230507003545.4078941-1-sashal@kernel.org> References: <20230507003545.4078941-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Tony Lindgren [ Upstream commit 04e82793f068d2f0ffe62fcea03d007a8cdc16a7 ] When we unbind a serial port hardware specific 8250 driver, the generic serial8250 driver takes over the port. After that we see an oops about 10 seconds later. This can produce the following at least on some TI SoCs: Unhandled fault: imprecise external abort (0x1406) Internal error: : 1406 [#1] SMP ARM Turns out that we may still have the serial port hardware specific driver port->pm in use, and serial8250_pm() tries to call it after the port specific driver is gone: serial8250_pm [8250_base] from uart_change_pm+0x54/0x8c [serial_base] uart_change_pm [serial_base] from uart_hangup+0x154/0x198 [serial_base] uart_hangup [serial_base] from __tty_hangup.part.0+0x328/0x37c __tty_hangup.part.0 from disassociate_ctty+0x154/0x20c disassociate_ctty from do_exit+0x744/0xaac do_exit from do_group_exit+0x40/0x8c do_group_exit from __wake_up_parent+0x0/0x1c Let's fix the issue by calling serial8250_set_defaults() in serial8250_unregister_port(). This will set the port back to using the serial8250 default functions, and sets the port->pm to point to serial8250_pm. Signed-off-by: Tony Lindgren Link: https://lore.kernel.org/r/20230418101407.12403-1-tony@atomide.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/8250/8250_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c index 0a7e9491b4d14..43f2eed6df78e 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c @@ -1165,6 +1165,7 @@ void serial8250_unregister_port(int line) uart->port.type = PORT_UNKNOWN; uart->port.dev = &serial8250_isa_devs->dev; uart->capabilities = 0; + serial8250_init_port(uart); serial8250_apply_quirks(uart); uart_add_one_port(&serial8250_reg, &uart->port); } else { -- 2.39.2