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=1796385791; b=NW+sCmP2lTzDMvJaIYZSSWOMmuhuCvNZW4uEUqKpUuzraDR3ItRIXCvpMBRS0blZ/dUe Hc8bUdC2PWhb2jjXwksebFHD6nu+gPWSgY37NOKnD3Q0VXFC6tXEcZtMCNxgTBsHVtpVw yLTh0pQG2YelfoOeb2oj5VFhCa4kb/RFlSTT7l4tn0QARFQEZAYkNF4SbX7DzXsia9aLd Y6fijidl8fQOoh0sZw0/t348iGBc3QbUM9izZv7FuMT/TS7FcA3orshRo24xzWWR3ujPd 4jadQYIjOG82Z6T9rJZgJ35c2UH0AGD4SFZWMppN2Th1zFkCUU7aWABxK0Ef6+tQ07g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385791; 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=BDrXWfk+tH8vRINed29Wv/X26AVFSK6doRZ4zazgNKg=; b=R44MytJjGqgKaoJdlLx3CbazisDCgEWvZ7bC2e0Pwp8N7PUuVwk8ZFeCUNn9+rIggU+V lMsn+1KanbLAJ621Xha3v9n3TretGsMVl0UPVsB3TGGCMnoyYvGXSEb2ukASRN7o50Vbt tQJAcu/0bY6mmVsdwXcUE2JRB/q4ydsRmRoNmoFXAE2Z/IvUXpivvQ7jr5hvTNNaGewqC E9iiv+6SSSvzWXxkfiLbjIbqg/OUGNrc+7WJr7b3/OLM2niz+mDhHZ8CaUCsTVhxfgGF1 k8m0/iCQCOI33PRtHJWBVk+GnxF7qD6cf74BDsSXuUCobmIPMbcC1wOTY3VE1ttUGfw== 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=lpGHEPjo; 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 68ABF606A333; Fri, 4 Dec 2026 12:03:10 +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=lpGHEPjo Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44C251F00A07; Fri, 4 Dec 2026 12:03:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385790; bh=BDrXWfk+tH8vRINed29Wv/X26AVFSK6doRZ4zazgNKg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=lpGHEPjoK19Y8gWjkwDpvgKMUBjkDnexG7Sizd2pK7oSrqTF8F045UNepdTfZ/RFl WAkeGHjPM3An076lFoPUSDYfZTKBjDdpztfq6FgftQQHILXLfN3TSaOqNB3zy9uEzS 6+9d7QKyn/o1pDLN8mijcBctVMk/PwrQTybULR14= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Changyul Lee , Jonathan Cameron Subject: [PATCH 6.6 0695/1167] iio: trigger: free the trigger ID after device_del() Date: Fri, 4 Dec 2026 19:02:02 +0900 Message-ID: <20261204100720.168242994@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@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.6-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);