lkml.org 
[lkml]   [1999]   [Jul]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] 2.2 fixes for the loop device

This patch fixes a few minor problems in the 2.2 loopback block device:

- Proper version of the XOR zero pass word fix.
- Give EINVAL early for file systems without bmap, like NFS, instead of
silently zeroing data (2.3 patch with full NFS support will come later)
- Document a major design bug in the IV passing to transfer functions,
it basically makes it useless for NFS and anything but full devices.
Suggestions on the best way to fix it in a backwards compatible manner
would be welcome.


-Andi



--- linux/drivers/block/loop.c-o Tue Jul 6 00:38:42 1999
+++ linux/drivers/block/loop.c Tue Jul 6 01:15:52 1999
@@ -27,7 +27,13 @@
* - Should use an own CAP_* category instead of CAP_SYS_ADMIN
* - Should use the underlying filesystems/devices read function if possible
* to support read ahead (and for write)
- */
+ *
+ * WARNING/FIXME:
+ * - The block number as IV passing to low level transfer functions is broken:
+ * it passes the underlying device's block number instead of the
+ * offset. This makes it change for a given block when the file is
+ * moved/restored/copied and also doesn't work over NFS.
+ */

#include <linux/module.h>

@@ -107,7 +113,7 @@

static int xor_status(struct loop_device *lo, struct loop_info *info)
{
- if (info->lo_encrypt_key_size < 0)
+ if (info->lo_encrypt_key_size <= 0)
return -EINVAL;
return 0;
}
@@ -369,6 +375,10 @@
a file structure */
lo->lo_backing_file = NULL;
} else if (S_ISREG(inode->i_mode)) {
+ if (!inode->i_op->bmap) {
+ printk(KERN_ERR "loop: device has no block access/not implemented\n");
+ goto out_putf;
+ }

/* Backed by a regular file - we need to hold onto
a file structure for this file. We'll use it to
@@ -504,8 +514,6 @@
if ((unsigned int) info.lo_encrypt_key_size > LO_KEY_SIZE)
return -EINVAL;
type = info.lo_encrypt_type;
- if (info.lo_encrypt_key_size == 0 && type == LO_CRYPT_XOR)
- return -EINVAL;
if (type >= MAX_LO_CRYPT || xfer_funcs[type] == NULL)
return -EINVAL;
err = loop_release_xfer(lo);

--
This is like TV. I don't like TV.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:52    [W:0.281 / U:0.428 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site