diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-11-09 00:47:55 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-11-09 00:47:55 -0500 |
commit | cdfe1565c094f60fef00238884aff2c781dd0784 (patch) | |
tree | 2abc7568246a5d4b145072144bfd938f6b47c9fb | |
parent | a601e63717a269b9171a7164ab9e285788362d1b (diff) | |
parent | 237242bddc99041e15a4ca51b8439657cadaff17 (diff) |
Merge tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux
Pull virtio and module fixes from Rusty Russell:
"YA module signing build tweak, and two cc'd to stable."
* tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux:
virtio: Don't access index after unregister.
modules: don't break modules_install on external modules with no key.
module: fix out-by-one error in kallsyms
-rw-r--r-- | drivers/virtio/virtio.c | 4 | ||||
-rw-r--r-- | kernel/module.c | 27 | ||||
-rw-r--r-- | scripts/Makefile.modinst | 3 |
3 files changed, 21 insertions, 13 deletions
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index 1e8659ca27ef..809b0de59c09 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c | |||
@@ -225,8 +225,10 @@ EXPORT_SYMBOL_GPL(register_virtio_device); | |||
225 | 225 | ||
226 | void unregister_virtio_device(struct virtio_device *dev) | 226 | void unregister_virtio_device(struct virtio_device *dev) |
227 | { | 227 | { |
228 | int index = dev->index; /* save for after device release */ | ||
229 | |||
228 | device_unregister(&dev->dev); | 230 | device_unregister(&dev->dev); |
229 | ida_simple_remove(&virtio_index_ida, dev->index); | 231 | ida_simple_remove(&virtio_index_ida, index); |
230 | } | 232 | } |
231 | EXPORT_SYMBOL_GPL(unregister_virtio_device); | 233 | EXPORT_SYMBOL_GPL(unregister_virtio_device); |
232 | 234 | ||
diff --git a/kernel/module.c b/kernel/module.c index 6085f5ef88ea..6e48c3a43599 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -2293,12 +2293,17 @@ static void layout_symtab(struct module *mod, struct load_info *info) | |||
2293 | src = (void *)info->hdr + symsect->sh_offset; | 2293 | src = (void *)info->hdr + symsect->sh_offset; |
2294 | nsrc = symsect->sh_size / sizeof(*src); | 2294 | nsrc = symsect->sh_size / sizeof(*src); |
2295 | 2295 | ||
2296 | /* strtab always starts with a nul, so offset 0 is the empty string. */ | ||
2297 | strtab_size = 1; | ||
2298 | |||
2296 | /* Compute total space required for the core symbols' strtab. */ | 2299 | /* Compute total space required for the core symbols' strtab. */ |
2297 | for (ndst = i = strtab_size = 1; i < nsrc; ++i, ++src) | 2300 | for (ndst = i = 0; i < nsrc; i++) { |
2298 | if (is_core_symbol(src, info->sechdrs, info->hdr->e_shnum)) { | 2301 | if (i == 0 || |
2299 | strtab_size += strlen(&info->strtab[src->st_name]) + 1; | 2302 | is_core_symbol(src+i, info->sechdrs, info->hdr->e_shnum)) { |
2303 | strtab_size += strlen(&info->strtab[src[i].st_name])+1; | ||
2300 | ndst++; | 2304 | ndst++; |
2301 | } | 2305 | } |
2306 | } | ||
2302 | 2307 | ||
2303 | /* Append room for core symbols at end of core part. */ | 2308 | /* Append room for core symbols at end of core part. */ |
2304 | info->symoffs = ALIGN(mod->core_size, symsect->sh_addralign ?: 1); | 2309 | info->symoffs = ALIGN(mod->core_size, symsect->sh_addralign ?: 1); |
@@ -2332,15 +2337,15 @@ static void add_kallsyms(struct module *mod, const struct load_info *info) | |||
2332 | mod->core_symtab = dst = mod->module_core + info->symoffs; | 2337 | mod->core_symtab = dst = mod->module_core + info->symoffs; |
2333 | mod->core_strtab = s = mod->module_core + info->stroffs; | 2338 | mod->core_strtab = s = mod->module_core + info->stroffs; |
2334 | src = mod->symtab; | 2339 | src = mod->symtab; |
2335 | *dst = *src; | ||
2336 | *s++ = 0; | 2340 | *s++ = 0; |
2337 | for (ndst = i = 1; i < mod->num_symtab; ++i, ++src) { | 2341 | for (ndst = i = 0; i < mod->num_symtab; i++) { |
2338 | if (!is_core_symbol(src, info->sechdrs, info->hdr->e_shnum)) | 2342 | if (i == 0 || |
2339 | continue; | 2343 | is_core_symbol(src+i, info->sechdrs, info->hdr->e_shnum)) { |
2340 | 2344 | dst[ndst] = src[i]; | |
2341 | dst[ndst] = *src; | 2345 | dst[ndst++].st_name = s - mod->core_strtab; |
2342 | dst[ndst++].st_name = s - mod->core_strtab; | 2346 | s += strlcpy(s, &mod->strtab[src[i].st_name], |
2343 | s += strlcpy(s, &mod->strtab[src->st_name], KSYM_NAME_LEN) + 1; | 2347 | KSYM_NAME_LEN) + 1; |
2348 | } | ||
2344 | } | 2349 | } |
2345 | mod->core_num_syms = ndst; | 2350 | mod->core_num_syms = ndst; |
2346 | } | 2351 | } |
diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst index dda4b2b61927..ecbb44797e28 100644 --- a/scripts/Makefile.modinst +++ b/scripts/Makefile.modinst | |||
@@ -16,8 +16,9 @@ PHONY += $(modules) | |||
16 | __modinst: $(modules) | 16 | __modinst: $(modules) |
17 | @: | 17 | @: |
18 | 18 | ||
19 | # Don't stop modules_install if we can't sign external modules. | ||
19 | quiet_cmd_modules_install = INSTALL $@ | 20 | quiet_cmd_modules_install = INSTALL $@ |
20 | cmd_modules_install = mkdir -p $(2); cp $@ $(2) ; $(mod_strip_cmd) $(2)/$(notdir $@) ; $(mod_sign_cmd) $(2)/$(notdir $@) | 21 | cmd_modules_install = mkdir -p $(2); cp $@ $(2) ; $(mod_strip_cmd) $(2)/$(notdir $@) ; $(mod_sign_cmd) $(2)/$(notdir $@) $(patsubst %,|| true,$(KBUILD_EXTMOD)) |
21 | 22 | ||
22 | # Modules built outside the kernel source tree go into extra by default | 23 | # Modules built outside the kernel source tree go into extra by default |
23 | INSTALL_MOD_DIR ?= extra | 24 | INSTALL_MOD_DIR ?= extra |