From patchwork Sat Oct 22 07:22:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7392 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1096931wrr; Sat, 22 Oct 2022 01:06:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4H6foyCPyRA7QzfnKvmqbT/HN3zK2wZ0htn4+ZS/E/1KRWWQw6F2q1biZ0Ov9vS85k1DV+ X-Received: by 2002:a62:4c2:0:b0:52e:bd4d:50e1 with SMTP id 185-20020a6204c2000000b0052ebd4d50e1mr23512010pfe.8.1666425984526; Sat, 22 Oct 2022 01:06:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425984; cv=none; d=google.com; s=arc-20160816; b=IJ1nfRVdeKcpabeViwYeLA/8YbzT8gPcYzDHQQD0EhFuoWFxBXVxsPcTzq6vJOrCkM Etf17HGSdPdv9vYv8iKVJDW5Doyemql8Nbw3chI5oKGu8G3L4MDffxPo6uFRVJ6FGXpp +KyHLW+4Aj9Xhwjbgu7OCXOx45HOXpdY8RqfcY88xpQFF8/3laSVPV/9hPyKc4qaTZg8 BhkxUSeRTB2r7RaayZCXtCKyaELO8Wf6uZ3JOGEuaUtbkuT64Vmu2WUn6iFxjvvwYVQq Be9kl6fki0l95gNz2GKIO88kaooVK91wcqxuF3vM02PpusA4tVY1l/Ft0qVtejugP4oD ciNg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s16-20020a170902b19000b00172ded6ff02si1589235plr.382.2022.10.22.01.06.10; Sat, 22 Oct 2022 01:06:24 -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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747374293233915234?= X-GMAIL-MSGID: =?utf-8?q?1747374293233915234?= 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); }