Bug 106181 - there exists a wrong return value of function ezusb_probe() when alloc_orinocodev() fails
Summary: there exists a wrong return value of function ezusb_probe() when alloc_orinoc...
Status: CLOSED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: network-wireless (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: drivers_network-wireless@kernel-bugs.osdl.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-19 06:47 UTC by RUC_Soft_Sec
Modified: 2015-10-19 15:17 UTC (History)
1 user (show)

See Also:
Kernel Version: 4.2
Subsystem:
Regression: No
Bisected commit-id:


Attachments
0001-orinoco_usb-return-error-in-ezusb_probe-when-alloc_o.patch (1.05 KB, patch)
2015-10-19 15:16 UTC, John W. Linville
Details | Diff

Description RUC_Soft_Sec 2015-10-19 06:47:33 UTC
In function ezusb_probe() at drivers/net/wireless/orinoco/orinoco_usb.c:1561, if alloc_orinocodev() at line 1574 fails, ezusb_probe() will return 0 indicating success, because variable 'retval' is assigned 0 at line 1571. But, function ezusb_probe() should propagate the error and return the error to its caller functions. So, when ezusb_probe() fails, the return value 0 is wrong.
The related code snippets in ezusb_probe are as following.
ezusb_probe @@ drivers/net/wireless/orinoco/orinoco_usb.c:1561
1561 static int ezusb_probe(struct usb_interface *interface,
1562                        const struct usb_device_id *id)
1563 {

                 ....
1571         int retval = 0;
1572         int i;
1573 
1574         priv = alloc_orinocodev(sizeof(*upriv), &udev->dev,
1575                                 ezusb_hard_reset, NULL);
1576         if (!priv) {
1577                 err("Couldn't allocate orinocodev");
1578                 goto exit;
1579         }
                 ...

1712  exit:
1713         if (fw_entry) {
1714                 firmware.code = NULL;
1715                 firmware.size = 0;
1716                 release_firmware(fw_entry);
1717         }
1718         usb_set_intfdata(interface, upriv);
1719         return retval;
1720 }
Comment 1 John W. Linville 2015-10-19 15:16:30 UTC
Created attachment 190511 [details]
0001-orinoco_usb-return-error-in-ezusb_probe-when-alloc_o.patch

Note You need to log in before you can comment on or make changes to this bug.