Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp938032iog; Thu, 30 Jun 2022 13:17:05 -0700 (PDT) X-Google-Smtp-Source: AGRyM1spCdvHur4cNBbdMp9pknrLlKnQm7V7bLHbSKm/tGpU9GjAqbofSAQn45RsQ8fdNyyjEdi4 X-Received: by 2002:a17:90b:4cc8:b0:1ee:d3a3:4e6 with SMTP id nd8-20020a17090b4cc800b001eed3a304e6mr14199012pjb.54.1656620225226; Thu, 30 Jun 2022 13:17:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656620225; cv=none; d=google.com; s=arc-20160816; b=xV1hUAgxNXwvDDePu9PqIixn8j/CsKPotuA9EepL2n/iGKCTfOyZx8DqzWe18DNWde VHuKeI36pAmZiMwh+Ek3x7QX78bbdIGIZgCnwBGxM+4cobdMmGUgT+jsqmATv2mFfTVb 51CnTlOflXmpzigC81Md9YFpBwYwlLdjOcTYvN3a3zwq7Uh2xfDGg6TH86jQMIP8HxQu /rugD8v8JPNiQFQAUZDd1zdKjP3EuGp63mDhWQA9LggSsHXp+/akpdrtELEQa8n7X33m 0pNlP069w47B2vTxXGYq9O8boyfzqxQ6PlfSS4g7LyicY44VJk6frf4ZmLdzq74vuixD YLOw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yenZYuzrcGJiZKBbnMjobIK/6t4s0mUC/5g0BJZcJmM=; b=WLHdQW0ZXpmMs8drblZXm4VZn4TzWG6W6i2HgCgc8kbsdv0Tag/AYq5nFUWfViRuuf VgtlOZjYCytOiKVMtTQdyVK0HiaY4oGdWLP5HerKKmtUHOu/Xscu5ZviirZ/z8tY2XY5 F14Ed25H7G4ywx9hnkKN/39gKx4WjwAgVAxd+hOcvXuZ2yswDfhZlD6w5Id1ymHOPIGv V0TotQP+GvDJ+pvKlkEccvn7aHemphx/YuNOL7qjhYC0HDemsF22xV5T+QqH9opKm4/J m4tXQYnbY52LAUIa0DOAWCCFEBd8OGhndad5gwbiRzqVO4L4ShDDXr/eRqj0tmAVbb0+ fPPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=SzwraIxS; 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=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pc7-20020a17090b3b8700b001ecd1423affsi870430pjb.1.2022.06.30.13.16.49; Thu, 30 Jun 2022 13:17:05 -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=@collabora.com header.s=mail header.b=SzwraIxS; 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=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237032AbiF3UH5 (ORCPT + 99 others); Thu, 30 Jun 2022 16:07:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235860AbiF3UHz (ORCPT ); Thu, 30 Jun 2022 16:07:55 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03F4F4477D for ; Thu, 30 Jun 2022 13:07:55 -0700 (PDT) Received: from dimapc.. (109-252-118-164.nat.spd-mgts.ru [109.252.118.164]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: dmitry.osipenko) by madras.collabora.co.uk (Postfix) with ESMTPSA id DFFA36601970; Thu, 30 Jun 2022 21:07:52 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1656619673; bh=3p9Ax8YAOsHUmi2qoBP7nReTf2A79FyPDDyD8wxhcZY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SzwraIxSbXHVLJwmwaTh203yYwrP6halqYrD0iBg+mhiqm/+dZOWo6xH4ZpF+OJCU 517Ju1mDMlDAZG00gsgFMTApSFrsdbcHF4wL08QIxAAZVLYeuC0ulWIhStDJw4by8X OVetO6dF2Z8wRHl4vqT0AXNQ14BQS2WGEGanViMyxi+iHLMS1oceELmWNS86GLpCP+ 7OZ0oGqnCVZHX+QHfLgfwi9z2oHEehEelMuvL77nlOpTMu00vpPdtEiSVe7wwNjMvV sLwjV89b9+PIdxOf5Ogd+FDIP11u2NCDU/yAy55f4Sv3kWiH6tp8vyNz4djToLOcfw FUpnsyU76OZFA== From: Dmitry Osipenko To: David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Daniel Vetter , Thomas Zimmermann , Emil Velikov , Robin Murphy , =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Dmitry Osipenko , kernel@collabora.com Subject: [PATCH v7 1/9] drm/virtio: Correct drm_gem_shmem_get_sg_table() error handling Date: Thu, 30 Jun 2022 23:07:18 +0300 Message-Id: <20220630200726.1884320-2-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220630200726.1884320-1-dmitry.osipenko@collabora.com> References: <20220630200726.1884320-1-dmitry.osipenko@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 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 --- 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 1cc8f3fc8e4b..87b19b3b96e0 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.36.1