From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796388501; b=y21KuYynJnp8NjdDI4xxuvIewct89L4wbH1C8pDS1aI81vI57C3S7r1dVZ2fR0kzc6BU xuquXnkgj+BIFw3gHAu6WvR3fmSZYF5NYHnNDLE4ZSxpnR81H76/i7HYWwNKrtELd2EnE Gn13VZzfuKM1M9rZTpu0UpaR+A6l+8jSrpH8yjy3fb5iHwLEqwz8Rrzz4Wl4hl2BAfcXj raMLVRjWzKwpPTkFmleYgJCYm7osxqH0B/GlPYtuL7uK47tv6G5r+kTS9UaGqYginRw5w seh2mCbT8kCQIhot1Ho1vcvOMS3J8ixN3du3i0mz5MD4fuwZGrTD7147gHtN+5JctIA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796388501; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=3RORIZrK5TnsrPI9K2hMa+wNIifxTHA2D5Q6Z3nl/Bs=; b=vnf5+mOvyMUzi2tv2ieCT7zvnLFNuNL2q1u7fYIZXit5goLapydwvY+kpiv5O5Xj/hqi /GD3tw6wShSS/pNdfuYnpL0cE8ZU6DcR1gw9bAtxRFsCBEY/jGRbpU9VGiguZEam2zCaQ EPshknurzklDCa0XWnVPOryltDWidHGU9gA8cnt/cSmcrP/IWV0sYsYxZIP4LJyxXItpi mdAuO+hrFTVXqTjU3eoav7lg/58tMwrn78nGNhIwTmRGoKqSKElxDcXa9eEs1XvReYvCy 3Fj/j4cn6eyaIb/fdK0dvtDkV9A3rRksaKL/XYRkT7ab4Thel5bX/b/DxVMfXm/n0OA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=uP3GYziL; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E400B606A683; Fri, 4 Dec 2026 12:48:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=uP3GYziL Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24CD31F000CE; Fri, 4 Dec 2026 12:48:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796388500; bh=3RORIZrK5TnsrPI9K2hMa+wNIifxTHA2D5Q6Z3nl/Bs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=uP3GYziL57aHnzN74FjNOXIKk52mLhaDiJStHnDcPR5HrSV9gNGfwNVj0111ibvZU vjZam+R6nW8i/VjHoe6mMFBqLUhjQGKRW2huHC/bdZSOqfGv6V21qD6I1fLeOpcSVJ PhOnOfzYHd72BMCZSVBCa8ILJ4wClfcxeIGu/UWY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Changyul Lee , Jonathan Cameron Subject: [PATCH 6.1 0641/1059] iio: trigger: free the trigger ID after device_del() Date: Fri, 4 Dec 2026 19:02:52 +0900 Message-ID: <20261204100700.677642485@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Changyul Lee commit d32bf759801e6df23038dc834622a122ec76a4dd upstream. iio_trigger_unregister() returns the trigger ID to iio_trigger_ida before device_del() removes the "trigger" device. A trigger registered in between can get the same ID, and its device_add() fails: sysfs: cannot create duplicate filename '/bus/iio/devices/trigger0' For example, adding a sysfs trigger while an hrtimer trigger is being removed through configfs, or the other way around, hits this because the two paths do not share a lock. Free the ID after device_del(), as the error path of iio_trigger_register() already does, and drop the "Possible issue in here" comment. Fixes: 1637db44413e ("Staging: IIO: Trigger support added to core.") Signed-off-by: Changyul Lee Cc: stable@vger.kernel.org Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/industrialio-trigger.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/iio/industrialio-trigger.c +++ b/drivers/iio/industrialio-trigger.c @@ -106,9 +106,8 @@ void iio_trigger_unregister(struct iio_t list_del(&trig_info->list); mutex_unlock(&iio_trigger_list_lock); - ida_free(&iio_trigger_ida, trig_info->id); - /* Possible issue in here */ device_del(&trig_info->dev); + ida_free(&iio_trigger_ida, trig_info->id); } EXPORT_SYMBOL(iio_trigger_unregister);