From: Johannes Berg <johannes@sipsolutions.net>
To: Andrew Zaborowski <andrew.zaborowski@intel.com>,
linux-wireless@vger.kernel.org
Subject: Re: [PATCH 1/2] mac80211_hwsim: Make sure NEW_RADIO contains final name
Date: Mon, 27 Feb 2017 14:24:22 +0100 [thread overview]
Message-ID: <1488201862.28431.5.camel@sipsolutions.net> (raw)
In-Reply-To: <CAOq732LiwZ13wVuB+wvk6nOCpY+oq=KWhcY1Au2zpcGSWsZ3uA@mail.gmail.com> (sfid-20170224_010957_854416_31DD49EC)
On Fri, 2017-02-24 at 01:08 +0100, Andrew Zaborowski wrote:
> On 23 February 2017 at 13:02, Andrew Zaborowski
> <andrew.zaborowski@intel.com> wrote:
> > ieee80211_alloc_hw_nm will validate the requested name (if any)
> > before
> > creating the new device and may use a name different from the one
> > requested rather than fail. Make sure the HWSIM_CMD_NEW_RADIO
> > event/response generated has the final name or userspace will
> > receive
> > the wrong name. Note that mac80211_hwsim_new_radio may now modify
> > params.
>
> Also related to this I find that the HWSIM_ATTR_RADIO_NAME attributes
> emitted contain the name string and are exactly of the right length
> while the HWSIM_ATTR_RADIO_NAME attributes received by the kernel are
> assumed to be NUL-terminated.
I'll agree this is a bit strange - I guess it's too late to fix now
though since userspace might assume "length/data" is the string, rather
than "0-terminated" (especially if there's something like python
userspace where strings can trivially contain NUL bytes).
nla_put_string() would have added the NUL byte.
> Is there a guarantee that a 0-byte
> follows an attribute, or should this be changed for consistency?
[HWSIM_ATTR_RADIO_NAME] = { .type = NLA_STRING },
enforces that a NUL byte *must* be present when userspace gives us the
information, so we're save - just asymmetric.
Anyway, patch applied.
johannes
next prev parent reply other threads:[~2017-02-27 13:24 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-23 12:02 [PATCH 1/2] mac80211_hwsim: Make sure NEW_RADIO contains final name Andrew Zaborowski
2017-02-23 12:02 ` [PATCH 2/2][RFC] mac80211_hwsim: Report radio addresses in NEW_RADIO/GET_RADIO Andrew Zaborowski
2017-02-23 19:01 ` Benjamin Beichler
2017-02-24 0:02 ` Andrew Zaborowski
2017-02-24 0:25 ` Ben Greear
2017-02-27 13:27 ` Johannes Berg
2017-02-27 15:26 ` Andrew Zaborowski
2017-02-27 17:10 ` Ben Greear
2017-02-28 1:23 ` Andrew Zaborowski
2017-02-28 1:57 ` Ben Greear
2017-03-01 14:33 ` Benjamin Beichler
2017-03-01 15:35 ` Ben Greear
2017-03-01 17:04 ` Benjamin Beichler
2017-03-02 8:23 ` Johannes Berg
2017-02-24 0:08 ` [PATCH 1/2] mac80211_hwsim: Make sure NEW_RADIO contains final name Andrew Zaborowski
2017-02-27 13:24 ` Johannes Berg [this message]
2017-02-27 15:16 ` Andrew Zaborowski
2017-02-27 16:08 ` 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=1488201862.28431.5.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=andrew.zaborowski@intel.com \
--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 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.