Skip to content

Commit

Permalink
udf: fix ioctl errors
Browse files Browse the repository at this point in the history
Currently, lsattr for instance in udf directory gives
"udf: Invalid argument While reading flags on ..."

This patch returns -ENOIOCTLCMD
when command is unknown to have more accurate message like this:
"Inappropriate ioctl for device While reading flags on ..."

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Jan Kara <jack@suse.cz>
  • Loading branch information
Fabian Frederick authored and Jan Kara committed Feb 3, 2017
1 parent 70f16ce commit 782deb2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fs/udf/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ long udf_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
goto out;
}

if (!arg) {
if (!arg && ((cmd == UDF_GETVOLIDENT) || (cmd == UDF_GETEASIZE) ||
(cmd == UDF_RELOCATE_BLOCKS) || (cmd == UDF_GETEABLOCK))) {
udf_debug("invalid argument to udf_ioctl\n");
result = -EINVAL;
goto out;
Expand Down Expand Up @@ -220,6 +221,8 @@ long udf_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
UDF_I(inode)->i_ext.i_data,
UDF_I(inode)->i_lenEAttr) ? -EFAULT : 0;
goto out;
default:
return -ENOIOCTLCMD;
}

out:
Expand Down

0 comments on commit 782deb2

Please sign in to comment.