Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp200025pxj; Thu, 20 May 2021 07:31:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxO+1lXWOVdY30nZahP1dcDODLRpqatijQF5UVnfv9KnRHf0sTo4wkhLyd17TNuzR7R75W1 X-Received: by 2002:a05:6602:134c:: with SMTP id i12mr6004341iov.175.1621521099482; Thu, 20 May 2021 07:31:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621521099; cv=none; d=google.com; s=arc-20160816; b=zyBPHoySFjj7QtG+VIcDospbPgAdo0QWr7jCJolvtO+FARDqXM5dJbQwo4txB1zDTN CRg0JfDgGv+TGpQ2gN66NU+WExVFIzATRgJXjxFG+iS+/MbYC7ctXyfv9J3EHKVJUPQW 5PR/idIQCsBxD53ZKZp13uPtnbCTdOlPoffUk9hJYNW1o5NSKWbotnyAtUwF9K5mHQ9+ W85wmXpiTRRijBBB7DPa2iwbGKkAOWs929f2SrxhL4o7cKuZyCr5Rpx53xP0F0HGRyTc cmtSOyBr2O8grwZIOLAdnbyPh1LiGK5u6RB7+QQ7LDITIqkRFY5w3MTs7o1augSBwGNg Sh6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=JjAwsCoIg1/iZ6SBezI27jbiG1mzSXb1USEkPlz4g2c=; b=myAW+mJ34mTrBD+NJaXIZIX1UsKomUItEsmhOrKF7aj0llSqhC8WFK2LHw2cgKkN4T z2vjOsr6Bq1g/hTDbFlSQP+EKpcHn96eJ2t7ORgKLw2oQ4PV/1RlDWuBB6nsXqjwBZxY 9TtmKo8F7NZnt21N2UQz0MsKKw15JlsFizz/e4krDkif74NI4vXna65hIxU4PGeMwjJa vPRv+ls+2DAPPDpRHifXeY2dHoBF4TpamdUZxkyszbctLeueW807/MIQ0wkst3oezi10 C/aQKgp7sPjRDehtz/POqRSQHbn0mpvaMF8e/7teTXXPWQYgzWJwx/AV3X29Cf90g6hd Zc+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=v0kK+vQb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k1si2659983ilu.64.2021.05.20.07.31.24; Thu, 20 May 2021 07:31:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=v0kK+vQb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238540AbhETObf (ORCPT + 99 others); Thu, 20 May 2021 10:31:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:47372 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236853AbhETOb3 (ORCPT ); Thu, 20 May 2021 10:31:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EFD4861002; Thu, 20 May 2021 14:30:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621521007; bh=DwkT+nQymoBm5mEDw50KxpS1sTtx5DPSq6uiROs6fx0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=v0kK+vQb6CCfEXNMqvKXTPIWzmEKVvm8T1pZjg4R7x1j0Z2heovIq0Pm5JLpbLpaR Vk5ofpXLNVXNbK7kgOedujHBJKLyV0HFUr6QzUWlVquXpGUUGSQ6jvmN8PRRkvm74b GaeTeak/FyZrcrAmGuAjRmwwzGJmoZDzQTisVuiM= Date: Thu, 20 May 2021 16:30:05 +0200 From: Greg KH To: Zheyu Ma Cc: cernekee@gmail.com, jirislaby@kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] serial: rp2: disable interrupt in rp2_probe(): Message-ID: References: <1620991027-25856-1-git-send-email-zheyuma97@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1620991027-25856-1-git-send-email-zheyuma97@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 14, 2021 at 11:17:07AM +0000, Zheyu Ma wrote: > In 'rp2_probe', the driver registers 'rp2_uart_interrupt' then calls > 'rp2_fw_cb' through 'request_firmware_nowait'. In 'rp2_fw_cb', if the > firmware don't exists, function just return without initializing ports > of 'rp2_card'. But now the interrupt handler function has been registered, > and when an interrupt comes('rp2' may shares an interrupt line with other > devices), 'rp2_uart_interrupt' may access those ports then causing NULL > pointer dereference or other bugs. > > Fix this by disabling interrupt after registering 'rp2_uart_interrupt', > and enable it in 'rp2_uart_startup'. What prevents an interrupt from coming in right after callin rp2_uart_interrupt()? The driver has to be able to handle that. Why is the interrupt being registered before the firmware is loaded? That should be the proper fix as once you register an interrupt, the driver HAS to be able to properly handle it. thanks, greg k-h