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=-8.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham 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 E601AC07E9A for ; Wed, 14 Jul 2021 16:49:29 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 93F6460FDB for ; Wed, 14 Jul 2021 16:49:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 93F6460FDB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=virtualization-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 437E7421EE; Wed, 14 Jul 2021 16:49:29 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4Ijh76iLCatn; Wed, 14 Jul 2021 16:49:27 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id AD6F8421DA; Wed, 14 Jul 2021 16:49:26 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 8EAE8C000E; Wed, 14 Jul 2021 16:49:25 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 5EC5CC000E for ; Wed, 14 Jul 2021 16:49:22 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 4151441639 for ; Wed, 14 Jul 2021 16:49:22 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1-5AKK1YkdLR for ; Wed, 14 Jul 2021 16:49:20 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp4.osuosl.org (Postfix) with ESMTPS id 5C7424162A for ; Wed, 14 Jul 2021 16:49:20 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id B302D613C3; Wed, 14 Jul 2021 16:49:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1626281359; bh=6SKB3Qqjs+EC5rQxtbZljNFZlyLM4HZOJZxqpbfl9sM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Ko/UfbhD+PKfNZ3iK4ym6LzrxkwTJIAnlAs+qXdzedMZaGQBceXrGL4yO3Mhi8Yui vMOTVVJx+4Ujke2mPgfBk3Ht3ixeEAIiueMcl+Mt3nZdEGKe/obO9fAbsIwGZd2S1E wlHDb7pZo4ORM9aKt7vjHyClabpj5MHNp1aihZ0eiiUfnZphY1Cf8Si2OtplBMmvoA FklATVbj/QyXl8hG1qWEX00mxNkUQ0OdAccH8p4pfKml6iQ2yveG5hqAcabY/0PnHT ShhjQGUDah6fa1UE1UZsYnAqBBPNlHHBWN0dRxflqSplK04t3uzsQ1hpgqx1ZY+qSN 8z4l8b9ME85bA== Date: Wed, 14 Jul 2021 12:49:18 -0400 From: Sasha Levin To: Pavel Machek Subject: Re: [PATCH AUTOSEL 4.4 08/31] drm/virtio: Fixes a potential NULL pointer dereference on probe failure Message-ID: References: <20210706112931.2066397-1-sashal@kernel.org> <20210706112931.2066397-8-sashal@kernel.org> <20210712215937.GA9488@amd> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210712215937.GA9488@amd> Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, virtualization@lists.linux-foundation.org, Xie Yongji , stable@vger.kernel.org X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" On Mon, Jul 12, 2021 at 11:59:37PM +0200, Pavel Machek wrote: >Hi! > >> From: Xie Yongji >> >> [ Upstream commit 17f46f488a5d82c5568e6e786cd760bba1c2ee09 ] >> >> The dev->dev_private might not be allocated if virtio_gpu_pci_quirk() >> or virtio_gpu_init() failed. In this case, we should avoid the cleanup >> in virtio_gpu_release(). > >The check is in wrong place at least in 4.4: > >> +++ b/drivers/gpu/drm/virtio/virtgpu_kms.c >> @@ -257,6 +257,9 @@ int virtio_gpu_driver_unload(struct drm_device *dev) >> flush_work(&vgdev->config_changed_work); >> vgdev->vdev->config->del_vqs(vgdev->vdev); >> >> + if (!vgdev) >> + return; >> + > >Pointer is dereferenced before being tested. Heh, yes, thanks for catching that. I'll drop it for now and rework it next week. -- Thanks, Sasha _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization