From mboxrd@z Thu Jan 1 00:00:00 1970 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 6036151017 for ; Tue, 21 Nov 2023 18:40:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ECQJbYQf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5DB5C433C9; Tue, 21 Nov 2023 18:40:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700592009; bh=scGvM5ZeLf2f5BF5h3F7rDzfO+6jGUYmP7jnnfz1ZUw=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=ECQJbYQfr51w20CizN0ST5Vke0LzD38USn+LQOWwJC/LnsCqurDLEPEfj/uLjqeLE IukULGSsYWAy1/Jdaxets4FkoIVJSaugXJ22zHZ4BkRZdMqyB9bATahcLaYUdTnSdF HTsU9CKhlYQjSPExJPKDhrv2R44hCwfIihxUatm0Hd28cRHJW4h3CejCstNSd+TXc3 HpxhmHGPE1Y9LHoX1lyeHdmMdRe4hXdHhVNmejlqfyAKkXYG3a7gUPIusr/0br2trX uaviinlHUnl/aOS/WX2ZxHi5iQN1FrCQM01Sh7g6jH2k5dupdPmlqw/UBJWi0Typbh eTLy6I0DAYlUw== Date: Tue, 21 Nov 2023 12:40:08 -0600 From: Bjorn Helgaas To: Daniel Stodden Cc: Kurt Schwemmer , Logan Gunthorpe , linux-pci@vger.kernel.org Subject: Re: [PATCH v3] switchtec: Fix stdev_release crash after suprise device loss. Message-ID: <20231121184008.GA249064@bhelgaas> Precedence: bulk X-Mailing-List: linux-pci@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: On Tue, Nov 21, 2023 at 10:23:51AM -0800, Daniel Stodden wrote: > > On Nov 20, 2023, at 1:25 PM, Bjorn Helgaas wrote: > > On Mon, Nov 13, 2023 at 01:21:50PM -0800, Daniel Stodden wrote: > >> A pci device hot removal may occur while stdev->cdev is held open. The > >> call to stdev_release is then delivered during close or exit, at a > >> point way past switchtec_pci_remove. Otherwise the last ref would > >> vanish with the trailing put_device, just before return. > >> > >> At that later point in time, the device layer has alreay removed > >> stdev->mrpc_mmio map. Also, the stdev->pdev reference was not a > > > > I guess this should say the "stdev->mmio_mrpc" (not "mrpc_mmio")? > > Eww. My fault. Could you still correct that? Yep, I speculatively made that change already, so thanks for confirming it :) https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git/commit/?h=switchtec&id=f9724598e29d Bjorn