Skip to content

Commit

Permalink
usb: fix cleanup after failure in hub_configure()
Browse files Browse the repository at this point in the history
commit d0308d4 upstream.

If the hub_configure() fails after setting the hdev->maxchild
the hub->ports might be NULL or point to uninitialized kzallocated
memory causing NULL pointer dereference in hub_quiesce() during cleanup.

Now after such error the hdev->maxchild is set to 0 to avoid cleanup
of uninitialized ports.

Signed-off-by: Krzysztof Mazur <krzysiek@podlesie.net>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Krzysztof Mazur authored and Greg Kroah-Hartman committed Nov 20, 2013
1 parent 1744756 commit a73ff61
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/usb/core/hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -1335,6 +1335,7 @@ static int hub_configure(struct usb_hub *hub,
return 0;

fail:
hdev->maxchild = 0;
dev_err (hub_dev, "config failed, %s (err %d)\n",
message, ret);
/* hub_disconnect() frees urb and descriptor */
Expand Down

0 comments on commit a73ff61

Please sign in to comment.