Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3516902pxf; Mon, 15 Mar 2021 11:17:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQ/F3+aP2q8jopVD/K77VS7r9KmGqLqLHLCVEsiWoESZSLu3+UpU05mTjU6Iojte2UcXgz X-Received: by 2002:a05:6402:b48:: with SMTP id bx8mr32578029edb.162.1615832243313; Mon, 15 Mar 2021 11:17:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832243; cv=none; d=google.com; s=arc-20160816; b=HEQmiYOv5bciXVXSGmjhlf7cxUs8kqp8fTdaAApjLUl/jOXiFC4nmQyjniuH3Ziqvc nWlyxbGqgzrcuRZFoJs6IzsPDjvblRhRuYggDg1RNcPZQxrNGN/x+kfAqCgAshAk1OB5 s/Aj9X43A+oHTRWomvAN+qY1XR52J6qyzLvmJG/RrFc3brIjxb20/7OloFeJ/K4wDL7K bzpm6uHKqmvWSk61ocTr943CfOXMjEem4hlicvqRxvxbFuiQpnNonbcbUKvDRvpgzdQD +9Xpy3gUuSPbZrWlhsgWQrmFd88+ZwzxtCpMOxqiqAMtz+E9L+jkABAhYv3Ztn14jAn4 yvsA== 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=yZk+iWiyS7KL0vxvtZfYoNRmjc4xjKFuNROV6G/kM4U=; b=YTQiE3lKqF0uJDj3MYhzjMufCOdiz6p3dvchNz5KdafxMrHvw06Q1GyPDd+J+GvG9i s9jRc3zpqD9eD9fRUIa/5mNMmpSperLxDXtg2HR162/f+LZ2fj+fNpZd/vj/jTn7O5Dm wOyv/6IoTWjaoi8Baq9AA4f/4xtuZ+DlqjWsn4LwYanrcrYf7fexkkgzXZdtohv6zH5H SXnkM0ESpyPCCXYIp1t9gt2MGEOx7DmiLpWQG+aqlNT0Sf+YZ/uK2uGyi6x3ItOoN6VL Tj7n+/8qbMT7XIwccW4Fz/5PVbcpSSqvbr5hEbHP4D2O70iK7E0JR6+IqSgWxEwVdeln xFAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WQhnCoIt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kl9si7026562ejc.271.2021.03.15.11.17.00; Mon, 15 Mar 2021 11:17:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WQhnCoIt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S236899AbhCOOQ1 (ORCPT + 99 others); Mon, 15 Mar 2021 10:16:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:35904 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232632AbhCON7U (ORCPT ); Mon, 15 Mar 2021 09:59:20 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3FD3464F40; Mon, 15 Mar 2021 13:59:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816741; bh=YID2P7AvDCfohH6m59JbgtIUUiOAnIQBKEJthKB0uos=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WQhnCoItQi/+EM667U8KW2i7V5R8eYZjQrhWVbCiXh9mT03l86OXQT0cQskISkB2B Qcs6EaHbSaQufrjMXcsewHW2zMKVdNmBqOWoNIcjgMHBa7V1mA7HiH9E4B/lIo2gHO s2P20McCFI1/kitTVRwMuDCRQrOwJHsYVZZYPs3c= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Christian=20K=C3=B6nig?= , Alex Deucher Subject: [PATCH 5.11 096/306] drm/radeon: also init GEM funcs in radeon_gem_prime_import_sg_table Date: Mon, 15 Mar 2021 14:52:39 +0100 Message-Id: <20210315135510.902710918@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135507.611436477@linuxfoundation.org> References: <20210315135507.611436477@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Christian König commit a25955ba123499d7db520175c6be59c29f9215e3 upstream. Otherwise we will run into a NULL ptr deref. Signed-off-by: Christian König Bug: https://bugzilla.kernel.org/show_bug.cgi?id=212137 Reviewed-by: Alex Deucher Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org # 5.11.x Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/radeon/radeon.h | 2 ++ drivers/gpu/drm/radeon/radeon_gem.c | 4 ++-- drivers/gpu/drm/radeon/radeon_prime.c | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -575,6 +575,8 @@ struct radeon_gem { struct list_head objects; }; +extern const struct drm_gem_object_funcs radeon_gem_object_funcs; + int radeon_gem_init(struct radeon_device *rdev); void radeon_gem_fini(struct radeon_device *rdev); int radeon_gem_object_create(struct radeon_device *rdev, unsigned long size, --- a/drivers/gpu/drm/radeon/radeon_gem.c +++ b/drivers/gpu/drm/radeon/radeon_gem.c @@ -43,7 +43,7 @@ struct sg_table *radeon_gem_prime_get_sg int radeon_gem_prime_pin(struct drm_gem_object *obj); void radeon_gem_prime_unpin(struct drm_gem_object *obj); -static const struct drm_gem_object_funcs radeon_gem_object_funcs; +const struct drm_gem_object_funcs radeon_gem_object_funcs; static void radeon_gem_object_free(struct drm_gem_object *gobj) { @@ -227,7 +227,7 @@ static int radeon_gem_handle_lockup(stru return r; } -static const struct drm_gem_object_funcs radeon_gem_object_funcs = { +const struct drm_gem_object_funcs radeon_gem_object_funcs = { .free = radeon_gem_object_free, .open = radeon_gem_object_open, .close = radeon_gem_object_close, --- a/drivers/gpu/drm/radeon/radeon_prime.c +++ b/drivers/gpu/drm/radeon/radeon_prime.c @@ -56,6 +56,8 @@ struct drm_gem_object *radeon_gem_prime_ if (ret) return ERR_PTR(ret); + bo->tbo.base.funcs = &radeon_gem_object_funcs; + mutex_lock(&rdev->gem.mutex); list_add_tail(&bo->list, &rdev->gem.objects); mutex_unlock(&rdev->gem.mutex);