From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 7D67E2D77F5; Fri, 9 Oct 2026 14:52:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791557556; cv=none; b=cdSj+wBNbeiXUT2jTcsD/swKOb5mYzVW1/T+p11f0GO6SOg4okQhBA8C0VhgyeHWRw6pOXKtFgvufvpQjPB0swhBXM6BniBNtpdDl/3IClAxnWsEhQMPL2MLhJBSs1cuhRenjEdVHDT76obt9tBsEHZq8aw/uvXsnme5yG/pj8w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791557556; c=relaxed/simple; bh=oW61MLaX9dg6o3yBUM/hIhbIgOM5Zk9Are3b7sNy6NY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jUyb8TvtaIGHnNeHbN2QfE4a2W003z0i5v55ASbXKn1VsP8/j29oFGGxXFEJ1sQGCyPF9SkHO3tOYSeuE85HESva7YSar9H3hlXH0xx2lMUWZKLrEgPcsjKjBjEy9fpwZgr3f5ahHHGBD9/IDq3BDECAepOt05i4rcNVBU2srQU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=wslH0GtB; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="wslH0GtB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDA9C1F000FF; Fri, 9 Oct 2026 14:52:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1791557555; bh=UQ3gGDAfhG2uWkLJY4w/osc1X4ztQe7Tz7UC3Gmeixc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=wslH0GtBh+SwA3cOKIvqUt7zMQixAHlNMYn/JCvuhTTgSx1eZ2aniHy2ZXmlzvpnE mN5Ar9QX9tWpxncUN64mYRv6B6xVbj5gK1N2duskzG9oReRQLJuHkhzZ+TeVcl63bw mAe1Dlnnd+aYlfQPUaQWUm6bnFxdz86Dac5dtFtw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Arka Mondal , Jonathan Cameron Subject: [PATCH 7.2 402/428] iio: imu: adis16400: fix unprotected debugfs reads Date: Fri, 9 Oct 2026 16:12:19 +0200 Message-ID: <20261009140955.047368376@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261009140946.008206689@linuxfoundation.org> References: <20261009140946.008206689@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.2-stable review patch. If anyone has any objections, please let me know. ------------------ From: Arka Mondal commit d94787287a113a1326211647d5e0deed1e9de105 upstream. adis16400_serial_number_fops is open coded and never calls debugfs_file_get(), so debugfs_remove_recursive() does not wait for a read in progress and unbind frees the iio_dev underneath it. Commit ae1d37a9bb4b ("iio: imu: adis16400: use DEFINE_DEBUGFS_ATTRIBUTE instead of DEFINE_SIMPLE_ATTRIBUTE") converted product_id and flash_count to DEFINE_DEBUGFS_ATTRIBUTE, which protects itself, but moved all three files to debugfs_create_file_unsafe(). serial_number prints three registers as "%.4x-%.4x-%.4x" and DEFINE_DEBUGFS_ATTRIBUTE() formats a single u64, so it cannot be converted without changing what the file returns. adis16475 and adis16550 already use debugfs_create_file() for their open coded files. Use it here too. Fixes: ae1d37a9bb4b ("iio: imu: adis16400: use DEFINE_DEBUGFS_ATTRIBUTE instead of DEFINE_SIMPLE_ATTRIBUTE") Signed-off-by: Arka Mondal Cc: stable@vger.kernel.org Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/imu/adis16400.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/iio/imu/adis16400.c +++ b/drivers/iio/imu/adis16400.c @@ -280,7 +280,7 @@ static void adis16400_debugfs_init(struc return; if (st->variant->flags & ADIS16400_HAS_SERIAL_NUMBER) - debugfs_create_file_unsafe("serial_number", 0400, + debugfs_create_file("serial_number", 0400, d, st, &adis16400_serial_number_fops); if (st->variant->flags & ADIS16400_HAS_PROD_ID) debugfs_create_file_unsafe("product_id", 0400,