From: Pavel Roskin <proski@gnu.org>
To: Julian Calaby <julian.calaby@gmail.com>
Cc: linux-wireless@vger.kernel.org,
"John W. Linville" <linville@tuxdriver.com>
Subject: Re: [PATCH] lib80211: call try_module_get() in lib80211_get_crypto_ops()
Date: Fri, 29 Jul 2011 11:55:42 -0400 [thread overview]
Message-ID: <4E32D7FE.9030402@gnu.org> (raw)
In-Reply-To: <CAGRGNgWo=jgOwffbvCL5SDA6TD=cKUheObSM=23+ZTNCqH+-GQ@mail.gmail.com>
On 07/28/2011 11:27 PM, Julian Calaby wrote:
> If I recall correctly, lib80211 is the last remainder of the
> pre-mac80211 wireless stack. It should be annihilated with extreme
> prejudice, but the intel centrino 2xxx drivers are so interwoven with
> it that extracting them would be a pain in the ass - and given that
> nobody who has those parts really cares, this hasn't happened.
Basically, lib80211 has no consistent API. The callers (hostap and
ipw2x00) get all the internals and do way too much with them.
Module refcounting is (presumably) done by the "key objects", i.e. the
structures consisting of the keys and the operations that apply to them.
Something is done wrong, as there are more module puts than module gets.
But the caller also gets the ops, that is the set of encryption
functions from a particular encryption module. There is no locking for
the ops. There is no lib80211_put_crypto_ops(), that is, the caller
never says it's not using the ops anymore.
Possible fixes are:
1) Rewrite the whole API. Hide ops from the callers. Enforce
refcounting by the keys. The keys should hold the ops, the ops should
hold the modules. That may be a lot of work, but the result will be
nice. Maybe even mac80211 could use it.
2) Fix key object based refcounting. Ignore the fact that a crypto
module can be unloaded at a wrong time while the caller is using the
ops. That may be a simple fix, but it won't be complete. At least no
new bugs would be introduced.
3) Same as above, but add ops-based refcounting to protect against
crypto module unloading. The problem is that it's hard to find the
places where the callers stop using the ops. The result would work
correctly, and the changes won't be too radical. But it's hard to get
right.
4) Merge lib80211 and lib80211_crypt_* into one module. That solves the
problem completely. Some memory would be wasted for those who use only
one algorithm.
5) Make lib80211_crypt_* modules permanent (not unloadable). Some
sysadmins may be unhappy that the modules cannot be replaced without reboot.
--
Regards,
Pavel Roskin
prev parent reply other threads:[~2011-07-29 15:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-29 2:50 [PATCH] lib80211: call try_module_get() in lib80211_get_crypto_ops() Pavel Roskin
2011-07-29 3:02 ` Pavel Roskin
2011-07-29 3:27 ` Julian Calaby
2011-07-29 15:55 ` Pavel Roskin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E32D7FE.9030402@gnu.org \
--to=proski@gnu.org \
--cc=julian.calaby@gmail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).