Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3696516pxb; Mon, 24 Jan 2022 15:38:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJwhIt3X3Mq4q3IPPcuUzGrXB8921unQ1usXYVM2PoJLnyp20NWhVX9tGIbNKjD/1d3REaZT X-Received: by 2002:a17:902:8605:b0:149:9a25:103c with SMTP id f5-20020a170902860500b001499a25103cmr16281208plo.155.1643067482780; Mon, 24 Jan 2022 15:38:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643067482; cv=none; d=google.com; s=arc-20160816; b=yp7VpR9NdZGtOjXXgSx89r99Q1Ik47wREzCVap2zURN1WK5wKuWRx3ddxXme+wFEde AC4ISbY6tfceaNdGmdXAOI1uHfJh97oIljSuezPhJ/tTDxhdPUg/o3dV3q+CTp4dccNo HgIVZYDN82ct+Md+obJXCvuU8UXWpjACvywYa7LWqTp9+cHdhI95Qc/vrUrR48e5zJSd 3S+p1KKzrH66yGw7WFpuQOwtV6GNrcxkoN4a7520lIuis+r9qXxflf93uais0no1EfEt 4t97oh+8Wpm3L9aLmn2o1jBamaluYRy7KH9nz4iYdAc8RRyTj3MqTtrk0y66WMxlD2k5 +oyg== 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=mUdy29x7wBrap0WamjsYOLgw1Z95dmQZ6sUB7zT0cO8=; b=chbyMHEFO8MM066iXpSbDj+L3fGcEpnErjoQAOfWfraW8EeGrIiStF6vpmXBzb/4Cc oSv7EVMII+LyvnjkJNwJnkU3gkt6AO7lNIUVzmwS8HNdKNR0Rlp/kaoLrJtzKdqgLu6p 665IF0cdzKDoFRQMF29Hr1731lsK5B1eODh6A+JTQ3LjeB5A6bbQjM43DD4YPgJUU0xf Fp4SVwGKkpaCu2Jleh87iDhrPvTuFliPupwm0W19UeY5KwTOIrXFMRnTWigVmDaNljbV oJ5MBLiHLBOZ+p4DSM4YeTTKQXP4LiqlrsTAZiS8AOVicf8YHSYFQcAV1yCdJO7CMbD2 peJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nkpOXUrn; 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 k62si6511968pgd.675.2022.01.24.15.37.50; Mon, 24 Jan 2022 15:38:02 -0800 (PST) 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=nkpOXUrn; 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 S1844688AbiAXXdi (ORCPT + 99 others); Mon, 24 Jan 2022 18:33:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1837823AbiAXWpZ (ORCPT ); Mon, 24 Jan 2022 17:45:25 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A95FDC0550C6; Mon, 24 Jan 2022 13:05:52 -0800 (PST) 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 4754761444; Mon, 24 Jan 2022 21:05:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A810C340E5; Mon, 24 Jan 2022 21:05:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058351; bh=SyX2binZIMZmb2KlIl35FcVA0rQzcTa8I5o9poz9bXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nkpOXUrnmr1AOF7jA5DcT3wHj0SF7aQ3tzXDyY22iaKTRoL29Ab8BLBrQYVAdI20X RkutxjZO6juoGTYFgDf/gKZkZy579aoEkCtZYsaEFXUHeV2uykHmcR49eRMQVTsLXp Few/IYkWFq+aA8PqzcbIwlyc/YkoQdqB0mf+X5lg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rob Clark , Sasha Levin Subject: [PATCH 5.16 0260/1039] drm/msm/gpu: Dont allow zero fence_id Date: Mon, 24 Jan 2022 19:34:09 +0100 Message-Id: <20220124184134.049799468@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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: Rob Clark [ Upstream commit ca3ffcbeb0c866d9b0cb38eaa2bd4416597b5966 ] Elsewhere we treat zero as "no fence" and __msm_gem_submit_destroy() skips removal from fence_idr. We could alternately change this to use negative values for "no fence" but I think it is more clear to not allow zero as a valid fence_id. Signed-off-by: Rob Clark Fixes: a61acbbe9cf8 ("drm/msm: Track "seqno" fences by idr") Link: https://lore.kernel.org/r/20211129182344.292609-1-robdclark@gmail.com Signed-off-by: Rob Clark Signed-off-by: Sasha Levin --- drivers/gpu/drm/msm/msm_gem_submit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c index 282628d6b72c0..6cfa984dee6ae 100644 --- a/drivers/gpu/drm/msm/msm_gem_submit.c +++ b/drivers/gpu/drm/msm/msm_gem_submit.c @@ -881,7 +881,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, * to the underlying fence. */ submit->fence_id = idr_alloc_cyclic(&queue->fence_idr, - submit->user_fence, 0, INT_MAX, GFP_KERNEL); + submit->user_fence, 1, INT_MAX, GFP_KERNEL); if (submit->fence_id < 0) { ret = submit->fence_id = 0; submit->fence_id = 0; -- 2.34.1