All of lore.kernel.org
 help / color / mirror / Atom feed
* re: ath10k: fix peer limit enforcement
@ 2015-08-18 19:01 Dan Carpenter
  2015-08-19 11:19 ` Michal Kazior
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2015-08-18 19:01 UTC (permalink / raw)
  To: michal.kazior; +Cc: ath10k

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
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ath10k: fix peer limit enforcement
  2015-08-18 19:01 ath10k: fix peer limit enforcement Dan Carpenter
@ 2015-08-19 11:19 ` Michal Kazior
  2015-08-19 12:41   ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Michal Kazior @ 2015-08-19 11:19 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: ath10k@lists.infradead.org

On 18 August 2015 at 21:01, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 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
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ath10k: fix peer limit enforcement
  2015-08-19 11:19 ` Michal Kazior
@ 2015-08-19 12:41   ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2015-08-19 12:41 UTC (permalink / raw)
  To: Michal Kazior; +Cc: ath10k@lists.infradead.org

On Wed, Aug 19, 2015 at 01:19:32PM +0200, Michal Kazior wrote:
> On 18 August 2015 at 21:01, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> > 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 re-wrote the dma_mapping_error() check yesteday but I will push it
soon.

> 
> 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
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-08-19 12:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-18 19:01 ath10k: fix peer limit enforcement Dan Carpenter
2015-08-19 11:19 ` Michal Kazior
2015-08-19 12:41   ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.