Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp3544881rwo; Fri, 4 Aug 2023 06:35:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH+wURi2g1SLN+t8IpBvxIZNtalbsDD8WpnNKE9ZLfA3DmH/3H9HAfgFD3Lt6CRdI7xx/Dn X-Received: by 2002:a17:90a:1b6d:b0:268:2658:3b01 with SMTP id q100-20020a17090a1b6d00b0026826583b01mr1507888pjq.39.1691156140381; Fri, 04 Aug 2023 06:35:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691156140; cv=none; d=google.com; s=arc-20160816; b=vd+/PmTW80BjhXkpfhK1a8z3KgiU9awxxlTj1kbrLVv+3F81f28RvBmsh+75+nBL5V LfXaKWmAHAzMb47Pa3m6WyVoMGpXohd5+C/xVOwZtX9xlFWTpH+eD5mc626VS2CX+RaV aCiPLfLDTEHG8fy31vVi49ecco9f9FZKUXFHwpXk7a4xdHPPyCau4OZodW0qKuN4FykW m3t5k/gtJC5Kwkko+iWAc7Q4Oxr3RjjF+EkSarmXjj9TNBz6pVfgoV88bPpQUKFFA3fA OU9Wvr5rJW7AJwVxjLjhH6ydddiBtI0y9UQTjC0xTJXkSvTkgrUtT4pyco4uNxHLuPAi 6w8g== 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 :message-id:date:subject:cc:to:from; bh=qtnwyyz6WVzAWle+iWm2DW/8tdPSg9atPDjdUPd86V4=; fh=IFcf3iAw72IF1KlvnVHX7hQ4wCcJMibeQr9RkAbnCBk=; b=y8QcK5JEiqK0xSuCNe9yD6nfXNoxWq94mrNqRaDRlnIxkebxpQdROAIxtAeDoD3Zfo 91Dkuh3LmW7bGUirinXn6CY9skr8uHOnZysI6hojBuzO+k168XcsXc6dgoIJJxsL9cPQ lDtrnMmYfDmK9dcKEEYI2PByMsN5otH7LHFDQYTJsuTthR/Aa1lMeADRYIew2tymvK2Q 8aA6GFulMq2a+axK3eqxDsp6olR5hewb1GGJLI4LaXCuJNW894wsAPxrVhSDUpgMcJu0 oBQYxgeirP3/kYHqGIRkjG+tInk+FbZwdbBCQQHxU04VC0NxaAQA81A1s9aKxogWgyBd Lo2A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oo5-20020a17090b1c8500b00267f33cf006si5193719pjb.67.2023.08.04.06.35.28; Fri, 04 Aug 2023 06:35:40 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230483AbjHDNT0 (ORCPT + 99 others); Fri, 4 Aug 2023 09:19:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230108AbjHDNTL (ORCPT ); Fri, 4 Aug 2023 09:19:11 -0400 Received: from muru.com (muru.com [72.249.23.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D1F6A659E; Fri, 4 Aug 2023 06:16:34 -0700 (PDT) Received: from hillo.muru.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id 7166980F7; Fri, 4 Aug 2023 13:15:55 +0000 (UTC) From: Tony Lindgren To: Greg Kroah-Hartman , Jiri Slaby Cc: Andy Shevchenko , Dhruva Gole , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , John Ogness , Johan Hovold , Sebastian Andrzej Siewior , Vignesh Raghavendra , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH] serial: 8250: Fix oops for port->pm on uart_change_pm() Date: Fri, 4 Aug 2023 16:15:51 +0300 Message-ID: <20230804131553.52927-1-tony@atomide.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE 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 Unloading a hardware specific 8250 driver can produce error "Unable to handle kernel paging request at virtual address" about ten seconds after unloading the driver. This happens on uart_hangup() calling uart_change_pm(). Turns out commit 04e82793f068 ("serial: 8250: Reinit port->pm on port specific driver unbind") was only a partial fix. If the hardware specific driver has initialized port->pm function, we need to clear port->pm too. Just reinitializing port->ops does not do this. Otherwise serial8250_pm() will call port->pm() instead of serial8250_do_pm(). Fixes: 04e82793f068 ("serial: 8250: Reinit port->pm on port specific driver unbind") Signed-off-by: Tony Lindgren --- drivers/tty/serial/8250/8250_port.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -3278,6 +3278,7 @@ void serial8250_init_port(struct uart_8250_port *up) spin_lock_init(&port->lock); port->ctrl_id = 0; + port->pm = NULL; port->ops = &serial8250_pops; port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE); -- 2.41.0