aboutsummaryrefslogtreecommitdiff
path: root/modutils
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2011-01-17 14:58:27 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2011-01-17 14:58:27 +0100
commit094cc51e50bdb877fa4c245dbde47e4dfbf94387 (patch)
tree2a9eaa84a5bfd0432847ce9f1ff5e6472ce3df72 /modutils
parent10ee20b58b77bdfb941480fdf4b95347c2b2ea79 (diff)
downloadbusybox-094cc51e50bdb877fa4c245dbde47e4dfbf94387.tar.gz
insmod: check for module read errors
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'modutils')
-rw-r--r--modutils/modprobe-small.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/modutils/modprobe-small.c b/modutils/modprobe-small.c
index f4f17e766..188a7f229 100644
--- a/modutils/modprobe-small.c
+++ b/modutils/modprobe-small.c
@@ -205,6 +205,7 @@ static void parse_module(module_info *info, const char *pathname)
/* Read (possibly compressed) module */
len = 64 * 1024 * 1024; /* 64 Mb at most */
module_image = xmalloc_open_zipped_read_close(pathname, &len);
+ /* module_image == NULL is ok here, find_keyword handles it */
//TODO: optimize redundant module body reads
/* "alias1 symbol:sym1 alias2 symbol:sym2" */
@@ -845,6 +846,8 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
len = MAXINT(ssize_t);
map = xmalloc_open_zipped_read_close(*argv, &len);
+ if (!map)
+ bb_perror_msg_and_die("can't read '%s'", *argv);
if (init_module(map, len,
IF_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE(options ? options : "")
IF_NOT_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE("")