X-Git-Url: https://git.pld-linux.org/?a=blobdiff_plain;f=kernel-aufs4.patch;h=c5e4ae455e87fe2699b07d39f06a474974bdfc72;hb=e110641897f9fd18242214c15530f96d411e245c;hp=01990861c20b22785fb48c4ef8e58e4bbd686256;hpb=fc3b48f7f3819ac3c2f0019c44d03c5d0d152234;p=packages%2Fkernel.git diff --git a/kernel-aufs4.patch b/kernel-aufs4.patch index 01990861..c5e4ae45 100644 --- a/kernel-aufs4.patch +++ b/kernel-aufs4.patch @@ -39361,7 +39361,7 @@ index 470dd02..20dc3ec 100644 @@ -689,6 +698,7 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev, unsigned int arg) { - struct file *file, *old_file; + struct file *file = NULL, *old_file; + struct file *f, *virt_file = NULL, *old_virt_file; int error; @@ -39369,7 +39369,7 @@ index 470dd02..20dc3ec 100644 @@ -704,12 +714,19 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev, file = fget(arg); if (!file) - goto out; + goto out_err; + f = loop_real_file(file); + if (f) { + virt_file = file; @@ -39379,7 +39379,7 @@ index 470dd02..20dc3ec 100644 error = loop_validate_file(file, bdev); if (error) - goto out_putf; + goto out_err; old_file = lo->lo_backing_file; + old_virt_file = lo->lo_backing_virt_file; @@ -39394,23 +39394,25 @@ index 470dd02..20dc3ec 100644 lo->old_gfp_mask = mapping_gfp_mask(file->f_mapping); mapping_set_gfp_mask(file->f_mapping, lo->old_gfp_mask & ~(__GFP_IO|__GFP_FS)); -@@ -728,12 +746,16 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev, - blk_mq_unfreeze_queue(lo->lo_queue); - +@@ -728,14 +746,18 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev, + * dependency. + */ fput(old_file); + if (old_virt_file) + fput(old_virt_file); - if (lo->lo_flags & LO_FLAGS_PARTSCAN) + if (partscan) loop_reread_partitions(lo, bdev); return 0; - out_putf: - fput(file); + out_err: + mutex_unlock(&loop_ctl_mutex); + if (file) + fput(file); + if (virt_file) + fput(virt_file); - out: return error; } + @@ -921,7 +943,7 @@ static int loop_prepare_queue(struct loop_device *lo) static int loop_set_fd(struct loop_device *lo, fmode_t mode, struct block_device *bdev, unsigned int arg) @@ -39443,17 +39445,17 @@ index 470dd02..20dc3ec 100644 lo->lo_sizelimit = 0; @@ -1000,6 +1029,8 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode, - out_putf: + out_putf: fput(file); + if (virt_file) + fput(virt_file); - out: + out: /* This is safe: open() is still holding a reference. */ module_put(THIS_MODULE); @@ -1046,6 +1077,7 @@ loop_init_xfer(struct loop_device *lo, struct loop_func_table *xfer, static int loop_clr_fd(struct loop_device *lo) { - struct file *filp = lo->lo_backing_file; + struct file *filp = NULL; + struct file *virt_filp = lo->lo_backing_virt_file; gfp_t gfp = lo->old_gfp_mask; struct block_device *bdev = lo->lo_device; @@ -39467,12 +39469,12 @@ index 470dd02..20dc3ec 100644 loop_release_xfer(lo); @@ -1125,6 +1158,8 @@ static int loop_clr_fd(struct loop_device *lo) - * bd_mutex which is usually taken before lo_ctl_mutex. */ - fput(filp); + if (filp) + fput(filp); + if (virt_filp) + fput(virt_filp); - return 0; + return err; } diff --git a/drivers/block/loop.h b/drivers/block/loop.h