From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C4ACC07E9B for ; Mon, 19 Jul 2021 13:05:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DF6E36113E for ; Mon, 19 Jul 2021 13:05:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237046AbhGSMY1 (ORCPT ); Mon, 19 Jul 2021 08:24:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:53732 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236883AbhGSMYZ (ORCPT ); Mon, 19 Jul 2021 08:24:25 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DF97D610A5; Mon, 19 Jul 2021 13:05:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626699905; bh=35IH1Be/xn27F8mXBOPo5R8WaCBnv5MW7j4hM992ZeU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=onoAm0NSVStQeP9V4wR6k8eqWvO+KFUNnqtYFgRjuMLbse6Or2MUtp13xliIfe1qk YEO/YIMZ9PAd3PDh9IHJHSZJ4GPoXzRkn+VC2DvhrbCM7WeN/Ta2k3GeMGbM67RtZV qojNHhN5gTjV5jrCbHL+ZEJrkuPXOgdchTbUWM88= Date: Mon, 19 Jul 2021 15:05:02 +0200 From: Greg Kroah-Hartman To: Xiaotian Feng Cc: linux-kernel , stable@vger.kernel.org, Thomas Zimmermann , "Michael J. Ruhl" , KuoHsiang Chou , kernel test robot , Dave Airlie , dri-devel@lists.freedesktop.org Subject: Re: [PATCH 5.12 237/242] drm/ast: Remove reference to struct drm_device.pdev Message-ID: References: <20210715182551.731989182@linuxfoundation.org> <20210715182634.577299401@linuxfoundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Mon, Jul 19, 2021 at 07:43:39PM +0800, Xiaotian Feng wrote: > On Mon, Jul 19, 2021 at 7:23 PM Greg Kroah-Hartman > wrote: > > > > On Mon, Jul 19, 2021 at 05:57:30PM +0800, Xiaotian Feng wrote: > > > On Fri, Jul 16, 2021 at 5:13 AM Greg Kroah-Hartman > > > wrote: > > > > > > > > From: Thomas Zimmermann > > > > > > > > commit 0ecb51824e838372e01330752503ddf9c0430ef7 upstream. > > > > > > > > Using struct drm_device.pdev is deprecated. Upcast with to_pci_dev() > > > > from struct drm_device.dev to get the PCI device structure. > > > > > > > > v9: > > > > * fix remaining pdev references > > > > > > > > Signed-off-by: Thomas Zimmermann > > > > Reviewed-by: Michael J. Ruhl > > > > Fixes: ba4e0339a6a3 ("drm/ast: Fixed CVE for DP501") > > > > Cc: KuoHsiang Chou > > > > Cc: kernel test robot > > > > Cc: Thomas Zimmermann > > > > Cc: Dave Airlie > > > > Cc: dri-devel@lists.freedesktop.org > > > > Link: https://patchwork.freedesktop.org/patch/msgid/20210429105101.25667-2-tzimmermann@suse.de > > > > Signed-off-by: Greg Kroah-Hartman > > > > --- > > > > drivers/gpu/drm/ast/ast_main.c | 5 ++--- > > > > 1 file changed, 2 insertions(+), 3 deletions(-) > > > > > > > > --- a/drivers/gpu/drm/ast/ast_main.c > > > > +++ b/drivers/gpu/drm/ast/ast_main.c > > > > @@ -411,7 +411,6 @@ struct ast_private *ast_device_create(co > > > > return ast; > > > > dev = &ast->base; > > > > > > > > - dev->pdev = pdev; > > > > pci_set_drvdata(pdev, dev); > > > > > > > > ast->regs = pcim_iomap(pdev, 1, 0); > > > > @@ -453,8 +452,8 @@ struct ast_private *ast_device_create(co > > > > > > > > /* map reserved buffer */ > > > > ast->dp501_fw_buf = NULL; > > > > - if (dev->vram_mm->vram_size < pci_resource_len(dev->pdev, 0)) { > > > > - ast->dp501_fw_buf = pci_iomap_range(dev->pdev, 0, dev->vram_mm->vram_size, 0); > > > > + if (dev->vram_mm->vram_size < pci_resource_len(pdev, 0)) { > > > > + ast->dp501_fw_buf = pci_iomap_range(pdev, 0, dev->vram_mm->vram_size, 0); > > > > if (!ast->dp501_fw_buf) > > > > drm_info(dev, "failed to map reserved buffer!\n"); > > > > } > > > > > > > > > > Hi Greg, > > > > > > This backport is incomplete for 5.10 kernel, kernel is panicked > > > on RIP: ast_device_create+0x7d. When I look into the crash code, I > > > found > > > > > > struct ast_private *ast_device_create(struct drm_driver *drv, > > > struct pci_dev *pdev, > > > unsigned long flags) > > > { > > > ....... > > > dev->pdev = pdev; // This is removed > > > pci_set_drvdata(pdev, dev); > > > > > > ast->regs = pcim_iomap(pdev, 1, 0); > > > if (!ast->regs) > > > return ERR_PTR(-EIO); > > > > > > /* > > > * If we don't have IO space at all, use MMIO now and > > > * assume the chip has MMIO enabled by default (rev 0x20 > > > * and higher). > > > */ > > > if (!(pci_resource_flags(dev->pdev, 2) & IORESOURCE_IO)) { // > > > dev->pdev is in used here. > > > drm_info(dev, "platform has no IO space, trying MMIO\n"); > > > ast->ioregs = ast->regs + AST_IO_MM_OFFSET; > > > } > > > > > > That's because commit 46fb883c3d0d8a823ef995ddb1f9b0817dea6882 > > > is not backported to 5.10 kernel. > > > > So what should I do here? Backport that commit (was was not called > > out), or just revert this? > > > I think we can just simply revert the patch. Because commit 46fb883c > removed drm_device.pdev usage, > then commit ba4e0339 used drm_device.pdev again. Since commit 46fb883c > is not in 5.10.50 kernel, > it's not a stable fix. Now qropped, thanks. greg k-h