linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Lots of confusion on bss refcounting.
@ 2013-06-17 18:49 Ben Greear
  2013-06-17 19:02 ` Johannes Berg
  0 siblings, 1 reply; 10+ messages in thread
From: Ben Greear @ 2013-06-17 18:49 UTC (permalink / raw)
  To: linux-wireless@vger.kernel.org

More on looking for bss and ies leaks...

I am trying to understand the bss refcounting, but everywhere I
look it seems like the code is weird at best.

For instance:

We create an assoc_data, assign a bss pointer in ieee80211_mgd_assoc,
but do not claim a reference.

Later, when deleting the assoc_data, the ref is not freed either,
except in one error path where it is explicitly freed:

		if (!ieee80211_assoc_success(sdata, *bss, mgmt, len)) {
			/* oops -- internal error -- send timeout for now */
			ieee80211_destroy_assoc_data(sdata, false);
			cfg80211_put_bss(sdata->local->hw.wiphy, *bss);
			return RX_MGMT_CFG80211_ASSOC_TIMEOUT;
		}

This seems ripe for bugs, if not already buggy.

Maybe we should be more explicit about always grabbing a ref when
we take a reference to the pointer, and always put it when we
destroy the pointer?

I'll be happy to cook up some patches if this seems like the right
path to take.

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


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

end of thread, other threads:[~2013-06-18 21:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-17 18:49 Lots of confusion on bss refcounting Ben Greear
2013-06-17 19:02 ` Johannes Berg
2013-06-17 19:09   ` Ben Greear
2013-06-17 21:31     ` Ben Greear
2013-06-18  0:30       ` Ben Greear
2013-06-18 12:49         ` Johannes Berg
2013-06-18 15:47           ` Ben Greear
2013-06-18 15:52             ` Johannes Berg
2013-06-18 15:59               ` Ben Greear
2013-06-18 21:36               ` Ben Greear

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).