]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From: Dean Roe <roe@sgi.com> |
2 | Subject: Prevent NULL pointer deref in grab_swap_token | |
3 | References: 159260 | |
4 | ||
5 | grab_swap_token() assumes that the current process has an mm struct, | |
6 | which is not true for kernel threads invoking get_user_pages(). Since | |
7 | this should be extremely rare, just return from grab_swap_token() | |
8 | without doing anything. | |
9 | ||
10 | Signed-off-by: Dean Roe <roe@sgi.com> | |
11 | Acked-by: mason@suse.de | |
12 | Acked-by: okir@suse.de | |
13 | ||
14 | ||
15 | mm/thrash.c | 3 +++ | |
16 | 1 file changed, 3 insertions(+) | |
17 | ||
18 | --- a/mm/thrash.c | |
19 | +++ b/mm/thrash.c | |
20 | @@ -31,6 +31,9 @@ void grab_swap_token(void) | |
21 | int current_interval; | |
22 | ||
23 | global_faults++; | |
24 | + if (current->mm == NULL) | |
25 | + return; | |
26 | + | |
27 | ||
28 | current_interval = global_faults - current->mm->faultstamp; | |
29 |