Bug 188671

Summary: Function orinoco_ioctl_commit() returns an improper error code when the call to orinoco_lock() fails
Product: Drivers Reporter: bianpan (bianpan2010)
Component: network-wirelessAssignee: drivers_network-wireless (drivers_network-wireless)
Status: NEW ---    
Severity: normal    
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: linux-4.9-rc6 Subsystem:
Regression: No Bisected commit-id:

Description bianpan 2016-11-25 10:47:16 UTC
In the function orinoco_ioctl_commit() defined in file drivers/net/wireless/intersil/orinoco/wext.c, variable err takes the error code. However, the value of variable err keeps 0 (indicates success) even when the call to orinoco_lock() (at line 1316) fails. Maybe it is better to assign "-EBUSY" to err when the call to orinoco_lock() fails. Codes related to this bug are shown as follows.

orinoco_ioctl_commit @@ drivers/net/wireless/intersil/orinoco/wext.c
1303 /* Commit handler, called after set operations */
1304 static int orinoco_ioctl_commit(struct net_device *dev,
1305                 struct iw_request_info *info,
1306                 void *wrqu,
1307                 char *extra)
1308 {
1309     struct orinoco_private *priv = ndev_priv(dev);
1310     unsigned long flags;
1311     int err = 0;
1312 
1313     if (!priv->open)
1314         return 0;
1315 
1316     if (orinoco_lock(priv, &flags) != 0)
1317         return err;    // insert "err = -EBUSY;" before this return statement?
1318 
1319     err = orinoco_commit(priv);
1320 
1321     orinoco_unlock(priv, &flags);
1322     return err;
1323 }

Thanks very much!