Message ID | 20240829-i3c_fix-v4-4-ebcbd5efceba@nxp.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show
Return-Path: <linux-i3c-bounces+linux-i3c=archiver.kernel.org@lists.infradead.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BE506CA0EC4 for <linux-i3c@archiver.kernel.org>; Thu, 29 Aug 2024 21:15:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To:In-Reply-To: References:Message-Id:Subject:Date:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=nZfLpjxpEvhfB/dDjnvtJPsXQJmOms3OC+3Q/hnKKjQ=; b=rWdYdCNRpiGuo1xwfIFWU2cGiQ opD1ysEDeF2PsagsbnVw1SDGM5Rd/mM0p7uybPhzIm+bvexS+bo/uy5Rym7ivW3BP32HIG7mgN5lg CD2cw2eYAPeNz96czeQeuy12YDOUUBfqW4auuQpoFrCJ1qQe2IaTKux9El165zDXEfSzIa8ZxQITP kYw7+HmaxrNytMk/27GvOuFWadBwzmTWxHYViA0S5YkxLoeKYL/UNHWxFnQSLXt3PTP9UO7b8L/t8 37M3QXotysCgyDfJjs43Rmn8cy0U4zlSUhfvtGu+lubWFPeQYvKr3+y0awx41uzvFwIu/cm/p7p7c Ytj1GlJw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjmTz-00000003erm-20Jc; Thu, 29 Aug 2024 21:15:07 +0000 Received: from mail-northeuropeazlp170110001.outbound.protection.outlook.com ([2a01:111:f403:c200::1] helo=DB3PR0202CU003.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjmTw-00000003en9-2t38 for linux-i3c@lists.infradead.org; Thu, 29 Aug 2024 21:15:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CFpgBnIlXQhRVmHvh8crKs7ji8VfLZsCIcqnzCKkJoEo6JIcoVO8QoLp0l63A6tjIZquI9cdJ48yhHbf2QO+oQtlPE3S5wA3QTjXIoRzfen6gLgpOmOVya1ZQ/jePENZgGT/4XkA0upf51cJcpt1SkGaOfHIJsR1QRj+GYgIXckTkdPTPb9RYlTTRBlhcZSMJneDs742IvoWWk3+ozZdE8A5DnvbuTEAOnTjkF/a/+GavhQhAd2HBCOqcyQyGrTXq5WRdZtqss7/WOIc5XPXFs0ZsuwDL/+7uSMkYWrB6FLOm95GMt2lZCMM4LBcHqjzgFgyjWr6Df+YCeJQ9b+BuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jy77LfzIZBFz5cAmmQqERugeCp1CMhNFr8Kv8JBCwYE=; b=kaYJ7g4G+HQm2J3k5jZBazBJaJdXdmZd2eaDWSkTR3mK85N9bFGsReFGl8F4Uh5kZ+pcr9w64AP2OU4746PtV5t5G4PquF9j603vAq7zitSC9EmhtlyW3TTxzVa6MrruLcH0URGHXIolXFz39gri8y5vAEuaAPq6EtifI2VBbQ6Xpu4uBX4IHHZBGET47jHD9y4fA6e3JveNVtXH+QZNffW8ppzUnFI6vfY9cU42Ol/aBRORxDXbl1C8q9YbkH0i4RfwWtwYLUQVI3l4edCihg+gNHjCJlH5+1XT+HofMeziODfRJ7DT/7vQnnQe5qSEH6e1ievDsStBX2hes8Ipyg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jy77LfzIZBFz5cAmmQqERugeCp1CMhNFr8Kv8JBCwYE=; b=jVc04ghb6puuup0n/oK65RLio9X9t8KiC4XM4sYNUDCNA+GDNKT8swuw7KosDU4hJhKYTkFnBCJJGOXs9TtUKYQgXrpimQuUKAlBdwLfh1KxM/vEIjsPtl0GolZYkSk0g4jfYElms2fyZwNdMVoTCNF8UXNYAONkUeNLtLBb+s2HPgG9JrjIfhvheGzX27DclEQxVOAcpCDbImLgBA0c1L5ZsdlK9vk/kVTJYF6QpbqsxL3WRDg22RUwMki60TlohNFTrwo26A5i0juWsjL94jwO3k8KZePBlyPOmn8EtYYU8EFVl8sSNsKn3H1CA+WIm6WSbA9G3TvFsLLCYPNU8Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by AS8PR04MB7560.eurprd04.prod.outlook.com (2603:10a6:20b:29d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.28; Thu, 29 Aug 2024 21:14:59 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%4]) with mapi id 15.20.7897.027; Thu, 29 Aug 2024 21:14:59 +0000 From: Frank Li <Frank.Li@nxp.com> Date: Thu, 29 Aug 2024 17:14:01 -0400 Subject: [PATCH v4 04/11] i3c: master: Fix dynamic address leak when 'assigned-address' is present Message-Id: <20240829-i3c_fix-v4-4-ebcbd5efceba@nxp.com> References: <20240829-i3c_fix-v4-0-ebcbd5efceba@nxp.com> In-Reply-To: <20240829-i3c_fix-v4-0-ebcbd5efceba@nxp.com> To: Alexandre Belloni <alexandre.belloni@bootlin.com>, Boris Brezillon <boris.brezillon@collabora.com>, Parshuram Thombare <pthombar@cadence.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Boris Brezillon <bbrezillon@kernel.org>, Arnd Bergmann <arnd@arndb.de>, Miquel Raynal <miquel.raynal@bootlin.com>, Conor Culhane <conor.culhane@silvaco.com> Cc: linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, Frank Li <Frank.Li@nxp.com>, stable@kernel.org X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1724966082; l=3667; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=uz6xhxIxIAnIyubwtBkXjuhhwkKj4UjgCJHpQO5eyaA=; b=Roesay8np1PbKxGrXQ3hkNHYDpTVwaMlAy/eHLfxCBNNfSp5d0Pg8m5UwsvQ+rxkiVaEkXloc B0twHo4kYo4C+ZRYex1qK4n+YjFky9AWA9Wk2fUZypDUh6aT+yZfXJD X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR13CA0219.namprd13.prod.outlook.com (2603:10b6:a03:2c1::14) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS8PR04MB7560:EE_ X-MS-Office365-Filtering-Correlation-Id: 9806d1f2-0fc1-4719-2e36-08dcc86fa3a5 X-LD-Processed: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014|52116014|7416014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?MnrMSkN9RpLUnaavdP7+/tyl2P/5YS0?= =?utf-8?q?Y/WvpKZrAJxRC5fTQJeTSDqeYoCpP44gCDXkQn43ybcV5ZU2vkTiL3fxzelqUSMPc?= =?utf-8?q?nq/BT0hsDcKvsxi7ANO+hG5VVyvNDFYdzvxVSt0BeWsbMFgQ+X2ABcFQ40j172REH?= =?utf-8?q?xTjhMGkB6mXdiM4rh7GkyW/8Jv9vFh5S2QWHoeOHOS79cJ36OOCa+NT9E52HlOCWu?= =?utf-8?q?5DF/y49DqMQNJF8MV95uLWzcSfZSmroHvcoQy1wlKj+IUs8w2duX+i3iEyf7CTOQh?= =?utf-8?q?DjMEUQ6D4jQm4aaBCXldWSg27b75vny5MTsDc3y/Rlin54FRDgQIY9VXH7VNv6c7Y?= =?utf-8?q?B3v9/WhtFKv69wMWmuoMbSc3yXJd9nstNX0t81fDeya1IYIndegeqYWRosQSwm7Ex?= =?utf-8?q?grroyDEkszdRiLoRrULCRr8yeaar9ZoJIMgBwKv5DUfq4gx+9vgN2GeSoyPs8du/D?= =?utf-8?q?LtrS9nWwFcxho5b9m0vlWq9rsHaMyrg0Yf5v6oyoBWzPs4f4lhVT2wnoDRkIZB5qk?= =?utf-8?q?RZCGWGC/+yfJbvhAp3xLwLIS8DOZcnsYqQg0ZNFmpxY1s5DHYym7eqbPAj6j78t8T?= =?utf-8?q?8zv9yJwHaHlTir7UwFtMI1u8fdwwOMhDzkohSL4MnYjAsK/cnra2I+fxERaX3RS/7?= =?utf-8?q?odpPYN3Xn6goOakcBpONy3XaD4xmNVk5EBG7l4kPNTBXkvSTzA3k+sFz9iLD9G88R?= =?utf-8?q?nSa14sffx0tL+J9c9a8o0syOog3UoOsJoLRAbPNOFRmZU5Nm+Alu4nA+H22i0VreV?= =?utf-8?q?BF6LTs0aVUZueW7H9bE9ZPh3en6mJ5Mb3jxl1kTYw5muzcl/nUx8HRrYmlBgz/j7t?= =?utf-8?q?ksw21emhTHFYWvRlvWZuicyC+3mQUhamXXZqMOUYRctKtyBWFs4RrEhwns7pJQnUr?= =?utf-8?q?zuPCXRcRDsxtc8ojr8wBtpxsyYlmDsgmxPN8CW/cTVDRFocAvL0Hc5Jv/1aI3P1mc?= =?utf-8?q?cOPR/njwFh6J4CmzTh2xOXRL3r0QnxNKJ6nVhIJgiDlHskPx4naeNHqSokotnI5Ce?= =?utf-8?q?L5PSkeH5XX3AInEQsSt84cV9Vn+4A96ahnuEDq5Ya8fzu+dWmeRe+9N4qbXRdRg3F?= =?utf-8?q?0zKSGlh8cZpoMsopeLKsstxQ3hduGu7Wt4KVypG9+xpIa0w+vrHLPqIl2NgVs/HVd?= =?utf-8?q?qXUpc9yhtLH+iVo0kTkjp0WZEWU+twdBBBXyBPBQg1yXfSVwyD5F285gPt6EXrg29?= =?utf-8?q?Ek+6f5j1TN+oOXwBzLJ79REJ13xPntvxpKpHJZ5qR4WE+jjVJ7pObzjitivzzCw6X?= =?utf-8?q?zJPKZzLmC3iRtSiHWH7r43e71exNhzfbDPNmrUXazVeM0FOwiuhT83AWYi2sYl9vI?= =?utf-8?q?oqOpHM7FOs5jvWC7HYKRjq5JYYpw6R7VGA=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(376014)(52116014)(7416014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?Tr241xkapeYp0Su6zogiYZSOHdiM?= =?utf-8?q?uZvmX/nZR0uu8qZx7t8EQqMugn+vmmwoyTB2o92kVZpzVcXJu3lLNF6OwvElPfJMD?= =?utf-8?q?pnrtdS46qD7YRECtorF0rF8qmFXJiujVKpkT3O+C3YolLMYjUddtKkNsRma07oxDu?= =?utf-8?q?s5HLjhA5RS5IAA7JS1c6MI4/DJJlaTkbrnor5I3AoiCCVtf9g8vNsyTRfjzO4dM7N?= =?utf-8?q?sru9RFk2TrXSPEO6GDVSiJiHyjRSWklBOtsVbViL2qcgr20epaM4sgp9nzt0EMmHK?= =?utf-8?q?z/5JzXVUVSZgHQNQROhpn5R2acjul6w+MavZm+bMNcj70JV1Jd5TaxPfUvghZ/Vqw?= =?utf-8?q?3O69ACuYYG2YSiANaZdIGoNqCMqwtw8ZuQVsIgPDSJ8r9PcbfcH2ztKZirWSTxkrb?= =?utf-8?q?NvA3e7T9jOq1lTTbF8/vybYUrM/EDpyi6n9kFf9VFs5RipitfgG3xpE9oixjDMJSi?= =?utf-8?q?gfpBH66uR/t6N22a3jD0qTGidOe/dGU5wt/4ekwfYYLzhNq41d8VwnQBYOzE7MRwr?= =?utf-8?q?ZWmM9X7e2/K+gUMC89Qy8qw1d8FGLOxXl7g0n5z/WtTUh6ZzD7E4Cg3Wfd6+2HhFb?= =?utf-8?q?XgeytRf6wDmhurBp+59TbjLYu5ozJnIotap3aFBWkr3/wlIaTyjWRHCzvoX32P3SK?= =?utf-8?q?jMGTkPNb3Q20HJQ17UyMjSHEJUb4Hu9KcN/VJxd6wBCx0c22uhI+RH7pkwJmyxrso?= =?utf-8?q?efocM6XkuTECx5Am+wHPsXTPj9hv3qQgMmFX6XrHvXdxIC8DCAxV/eD/c3ifjrMQD?= =?utf-8?q?jrAEnAGzvIAXzAOluObqyY4YZGTEioq1sSZSqSWacDHNDPOIovLUFSnpiTUuUW3Zc?= =?utf-8?q?fSI+m+TmVikb+qsW5iQvOq5zb/VYHYS+1JtvYwxgotKGJPKKvikOLva1WiwbAtDAt?= =?utf-8?q?JwL1Qvb8vdaikVxx4Roxf1sVizrFuuolTUmppm+mE+KWHm21ag5HEfzLU2E7wwmRX?= =?utf-8?q?+1yI1JlD06PFr+Zv8I7+jilaNZBC51VRgsJZZcikK8jNEpAfhpILFt7ZIQdR9DyKG?= =?utf-8?q?oomGKFmLrAOdrtD5lcxFjwQeEwOYUuxY1Ce/QXCS163bE9TJEdx8zqxydtCGSfJzr?= =?utf-8?q?BgI7GO//XifRUTwyXsvweI/BsHo3lKk+kveEYCiJpsBe4BKd0U52jzDYgdIrMPZ3I?= =?utf-8?q?JycDso6D1ZA3tSn0JwlRkvboC9rHCmyVMGjbfs7ND355IzK1o5a4Z7RJXxi+BSCr2?= =?utf-8?q?eljHsxisNEEVtGtYdQBA0NhLbZ5kVFIaM5/HDqWJXBEmeYxnhzPYpTR/TmQ3YXMMF?= =?utf-8?q?Ub7J+dX95Rts3HqeXTtEaTM3h/GCSaXg17MuEBCwGAvBgtRvtM2CPsj5gHaypcx5Z?= =?utf-8?q?etGg9baFCW1oumcHIKp4oTrPLRAizJyHlE5iEpY71viNSxxmrK5+Gd1/eEvWrVq77?= =?utf-8?q?r1E8uVXqItjq1ZUWvbHL4uIgpDE5jD6EOLc+0D5ktrGjI8IwADqkigTWOxo4XDx13?= =?utf-8?q?N1vg5HszRl2roMah2kbOv2ZEieLyGnjt4Cn1GnGm/HMLmVavwZfs2UzEVNiVOLtFH?= =?utf-8?q?Dqs6vdbW6hHS?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9806d1f2-0fc1-4719-2e36-08dcc86fa3a5 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2024 21:14:59.3274 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: r3H+cQ05VSbFTM2aCD5eqJKa18/QlW/lTXvlYtRgh4z+cfcPanplvi+Gnd7UZxCR5QGOPGxrN4rDES9IOVs+aQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7560 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240829_141504_775183_CA9FE4EA X-CRM114-Status: GOOD ( 13.20 ) X-BeenThere: linux-i3c@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-i3c.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-i3c>, <mailto:linux-i3c-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-i3c/> List-Post: <mailto:linux-i3c@lists.infradead.org> List-Help: <mailto:linux-i3c-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-i3c>, <mailto:linux-i3c-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-i3c" <linux-i3c-bounces@lists.infradead.org> Errors-To: linux-i3c-bounces+linux-i3c=archiver.kernel.org@lists.infradead.org |
Series |
i3c: master: some fix and improvemnt for hotjoin
|
expand
|
diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 1dad727e28435..7c8fc4378b979 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -1556,16 +1556,9 @@ static int i3c_master_reattach_i3c_dev(struct i3c_dev_desc *dev, u8 old_dyn_addr) { struct i3c_master_controller *master = i3c_dev_get_master(dev); - enum i3c_addr_slot_status status; int ret; - if (dev->info.dyn_addr != old_dyn_addr && - (!dev->boardinfo || - dev->info.dyn_addr != dev->boardinfo->init_dyn_addr)) { - status = i3c_bus_get_addr_slot_status(&master->bus, - dev->info.dyn_addr); - if (status != I3C_ADDR_SLOT_FREE) - return -EBUSY; + if (dev->info.dyn_addr != old_dyn_addr) { i3c_bus_set_addr_slot_status(&master->bus, dev->info.dyn_addr, I3C_ADDR_SLOT_I3C_DEV); @@ -1956,9 +1949,10 @@ static int i3c_master_bus_init(struct i3c_master_controller *master) goto err_rstdaa; } + /* Not mark as occupied until real device exist in bus */ i3c_bus_set_addr_slot_status_ext(&master->bus, i3cboardinfo->init_dyn_addr, - I3C_ADDR_SLOT_I3C_DEV | I3C_ADDR_SLOT_EXT_INIT); + I3C_ADDR_SLOT_EXT_INIT); /* * Only try to create/attach devices that have a static @@ -2126,7 +2120,8 @@ int i3c_master_add_i3c_dev_locked(struct i3c_master_controller *master, else expected_dyn_addr = newdev->info.dyn_addr; - if (newdev->info.dyn_addr != expected_dyn_addr) { + if (newdev->info.dyn_addr != expected_dyn_addr && + i3c_bus_get_addr_slot_status(&master->bus, expected_dyn_addr) == I3C_ADDR_SLOT_FREE) { /* * Try to apply the expected dynamic address. If it fails, keep * the address assigned by the master.
If the DTS contains 'assigned-address', a dynamic address leak occurs during hotjoin events. Assume a device have assigned-address 0xb. - Device issue Hotjoin - Call i3c_master_do_daa() - Call driver xxx_do_daa() - Call i3c_master_get_free_addr() to get dynamic address 0x9 - i3c_master_add_i3c_dev_locked(0x9) - expected_dyn_addr = newdev->boardinfo->init_dyn_addr (0xb); - i3c_master_reattach_i3c_dev(newdev(0xb), old_dyn_addr(0x9)); - if (dev->info.dyn_addr != old_dyn_addr && ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 0xb != 0x9 -> TRUE (!dev->boardinfo || ^^^^^^^^^^^^^^^ -> FALSE dev->info.dyn_addr != dev->boardinfo->init_dyn_addr)) { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 0xb != 0xb -> FALSE ... i3c_bus_set_addr_slot_status(&master->bus, old_dyn_addr, I3C_ADDR_SLOT_FREE); ^^^ This will be skipped. So old_dyn_addr never free } - i3c_master_get_free_addr() will return increased sequence number. Remove dev->info.dyn_addr != dev->boardinfo->init_dyn_addr condition check. dev->info.dyn_addr should be checked before calling this function because i3c_master_setnewda_locked() has already been called and the target device has already accepted dyn_addr. It is too late to check if dyn_addr is free in i3c_master_reattach_i3c_dev(). Add check to ensure expected_dyn_addr is free before i3c_master_setnewda_locked(). Fixes: cc3a392d69b6 ("i3c: master: fix for SETDASA and DAA process") Cc: stable@kernel.org Signed-off-by: Frank Li <Frank.Li@nxp.com> --- Change v3 to v4 - none --- drivers/i3c/master.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)