mirror of
https://git.openafs.org/openafs.git
synced 2025-01-19 07:20:11 +00:00
STABLE12-linux-hold-tasklist-lock-in-get-page-offset-20030321
tasklist_lock must be held to traverse list
(cherry picked from commit 38cec12f2c
)
This commit is contained in:
parent
c9481ff6b2
commit
058866630d
@ -25,9 +25,9 @@ RCSID("$Header$");
|
|||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
|
#include <linux/sched.h>
|
||||||
#endif
|
#endif
|
||||||
#ifndef EXPORTED_SYS_CALL_TABLE
|
#ifndef EXPORTED_SYS_CALL_TABLE
|
||||||
#include <linux/sched.h>
|
|
||||||
#include <linux/syscall.h>
|
#include <linux/syscall.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -446,14 +446,26 @@ static long get_page_offset(void)
|
|||||||
struct task_struct *p, *q;
|
struct task_struct *p, *q;
|
||||||
|
|
||||||
/* search backward thru the circular list */
|
/* search backward thru the circular list */
|
||||||
#ifdef DEFINED_PREV_TASK
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
|
||||||
for(q = current; p = q; q = prev_task(p))
|
read_lock(&tasklist_lock);
|
||||||
#else
|
#endif
|
||||||
for(p = current; p; p = p->prev_task)
|
/* search backward thru the circular list */
|
||||||
|
#ifdef DEFINED_PREV_TASK
|
||||||
|
for(q = current; p = q; q = prev_task(p)) {
|
||||||
|
#else
|
||||||
|
for(p = current; p; p = p->prev_task) {
|
||||||
|
#endif
|
||||||
|
if (p->pid == 1) {
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
|
||||||
|
read_unlock(&tasklist_lock);
|
||||||
#endif
|
#endif
|
||||||
if (p->pid == 1)
|
|
||||||
return p->addr_limit.seg;
|
return p->addr_limit.seg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
|
||||||
|
read_unlock(&tasklist_lock);
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user