Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
63ac2a63
Commit
63ac2a63
authored
Feb 27, 2003
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid memory leak on fork() failure path.
Noticed by Martin Schwidefsky <schwidefsky@de.ibm.com>
parent
ea3d5d12
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
kernel/fork.c
kernel/fork.c
+13
-9
No files found.
kernel/fork.c
View file @
63ac2a63
...
@@ -72,15 +72,8 @@ int nr_processes(void)
...
@@ -72,15 +72,8 @@ int nr_processes(void)
return
total
;
return
total
;
}
}
void
__put
_task_struct
(
struct
task_struct
*
tsk
)
static
void
free
_task_struct
(
struct
task_struct
*
tsk
)
{
{
WARN_ON
(
!
(
tsk
->
state
&
(
TASK_DEAD
|
TASK_ZOMBIE
)));
WARN_ON
(
atomic_read
(
&
tsk
->
usage
));
WARN_ON
(
tsk
==
current
);
security_task_free
(
tsk
);
free_uid
(
tsk
->
user
);
/*
/*
* The task cache is effectively disabled right now.
* The task cache is effectively disabled right now.
* Do we want it? The slab cache already has per-cpu
* Do we want it? The slab cache already has per-cpu
...
@@ -103,6 +96,17 @@ void __put_task_struct(struct task_struct *tsk)
...
@@ -103,6 +96,17 @@ void __put_task_struct(struct task_struct *tsk)
}
}
}
}
void
__put_task_struct
(
struct
task_struct
*
tsk
)
{
WARN_ON
(
!
(
tsk
->
state
&
(
TASK_DEAD
|
TASK_ZOMBIE
)));
WARN_ON
(
atomic_read
(
&
tsk
->
usage
));
WARN_ON
(
tsk
==
current
);
security_task_free
(
tsk
);
free_uid
(
tsk
->
user
);
free_task_struct
(
tsk
);
}
void
add_wait_queue
(
wait_queue_head_t
*
q
,
wait_queue_t
*
wait
)
void
add_wait_queue
(
wait_queue_head_t
*
q
,
wait_queue_t
*
wait
)
{
{
unsigned
long
flags
;
unsigned
long
flags
;
...
@@ -1034,7 +1038,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
...
@@ -1034,7 +1038,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
atomic_dec
(
&
p
->
user
->
processes
);
atomic_dec
(
&
p
->
user
->
processes
);
free_uid
(
p
->
user
);
free_uid
(
p
->
user
);
bad_fork_free:
bad_fork_free:
put
_task_struct
(
p
);
free
_task_struct
(
p
);
goto
fork_out
;
goto
fork_out
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment