From: Johannes Berg <johannes@sipsolutions.net>
To: Benjamin Beichler <benjamin.beichler@uni-rostock.de>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH v3 4/5] mac80211_hwsim: add permanent mac address option for new radios
Date: Mon, 15 Jan 2018 13:14:32 +0100 [thread overview]
Message-ID: <1516018472.410.16.camel@sipsolutions.net> (raw)
In-Reply-To: <6596c1d9-da4f-4d83-bd5e-5e276391a0c9@MAIL2.uni-rostock.de>
On Wed, 2018-01-10 at 17:42 +0100, Benjamin Beichler wrote:
>
>
> + if (info->attrs[HWSIM_ATTR_PERM_ADDR]) {
> + if (nla_len(info->attrs[HWSIM_ATTR_PERM_ADDR]) != ETH_ALEN) {
> + pr_debug("mac80211_hwsim: MAC has wrong size\n");
> + return -EINVAL;
> + }
Oh, also - don't do this.
1) don't print, use NL_SET_ERR_MSG().
2) use the policy to validate lengths
> + if (!is_local_ether_addr(
> + nla_data(info->attrs[HWSIM_ATTR_PERM_ADDR]))) {
> + pr_debug("mac80211_hwsim: MAC is not locally administered\n");
> + return -EINVAL;
> + }
This doesn't really matter - it's purely virtual. I think we can avoid
that.
> + if (get_hwsim_data_ref_from_addr(
> + nla_data(info->attrs[HWSIM_ATTR_PERM_ADDR]))) {
> + pr_debug("mac80211_hwsim: perm MAC already in use\n");
> + return -EINVAL;
> + }
This is racy afaict - remove it and return a clash later when you fail
to insert the new radio.
johannes
next prev parent reply other threads:[~2018-01-15 12:14 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20180110164255.2763-1-benjamin.beichler@uni-rostock.de>
2018-01-10 16:42 ` [PATCH v3 1/5] mac80211_hwsim: add workqueue to wait for deferred radio deletion on mod unload Benjamin Beichler
2018-01-15 11:46 ` Johannes Berg
2018-01-10 16:42 ` [PATCH v3 2/5] mac80211_hwsim: add hashtable with mac address keys for faster lookup Benjamin Beichler
2018-01-15 11:46 ` Johannes Berg
2018-01-10 16:42 ` [PATCH v3 3/5] mac80211_hwsim: add generation count for netlink dump operation Benjamin Beichler
2018-01-15 12:08 ` Johannes Berg
2018-01-15 14:28 ` Benjamin Beichler
2018-01-22 13:24 ` Johannes Berg
2018-01-22 14:58 ` Benjamin Beichler
2018-01-10 16:42 ` [PATCH v3 4/5] mac80211_hwsim: add permanent mac address option for new radios Benjamin Beichler
2018-01-15 12:09 ` Johannes Berg
2018-01-15 14:39 ` Benjamin Beichler
2018-01-22 13:22 ` Johannes Berg
2018-01-15 12:14 ` Johannes Berg [this message]
2018-01-15 14:48 ` Benjamin Beichler
2018-01-22 13:23 ` Johannes Berg
2018-01-22 14:49 ` Benjamin Beichler
2018-01-22 14:51 ` Johannes Berg
2018-01-10 16:42 ` [PATCH v3 5/5] mac80211_hwsim: add hwsim_tx_rate_flags to netlink attributes Benjamin Beichler
2018-01-15 12:19 ` Johannes Berg
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=1516018472.410.16.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=benjamin.beichler@uni-rostock.de \
--cc=linux-wireless@vger.kernel.org \
/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).