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
076a2e8f
Commit
076a2e8f
authored
Sep 03, 2003
by
Chas Williams
Committed by
Stephen Hemminger
Sep 03, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ATM]: In atm_getaddr() do not copy_to_user() with locks held.
parent
70150e54
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
14 deletions
+15
-14
net/atm/addr.c
net/atm/addr.c
+15
-14
No files found.
net/atm/addr.c
View file @
076a2e8f
...
...
@@ -118,23 +118,24 @@ int atm_get_addr(struct atm_dev *dev,struct sockaddr_atmsvc *u_buf,int size)
{
unsigned
long
flags
;
struct
atm_dev_addr
*
walk
;
int
total
;
int
total
=
0
,
error
;
struct
sockaddr_atmsvc
*
tmp_buf
,
*
tmp_bufp
;
spin_lock_irqsave
(
&
dev
->
lock
,
flags
);
total
=
0
;
for
(
walk
=
dev
->
local
;
walk
;
walk
=
walk
->
next
)
{
for
(
walk
=
dev
->
local
;
walk
;
walk
=
walk
->
next
)
total
+=
sizeof
(
struct
sockaddr_atmsvc
);
if
(
total
>
size
)
{
spin_unlock_irqrestore
(
&
dev
->
lock
,
flags
);
return
-
E2BIG
;
}
if
(
copy_to_user
(
u_buf
,
&
walk
->
addr
,
sizeof
(
struct
sockaddr_atmsvc
)))
{
tmp_buf
=
tmp_bufp
=
kmalloc
(
total
,
GFP_ATOMIC
);
if
(
!
tmp_buf
)
{
spin_unlock_irqrestore
(
&
dev
->
lock
,
flags
);
return
-
EFAULT
;
}
u_buf
++
;
return
-
ENOMEM
;
}
for
(
walk
=
dev
->
local
;
walk
;
walk
=
walk
->
next
)
memcpy
(
tmp_bufp
++
,
&
walk
->
addr
,
sizeof
(
struct
sockaddr_atmsvc
));
spin_unlock_irqrestore
(
&
dev
->
lock
,
flags
);
return
total
;
error
=
total
>
size
?
-
E2BIG
:
total
;
if
(
copy_to_user
(
u_buf
,
tmp_buf
,
total
<
size
?
total
:
size
))
error
=
-
EFAULT
;
kfree
(
tmp_buf
);
return
error
;
}
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