ath10k: fix peer limit enforcement
Hello Michal Kazior,
The patch e04cafbc38c7: "ath10k: fix peer limit enforcement" from Aug 5, 2015, leads to the following static checker warning:
drivers/net/wireless/ath/ath10k/mac.c:4365 ath10k_add_interface() warn: inconsistent returns 'mutex:&ar->conf_mutex'. Locked on: line 4125 Unlocked on: line 4344 line 4365
drivers/net/wireless/ath/ath10k/mac.c
4098 int i;
4099 u32 vdev_param;
4100
4101 vif->driver_flags |= IEEE80211_VIF_SUPPORTS_UAPSD;
4102
4103 mutex_lock(&ar->conf_mutex);
^^^^^^^^^^^^^^^^^^^^^^^^^^Lock.
4104
4105 memset(arvif, 0, sizeof(*arvif));
4106
4107 arvif->ar = ar;
4108 arvif->vif = vif;
4109
4110 INIT_LIST_HEAD(&arvif->list);
4111 INIT_WORK(&arvif->ap_csa_work, ath10k_mac_vif_ap_csa_work);
4112 INIT_DELAYED_WORK(&arvif->connection_loss_work,
4113 ath10k_mac_vif_sta_connection_loss_work);
4114
4115 for (i = 0; i < ARRAY_SIZE(arvif->bitrate_mask.control); i++) {
4116 arvif->bitrate_mask.control[i].legacy = 0xffffffff;
4117 memset(arvif->bitrate_mask.control[i].ht_mcs, 0xff,
4118 sizeof(arvif->bitrate_mask.control[i].ht_mcs));
4119 memset(arvif->bitrate_mask.control[i].vht_mcs, 0xff,
4120 sizeof(arvif->bitrate_mask.control[i].vht_mcs));
4121 }
4122
4123 if (ar->num_peers >= ar->max_num_peers) {
4124 ath10k_warn(ar, "refusing vdev creation due to insufficient peer entry resources in firmware\n");
4125 return -ENOBUFS;Can't return directly. We're holding a lock.
4126 }
4127
4128 if (ar->free_vdev_map == 0) {
4129 ath10k_warn(ar, "Free vdev map is empty, no more interfaces allowed.\n");
4130 ret = -EBUSY;
4131 goto err;
4132 }
4133 bit = __ffs64(ar->free_vdev_map);regards,
dan carpenter
_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
Quoted 10 lines · Dan Carpenter
Hello Michal Kazior,
The patch
e04cafbc38c7: "ath10k: fix peer limit enforcement" from Aug 5, 2015, leads to the following static checker warning:drivers/net/wireless/ath/ath10k/mac.c:4365 ath10k_add_interface() warn: inconsistent returns 'mutex:&ar->conf_mutex'. Locked on: line 4125 Unlocked on: line 4344 line 4365
[...]
Great job finding this and the other one (dma_mapping_error) as well! I've just sent patches to fix them.
I'd love to have this sort of static analysis in my tool set. What did you use (I have a weird feeling I did ask about it at one point..)? Thanks!
Michał
_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
Quoted 11 lines · Michal Kazior
Quoted 10 lines · Dan Carpenter
Hello Michal Kazior,
The patch
e04cafbc38c7: "ath10k: fix peer limit enforcement" from Aug 5, 2015, leads to the following static checker warning:drivers/net/wireless/ath/ath10k/mac.c:4365 ath10k_add_interface() warn: inconsistent returns 'mutex:&ar->conf_mutex'. Locked on: line 4125 Unlocked on: line 4344 line 4365
Quoted 4 lines
[...]
Great job finding this and the other one (
dma_mapping_error) as well! I've just sent patches to fix them.
I re-wrote the dma_mapping_error() check yesteday but I will push it soon.
Quoted 3 lines
I'd love to have this sort of static analysis in my tool set. What did you use (I have a weird feeling I did ask about it at one point..)?
This is a Smatch warning.
regards,
dan carpenter
_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k