Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
Linux
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
E-EXK4 - Operating System Group
projects
Linux
Commits
ebb06be1
Commit
ebb06be1
authored
12 years ago
by
Al Viro
Browse files
Options
Downloads
Patches
Plain Diff
mISDN: fix mISDN_read()/mISDN_read() race
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
1678ec00
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
drivers/isdn/mISDN/timerdev.c
+14
-9
14 additions, 9 deletions
drivers/isdn/mISDN/timerdev.c
with
14 additions
and
9 deletions
drivers/isdn/mISDN/timerdev.c
+
14
−
9
View file @
ebb06be1
...
@@ -102,36 +102,41 @@ static ssize_t
...
@@ -102,36 +102,41 @@ static ssize_t
mISDN_read
(
struct
file
*
filep
,
char
__user
*
buf
,
size_t
count
,
loff_t
*
off
)
mISDN_read
(
struct
file
*
filep
,
char
__user
*
buf
,
size_t
count
,
loff_t
*
off
)
{
{
struct
mISDNtimerdev
*
dev
=
filep
->
private_data
;
struct
mISDNtimerdev
*
dev
=
filep
->
private_data
;
struct
list_head
*
list
=
&
dev
->
expired
;
struct
mISDNtimer
*
timer
;
struct
mISDNtimer
*
timer
;
u_long
flags
;
int
ret
=
0
;
int
ret
=
0
;
if
(
*
debug
&
DEBUG_TIMER
)
if
(
*
debug
&
DEBUG_TIMER
)
printk
(
KERN_DEBUG
"%s(%p, %p, %d, %p)
\n
"
,
__func__
,
printk
(
KERN_DEBUG
"%s(%p, %p, %d, %p)
\n
"
,
__func__
,
filep
,
buf
,
(
int
)
count
,
off
);
filep
,
buf
,
(
int
)
count
,
off
);
if
(
list_empty
(
&
dev
->
expired
)
&&
(
dev
->
work
==
0
))
{
if
(
count
<
sizeof
(
int
))
return
-
ENOSPC
;
spin_lock_irq
(
&
dev
->
lock
);
while
(
list_empty
(
list
)
&&
(
dev
->
work
==
0
))
{
spin_unlock_irq
(
&
dev
->
lock
);
if
(
filep
->
f_flags
&
O_NONBLOCK
)
if
(
filep
->
f_flags
&
O_NONBLOCK
)
return
-
EAGAIN
;
return
-
EAGAIN
;
wait_event_interruptible
(
dev
->
wait
,
(
dev
->
work
||
wait_event_interruptible
(
dev
->
wait
,
(
dev
->
work
||
!
list_empty
(
&
dev
->
expired
)));
!
list_empty
(
list
)));
if
(
signal_pending
(
current
))
if
(
signal_pending
(
current
))
return
-
ERESTARTSYS
;
return
-
ERESTARTSYS
;
spin_lock_irq
(
&
dev
->
lock
);
}
}
if
(
count
<
sizeof
(
int
))
return
-
ENOSPC
;
if
(
dev
->
work
)
if
(
dev
->
work
)
dev
->
work
=
0
;
dev
->
work
=
0
;
if
(
!
list_empty
(
&
dev
->
expired
))
{
if
(
!
list_empty
(
list
))
{
spin_lock_irqsave
(
&
dev
->
lock
,
flags
);
timer
=
list_first_entry
(
list
,
struct
mISDNtimer
,
list
);
timer
=
(
struct
mISDNtimer
*
)
dev
->
expired
.
next
;
list_del
(
&
timer
->
list
);
list_del
(
&
timer
->
list
);
spin_unlock_irq
restore
(
&
dev
->
lock
,
flags
);
spin_unlock_irq
(
&
dev
->
lock
);
if
(
put_user
(
timer
->
id
,
(
int
__user
*
)
buf
))
if
(
put_user
(
timer
->
id
,
(
int
__user
*
)
buf
))
ret
=
-
EFAULT
;
ret
=
-
EFAULT
;
else
else
ret
=
sizeof
(
int
);
ret
=
sizeof
(
int
);
kfree
(
timer
);
kfree
(
timer
);
}
else
{
spin_unlock_irq
(
&
dev
->
lock
);
}
}
return
ret
;
return
ret
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment