Re: [PATCH -v3] avoid null pointer access in vm_struct
From: Wanlong Gao <hidden>
Date: 2011-08-24 16:10:14
Mitsuo Hayasaka <mitsuo.hayasaka.hu <at> hitachi.com> writes:
The /proc/vmallocinfo shows information about vmalloc allocations in vmlist that is a linklist of vm_struct. It, however, may access pages field of vm_struct where a page was not allocated. This results in a null pointer access and leads to a kernel panic.
quoted hunk ↗ jump to hunk
+static void insert_vmalloc_vmlist(struct vm_struct *vm) +{ + struct vm_struct *tmp, **p; + vm->flags &= ~VM_UNLIST; write_lock(&vmlist_lock); for (p = &vmlist; (tmp = *p) != NULL; p = &tmp->next) { if (tmp->addr >= vm->addr)@@ -1275,6 +1279,13 @@ static void insert_vmalloc_vm(struct vm_struct *vm,
struct vmap_area *va,
write_unlock(&vmlist_lock); }
Hi Mitsuo: Is it needed to set the VM_UNLIST after vm_struct added to vmlist here? or put it into lock protection? Thanks -Wanlong Gao -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>