Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp454826iog; Mon, 13 Jun 2022 06:17:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzZtWEQ/AJGQufl7Z8WmdbazDBv2U4PteTu1KaybjGBtN96aXFphv6NyXACADywKvaY6m/ X-Received: by 2002:a17:907:9805:b0:710:858f:ae0d with SMTP id ji5-20020a170907980500b00710858fae0dmr32209316ejc.360.1655125301665; Mon, 13 Jun 2022 06:01:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655125301; cv=none; d=google.com; s=arc-20160816; b=rAxow6B7yPRI14GTF1QGAeldjCZ7q/LRZKc+Rwd61XAdIiLOwMYKetNiHu9AOuy2c/ VzITil4UfqAVYlbyo31IC7MFHgZq2tXL+6LAZOkqvv1qvAIWGK4Zmomwy9FoHPXICjhu biKAM60Oz78sWz1+MopHgu2hIr2cV9d0urJ4Y0L24u18ng7tOrnx417KaKjU218uxEqO bfQreY1r/EBBdsOe1DIqvcegIGyJOxc7jClHPEB9bFNju5TwvSJvdZU53Yd/0mDvijjF oRRXGLE/dsrbf+JgDZkGPXG1UZfJUN2mC/fuSX/t9n0N24iszlwSvq2EGCsrfMZcWVTI ru6w== 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=S94AygR638HbJjkGT37q1lDmOkFCjbXxVsWnKbPxHXk=; b=rCpwqgWpT0im3B5O30SOBwzSne6cYivLNrBrdUXKOxpcRc4BxYeW3sh6DFPsUgiedo gYoj3bbCyUMaI+A4EMsuMTxX23TZ8OYCRSbkL0YKOtNdlJhC865fS5/UmTojYeMYx4SS /Vqk2ylDT0Tb7mnFuNXOY8tY1ABdQEWT3DfERus6kgXK3DP5u9l1JY1cF+Ch5xUOS752 yTOLbYWU6ZLbAhQNrkMipGbq6+IgbQO8Drlgh2/eJa9lp0I2bZzP4Ki7IWuWDnE5OeDM V9vz/cW6VF6Cy6+noL/ZiJStZ8kGh/rZZobTk8Pc2cGBjwtSTFATEkspHwVNh5sT1URS jGUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="0e/1RHeo"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gb33-20020a170907962100b006e8bbf3d88fsi8221330ejc.15.2022.06.13.06.01.13; Mon, 13 Jun 2022 06:01:41 -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="0e/1RHeo"; 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 S242619AbiFMKUW (ORCPT + 99 others); Mon, 13 Jun 2022 06:20:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242682AbiFMKSb (ORCPT ); Mon, 13 Jun 2022 06:18:31 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C67D4DF37; Mon, 13 Jun 2022 03:16:17 -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 sin.source.kernel.org (Postfix) with ESMTPS id 0DAB2CE1106; Mon, 13 Jun 2022 10:16:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0534CC34114; Mon, 13 Jun 2022 10:16:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655115374; bh=9AWYvwpbknsiS/4G3LdwateIgFBMMn2KK4bA6s5Ljp4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0e/1RHeoLnw2NwUi+U31MgZtBhCkn5m4mqskBta8LEbctKEbLLNWDpKCMv0rETY4C 0E0yPnWUcqH4zRvr+RPDtgNgOCyrNrArJX36shcsXM6kL/fEBA/Jjcff4B0vjbveLX I2+zQhBNvDAItHAKN/bwoZKo4/BMV2xLrUGd4Kfo= 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 4.9 051/167] drm/msm: return an error pointer in msm_gem_prime_get_sg_table() Date: Mon, 13 Jun 2022 12:08:45 +0200 Message-Id: <20220613094852.941038391@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094840.720778945@linuxfoundation.org> References: <20220613094840.720778945@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=-8.3 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,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 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 13403c6da6c7..7e4664968106 100644 --- a/drivers/gpu/drm/msm/msm_gem_prime.c +++ b/drivers/gpu/drm/msm/msm_gem_prime.c @@ -26,7 +26,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(msm_obj->pages, npages); } -- 2.35.1