Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: gpio: gpio-aggregator: add a test case for _sysfs prefix reservation

The kernel doc for gpio-aggregator configfs interface, which was recently
added, states that users should not be able to create an aggregator with a
name prefixed by "_sysfs" via configfs. However, it was found that this
guard does not function as expected (thanks to Dan Carpenter for
identifying and fixing the issue).

Add a test case to verify the guard.

Signed-off-by: Koichiro Den <koichiro.den@canonical.com>
Link: https://lore.kernel.org/r/20250412150119.1461023-1-koichiro.den@canonical.com
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>

authored by

Koichiro Den and committed by
Bartosz Golaszewski
290ffcfe d945ff52

+4
+4
tools/testing/selftests/gpio/gpio-aggregator.sh
··· 335 335 agg_remove_line agg0 line0 336 336 agg_remove_chip agg0 337 337 338 + echo "1.1.6. Can't instantiate a chip with _sysfs prefix" 339 + mkdir "$CONFIGFS_AGG_DIR/_sysfs" 2> /dev/null && fail "chip _sysfs unexpectedly created" 340 + mkdir "$CONFIGFS_AGG_DIR/_sysfs.foo" 2> /dev/null && fail "chip _sysfs.foo unexpectedly created" 341 + 338 342 echo "1.2. Creation/deletion via sysfs" 339 343 340 344 echo "1.2.1. Minimum creation/deletion"