Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2183830iof; Tue, 7 Jun 2022 22:29:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywFhCsx0SSMWB2hdB0YEeOuebnVBzg1DqJvxDWHlb5Jk4kyo5sAdw4izvdm2uo7kwRvjOP X-Received: by 2002:a17:902:c40c:b0:167:8179:62c0 with SMTP id k12-20020a170902c40c00b00167817962c0mr12600187plk.29.1654666149339; Tue, 07 Jun 2022 22:29:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654666149; cv=none; d=google.com; s=arc-20160816; b=BEA5dQzNOuAiEb2fwZGIu79tdWhjG2BN99BQ6gOTfmRQjDsgQJlJEdFgC9ZRIOjNP5 CkQudpVzHSg4KcxJJwqEqR51EuW7KGd8jazNrcVT5LehD6REqYv0A1YlMmoiM87rWog9 66DT4t1u4vsKe+Wh5ENdUauDFDByggAF61ueeO8rzkldqZvjdErhoDjyiH9097RbyOqR GE2CNRhlwEJ3ox2MBBoMVqrDScRsYTlXKS6q8sk+O8q2dUgQkToad8v/cXTRIvWtcXJW EQ4d1DiIbjx6+aUyCXU4cL+xnryFhU+AnNDp6GOLeXBbQTq+quBPIEXqq1q+wuDJ403m ZkTw== 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=6CQUG31w6j3f1F2RqXTQhkWCuOD7pTJ8WHo4z0sWUuc=; b=YyRBMiNsACpLdGj8+v9zCu+bKQf6/demojJ8fpFGQUN451SJ+Ecg51q/RR6oeHAd4y mf2IkVMW2KsXBoJddh6dGSt7Q5ZhY7AZcfc+KpBMGeYsKevefshZLWYK6VS4Mh7lhsAa mFQnk8GskKg21UXLD7WVzQGd/1PRCAqwHkzRcOD/y2fH2PSyX4XnlwpTMiZqSpnxT+SR 7iGjSlzL702lN2uH8c+LatLDU+DMztn9oFjpwEuIFx0UhpdRq5VwNi2nDbYH7bDlfhsg CstPvtPod/LBvKQyfjzXU8nw79MjZIw6UFtK+VnX+LS3P44zeywTLEFyz7ZMxaGjQixd Bduw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KGNS18jw; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id t186-20020a6381c3000000b003fe0ac61b9fsi4234005pgd.367.2022.06.07.22.29.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:29:09 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KGNS18jw; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F3B092B6EAD; Tue, 7 Jun 2022 21:55:01 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347807AbiFGRkL (ORCPT + 99 others); Tue, 7 Jun 2022 13:40:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347478AbiFGRas (ORCPT ); Tue, 7 Jun 2022 13:30:48 -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 1247B111B94; Tue, 7 Jun 2022 10:27:03 -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 9939B6127C; Tue, 7 Jun 2022 17:27:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0988C385A5; Tue, 7 Jun 2022 17:27:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654622822; bh=M25JXcvDykKqIPIZeQD3S3WaYhxCDWlKyqcnmgUM6WE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KGNS18jwW1+h43HNTQjwicbqHMzm+uMrgNVNa9HSewJslCIPHfxri2Nby0fxYtEjD hwbCEQARs7WPCj+GfW0ZqLcIS66mkHf6qcf/rLM4XxF71nmI3hBwdpTyQe4y6yQOa8 Av0d3qO015wSEo0KKIeWQ91GITq/FovNPWAob3eQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Dmitry Baryshkov , Sasha Levin Subject: [PATCH 5.10 194/452] drm/msm: return an error pointer in msm_gem_prime_get_sg_table() Date: Tue, 7 Jun 2022 19:00:51 +0200 Message-Id: <20220607164914.345654338@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164908.521895282@linuxfoundation.org> References: <20220607164908.521895282@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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: Dan Carpenter [ Upstream commit cf575e31611eb6dccf08fad02e57e35b2187704d ] The msm_gem_prime_get_sg_table() needs to return error pointers on error. This is called from drm_gem_map_dma_buf() and returning a NULL will lead to a crash in that function. Fixes: ac45146733b0 ("drm/msm: fix msm_gem_prime_get_sg_table()") Signed-off-by: Dan Carpenter Reviewed-by: Dmitry Baryshkov Patchwork: https://patchwork.freedesktop.org/patch/485023/ Link: https://lore.kernel.org/r/YnOmtS5tfENywR9m@kili Signed-off-by: Dmitry Baryshkov Signed-off-by: Sasha Levin --- drivers/gpu/drm/msm/msm_gem_prime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/msm_gem_prime.c b/drivers/gpu/drm/msm/msm_gem_prime.c index 515ef80816a0..8c64ce7288f1 100644 --- a/drivers/gpu/drm/msm/msm_gem_prime.c +++ b/drivers/gpu/drm/msm/msm_gem_prime.c @@ -17,7 +17,7 @@ struct sg_table *msm_gem_prime_get_sg_table(struct drm_gem_object *obj) int npages = obj->size >> PAGE_SHIFT; if (WARN_ON(!msm_obj->pages)) /* should have already pinned! */ - return NULL; + return ERR_PTR(-ENOMEM); return drm_prime_pages_to_sg(obj->dev, msm_obj->pages, npages); } -- 2.35.1