All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Collier <Ian.Collier@comlab.ox.ac.uk>
To: linux-kernel@vger.kernel.org
Subject: loop: auto-load crypto module [PATCH]
Date: Wed, 14 Sep 2005 16:38:28 +0100	[thread overview]
Message-ID: <20050914163827.B25087@pixie.comlab> (raw)
In-Reply-To: <20050909132725.C23462@pixie.comlab>; from Ian.Collier@comlab.ox.ac.uk on Fri, Sep 09, 2005 at 01:27:26PM +0100

It seems odd that "losetup -e blowfish" will auto-load the blowfish module
if it's not already loaded but it doesn't work if the cryptoloop module
isn't loaded.  It's fairly simple to amend loop so that it requests
a crypto module when required - a sample patch appears below.  Just put
"alias loop-encrypt-18 cryptoloop" in your modprobe.conf.  This currently
fails silently if the module isn't found - I don't know whether it's
worth putting a message in there.

On an unrelated note, while looking at loop.c I noticed that loop_init
contains two calls to memset for the same block of memory (one outside
the for-loop, one inside).  It seems to me that one of these isn't
necessary.  :-)

imc

--- linux-2.6.13/drivers/block/loop.c.orig	2005-08-29 00:41:01.000000000 +0100
+++ linux-2.6.13/drivers/block/loop.c	2005-09-14 14:01:42.844009381 +0100
@@ -74,6 +74,7 @@
 #include <linux/completion.h>
 #include <linux/highmem.h>
 #include <linux/gfp.h>
+#include <linux/kmod.h>
 
 #include <asm/uaccess.h>
 
@@ -950,8 +951,12 @@
 		if (type >= MAX_LO_CRYPT)
 			return -EINVAL;
 		xfer = xfer_funcs[type];
-		if (xfer == NULL)
-			return -EINVAL;
+		if (xfer == NULL) {
+			request_module("loop-encrypt-%u",type);
+			xfer = xfer_funcs[type];
+			if (xfer == NULL)
+				return -EINVAL;
+		}
 	} else
 		xfer = NULL;
 

      parent reply	other threads:[~2005-09-14 15:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-09 12:27 2.6.13: loop ioctl crashes Ian Collier
2005-09-09 12:32 ` linux-os (Dick Johnson)
2005-09-09 13:38   ` Ian Collier
2005-09-09 14:41     ` linux-os (Dick Johnson)
2005-09-09 14:59       ` linux-os (Dick Johnson)
2005-09-09 15:42       ` Ian Collier
2005-09-14 12:51 ` 2.6.13: More on drivers/block/loop.c Ian Collier
2005-09-14 13:12   ` Anton Altaparmakov
2005-09-14 15:38 ` Ian Collier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050914163827.B25087@pixie.comlab \
    --to=ian.collier@comlab.ox.ac.uk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.