mirror of
https://github.com/nilfs-dev/nilfs-utils.git
synced 2026-01-26 05:37:51 +00:00
Fix regression causing nilfs-clean failure without device argument
Commit ae0fc7c09b90 ("nilfs-clean: allow specifying filesystem node
instead of device") introduced a regression where running nilfs-clean
without a device argument (e.g., 'nilfs-clean -l') fails with an
"Error: Bad address" message.
This issue occurs because nilfs_cleaner_open() unconditionally calls
nilfs_lookup_device() with the 'device' argument, which is NULL when
no device is specified. This results in an invalid pointer access
within the lookup function.
Fix this by checking if the 'device' argument is valid before attempting
to resolve the backing device.
Fixes: ae0fc7c09b90 ("nilfs-clean: allow specifying filesystem node instead of device")
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
This commit is contained in:
parent
3b56b36203
commit
cd6a4ab74c
@ -439,11 +439,13 @@ struct nilfs_cleaner *nilfs_cleaner_open(const char *device,
|
||||
cleaner->sendq = -1;
|
||||
cleaner->recvq = -1;
|
||||
|
||||
ret = nilfs_lookup_device(device, &backdev);
|
||||
if (unlikely(ret < 0))
|
||||
goto error;
|
||||
else if (ret > 0)
|
||||
device = backdev; /* replace device in this function */
|
||||
if (device) {
|
||||
ret = nilfs_lookup_device(device, &backdev);
|
||||
if (unlikely(ret < 0))
|
||||
goto error;
|
||||
else if (ret > 0)
|
||||
device = backdev; /* Substitute with backdev */
|
||||
}
|
||||
|
||||
ret = nilfs_cleaner_find_fs(cleaner, device, mntdir);
|
||||
if (unlikely(ret < 0))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user