From patchwork Mon Oct 24 11:29:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9320 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp465517wru; Mon, 24 Oct 2022 06:52:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5gCZqwF2jkSgNkb7HPJfN+IrQ+2BKjHLjR3QveIKFHgRWEnNayGbULJYPDZgxyewss4pwY X-Received: by 2002:aa7:9dcb:0:b0:565:89a8:c708 with SMTP id g11-20020aa79dcb000000b0056589a8c708mr34154563pfq.4.1666619572764; Mon, 24 Oct 2022 06:52:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619572; cv=none; d=google.com; s=arc-20160816; b=oj75eHCkYGljzYVRDrB7qHSTIVwjkGIHxewD+VzBiquDksqpn5JlOcb3dBXP9xg5OE 2YZEjx1bGaIweh//DQ3LoA5M2AEafeuV4JmEHS7guGZWmEgl8L+dqWARAjUIavXs4ayF lZw1RpFyIYUClOEZVLkOb+Wh2t3zIgLAgXGBy41AdHNezyzsELLKhklD81p0AXgxND3a cRHbdnxYnMMK/ThSPlifLtpEMOigHszcygRG8No64RIPjWbkDrMzys11w8Es7S9izb5p 7nuGRT482IdBNZ9DqEiI/bTUdiKDBEe1CkqkrnPkLgVF3MfaCIuQGroMO2XrAEf69rOt fObQ== 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=F9M6/7Ol5OgRtoYC78Ydxm10caWaxE729reSbp+TWus=; b=VXZJqrkoKPnGIPneYOGeogJuWKRdg/VAmrJ8I9Sv7E3C2IpEElfUxnkOP/n2zf31GJ u5sAvpqia4z8Ldj9k4QOLhMcg5sXgdA1UCefzf5Aelm+3kw3mYWECMfKzwHbVlZdLhCO 4HXT9g0Ng7UMbet6ytOEXhwSc1vTizV1fC5eQYfrdXggEKR6sACrXrEF/PAZdWZRaaED yPDhT5lNQC1GCb4g5dmoSZjW4fHzIkfxHl/v36yJYOqVKsT+KZV1E7ycGc9Nb27HGwlI X7mHAysYZkdiWSB/Xta/v1Prc8clMh/G5gtqgup8qbZ5rV/tTTuOW1qssjMu3+pnnFp7 ymHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=glANfJza; 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 21-20020a631655000000b0043c3fa353d6si33725178pgw.153.2022.10.24.06.52.39; Mon, 24 Oct 2022 06:52:52 -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=glANfJza; 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 S236633AbiJXNwV (ORCPT + 99 others); Mon, 24 Oct 2022 09:52:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236569AbiJXNvg (ORCPT ); Mon, 24 Oct 2022 09:51:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1F22BA93E; Mon, 24 Oct 2022 05:42:32 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 84D2D61337; Mon, 24 Oct 2022 12:42:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9206AC433C1; Mon, 24 Oct 2022 12:42:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666615334; bh=MTUwvdIH1m4wWWH2KRVsJB59R2sbcD1HjU4sF/1AyAU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=glANfJzaSfUEcVCU91oth7V6J0ngMCh1VyDpCKwqu/LvtLNutoFSN67+Ukpz6Qw1M xQm2rCYniFzpRJPVPH5NaidiHPf228UKCEbmMjNzyUvbhtYVwvKzTu/axzxjf6C9Fj 0yTW1XHxMm7whyUwA5DvrCbGl42soRUnQzQp1qtY= 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.15 212/530] drm/virtio: Correct drm_gem_shmem_get_sg_table() error handling Date: Mon, 24 Oct 2022 13:29:16 +0200 Message-Id: <20221024113054.675848072@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113044.976326639@linuxfoundation.org> References: <20221024113044.976326639@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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?1747577285157458809?= X-GMAIL-MSGID: =?utf-8?q?1747577285157458809?= 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 248ecd3006c3..7e75fb0fc7bd 100644 --- a/drivers/gpu/drm/virtio/virtgpu_object.c +++ b/drivers/gpu/drm/virtio/virtgpu_object.c @@ -169,6 +169,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); }