lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <TYCP286MB26079F414019C8AC9303E412B1E69@TYCP286MB2607.JPNP286.PROD.OUTLOOK.COM>
Date:   Fri, 16 Dec 2022 10:07:51 +0800
From:   Riwen Lu <luriwen@...mail.com>
To:     wsa@...nel.org
Cc:     linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org,
        xiongxin@...inos.cn, Riwen Lu <luriwen@...inos.cn>
Subject: [PATCH v1] i2c: i2c-core-base: Modify the maximum idr id for i2c adapter

From: Riwen Lu <luriwen@...inos.cn>

Change the maximum idr ID to INT_MAX for i2c adapter.
This fix the following adding i2c adapter error while the idr with
adap->nr has been allocated by other i2c driver, and find a proper ID
for it.
[  357.620685][ 3] [ T3655] ------------[ cut here ]------------
[  357.626544][ 3] [ T3655] couldn't get idr

Signed-off-by: Riwen Lu <luriwen@...inos.cn>
---
 drivers/i2c/i2c-core-base.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index 7539b0740351..c2982861057a 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -1535,11 +1535,12 @@ static int __i2c_add_numbered_adapter(struct i2c_adapter *adap)
 	int id;
 
 	mutex_lock(&core_lock);
-	id = idr_alloc(&i2c_adapter_idr, adap, adap->nr, adap->nr + 1, GFP_KERNEL);
+	id = idr_alloc(&i2c_adapter_idr, adap, adap->nr, 0, GFP_KERNEL);
 	mutex_unlock(&core_lock);
 	if (WARN(id < 0, "couldn't get idr"))
 		return id == -ENOSPC ? -EBUSY : id;
 
+	adap->nr = id;
 	return i2c_register_adapter(adap);
 }
 
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