summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2012-03-02 19:43:48 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-02 20:38:15 +0100
commitc8e252586f8d5de906385d8cf6385fee289a825e (patch)
tree11bf3ac4f0d0b3961fcf1c98ee5cd1824ebd5614 /fs
parentMerge git://www.linux-watchdog.org/linux-watchdog (diff)
downloadlinux-c8e252586f8d5de906385d8cf6385fee289a825e.tar.xz
linux-c8e252586f8d5de906385d8cf6385fee289a825e.zip
regset: Prevent null pointer reference on readonly regsets
The regset common infrastructure assumed that regsets would always have .get and .set methods, but not necessarily .active methods. Unfortunately people have since written regsets without .set methods. Rather than putting in stub functions everywhere, handle regsets with null .get or .set methods explicitly. Signed-off-by: H. Peter Anvin <hpa@zytor.com> Reviewed-by: Oleg Nesterov <oleg@redhat.com> Acked-by: Roland McGrath <roland@hack.frob.com> Cc: <stable@vger.kernel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/binfmt_elf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index bcb884e2d613..07d096c49920 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1421,7 +1421,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,
for (i = 1; i < view->n; ++i) {
const struct user_regset *regset = &view->regsets[i];
do_thread_regset_writeback(t->task, regset);
- if (regset->core_note_type &&
+ if (regset->core_note_type && regset->get &&
(!regset->active || regset->active(t->task, regset))) {
int ret;
size_t size = regset->n * regset->size;