Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3614086pxv; Mon, 19 Jul 2021 04:45:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJygf8+B8hkq8CAEPt0yFe4d8mdP1+UVQSbHiTZgEcRtzajKllerjFRHqzrtaJF7HszBuk8w X-Received: by 2002:a92:3f01:: with SMTP id m1mr17218226ila.122.1626695126459; Mon, 19 Jul 2021 04:45:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626695126; cv=none; d=google.com; s=arc-20160816; b=HXlQOwHvqIFGif6lFzhOl+rDro/q6rnx30pqUDwXDQQqEr3KP6ujY+k1Q4iSHnBCc3 G9uXEeU0mIXOplfnSAjFon0CIkLDCLYVD7ingfiyIiq456gd2llzmmnktdlifkXxbcyN Nm8McquAR7RgrEV7vdF7O6MhRv8xmHccIYsFX9Q8r/aDrEAXCTVqDdUeKUkIMoaKheCf sxoSO3sENrr29r1x1og+WS7WpjFVK3cY/gS9Z0/ao7C/ah/2GCVlduuqASIgC2F7dc+5 qmfYgX7gzJ2dbPXzTaSzd/ki0uQiFanDV9sG2d8HASve9+S7eK9AYWaxDXrma9kc7RkO U5gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=lkb64p666TsMQoJB8bFW0M3JYMVrr4pV3PJi1xmP1sQ=; b=KGmtkTejA458ql2FDjqsNy4BVj9UeCsrG52KMs/LqbPR/oRbqorVk+/FpskOhLYHPT 72xrC9LXCVb+j+hWpkfyciGEuPIZrWYSFjOMu2Fub4AMFAA3BBX8pU8xdcdMmXuJnzRL BCipUT7pvbQ77e64pJxtCf9Q2NPbYqBbl7miZjqEWIDY6YslpgpJa9N4UyUi0Xhtcgaw wVcX6aweZE/0Sgu/jQHYDt7dQRfqkhazi0OP4LyCgVS0Brtp9nGV76EJvT2pDEn4P/B8 8k62xAVOumxv4LIc/akwe9BpA/SX90jShzdq8B9zydum8Wz88rwfWn4CmYl79Q2Uxg/Q 05PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=SCfJHRU6; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u4si9721460jak.4.2021.07.19.04.45.14; Mon, 19 Jul 2021 04:45:26 -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=@gmail.com header.s=20161025 header.b=SCfJHRU6; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236469AbhGSLDO (ORCPT + 99 others); Mon, 19 Jul 2021 07:03:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232156AbhGSLDO (ORCPT ); Mon, 19 Jul 2021 07:03:14 -0400 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB0BCC061574; Mon, 19 Jul 2021 03:56:27 -0700 (PDT) Received: by mail-lj1-x22d.google.com with SMTP id b29so4787476ljf.11; Mon, 19 Jul 2021 04:43:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lkb64p666TsMQoJB8bFW0M3JYMVrr4pV3PJi1xmP1sQ=; b=SCfJHRU6fnw/UMQ5GYy0ViwQJ1/EotLasE0u7oWiQ3108H8J1jp36eN0UgTgXZ70kb 367x5tyu4Ih0c1uu1XsKkwIbgtCH4I8EakwPF4jvugPRuheEe5lnKS/XFoC0C3+vxeN8 klhUV9++zgYfZZYTuE8G2ylpXcqXerxlI9WS3YJYheVPFpj7/qzeipOxZaNeh1H3ci/s Z2aZZx3V3gP6kyDJV2tyq5VBlmdntZbWTvY8rZbPMmrt8cK+tny9Ki0/TKhE+Iwky6ci tbix8ML+ZaCFQ8XIHZ6oNhaX2ayeN4y4IrvThIcUi7wsVcpTWVrlJ9kUdEY1JqyXtpM6 EzGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=lkb64p666TsMQoJB8bFW0M3JYMVrr4pV3PJi1xmP1sQ=; b=mL8Ft1XDFbDWzAADFX+wUEgc74BLfHVPGGPZodaFqlqYQ1FsL51dzFQjjcbMjZyNIj tiur6LZyNCSTL8lV6Xun68LV5hroaNIcPG1XM3bAvuQj13/6jqPjvb7F6GKqotXFEVtt kOrMARUD3Gw2FwQHGevE9Ol9UocdKWIDst1jbn9ju3EDAHVIz/TGVZIpGeIk/mbGJz9B D5OVI89nBpEosSmY4E8hYEYkKTU9WhP1ig1mNjuqiUkKKxsueXlQ4kElkQEdD+TC+NIl rg9G7I/PZxyAkEXgk2JHDfqU+hL9Hgqc+LpXWw4LULY5/XtFjKsdjkJL5NrAjWCgAi+E 55Ow== X-Gm-Message-State: AOAM533n1RnlwhAuQ05Yy7pAtif18ESKrfmCsNbDrP1BBWTIGW3VkdGJ jsMkwxu4ib7ZxC8QUPkVJJ+1X38uJmIAtOSXrJE= X-Received: by 2002:a2e:9e8e:: with SMTP id f14mr21872042ljk.468.1626695031106; Mon, 19 Jul 2021 04:43:51 -0700 (PDT) MIME-Version: 1.0 References: <20210715182551.731989182@linuxfoundation.org> <20210715182634.577299401@linuxfoundation.org> In-Reply-To: From: Xiaotian Feng Date: Mon, 19 Jul 2021 19:43:39 +0800 Message-ID: Subject: Re: [PATCH 5.12 237/242] drm/ast: Remove reference to struct drm_device.pdev To: Greg Kroah-Hartman Cc: linux-kernel , stable@vger.kernel.org, Thomas Zimmermann , "Michael J. Ruhl" , KuoHsiang Chou , kernel test robot , Dave Airlie , dri-devel@lists.freedesktop.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > thanks, > > greg k-h