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
c43c69e8
Commit
c43c69e8
authored
May 05, 2002
by
Oliver Neukum
Committed by
Greg Kroah-Hartman
May 05, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] USB printer freeing minors in probe error path
fix a failure to free a minor in the error path of probe
parent
13838748
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
drivers/usb/class/printer.c
drivers/usb/class/printer.c
+8
-6
No files found.
drivers/usb/class/printer.c
View file @
c43c69e8
...
@@ -828,12 +828,12 @@ static void *usblp_probe(struct usb_device *dev, unsigned int ifnum,
...
@@ -828,12 +828,12 @@ static void *usblp_probe(struct usb_device *dev, unsigned int ifnum,
usblp
->
writeurb
=
usb_alloc_urb
(
0
,
GFP_KERNEL
);
usblp
->
writeurb
=
usb_alloc_urb
(
0
,
GFP_KERNEL
);
if
(
!
usblp
->
writeurb
)
{
if
(
!
usblp
->
writeurb
)
{
err
(
"out of memory"
);
err
(
"out of memory"
);
goto
abort
;
goto
abort
_minor
;
}
}
usblp
->
readurb
=
usb_alloc_urb
(
0
,
GFP_KERNEL
);
usblp
->
readurb
=
usb_alloc_urb
(
0
,
GFP_KERNEL
);
if
(
!
usblp
->
readurb
)
{
if
(
!
usblp
->
readurb
)
{
err
(
"out of memory"
);
err
(
"out of memory"
);
goto
abort
;
goto
abort
_minor
;
}
}
/* Malloc device ID string buffer to the largest expected length,
/* Malloc device ID string buffer to the largest expected length,
...
@@ -841,7 +841,7 @@ static void *usblp_probe(struct usb_device *dev, unsigned int ifnum,
...
@@ -841,7 +841,7 @@ static void *usblp_probe(struct usb_device *dev, unsigned int ifnum,
* could change in length. */
* could change in length. */
if
(
!
(
usblp
->
device_id_string
=
kmalloc
(
DEVICE_ID_SIZE
,
GFP_KERNEL
)))
{
if
(
!
(
usblp
->
device_id_string
=
kmalloc
(
DEVICE_ID_SIZE
,
GFP_KERNEL
)))
{
err
(
"out of memory for device_id_string"
);
err
(
"out of memory for device_id_string"
);
goto
abort
;
goto
abort
_minor
;
}
}
/* Malloc write/read buffers in one chunk. We somewhat wastefully
/* Malloc write/read buffers in one chunk. We somewhat wastefully
...
@@ -849,7 +849,7 @@ static void *usblp_probe(struct usb_device *dev, unsigned int ifnum,
...
@@ -849,7 +849,7 @@ static void *usblp_probe(struct usb_device *dev, unsigned int ifnum,
* alternate setting can be changed later via an ioctl. */
* alternate setting can be changed later via an ioctl. */
if
(
!
(
usblp
->
buf
=
kmalloc
(
2
*
USBLP_BUF_SIZE
,
GFP_KERNEL
)))
{
if
(
!
(
usblp
->
buf
=
kmalloc
(
2
*
USBLP_BUF_SIZE
,
GFP_KERNEL
)))
{
err
(
"out of memory for buf"
);
err
(
"out of memory for buf"
);
goto
abort
;
goto
abort
_minor
;
}
}
/* Lookup quirks for this printer. */
/* Lookup quirks for this printer. */
...
@@ -863,12 +863,12 @@ static void *usblp_probe(struct usb_device *dev, unsigned int ifnum,
...
@@ -863,12 +863,12 @@ static void *usblp_probe(struct usb_device *dev, unsigned int ifnum,
dbg
(
"incompatible printer-class device 0x%4.4X/0x%4.4X"
,
dbg
(
"incompatible printer-class device 0x%4.4X/0x%4.4X"
,
dev
->
descriptor
.
idVendor
,
dev
->
descriptor
.
idVendor
,
dev
->
descriptor
.
idProduct
);
dev
->
descriptor
.
idProduct
);
goto
abort
;
goto
abort
_minor
;
}
}
/* Setup the selected alternate setting and endpoints. */
/* Setup the selected alternate setting and endpoints. */
if
(
usblp_set_protocol
(
usblp
,
protocol
)
<
0
)
if
(
usblp_set_protocol
(
usblp
,
protocol
)
<
0
)
goto
abort
;
goto
abort
_minor
;
/* Retrieve and store the device ID string. */
/* Retrieve and store the device ID string. */
usblp_cache_device_id_string
(
usblp
);
usblp_cache_device_id_string
(
usblp
);
...
@@ -897,6 +897,8 @@ static void *usblp_probe(struct usb_device *dev, unsigned int ifnum,
...
@@ -897,6 +897,8 @@ static void *usblp_probe(struct usb_device *dev, unsigned int ifnum,
return
usblp
;
return
usblp
;
abort_minor:
usb_deregister_dev
(
&
usblp_driver
,
1
,
usblp
->
minor
);
abort:
abort:
if
(
usblp
)
{
if
(
usblp
)
{
usb_free_urb
(
usblp
->
writeurb
);
usb_free_urb
(
usblp
->
writeurb
);
...
...
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