Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9101854pxu; Mon, 28 Dec 2020 06:41:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJxBPK+aA0Xin3tOQ0MJsNEO27oAKfiKfSUx3jHZeYHr1mTj1AxUuqE++f1uRiJR769Ib3A8 X-Received: by 2002:a17:906:4d47:: with SMTP id b7mr40805414ejv.420.1609166467314; Mon, 28 Dec 2020 06:41:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609166467; cv=none; d=google.com; s=arc-20160816; b=PFHckGkgtgaI0tQNPbsKOTjr6VSduVQ0spogdXBCmTlTjmOzZBsEdXoxPAGuaG5v3S nv/Vbg7EnrqP3rBRS+PtkAXWgAawTjr4ob0Ws23iAm53gD6E4Lfez4HdeknUayxFRpnP AWwUeAy80iT7SfQijbWhlTXNCxagKTDICdh6kha5EKRLPGiPcRqk9ufr6jcDlUvRFkhJ ZmBT75nGm+NCEcBVx0c/zplscfW5Svqzbg3iFXclEd/27tixzig1/9dKgzwgBbV8Adcn czo8b/ZS5YgaxhpCZ2m5XobR8RD6GJ86ob1cnwALdrkNmzRpLcRJahR4JMqQ6R2iDaGU R66Q== 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=GnewTUb4dReyoRaqzUmoAF0nXeJXobPUL7QMSj50JxM=; b=rnP7UMWQ8lmUMXlMARHUEOe16a5YZjvoW10+Zsm75vXJRVAYr8aMGSRaBdt4491eY3 ZkNNzqPQuka1G/ltVvyPYuyWrq4oFUrySGFeZqI97OxU4yCTcE58mSlSqNtBtp65+J2C O7RxjMG3+7NCzzlYJ1OPIj0WfQ6xU59qj/LSor7a5T9PVPrgu46KMcnnjkcd9PkEY78q uAlvcobegyzxLrZq8D24D5BNT3mYYpEBLcsGCy1DNRdPo2mR49WwzhJdGszM8AVuLP/A D9JqjKm5d48URnH685YNpma47tW/CKv1hd1dbFrNbm7lN6XR8Zffg0DSKpn+xs8qBDOb r+qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZAruYKr4; 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 a15si20943750edb.360.2020.12.28.06.40.44; Mon, 28 Dec 2020 06:41:07 -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=ZAruYKr4; 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 S2505656AbgL1Oij (ORCPT + 99 others); Mon, 28 Dec 2020 09:38:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:39410 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392098AbgL1Obt (ORCPT ); Mon, 28 Dec 2020 09:31:49 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3D19320739; Mon, 28 Dec 2020 14:31:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165893; bh=DKMCf1vF635AK2N9p/BqQ9Rel0Li6bF80vN4i84En7w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZAruYKr4NacivC+N+lXA4QJy0Q0BQ4TlKObTju9/M0Adr/lHP0/zN8gz85oPgn2iV m23vxE/VV89AiU72LNCawQO1wzGmRHQJs1O8gKFm3NZIlQOc/cR669sMk/w2C4tt9O AAzAmkcAG2nYesvHmqfnSn71pKj8k0yJrucKLloI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Niranjana Vishwanathapura , Maarten Lankhorst , =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= Subject: [PATCH 5.10 693/717] dma-buf/dma-resv: Respect num_fences when initializing the shared fence list. Date: Mon, 28 Dec 2020 13:51:31 +0100 Message-Id: <20201228125054.183148246@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@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: Maarten Lankhorst commit bf8975837dac156c33a4d15d46602700998cb6dd upstream. We hardcode the maximum number of shared fences to 4, instead of respecting num_fences. Use a minimum of 4, but more if num_fences is higher. This seems to have been an oversight when first implementing the api. Fixes: 04a5faa8cbe5 ("reservation: update api and add some helpers") Cc: # v3.17+ Reported-by: Niranjana Vishwanathapura Signed-off-by: Maarten Lankhorst Reviewed-by: Thomas Hellström Link: https://patchwork.freedesktop.org/patch/msgid/20201124115707.406917-1-maarten.lankhorst@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- drivers/dma-buf/dma-resv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/dma-buf/dma-resv.c +++ b/drivers/dma-buf/dma-resv.c @@ -200,7 +200,7 @@ int dma_resv_reserve_shared(struct dma_r max = max(old->shared_count + num_fences, old->shared_max * 2); } else { - max = 4; + max = max(4ul, roundup_pow_of_two(num_fences)); } new = dma_resv_list_alloc(max);