diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-10 09:09:47 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-10 09:09:47 -0700 |
commit | f741df1f3a2afe988f413ca78d1e866657079beb (patch) | |
tree | 385fe773b3549dec86261cf1933beb3f8a7adf61 /kernel | |
parent | c67723ebbb2d6f672a0e9e5b1a8d1a2442942557 (diff) | |
parent | 5950f0803ca9d396ab79b7fe6789351f96e1d8d5 (diff) | |
download | op-kernel-dev-f741df1f3a2afe988f413ca78d1e866657079beb.zip op-kernel-dev-f741df1f3a2afe988f413ca78d1e866657079beb.tar.gz |
Merge tag 'for-linus-20130509' of git://git.infradead.org/~dwmw2/random-2.6
Pull misc fixes from David Woodhouse:
"This is some miscellaneous cleanups that don't really belong anywhere
else (or were ignored), that have been sitting in linux-next for some
time. Two of them are fixes resulting from my audit of krealloc()
usage that don't seem to have elicited any response when I posted
them, and the other three are patches from Artem removing dead code."
* tag 'for-linus-20130509' of git://git.infradead.org/~dwmw2/random-2.6:
pcmcia: remove RPX board stuff
m68k: remove rpxlite stuff
pcmcia: remove Motorola MBX860 support
params: Fix potential memory leak in add_sysfs_param()
dell-laptop: Fix krealloc() misuse in parse_da_table()
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/params.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/kernel/params.c b/kernel/params.c index ed35345..53b958f 100644 --- a/kernel/params.c +++ b/kernel/params.c @@ -613,10 +613,13 @@ static __modinit int add_sysfs_param(struct module_kobject *mk, sizeof(*mk->mp) + sizeof(mk->mp->attrs[0]) * (num+1), GFP_KERNEL); if (!new) { - kfree(mk->mp); + kfree(attrs); err = -ENOMEM; goto fail; } + /* Despite looking like the typical realloc() bug, this is safe. + * We *want* the old 'attrs' to be freed either way, and we'll store + * the new one in the success case. */ attrs = krealloc(attrs, sizeof(new->grp.attrs[0])*(num+2), GFP_KERNEL); if (!attrs) { err = -ENOMEM; |