Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp3931647rwi; Sat, 22 Oct 2022 02:26:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5wu8aZ+z0JK0KgJiTaMpcWiojAAgKtP5T8YcBJ2BEU0Xvr4zUBcw41zcz/TGHRWBew6m3H X-Received: by 2002:a17:90b:390c:b0:20d:a662:dac2 with SMTP id ob12-20020a17090b390c00b0020da662dac2mr55279044pjb.5.1666430757796; Sat, 22 Oct 2022 02:25:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430757; cv=none; d=google.com; s=arc-20160816; b=bWO6Z0vglYlTuLc4ISEfBTWPNTc0qyizb0Oa3TbwhRDr63Jt6lgxrYgguaHxC830eO 8zlbFSdtHKcZGpWt/Ir6ufiOlQTkrc6GT0K2I9D1RKkCO1x/4Wj0s7TidWv3Hz2xMx50 ZGT11E3okCuy0eRd1N7qXl8bdgBGdTSbRIKOWfd43+7JdL0wdDZAzQ3JUDq8Bf7w7u8R iyfjQf2amw0HKdw49SMAI8207Vd6fyJXEYDIMUohTEvuR46uULs2Bw01hCykcmXu/KLs 5ABir5ADK6wRUQpgFq4YB4Eap1dTby0dHxcmbSmLSEGtJcfv2UUtIqweyNEdOF5mpoKf c2RQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GN0+YOy70zoYZPp5tqaWEccb5XQrXOx1r1uqZfcxcn4=; b=shqOSDnyj8XEdfoS7iSgmiS9THUhgY6IZ1iAD49Sp8+TN9gaeZxV9DFzhVyMqPyhl9 8vSFiLKzhVUXHWFeRlcnCdgx7Q7NYxuKaravc957vhtm0VTuwq2C4e2KFnsrl4AWmPjW 2rYRA+adFsDRcxvL9D8ZVvEFk6dTJvECnZvuFHJTkQtNALyKJ8POSYu3ac7XJmG+LreK oieoxlqw4xiAdQAwYWqYt5afequmm/zjF5RXjUjTXTC4ymv34uuL1INCA2QHMy15Ebj+ LgbfRfPgCFM7OOOad9tlHfK35glybsx+aETYXhRWzw1MVevliZlWaEj+zF/AngsrDDqI KxBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=imBb4EXp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c23-20020a63ea17000000b0044034efb2aesi26478596pgi.869.2022.10.22.02.25.46; Sat, 22 Oct 2022 02:25:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=imBb4EXp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232582AbiJVIFZ (ORCPT + 99 others); Sat, 22 Oct 2022 04:05:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232431AbiJVH67 (ORCPT ); Sat, 22 Oct 2022 03:58:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80FE7196B6E; Sat, 22 Oct 2022 00:49:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 26C37B82DF1; Sat, 22 Oct 2022 07:48:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BE02C433C1; Sat, 22 Oct 2022 07:48:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424930; bh=EEbUB2+t3mQjhUpvR8BIh6PyoINtwoaI6t93TceIrNU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=imBb4EXpPFTMr8v2qUGlyBGEomh3Sj2bovV9XCQ0FE8ESLWnZ8hKCVRXrMLj7asEs i6ijqN4t7T+Im8bkkqSF0/xzZUs67eL3pZXf+BY01rrhQ5jiPv6V7y7LUL69134Hjq BBLgwkx8UcCWYbNWO4c08HYMVALpzXsvzfYNL3PU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Emil Velikov , Dmitry Osipenko , Gerd Hoffmann , Sasha Levin Subject: [PATCH 5.19 300/717] drm/virtio: Correct drm_gem_shmem_get_sg_table() error handling Date: Sat, 22 Oct 2022 09:22:59 +0200 Message-Id: <20221022072506.048459884@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dmitry Osipenko [ Upstream commit 64b88afbd92fbf434759d1896a7cf705e1c00e79 ] Previous commit fixed checking of the ERR_PTR value returned by drm_gem_shmem_get_sg_table(), but it missed to zero out the shmem->pages, which will crash virtio_gpu_cleanup_object(). Add the missing zeroing of the shmem->pages. Fixes: c24968734abf ("drm/virtio: Fix NULL vs IS_ERR checking in virtio_gpu_object_shmem_init") Reviewed-by: Emil Velikov Signed-off-by: Dmitry Osipenko Link: http://patchwork.freedesktop.org/patch/msgid/20220630200726.1884320-2-dmitry.osipenko@collabora.com Signed-off-by: Gerd Hoffmann Signed-off-by: Sasha Levin --- drivers/gpu/drm/virtio/virtgpu_object.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b/drivers/gpu/drm/virtio/virtgpu_object.c index b38c338211aa..75a159df0af6 100644 --- a/drivers/gpu/drm/virtio/virtgpu_object.c +++ b/drivers/gpu/drm/virtio/virtgpu_object.c @@ -170,6 +170,7 @@ static int virtio_gpu_object_shmem_init(struct virtio_gpu_device *vgdev, shmem->pages = drm_gem_shmem_get_sg_table(&bo->base); if (IS_ERR(shmem->pages)) { drm_gem_shmem_unpin(&bo->base); + shmem->pages = NULL; return PTR_ERR(shmem->pages); } -- 2.35.1