From patchwork Fri Aug 4 13:15:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Lindgren X-Patchwork-Id: 131189 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:44a:b0:3f2:4152:657d with SMTP id ez10csp284861vqb; Fri, 4 Aug 2023 07:05:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEkwRzpPoQipThOhlCpOe202N/0I77lDZjag5shXKCRYyCkddOP8FbhJcX9o/YuTk/1TiVJ X-Received: by 2002:a05:6870:14d4:b0:1be:d9cc:d902 with SMTP id l20-20020a05687014d400b001bed9ccd902mr2192056oab.57.1691157905773; Fri, 04 Aug 2023 07:05:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691157905; cv=none; d=google.com; s=arc-20160816; b=cTf/LLKVDxqFXB6yJz4evFRzD7/l41vwjiVAD0P6224uUGtev0qXmS/q64dutCKYA9 UN58Zw8oybGP2l4PT0IcLgFQEzhR4qsh+Bc7ajlezz4IdUUp1X+OOeEp+ZuiFcCVEDci zkRvLGtCYrlLTAzCUqiHfPbH9ekZenWDQEi4w64g8pscynXQ9hf0MYpgIE7As6JHbmGv M1bwFiumlFCAWCVuJ2Y3U1RdWYcCrzQ6X2ANBkYfLF3F9JuJulUKMHNh7trRnIlbAU5u E3OQRwWiP6ffnmttuqRhLum5DEtp4PP94cq8TprFo+OdqZk6omm2Hee1OjTQ0yJOdkkP bC/w== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b22-20020a63e716000000b0055ac5d0fc79si1701739pgi.648.2023.08.04.07.04.36; Fri, 04 Aug 2023 07:05:05 -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 S229654AbjHDNT1 (ORCPT + 99 others); Fri, 4 Aug 2023 09:19:27 -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_J=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 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773307592170083833 X-GMAIL-MSGID: 1773307592170083833 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 Reviewed-by: Andy Shevchenko Reviewed-by: Dhruva Gole --- 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);