Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2155085lqz; Tue, 2 Apr 2024 08:43:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUqSagSRTHdBz+zCtQfvVKiOTcWj4HwjFI6yYC3o972Yd5T9kwwibT5Gd12FOulT6G8Xyb9ZSkYr0iJsENDQ7SCUFcSXf3YqO4Yq9rgRg== X-Google-Smtp-Source: AGHT+IFs0Znu8JsqwKYDhYiv66yqkVCmr+Nd7tTVhhCaqC7uYeNEzpVDF2WuW/NVTiAcmA922v7z X-Received: by 2002:a9d:7e92:0:b0:6e6:fdfc:3818 with SMTP id m18-20020a9d7e92000000b006e6fdfc3818mr41303otp.5.1712072584242; Tue, 02 Apr 2024 08:43:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712072584; cv=pass; d=google.com; s=arc-20160816; b=TKKGq9ie92f4gq29W/gX0w4J6PAIGxOcGUoWpClOON/nNdmR0+EVLdMJXEqIgma9l+ AYZc4bPd5X1kGvBrA8eBS/Nh/FbSZ59bTj7mRAnOLyaVOxRfvqzsLkZkc8U1h8GHvm+8 w8A8+jd8DtzKLELjB4xJgN32w17Gtx58OVpJijX/tT02yVDs4LgFSI9e3y/+LjCDIwC4 BwvqlTx1CuOhZXfnXiTHl3HN8U/jzwyZqvbvZE98NlQ6O0WE9d7kM/fOx4l5880aN9Jh 1+n+A9LGx7S+Cj184wKBnfLvXLELmxKvfpHYc64FfY9KSCE2VMa3zF0b5HZ/HSz5ZWg1 MIgA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=OsFvfqd9uo/WlEEGY935fg29mRulVTgRzEy+XCiE6HQ=; fh=G+kXbXZ7X6Rrw4sqwu0pPJ5LnQ6m545XsQoac6catcE=; b=pC6N5/G1auepxrXDezuVMTAKaKSubfGxcjTKPhub7J/mrAfktnjLQ3yMkRXynAUwK/ AxAdRa6fK9vf0yDt70YL8I/bb/OlJ03fv0yMoa6n2ChgQIYb/6tbiAdUtPcvNcP5XFZy y9XxKd0XvPhVoQuI2rBaxuRRoUxmEwfebAG5mO6F0cXnl7oxRewWLOnX8u3N0V4MQrz0 pH7sg8481/yol6fEiXjqWfy8XFGZgWV9CfOY/8+QqS2M1ql68/feDbsfugIzI3Dph4hm V/GV8c5UtMgD+JugJrjw0gtMvUfXdGxEvNK9xVJOsPpoP43DwEe/iQ2W5Gj4IiLE1ZD6 pphA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=JhRRKeZg; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-128256-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128256-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id f10-20020a0cf7ca000000b00690c04bf41dsi12422965qvo.31.2024.04.02.08.43.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 08:43:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-128256-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=JhRRKeZg; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-128256-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128256-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id F0E7B1C23179 for ; Tue, 2 Apr 2024 15:43:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F0D3C134431; Tue, 2 Apr 2024 15:42:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="JhRRKeZg" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8F00C132C39; Tue, 2 Apr 2024 15:42:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712072548; cv=none; b=WfAqcP8osRyOZPaR+UacYwkXBwB6fJxooLzj8Sx9B5LdxWOQ40KJMtYkwrYnXbo9qgAEeEkFK+bSnNqd9iKZkoRV3B99vV2+frvjYniI3KltNIZPiAd3iNabHT0DcdQrmhLOGAKPCKlKiMGtUEbtd9v0W9fx/KVayaZJ26ukyRI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712072548; c=relaxed/simple; bh=o78Fa752/ZOPs6iLperlSbDq86UPzIkFataSRBoiH5o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZjRj0BqSLS3ibp7ePEWLhmUNgNlQUCR8E51n7RtdMqPw/r5/32JZDAZDrAiQxIMfl4LbYlwdyFT9lYI7AO7WyloRDvt86VOjIFiVtMbPnW9mYHzb95AdnhTPusPFbGty2uJ4Ja9zZ4upGyyr8C5vzeGcSFIConENiJMeZO/shRs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=JhRRKeZg; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712072546; x=1743608546; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=o78Fa752/ZOPs6iLperlSbDq86UPzIkFataSRBoiH5o=; b=JhRRKeZgk4TdfSlc/i8PRARSiAPC7EdrZF4A98iOdkLp7nedM49aAicx 8BcCXCVQE0+DubNWlAldgI58xpIxFaBUSDLsbhUWw/NcabvPDd0f4/q+r +uGYI65LqCrrspLa5uf7aT8yDUqqdoAUqCk4JfXn2lZ2LVHoiEHERzVHK upVhcrn5sDpHekJMOsWF8qVslZ2NBZw4VNwVeglDxRWOKWR1+SEOdZ7R6 2HxtXuy/UUV7hZlF9QqLHmDFvrbsNBJxIWVhXVL9FVmA9XvkQ2JMPIvnq VrixDaXGlDMU66mM1R6boHMJs8rwjFY1RwB5+xqHnptK0kaR3AZqOM4gQ A==; X-CSE-ConnectionGUID: PV/v7GXrQkS+8xUl3pUVMg== X-CSE-MsgGUID: cprVtvEMTNC684Nd5tUTtA== X-IronPort-AV: E=McAfee;i="6600,9927,11032"; a="17870055" X-IronPort-AV: E=Sophos;i="6.07,175,1708416000"; d="scan'208";a="17870055" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Apr 2024 08:42:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11032"; a="937083636" X-IronPort-AV: E=Sophos;i="6.07,175,1708416000"; d="scan'208";a="937083636" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 02 Apr 2024 08:42:21 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 3506D506; Tue, 2 Apr 2024 18:42:20 +0300 (EEST) From: Andy Shevchenko To: Greg Kroah-Hartman , Andy Shevchenko , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Cc: Jiri Slaby Subject: [PATCH v1 02/16] serial: max3100: Update uart_driver_registered on driver removal Date: Tue, 2 Apr 2024 18:38:08 +0300 Message-ID: <20240402154219.3583679-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240402154219.3583679-1-andriy.shevchenko@linux.intel.com> References: <20240402154219.3583679-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The removal of the last MAX3100 device triggers the removal of the driver. However, code doesn't update the respective global variable and after insmod — rmmod — insmod cycle the kernel oopses: max3100 spi-PRP0001:01: max3100_probe: adding port 0 BUG: kernel NULL pointer dereference, address: 0000000000000408 ... RIP: 0010:serial_core_register_port+0xa0/0x840 ... max3100_probe+0x1b6/0x280 [max3100] spi_probe+0x8d/0xb0 Update the actual state so next time UART driver will be registered again. Fixes: 7831d56b0a35 ("tty: MAX3100") Signed-off-by: Andy Shevchenko --- drivers/tty/serial/max3100.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/tty/serial/max3100.c b/drivers/tty/serial/max3100.c index 45022f2909f0..efe26f6d5ebf 100644 --- a/drivers/tty/serial/max3100.c +++ b/drivers/tty/serial/max3100.c @@ -841,6 +841,7 @@ static void max3100_remove(struct spi_device *spi) } pr_debug("removing max3100 driver\n"); uart_unregister_driver(&max3100_uart_driver); + uart_driver_registered = 0; mutex_unlock(&max3100s_lock); } -- 2.43.0.rc1.1.gbec44491f096