From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 58A6728725B; Mon, 9 Feb 2026 14:51:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770648693; cv=none; b=tcXK7aK+fuVA8rxCC70ix7lbIx2a8Zxw+5Xu0iD1+l2X3t3HpQSBcFvfL6H+3EvSXdyF66dGEGKtD1ZxqVxwhdj2udTWbTawdjXh3hIHqjTgllh2+j8hMSjQ3c1RQ5zgy3Set2vmiyHpcbGq61nBGotdLpCYLK8xJLMc0gGBpQ4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770648693; c=relaxed/simple; bh=mVDqGz1Y5Q+30CjnnzsZ8i81TeW474Rh9OYdGYVKVyY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KOaouwKB05O2i7l4RZw9hhB3f4pRHRPC3K6+VjmLUL7Bffc/VpGsiYdjN8H2Knsv7gWU4KTmmydTL2ZR2NyNGsJ+00qXsuab/ELfildoeTyWkCTHSGtWQKwSnd56KnhlqGSsFSv1QpJDq066rrTND+/EY39Bu7QNLFpIg6s9/k8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=U/LFQeDG; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="U/LFQeDG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCA37C116C6; Mon, 9 Feb 2026 14:51:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1770648693; bh=mVDqGz1Y5Q+30CjnnzsZ8i81TeW474Rh9OYdGYVKVyY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U/LFQeDGG7acuPH7bBKB2ftdR53t5LTU/dWjVsLzBTW0dDTqcwARNJq8oPsG2I/8S LIAFnUqaRhrvkVNlnKXSNDUZJtaBY6u01FY6dFkV8WX+dX1hGOXNbKT/F3LpDd+yl2 0HGUtrpcUDFzywq5RGZhaBCvpaNKnQO7ZPPiNvS8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Carlos Llamas Subject: [PATCH 5.10 05/41] binderfs: fix ida_alloc_max() upper bound Date: Mon, 9 Feb 2026 15:24:26 +0100 Message-ID: <20260209142256.996652546@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260209142256.797267956@linuxfoundation.org> References: <20260209142256.797267956@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Carlos Llamas commit ec4ddc90d201d09ef4e4bef8a2c6d9624525ad68 upstream. The 'max' argument of ida_alloc_max() takes the maximum valid ID and not the "count". Using an ID of BINDERFS_MAX_MINOR (1 << 20) for dev->minor would exceed the limits of minor numbers (20-bits). Fix this off-by-one error by subtracting 1 from the 'max'. Cc: stable@vger.kernel.org Fixes: 3ad20fe393b3 ("binder: implement binderfs") Signed-off-by: Carlos Llamas Link: https://patch.msgid.link/20260127235545.2307876-2-cmllamas@google.com Signed-off-by: Greg Kroah-Hartman --- drivers/android/binderfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/android/binderfs.c +++ b/drivers/android/binderfs.c @@ -122,8 +122,8 @@ static int binderfs_binder_device_create mutex_lock(&binderfs_minors_mutex); if (++info->device_count <= info->mount_opts.max) minor = ida_alloc_max(&binderfs_minors, - use_reserve ? BINDERFS_MAX_MINOR : - BINDERFS_MAX_MINOR_CAPPED, + use_reserve ? BINDERFS_MAX_MINOR - 1 : + BINDERFS_MAX_MINOR_CAPPED - 1, GFP_KERNEL); else minor = -ENOSPC; @@ -423,8 +423,8 @@ static int binderfs_binder_ctl_create(st /* Reserve a new minor number for the new device. */ mutex_lock(&binderfs_minors_mutex); minor = ida_alloc_max(&binderfs_minors, - use_reserve ? BINDERFS_MAX_MINOR : - BINDERFS_MAX_MINOR_CAPPED, + use_reserve ? BINDERFS_MAX_MINOR - 1 : + BINDERFS_MAX_MINOR_CAPPED - 1, GFP_KERNEL); mutex_unlock(&binderfs_minors_mutex); if (minor < 0) {