Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2102982iof; Tue, 7 Jun 2022 19:51:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5nw5BormydFgMrLBZ7w9qX61RzHuj/FgkJTGVAkcp2fU9xx+sHWnAh4XYWuyXwVTkHzYH X-Received: by 2002:a17:903:2ca:b0:156:f1cc:7cb6 with SMTP id s10-20020a17090302ca00b00156f1cc7cb6mr32428513plk.174.1654656663030; Tue, 07 Jun 2022 19:51:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654656663; cv=none; d=google.com; s=arc-20160816; b=LiJiVwHby/1iY+uhaNvILh0D+qNDhaZvUo5D05M10nmT9sWMz7OljBLBJaCyUIh5g+ o2EpINLxEQiNbruDBQtngDCsgcckujtEiBPGVZ/553/QRGELMTgeQvtEN83Ot+NEEAsP buH6BGf8kPAKos05h/CngPbkw8uS8Qxb1jUum14P1C+ePQg3OjqX8e8fazbhePunAOS2 klqNZZFN24Ui/dfB90rlPg9m7/26Zg75cTY6J5XSHdC6HVRZOcAv8EOjJbsSnno1cxka zd9EQRYmoM5qEQ0lL4A4Z6OQTfQgCItzEY/cf/OrtFPBxRWC8z7LhRGEX63f3tOblsj2 bzYA== 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=M33mpPyWvDBxtIRCm/r6x4YBIfAUH7+iCA6W5GfFxPI=; b=zJvzyXUja5TIPWDIRFPKZ9UXtGlwFkn2KFJOjgjnwO4U/cVipAJMOH0hcASPXDivE0 voI/8vXDmE7r8E/+iBEtPyHgXbjX1dGf4dfn6qckTmCYEsBM0tn2yoCOnmbz6MLDHSzP 7zO9bSLK4o9HiGvlE/WDz+nToyRbvQwDNvxVV1hT3n/7rEheLm/6CgHzTzL6WhIcxoan 24QMKHBEexxEupK7JSO7Nxj/e2ekqxK/14n6f6vZ7AgDFbU9z0yfluIwM9yQHKS2Zy5Z CoJDpIqFjSHjxPKfqhLaKsahoY6wc1TPXAv39nOA751Qq35gaHiPLELE+BGkfJHry5zC Dz6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tcOLTucF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id h11-20020a056a00218b00b0051b8e74bc32si28639695pfi.169.2022.06.07.19.51.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 19:51:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tcOLTucF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E5FF62823F8; Tue, 7 Jun 2022 18:20:56 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383229AbiFGWo3 (ORCPT + 99 others); Tue, 7 Jun 2022 18:44:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381074AbiFGVbf (ORCPT ); Tue, 7 Jun 2022 17:31:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E00322CBDA; Tue, 7 Jun 2022 12:04:02 -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 20E3FB822C0; Tue, 7 Jun 2022 19:04:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78455C385A2; Tue, 7 Jun 2022 19:03:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628639; bh=6X4d72LwQTIc+6PTx5vEOmfhb6pBrV/KYQO5s5tQhc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tcOLTucFpB7oKXo8+0/TBNh/1OdWv1v2dnf9PXnFiGWcJnK2/467dmbjs6QTNFIu9 c21TanQf/b2w7BjGlA/XEs3AcWfS8mTQ/eQnMrXhOosk/VFVlRtL1gu3AP3BfPp9xG XqYlOdInJYdKwbOr4pb7bCvbmf4/fODKH477R18Y= 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.18 401/879] drm/msm: return an error pointer in msm_gem_prime_get_sg_table() Date: Tue, 7 Jun 2022 18:58:39 +0200 Message-Id: <20220607165014.502970283@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@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 e8f1b7a2ca9c..94ab705e9b8a 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