summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Bentele2019-08-28 11:19:47 +0200
committerManuel Bentele2019-08-28 11:19:47 +0200
commit61d6c3b067d07f11545b1acb36383c22f84cea37 (patch)
tree5c012b7c3af89197367644e010c0643d2cc7163f
parentblock: loop: fix coding style issues in file format subsystem (diff)
downloadkernel-qcow2-linux-kernel-qcow2.tar.gz
kernel-qcow2-linux-kernel-qcow2.tar.xz
kernel-qcow2-linux-kernel-qcow2.zip
block: loop: fix initialization issue in loop_set_status*kernel-qcow2
The loop_info structure is not initialized correctly if an old losetup utility without file format support is used. In that case, the file format type is not initalized and the LOOP_SET_STATUS* ioctl calls always fails. This patch initalizes the loop file format in the backward compatibility mode to the default RAW file format type and prevents the failing of the LOOP_SET_STATUS* ioctl calls. Signed-off-by: Manuel Bentele <development@manuel-bentele.de>
-rw-r--r--drivers/block/loop/loop_main.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/block/loop/loop_main.c b/drivers/block/loop/loop_main.c
index b3d9577f45eb..64c699a83966 100644
--- a/drivers/block/loop/loop_main.c
+++ b/drivers/block/loop/loop_main.c
@@ -1178,6 +1178,8 @@ loop_set_status_old(struct loop_device *lo, const struct loop_info __user *arg)
err = copy_from_user(&info, arg, sizeof(info));
if (err)
return -EFAULT;
+ } else {
+ info64.lo_file_fmt_type = LO_FILE_FMT_RAW;
}
loop_info64_from_old(&info, &info64);
@@ -1202,6 +1204,8 @@ loop_set_status64(struct loop_device *lo, const struct loop_info64 __user *arg)
err = copy_from_user(&info64, arg, sizeof(info64));
if (err)
return -EFAULT;
+ } else {
+ info64.lo_file_fmt_type = LO_FILE_FMT_RAW;
}
return loop_set_status(lo, &info64);
@@ -1453,6 +1457,8 @@ loop_info64_from_compat(const struct compat_loop_info __user *arg,
err = copy_from_user(&info, arg, sizeof(info));
if (err)
return -EFAULT;
+ } else {
+ info.lo_file_fmt_type = LO_FILE_FMT_RAW;
}
memset(info64, 0, sizeof(*info64));