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 60205276028; Mon, 9 Feb 2026 14:41:49 +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=1770648109; cv=none; b=FPI6A9TwShB6c4uHDrwsK1dafymqNagEH36ANShXNwWAUku64+0pLFUdKsGrymBmk1ejhSMyhENZytORxdfuVTrFUichRE8ETB5MjkT0bCSHAx+s3pdZb47jXy6k3k9sYOMmd99+nuRfp4UD6PZYvuzAsjt/mbPzqUWMp6bozVg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770648109; c=relaxed/simple; bh=FHEIm/m8ctVsaJNPDDjUc1cZsxYtFSAzyG1OtrmPDUc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qg7UzXt8g7MGvU+daTcmAGDUMAwIE+/j9MtPLvqnfvZdsgbMVJrFvcwcFaK9YEFNanM1jD0pDz3AV0IOyrABzQUorm+Z76V1Cg+1EE2KDP5/ivYut5QxiX8Teag/QYVUwgHlL4A/QsGy5StnDVwWJLLj4201NxtOYh9ib0Qw8tU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=rZlAXZYE; 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="rZlAXZYE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCB81C116C6; Mon, 9 Feb 2026 14:41:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1770648109; bh=FHEIm/m8ctVsaJNPDDjUc1cZsxYtFSAzyG1OtrmPDUc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rZlAXZYEk3fxdZdqJ8mO/arjKLgcWR7/J/tK2Ed+F/ARyYWRMYr739/GfWuMwwj+m rNMiLv+IkLnX5YbQaP90ihVf/A0jcTlSV8d7K6+k4nwiu81m067a3hThpNvFMpg+Kg T+IQg2m60puOfMpKLAds6zN+L24nukJ0MUDrkDaU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Carlos Llamas Subject: [PATCH 6.1 10/69] binderfs: fix ida_alloc_max() upper bound Date: Mon, 9 Feb 2026 15:23:38 +0100 Message-ID: <20260209142302.287211103@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260209142301.913348974@linuxfoundation.org> References: <20260209142301.913348974@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 6.1-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 @@ -131,8 +131,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; @@ -422,8 +422,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) {