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
nexedi
linux
Commits
ebb06be1
Commit
ebb06be1
authored
Apr 15, 2013
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mISDN: fix mISDN_read()/mISDN_read() race
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
1678ec00
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
9 deletions
+14
-9
drivers/isdn/mISDN/timerdev.c
drivers/isdn/mISDN/timerdev.c
+14
-9
No files found.
drivers/isdn/mISDN/timerdev.c
View file @
ebb06be1
...
...
@@ -102,36 +102,41 @@ static ssize_t
mISDN_read
(
struct
file
*
filep
,
char
__user
*
buf
,
size_t
count
,
loff_t
*
off
)
{
struct
mISDNtimerdev
*
dev
=
filep
->
private_data
;
struct
list_head
*
list
=
&
dev
->
expired
;
struct
mISDNtimer
*
timer
;
u_long
flags
;
int
ret
=
0
;
if
(
*
debug
&
DEBUG_TIMER
)
printk
(
KERN_DEBUG
"%s(%p, %p, %d, %p)
\n
"
,
__func__
,
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
)
return
-
EAGAIN
;
wait_event_interruptible
(
dev
->
wait
,
(
dev
->
work
||
!
list_empty
(
&
dev
->
expired
)));
!
list_empty
(
list
)));
if
(
signal_pending
(
current
))
return
-
ERESTARTSYS
;
spin_lock_irq
(
&
dev
->
lock
);
}
if
(
count
<
sizeof
(
int
))
return
-
ENOSPC
;
if
(
dev
->
work
)
dev
->
work
=
0
;
if
(
!
list_empty
(
&
dev
->
expired
))
{
spin_lock_irqsave
(
&
dev
->
lock
,
flags
);
timer
=
(
struct
mISDNtimer
*
)
dev
->
expired
.
next
;
if
(
!
list_empty
(
list
))
{
timer
=
list_first_entry
(
list
,
struct
mISDNtimer
,
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
))
ret
=
-
EFAULT
;
else
ret
=
sizeof
(
int
);
kfree
(
timer
);
}
else
{
spin_unlock_irq
(
&
dev
->
lock
);
}
return
ret
;
}
...
...
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