diff -Naur busybox.orig.a/modutils/insmod.c busybox.a/modutils/insmod.c
--- busybox.orig.a/modutils/insmod.c	2008-08-12 20:35:02 +0000
+++ busybox.a/modutils/insmod.c	2008-08-14 15:29:27 +0000
@@ -13,20 +13,20 @@
 int insmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 int insmod_main(int argc UNUSED_PARAM, char **argv)
 {
-	char *filename, *options;
+	char *filename;
 	int rc;
 
-	USE_FEATURE_2_4_MODULES(getopt32(argv, INSMOD_OPTS INSMOD_ARGS));
+	USE_FEATURE_2_4_MODULES(
+		getopt32(argv, INSMOD_OPTS INSMOD_ARGS);
+		argv += optind-1;
+	);
 
 	filename = *++argv;
 	if (!filename)
 		bb_show_usage();
 
-	/* Rest is options */
-	options = parse_cmdline_module_options(argv);
-	if ((rc = bb_init_module(filename, options)) != 0)
-		bb_error_msg_and_die("cannot insert '%s': %s",
-				     filename, moderror(rc));
+	if ((rc = bb_init_module(filename, parse_cmdline_module_options(argv))) != 0)
+		bb_error_msg("cannot insert '%s': %s", filename, moderror(rc));
 
-	return 0;
+	return rc;
 }
diff -Naur busybox.orig.a/modutils/lsmod.c busybox.a/modutils/lsmod.c
--- busybox.orig.a/modutils/lsmod.c	2008-08-12 20:35:02 +0000
+++ busybox.a/modutils/lsmod.c	2008-08-14 21:38:03 +0000
@@ -3,10 +3,7 @@
  * Mini lsmod implementation for busybox
  *
  * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
- *
- * Modified by Alcove, Julien Gaulmin <julien.gaulmin@alcove.fr> and
- * Nicolas Ferre <nicolas.ferre@alcove.fr> to support pre 2.1 kernels
- * (which lack the query_module() interface).
+ * Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com>
  *
  * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
  */
@@ -15,79 +12,55 @@
 
 
 #if ENABLE_FEATURE_CHECK_TAINTED_MODULE
-#define TAINT_FILENAME                  "/proc/sys/kernel/tainted"
-#define TAINT_PROPRIETORY_MODULE        (1<<0)
-#define TAINT_FORCED_MODULE             (1<<1)
-#define TAINT_UNSAFE_SMP                (1<<2)
+enum {
+	TAINT_PROPRIETORY_MODULE = (1<<0),
+	TAINT_FORCED_MODULE	= (1<<1),
+	TAINT_UNSAFE_SMP	= (1<<2),
+};
 
 static void check_tainted(void)
 {
 	int tainted = 0;
-	FILE *f;
-
-	f = fopen_for_read(TAINT_FILENAME);
-	if (f) {
-		fscanf(f, "%d", &tainted);
-		fclose(f);
+	char *buf = xmalloc_open_read_close("/proc/sys/kernel/tainted", NULL);
+	if (buf) {
+		tainted = atoi(buf);
+		if (ENABLE_FEATURE_CLEAN_UP)
+			free(buf);
 	}
+
 	if (tainted) {
 		printf("    Tainted: %c%c%c\n",
 				tainted & TAINT_PROPRIETORY_MODULE      ? 'P' : 'G',
 				tainted & TAINT_FORCED_MODULE           ? 'F' : ' ',
 				tainted & TAINT_UNSAFE_SMP              ? 'S' : ' ');
 	} else {
-		printf("    Not tainted\n");
+		puts("    Not tainted");
 	}
 }
 #else
-static void check_tainted(void) { bb_putchar('\n'); }
+static void check_tainted(void) { }
 #endif
 
 int lsmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 int lsmod_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
 {
-	FILE *file = xfopen_for_read("/proc/modules");
-
-	printf("Module                  Size  Used by");
+#if ENABLE_FEATURE_LSMOD_PRETTY_2_6_OUTPUT
+	char *token[4];
+	parser_t *parser = config_open("/proc/modules");
 	check_tainted();
-#if ENABLE_FEATURE_LSMOD_PRETTY
-	{
-		char *line;
-		while ((line = xmalloc_fgets(file)) != NULL) {
-			char *tok;
-
-			tok = strtok(line, " \t");
-			printf("%-19s", tok);
-			tok = strtok(NULL, " \t\n");
-			printf(" %8s", tok);
-			tok = strtok(NULL, " \t\n");
-			/* Null if no module unloading support. */
-			if (tok) {
-				printf("  %s", tok);
-				tok = strtok(NULL, "\n");
-				if (!tok)
-					tok = (char*)"";
-				/* New-style has commas, or -.  If so,
-				truncate (other fields might follow). */
-				else if (strchr(tok, ',')) {
-					tok = strtok(tok, "\t ");
-					/* Strip trailing comma. */
-					if (tok[strlen(tok)-1] == ',')
-						tok[strlen(tok)-1] = '\0';
-				} else if (tok[0] == '-'
-				 && (tok[1] == '\0' || isspace(tok[1]))
-				) {
-					tok = (char*)"";
-				}
-				printf(" %s", tok);
-			}
-			bb_putchar('\n');
-			free(line);
-		}
-		fclose(file);
+	puts("Module                  Size  Used by");
+	while (config_read(parser, token, 4, 4, "# \t", PARSE_NORMAL & ~PARSE_GREEDY)) {
+		// N.B. token[3] is either '-' (module is not used by others)
+		// or comma-separated list ended by comma
+		// so trimming the trailing char is just what we need!
+		token[3][strlen(token[3])-1] = '\0';
+		printf("%-19s %8s %2s %s\n", token[0], token[1], token[2], token[3]);
 	}
+	if (ENABLE_FEATURE_CLEAN_UP)
+		config_close(parser);
 #else
-	xprint_and_close_file(file);
-#endif  /*  CONFIG_FEATURE_2_6_MODULES  */
+	check_tainted();
+	xprint_and_close_file(xfopen_for_read("/proc/modules"));
+#endif
 	return EXIT_SUCCESS;
 }
diff -Naur busybox.orig.a/modutils/modprobe.c busybox.a/modutils/modprobe.c
--- busybox.orig.a/modutils/modprobe.c	2008-08-12 20:35:02 +0000
+++ busybox.a/modutils/modprobe.c	2008-08-14 13:57:57 +0000
@@ -46,6 +46,8 @@
 	MODPROBE_OPT_BLACKLIST	= (INSMOD_OPT_UNUSED << 9) * ENABLE_FEATURE_MODPROBE_BLACKLIST,
 };
 
+static llist_t *loaded;
+
 static int read_config(struct modprobe_conf *conf, const char *path);
 
 static void add_option(llist_t **all_opts, const char *module, const char *opts)
@@ -119,30 +121,6 @@
 	return NULL;
 }
 
