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
d3861d44
Commit
d3861d44
authored
Sep 22, 2003
by
Jens Axboe
Committed by
Linus Torvalds
Sep 22, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] cdrom memory leaks
From Szombathelyi György This fixes a memory leak in the uniform cdrom layer.
parent
9f15e609
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
7 deletions
+16
-7
drivers/cdrom/cdrom.c
drivers/cdrom/cdrom.c
+16
-7
No files found.
drivers/cdrom/cdrom.c
View file @
d3861d44
...
@@ -1869,20 +1869,26 @@ static int cdrom_do_cmd(struct cdrom_device_info *cdi,
...
@@ -1869,20 +1869,26 @@ static int cdrom_do_cmd(struct cdrom_device_info *cdi,
if
(
cgc
->
buflen
<
0
||
cgc
->
buflen
>=
131072
)
if
(
cgc
->
buflen
<
0
||
cgc
->
buflen
>=
131072
)
return
-
EINVAL
;
return
-
EINVAL
;
if
((
ubuf
=
cgc
->
buffer
))
{
usense
=
cgc
->
sense
;
cgc
->
sense
=
&
sense
;
if
(
usense
&&
!
access_ok
(
VERIFY_WRITE
,
usense
,
sizeof
(
*
usense
)))
{
return
-
EFAULT
;
}
ubuf
=
cgc
->
buffer
;
if
(
cgc
->
data_direction
==
CGC_DATA_READ
||
cgc
->
data_direction
==
CGC_DATA_WRITE
)
{
cgc
->
buffer
=
kmalloc
(
cgc
->
buflen
,
GFP_KERNEL
);
cgc
->
buffer
=
kmalloc
(
cgc
->
buflen
,
GFP_KERNEL
);
if
(
cgc
->
buffer
==
NULL
)
if
(
cgc
->
buffer
==
NULL
)
return
-
ENOMEM
;
return
-
ENOMEM
;
}
}
usense
=
cgc
->
sense
;
cgc
->
sense
=
&
sense
;
if
(
usense
&&
!
access_ok
(
VERIFY_WRITE
,
usense
,
sizeof
(
*
usense
)))
return
-
EFAULT
;
if
(
cgc
->
data_direction
==
CGC_DATA_READ
)
{
if
(
cgc
->
data_direction
==
CGC_DATA_READ
)
{
if
(
!
access_ok
(
VERIFY_READ
,
ubuf
,
cgc
->
buflen
))
if
(
!
access_ok
(
VERIFY_READ
,
ubuf
,
cgc
->
buflen
))
{
kfree
(
cgc
->
buffer
);
return
-
EFAULT
;
return
-
EFAULT
;
}
}
else
if
(
cgc
->
data_direction
==
CGC_DATA_WRITE
)
{
}
else
if
(
cgc
->
data_direction
==
CGC_DATA_WRITE
)
{
if
(
copy_from_user
(
cgc
->
buffer
,
ubuf
,
cgc
->
buflen
))
{
if
(
copy_from_user
(
cgc
->
buffer
,
ubuf
,
cgc
->
buflen
))
{
kfree
(
cgc
->
buffer
);
kfree
(
cgc
->
buffer
);
...
@@ -1894,7 +1900,10 @@ static int cdrom_do_cmd(struct cdrom_device_info *cdi,
...
@@ -1894,7 +1900,10 @@ static int cdrom_do_cmd(struct cdrom_device_info *cdi,
__copy_to_user
(
usense
,
cgc
->
sense
,
sizeof
(
*
usense
));
__copy_to_user
(
usense
,
cgc
->
sense
,
sizeof
(
*
usense
));
if
(
!
ret
&&
cgc
->
data_direction
==
CGC_DATA_READ
)
if
(
!
ret
&&
cgc
->
data_direction
==
CGC_DATA_READ
)
__copy_to_user
(
ubuf
,
cgc
->
buffer
,
cgc
->
buflen
);
__copy_to_user
(
ubuf
,
cgc
->
buffer
,
cgc
->
buflen
);
kfree
(
cgc
->
buffer
);
if
(
cgc
->
data_direction
==
CGC_DATA_READ
||
cgc
->
data_direction
==
CGC_DATA_WRITE
)
{
kfree
(
cgc
->
buffer
);
}
return
ret
;
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