Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp541276lqb; Wed, 17 Apr 2024 04:19:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVWgUvZQ/jLD2cs6Vbop+n6gYiXcNDCVnrXXelEc+jKMIPpeVL/t9jy/RNhvaXRNZbbX1jT6t8jQKmjZ+DFASTUjcWQye0Ulkt4dod6Yg== X-Google-Smtp-Source: AGHT+IEWWMDT0Fzy1sYYSHnYapRCCvRHBRY2YOYvp6anrPyF9HT0X6oexWjvJybVhefmAxcPIwUL X-Received: by 2002:a05:622a:1ba1:b0:437:4df0:79af with SMTP id bp33-20020a05622a1ba100b004374df079afmr3460608qtb.6.1713352756405; Wed, 17 Apr 2024 04:19:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713352756; cv=pass; d=google.com; s=arc-20160816; b=jYBn5oml7WnOMVut1LfLx3GWoS35ZpADA/NaEU1S8qp0BXK0SjuIa/CEo/h5ut+zCb PfQI/OBE/ictdCGuYWQnKYZq7oNR5cU17Ns+eqRRwoT6nnWE5++thQVvkA2aJpGYOoGL FKgmjkZ7CKkCRdSawwBKDs3oOYep7oNssDjitNHUOchFKFH4yl1LVd74TeVJ4c6VACJU 99lxz4UCl6Qtmcie9hWwNTi5qNJgKilSONTnK9woluYZVVb3SekMfq85pAR6o2JJpHYK GPDUDEdc4i5BPz7bq3EiA4itHUC6RVke6izCT53RcuIf42A1vsASirJHDOuBUjhc4r6v UVCA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=j4vnht0e9pH3tWcw0pHN6SIH7fA2SLJOcBHEWMkMUb0=; fh=WkkzK+CBKtEeOgyFwsMpc44oFba90CuMF7VXS4nAIdI=; b=cF9vgLxTgeu6r+0jUobh3B9MKQtV1F1VSPBByVolGniosKzmUyF5Soh8U39Dq3FDRj BGr5DXWWg+EPc9xE+sKpnJ8fZRnlovs8eFgdWd3z25Ys2u0C2WTNgjfjPtYLs1+dFU47 C/mbxxcA4CWT2Suc0g08K41pZRTdJXwckll9flArIVu9kAc/5duEZQ/f45vY/StL2K/N MZuKpeJEgfniDeoJYI1Me4YGE5lgi5Bjc1v82eWjqsn8vVDWMXK+9inymKVL6Ba/FNnv +UJE0ra1S4E3vpKWwc6vsZ0ocvo3q87gIK0xpd9FfsrSW6tgdE1TfmtcAm/BnHmG+3U/ d0Yw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZoVBz0gF; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-148392-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148392-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id g17-20020ac87f51000000b00436d9d1940csi9342178qtk.186.2024.04.17.04.19.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 04:19:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-148392-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZoVBz0gF; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-148392-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148392-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org 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 255F61C20E57 for ; Wed, 17 Apr 2024 11:19:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B170E13C905; Wed, 17 Apr 2024 11:19:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ZoVBz0gF" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D892B13C68E; Wed, 17 Apr 2024 11:19:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713352749; cv=none; b=sJmZbWRYT24KslvtJLSAYiGAI7QQSveCIWKpBn6TYdOPpQdYjclNthmJcRlRwoKlEIBhWXRI9dYs1wWapPM55bA4rjWBY8gqs+40CS1cZamloGBhA8K8+CMOerV371vju5kp/212Oxqm6NC4z2km8Idfx3mDMFLfEOJNPcWm8YQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713352749; c=relaxed/simple; bh=OUmscy4N4P8Jk2gTRlKg8QoiDcFeKHpdLLSRDJuAFUs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=HoQ0Zkvm5NXRc1pGvlh4lx+ubKLccZF5pgtJcVNtrcNWbTZBsqJ3WI1PEKHZq9IPcenLThPqkqwsXWbN4GjBm8DLt2QEGImBVQZPVwzTgNOCLtkCHQlxMoJo5NFaejlgLtWo/GEeQPa7dk0cANz4EMAQspjJosaq4RKCktjnjFE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ZoVBz0gF; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A0BBC072AA; Wed, 17 Apr 2024 11:19:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1713352749; bh=OUmscy4N4P8Jk2gTRlKg8QoiDcFeKHpdLLSRDJuAFUs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZoVBz0gFmumlP0r3VGjZnjMIWstMpSiEMcc5ylLCjx0s2EH0pz29JXox1qJPClen3 EeXnXZORb8fBYU7G0hcyEPRLh8TOCYW89wXPqclKJIFzZX1NacnWnWq9P6GBDteWU/ zlQjL0n86lGFd/vXCGv3zXIVScFoASpavFGigGX0= Date: Wed, 17 Apr 2024 13:19:07 +0200 From: Greg Kroah-Hartman To: Parker Newman Cc: Jiri Slaby , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Parker Newman Subject: Re: [PATCH v3 8/8] serial: exar: fix: fix crash during shutdown if setup fails Message-ID: <2024041746-galvanize-satchel-09a4@gregkh> References: <1a21fffe403d7181e0404db1ed92140c306f97b7.1713270624.git.pnewman@connecttech.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=us-ascii Content-Disposition: inline In-Reply-To: <1a21fffe403d7181e0404db1ed92140c306f97b7.1713270624.git.pnewman@connecttech.com> On Tue, Apr 16, 2024 at 08:55:35AM -0400, Parker Newman wrote: > From: Parker Newman > > If a port fails to register with serial8250_register_8250_port() the > kernel can crash when shutting down or module removal. > > This is because "priv->line[i]" will be set to a negative error code > and in the exar_pci_remove() function serial8250_unregister_port() is > called without checking if the "priv->line[i]" value is valid. > > Signed-off-by: Parker Newman > --- > drivers/tty/serial/8250/8250_exar.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c > index 501b9f3e9c89..f5a395ed69d1 100644 > --- a/drivers/tty/serial/8250/8250_exar.c > +++ b/drivers/tty/serial/8250/8250_exar.c > @@ -1671,7 +1671,8 @@ static void exar_pci_remove(struct pci_dev *pcidev) > unsigned int i; > > for (i = 0; i < priv->nr; i++) > - serial8250_unregister_port(priv->line[i]); > + if (priv->line[i] >= 0) > + serial8250_unregister_port(priv->line[i]); Is this a bug in the current driver? If so, can you resend it on its own so we can get it merged now? thanks, greg k-h