-static int module_in_kernel(const void *module_or_list, int islist)
-{
-	char *tokens[4];
-	parser_t *p;
-	int ret = -1, ok;
-
-	p = config_open2("/proc/modules", fopen_for_read);
-	if (p == NULL)
-		return -2;
-
-	while (config_read(p, tokens, 4, 1, "# \t", PARSE_NORMAL)) {
-		if (islist)
-			ok = llist_find((llist_t *) module_or_list, tokens[0]) != NULL;
-		else
-			ok = strcmp(module_or_list, tokens[0]) == 0;
-		if (ok) {
-			ret = tokens[2] ? atoi(tokens[2]) : 1;
-			break;
-		}
-	}
-	config_close(p);
-	return ret;
-}
-
 static char *gather_options(llist_t *first, const char *module, int usecmdline)
 {
 	struct modprobe_option *opt;
@@ -169,7 +147,7 @@
 	RESERVE_CONFIG_BUFFER(modname, MODULE_NAME_LEN);
 	llist_t *deps = NULL;
 	char *fn, *options, *colon, *tokens[2];
-	int found = 0, use;
+	int found = 0;
 	parser_t *p;
 	int rc = -1;
 
@@ -200,14 +178,15 @@
 	while (deps && rc == 0) {
 		fn = llist_pop(&deps);
 		filename2modname(fn, modname);
-		use = module_in_kernel(modname, 0);
 		if (option_mask32 & MODPROBE_OPT_REMOVE) {
-			if (use == 0 && bb_delete_module(modname, O_EXCL) != 0)
+			if (bb_delete_module(modname, O_EXCL) != 0)
 				rc = errno;
-		} else if (use < 0) {
+		} else if (llist_find(loaded, modname) == NULL) {
 			options = gather_options(conf->options, modname,
 						 strcmp(modname, module) == 0);
 			rc = bb_init_module(fn, options);
+			if (rc == 0)
+				llist_add_to(&loaded, modname);
 			if (ENABLE_FEATURE_CLEAN_UP)
 				free(options);
 		}
@@ -255,9 +234,18 @@
 			return EXIT_SUCCESS;
 		}
 	} else {
+		parser_t *parser;
 		/* the only module, the rest of parameters are options */
 		num_modules = 1;
 		add_option(&options, NULL, parse_cmdline_module_options(argv));
+		/* cache modules */
+		parser = config_open2("/proc/modules", fopen_for_read);
+		if (parser) {
+			char *s;
+			while (config_read(parser, &s, 1, 1, "# \t", PARSE_NORMAL & ~PARSE_GREEDY))
+				llist_add_to(&loaded, xstrdup(s));
+			config_close(parser);
+		}
 	}
 
 	for (i = 0; i < num_modules; i++) {
@@ -269,7 +257,7 @@
 		read_config(conf, "/etc/modprobe.conf");
 		read_config(conf, "/etc/modprobe.d");
 		if (ENABLE_FEATURE_MODUTILS_SYMBOLS &&
-		    conf->aliases == NULL && strncmp(*argv, "symbol:", 7) == 0)
+		    conf->aliases == NULL && strncmp(argv[i], "symbol:", 7) == 0)
 			read_config(conf, "modules.symbols");
 
 		/* Try if module by literal name is found; literal
@@ -283,12 +271,8 @@
 		if (ENABLE_FEATURE_MODUTILS_ALIAS && conf->aliases == NULL)
 			read_config(conf, "modules.alias");
 
-		/* If any of the aliases is loaded, we are good */
-		if (module_in_kernel(conf->aliases, 1) >= 0)
-			break;
-
-		/* Try to load one of the aliases */
-		while (conf->aliases != NULL && rc != 0) {
+		/* Try to load all of the aliases */
+		while (conf->aliases != NULL) {
 			char *realname = llist_pop(&conf->aliases);
 			if (check_blacklist(conf, realname))
 				rc = do_modprobe(conf, realname);
diff -Naur busybox.orig.a/modutils/modutils-24.c busybox.a/modutils/modutils-24.c
--- busybox.orig.a/modutils/modutils-24.c	2008-08-12 20:35:02 +0000
+++ busybox.a/modutils/modutils-24.c	2008-08-13 14:25:12 +0000
@@ -2330,6 +2330,7 @@
 /*======================================================================*/
 /* Functions relating to module loading after 2.1.18.  */
 
+#if 0
 static void
 new_process_module_arguments(struct obj_file *f, int argc, char **argv)
 {
@@ -2559,6 +2560,7 @@
 		argv++;
 	}
 }
+#endif
 
 #if ENABLE_FEATURE_INSMOD_VERSION_CHECKING
 static int new_is_module_checksummed(struct obj_file *f)
@@ -3847,12 +3849,12 @@
 #endif
 }
 #else /* !FEATURE_INSMOD_LOAD_MAP */
-static void print_load_map(struct obj_file *f)
+static void print_load_map(struct obj_file *f UNUSED_PARAM)
 {
 }
 #endif
 
-int FAST_FUNC bb_init_module_24(const char *m_filename, const char *options)
+int FAST_FUNC bb_init_module_24(const char *m_filename, const char *options UNUSED_PARAM)
 {
 	int k_crcs;
 	unsigned long m_size;
diff -Naur busybox.orig.a/modutils/modutils.c busybox.a/modutils/modutils.c
--- busybox.orig.a/modutils/modutils.c	2008-08-12 20:35:02 +0000
+++ busybox.a/modutils/modutils.c	2008-08-14 12:46:58 +0000
@@ -87,7 +87,7 @@
 {
 	size_t len = MAXINT(ssize_t);
 	char *image;
-	int rc = 0;
+	int rc = ENOENT;
 
 #if ENABLE_FEATURE_2_4_MODULES
 	if (get_linux_version_code() < KERNEL_VERSION(2,6,0))
@@ -96,7 +96,7 @@
 
 	/* Use the 2.6 way */
 	image = (char *) xmalloc_open_zipped_read_close(filename, &len);
-	if (init_module(image, len, options) != 0)
+	if (image && init_module(image, len, options) != 0)
 		rc = errno;
 	free(image);
 
diff -Naur busybox.orig.a/modutils/rmmod.c busybox.a/modutils/rmmod.c
--- busybox.orig.a/modutils/rmmod.c	2008-08-12 20:35:02 +0000
+++ busybox.a/modutils/rmmod.c	2008-08-14 16:06:11 +0000
@@ -12,43 +12,37 @@
 #include "modutils.h"
 
 int rmmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
-int rmmod_main(int argc, char **argv)
+int rmmod_main(int argc UNUSED_PARAM, char **argv)
 {
-	int n, ret = EXIT_SUCCESS;
+	int n;
 	unsigned int flags = O_NONBLOCK|O_EXCL;
-	char *modname;
+	char modname[MODULE_NAME_LEN];
 
 	/* Parse command line. */
-	n = getopt32(argv, "wfa");
+	n = getopt32(argv, "wfas"); // -s ignored
+	argv += optind;
+
 	if (n & 1)	// --wait
 		flags &= ~O_NONBLOCK;
 	if (n & 2)	// --force
 		flags |= O_TRUNC;
 	if (n & 4) {
 		/* Unload _all_ unused modules via NULL delete_module() call */
-		if (bb_delete_module(NULL, flags) != 0) {
-			if (errno == EFAULT)
-				return ret;
+		if (bb_delete_module(NULL, flags) != 0 && errno != EFAULT)
 			bb_perror_msg_and_die("rmmod");
-		}
 		return EXIT_SUCCESS;
 	}
 
-	if (optind == argc)
+	if (!*argv)
 		bb_show_usage();
 
-	for (n = optind; n < argc; n++) {
-		modname = filename2modname(bb_basename(argv[n]), NULL);
+	while (*argv) {
+		filename2modname(bb_basename(*argv++), modname);
 
-		if (bb_delete_module(modname, flags)) {
+		if (bb_delete_module(modname, flags))
 			bb_error_msg_and_die("cannot unload '%s': %s",
 					     modname, moderror(errno));
-			ret = EXIT_FAILURE;
-		}
-
-		if (ENABLE_FEATURE_CLEAN_UP)
-			free(modname);
 	}
 
-	return ret;
+	return EXIT_SUCCESS;
 }
