04 Nov, 2018

2 commits


10 Oct, 2018

1 commit

  • [ Upstream commit 4f0223bfe9c3e62d8f45a85f1ef1b18a8a263ef9 ]

    nl80211_update_ft_ies() tried to validate NL80211_ATTR_IE with
    is_valid_ie_attr() before dereferencing it, but that helper function
    returns true in case of NULL pointer (i.e., attribute not included).
    This can result to dereferencing a NULL pointer. Fix that by explicitly
    checking that NL80211_ATTR_IE is included.

    Fixes: 355199e02b83 ("cfg80211: Extend support for IEEE 802.11r Fast BSS Transition")
    Signed-off-by: Arunk Khandavalli
    Signed-off-by: Jouni Malinen
    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Arunk Khandavalli
     

05 Sep, 2018

1 commit

  • [ Upstream commit 5cf3006cc81d9aa09a10aa781fc065546b12919d ]

    I was looking at usually suppressed gcc warnings,
    [-Wimplicit-fallthrough=] in this case:

    The code definitely looks like a break is missing here.
    However I am not able to test the NL80211_IFTYPE_MESH_POINT,
    nor do I actually know what might be :)
    So please use this patch with caution and only if you are
    able to do some testing.

    Signed-off-by: Bernd Edlinger
    [johannes: looks obvious enough to apply as is, interesting
    though that it never seems to have been a problem]
    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Bernd Edlinger
     

24 Aug, 2018

2 commits

  • [ Upstream commit 95bca62fb723a121954fc7ae5473bb2c1f0d5986 ]

    At the very least we should check the return value if
    nla_parse_nested() is called with a non-NULL policy.

    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Johannes Berg
     
  • [ Upstream commit 188f60ab8e787fcbb5ac9d64ede23a0070231f09 ]

    Commit 9757235f451c, "nl80211: correct checks for
    NL80211_MESHCONF_HT_OPMODE value") relaxed the range for the HT
    operation field in meshconf, while also adding checks requiring
    the non-greenfield and non-ht-sta bits to be set in certain
    circumstances. The latter bit is actually reserved for mesh BSSes
    according to Table 9-168 in 802.11-2016, so in fact it should not
    be set.

    wpa_supplicant sets these bits because the mesh and AP code share
    the same implementation, but authsae does not. As a result, some
    meshconf updates from authsae which set only the NONHT_MIXED
    protection bits were being rejected.

    In order to avoid breaking userspace by changing the rules again,
    simply accept the values with or without the bits set, and mask
    off the reserved bit to match the spec.

    While in here, update the 802.11-2012 reference to 802.11-2016.

    Fixes: 9757235f451c ("nl80211: correct checks for NL80211_MESHCONF_HT_OPMODE value")
    Cc: Masashi Honma
    Signed-off-by: Bob Copeland
    Reviewed-by: Masashi Honma
    Reviewed-by: Masashi Honma
    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Bob Copeland
     

03 Mar, 2018

1 commit

  • [ Upstream commit 3ea15452ee85754f70f3b9fa1f23165ef2e77ba7 ]

    nl80211_nan_add_func() does not check if the required attribute
    NL80211_NAN_FUNC_FOLLOW_UP_DEST is present when processing
    NL80211_CMD_ADD_NAN_FUNCTION request. This request can be issued
    by users with CAP_NET_ADMIN privilege and may result in NULL dereference
    and a system crash. Add a check for the required attribute presence.

    Signed-off-by: Hao Chen
    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Hao Chen
     

08 Feb, 2018

1 commit

  • commit 259d8c1e984318497c84eef547bbb6b1d9f4eb05

    Wireless drivers rely on parse_txq_params to validate that txq_params->ac
    is less than NL80211_NUM_ACS by the time the low-level driver's ->conf_tx()
    handler is called. Use a new helper, array_index_nospec(), to sanitize
    txq_params->ac with respect to speculation. I.e. ensure that any
    speculation into ->conf_tx() handlers is done with a value of
    txq_params->ac that is within the bounds of [0, NL80211_NUM_ACS).

    Reported-by: Christian Lamparter
    Reported-by: Elena Reshetova
    Signed-off-by: Dan Williams
    Signed-off-by: Thomas Gleixner
    Acked-by: Johannes Berg
    Cc: linux-arch@vger.kernel.org
    Cc: kernel-hardening@lists.openwall.com
    Cc: gregkh@linuxfoundation.org
    Cc: linux-wireless@vger.kernel.org
    Cc: torvalds@linux-foundation.org
    Cc: "David S. Miller"
    Cc: alan@linux.intel.com
    Link: https://lkml.kernel.org/r/151727419584.33451.7700736761686184303.stgit@dwillia2-desk3.amr.corp.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Dan Williams
     

04 Oct, 2017

1 commit

  • Define a policy for packet pattern attributes in order to fix a
    potential read over the end of the buffer during nla_get_u32()
    of the NL80211_PKTPAT_OFFSET attribute.

    Note that the data there can always be read due to SKB allocation
    (with alignment and struct skb_shared_info at the end), but the
    data might be uninitialized. This could be used to leak some data
    from uninitialized vmalloc() memory, but most drivers don't allow
    an offset (so you'd just get -EINVAL if the data is non-zero) or
    just allow it with a fixed value - 100 or 128 bytes, so anything
    above that would get -EINVAL. With brcmfmac the limit is 1500 so
    (at least) one byte could be obtained.

    Cc: stable@kernel.org
    Signed-off-by: Peng Xu
    Signed-off-by: Jouni Malinen
    [rewrite description based on SKB allocation knowledge]
    Signed-off-by: Johannes Berg

    Peng Xu
     

19 Sep, 2017

1 commit


15 Sep, 2017

1 commit

  • nl80211_set_rekey_data() does not check if the required attributes
    NL80211_REKEY_DATA_{REPLAY_CTR,KEK,KCK} are present when processing
    NL80211_CMD_SET_REKEY_OFFLOAD request. This request can be issued by
    users with CAP_NET_ADMIN privilege and may result in NULL dereference
    and a system crash. Add a check for the required attributes presence.
    This patch is based on the patch by bo Zhang.

    This fixes CVE-2017-12153.

    References: https://bugzilla.redhat.com/show_bug.cgi?id=1491046
    Fixes: e5497d766ad ("cfg80211/nl80211: support GTK rekey offload")
    Cc: # v3.1-rc1
    Reported-by: bo Zhang
    Signed-off-by: Vladis Dronov
    Signed-off-by: Johannes Berg

    Vladis Dronov
     

05 Sep, 2017

1 commit


07 Jul, 2017

5 commits

  • …kernel/git/jberg/mac80211

    Johannes Berg says:

    ====================
    pull-request: mac80211 2017-07-07

    Just got a set of fixes in from Jouni/QCA, all netlink validation
    fixes. I assume they ran some kind of checker, but I don't know what
    kind :)

    Please pull and let me know if there's any problem.
    ====================

    Signed-off-by: David S. Miller <davem@davemloft.net>

    David S. Miller
     
  • validate_scan_freqs() retrieves frequencies from attributes
    nested in the attribute NL80211_ATTR_SCAN_FREQUENCIES with
    nla_get_u32(), which reads 4 bytes from each attribute
    without validating the size of data received. Attributes
    nested in NL80211_ATTR_SCAN_FREQUENCIES don't have an nla policy.

    Validate size of each attribute before parsing to avoid potential buffer
    overread.

    Fixes: 2a519311926 ("cfg80211/nl80211: scanning (and mac80211 update to use it)")
    Cc: stable@vger.kernel.org
    Signed-off-by: Srinivas Dasari
    Signed-off-by: Jouni Malinen
    Signed-off-by: Johannes Berg

    Srinivas Dasari
     
  • Buffer overread may happen as nl80211_set_station() reads 4 bytes
    from the attribute NL80211_ATTR_LOCAL_MESH_POWER_MODE without
    validating the size of data received when userspace sends less
    than 4 bytes of data with NL80211_ATTR_LOCAL_MESH_POWER_MODE.
    Define nla_policy for NL80211_ATTR_LOCAL_MESH_POWER_MODE to avoid
    the buffer overread.

    Fixes: 3b1c5a5307f ("{cfg,nl}80211: mesh power mode primitives and userspace access")
    Cc: stable@vger.kernel.org
    Signed-off-by: Srinivas Dasari
    Signed-off-by: Jouni Malinen
    Signed-off-by: Johannes Berg

    Srinivas Dasari
     
  • nla policy checks for only maximum length of the attribute data when the
    attribute type is NLA_BINARY. If userspace sends less data than
    specified, cfg80211 may access illegal memory. When type is NLA_UNSPEC,
    nla policy check ensures that userspace sends minimum specified length
    number of bytes.

    Remove type assignment to NLA_BINARY from nla_policy of
    NL80211_NAN_FUNC_SERVICE_ID to make these NLA_UNSPEC and to make sure
    minimum NL80211_NAN_FUNC_SERVICE_ID_LEN bytes are received from
    userspace with NL80211_NAN_FUNC_SERVICE_ID.

    Fixes: a442b761b24 ("cfg80211: add add_nan_func / del_nan_func")
    Cc: stable@vger.kernel.org
    Signed-off-by: Srinivas Dasari
    Signed-off-by: Jouni Malinen
    Signed-off-by: Johannes Berg

    Srinivas Dasari
     
  • nla policy checks for only maximum length of the attribute data
    when the attribute type is NLA_BINARY. If userspace sends less
    data than specified, the wireless drivers may access illegal
    memory. When type is NLA_UNSPEC, nla policy check ensures that
    userspace sends minimum specified length number of bytes.

    Remove type assignment to NLA_BINARY from nla_policy of
    NL80211_ATTR_PMKID to make this NLA_UNSPEC and to make sure minimum
    WLAN_PMKID_LEN bytes are received from userspace with
    NL80211_ATTR_PMKID.

    Fixes: 67fbb16be69d ("nl80211: PMKSA caching support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Srinivas Dasari
    Signed-off-by: Jouni Malinen
    Signed-off-by: Johannes Berg

    Srinivas Dasari
     

30 Jun, 2017

1 commit

  • If NAN interface is created with NL80211_ATTR_SOCKET_OWNER, the socket
    that is used to create the interface is used for all NAN operations and
    reporting NAN events.
    However, it turns out that sending commands and receiving events on
    the same socket is not possible in a completely race-free way:
    If the socket buffer is overflowed by the events, the command response
    will not be sent. In that case the caller will block forever on recv.
    Using non-blocking socket for commands is more complicated and still
    the command response or ack may not be received.
    So, keep unicasting NAN events to the interface creator, but allow
    using a different socket for commands.

    Signed-off-by: Andrei Otcheretianski
    Signed-off-by: Luca Coelho
    Reviewed-by: Johannes Berg
    Signed-off-by: Kalle Valo

    Andrei Otcheretianski
     

13 Jun, 2017

3 commits

  • Drivers that initiate roaming while being connected to a network that
    uses 802.1X authentication need to inform user space if 802.1X
    authentication is further required after roaming.
    For example, when using the Fast transition protocol, roaming within
    the mobility domain does not require new 802.1X authentication, but
    roaming to another mobility domain does.
    In addition, some drivers may not support 802.1X authentication
    (so it has to be done in user space), while other drivers do.

    Add a flag to the roaming notification to indicate if user space is
    required to do 802.1X authentication after the roaming or not.
    This flag will only be used for networks that use 802.1X
    authentication. For networks that do not use 802.1X authentication it
    is assumed that no further action is required from user space after
    the roaming notification.

    Signed-off-by: Avraham Stern
    Signed-off-by: Luca Coelho
    [arend.vanspriel@broadcom.com reuse NL80211_ATTR_PORT_AUTHORIZED]
    Signed-off-by: Arend van Spriel
    [rebase to apply w/o the flag in CONNECT]
    Signed-off-by: Johannes Berg

    Avraham Stern
     
  • Add API for setting the PMK to the driver. For FT support, allow
    setting also the PMK-R0 Name.

    This can be used by drivers that support 4-Way handshake offload
    while IEEE802.1X authentication is managed by upper layers.

    Signed-off-by: Avraham Stern
    Signed-off-by: Johannes Berg
    [arend.vanspriel@broadcom.com: add WANT_1X_4WAY_HS attribute]
    Signed-off-by: Arend van Spriel
    [reword NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X docs a bit to
    say that the device may require it]
    Signed-off-by: Johannes Berg

    Avraham Stern
     
  • Let drivers advertise support for station-mode 4-way handshake
    offloading with a new NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_PSK flag.

    Extend use of NL80211_ATTR_PMK attribute indicating it might be passed
    as part of NL80211_CMD_CONNECT command, and contain the PSK (which is
    the PMK, hence the name.)

    The driver/device is assumed to handle the 4-way handshake by
    itself in this case (including key derivations, etc.), instead
    of relying on the supplicant.

    This patch is somewhat based on this one (by Vladimir Kondratiev):
    https://patchwork.kernel.org/patch/1309561/.

    Signed-off-by: Vladimir Kondratiev
    Signed-off-by: Eliad Peller
    Signed-off-by: Luca Coelho
    [arend.vanspriel@broadcom.com rebase dealing with existing ATTR_PMK]
    Signed-off-by: Arend van Spriel
    [reword NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_PSK docs to indicate
    that this offload might be required]
    Signed-off-by: Johannes Berg

    Eliad Peller
     

19 May, 2017

2 commits

  • In the case the channel should be switched to one requiring DFS we need
    to make sure that userspace will handle radar events when they happen.
    For AP mode this is assumed to be the case, as a manager like hostapd
    is required. However IBSS and MESH modes can work without further
    userspace assistance, so refuse to use DFS channels unless userspace
    vouches that it handles DFS.

    NOTE: Userspace should have already flagged support earlier during mesh
    or IBSS setup. However, this information is not readily accessible
    currently.

    Signed-off-by: Benjamin Berg
    [sw: style cleanups]
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Johannes Berg

    Benjamin Berg
     
  • When joining a mesh network it is not guaranteed that userspace has a
    daemon listening for radar events. This is however required for channels
    requiring DFS. To flag that userspace will handle radar events, it needs
    to set NL80211_ATTR_HANDLE_DFS.

    This matches the current mechanism used for IBSS mode.

    Signed-off-by: Benjamin Berg
    Signed-off-by: Simon Wunderlich
    Signed-off-by: Johannes Berg

    Benjamin Berg
     

08 May, 2017

1 commit

  • Since groups 0 and 63 are invalid, we should check for those bits.
    Note that the 802.11 spec specifies the *bit* order, but the CPU
    doesn't care about bit order since it can't address bits, so it's
    always treating BIT(0) as the lowest bit within a byte.

    Reported-by: Jan Fuchs
    Signed-off-by: Johannes Berg

    Johannes Berg
     

28 Apr, 2017

1 commit

  • cfg80211_roamed() and cfg80211_roamed_bss() take the same arguments
    except that cfg80211_roamed() requires the BSSID and
    cfg80211_roamed_bss() requires the bss entry.

    Unify the two functions by using a struct for driver initiated
    roaming information so that either the BSSID or the bss entry can be
    passed as an argument to the unified function.

    Signed-off-by: Avraham Stern
    [modified the ath6k, brcm80211, rndis and wlan-ng drivers accordingly]
    Signed-off-by: Luca Coelho
    [modify brcmfmac to remove the useless cast, spotted by Arend]
    Signed-off-by: Johannes Berg

    Avraham Stern
     

27 Apr, 2017

3 commits

  • This patch allows for the scheduled scan request to specify matchsets
    for specific BSSIDs.

    Reviewed-by: Hante Meuleman
    Reviewed-by: Pieter-Paul Giesberts
    Reviewed-by: Franky Lin
    Signed-off-by: Arend van Spriel
    [docs, netlink policy fix]
    Signed-off-by: Johannes Berg

    Arend Van Spriel
     
  • This patch implements the idea to have multiple scheduled scan requests
    running concurrently. It mainly illustrates how to deal with the incoming
    request from user-space in terms of backward compatibility. In order to
    use multiple scheduled scans user-space needs to provide a flag attribute
    NL80211_ATTR_SCHED_SCAN_MULTI to indicate support. If not the request is
    treated as a legacy scan.

    Drivers currently supporting scheduled scan are now indicating they support
    a single scheduled scan request. This obsoletes WIPHY_FLAG_SUPPORTS_SCHED_SCAN.

    Reviewed-by: Hante Meuleman
    Reviewed-by: Pieter-Paul Giesberts
    Reviewed-by: Franky Lin
    Signed-off-by: Arend van Spriel
    [clean up netlink destroy path to avoid allocations, code cleanups]
    Signed-off-by: Johannes Berg

    Arend Van Spriel
     
  • There's no need to allocate a portid structure and then, for
    each of those, walk the interfaces - we can just add a flag
    to each interface and walk those directly. Due to padding in
    the struct, we can even do it without any memory cost, and
    it even simplifies the code.

    Signed-off-by: Johannes Berg

    Johannes Berg
     

21 Apr, 2017

1 commit

  • …inux/kernel/git/jberg/mac80211-next

    Johannes Berg says:

    ====================
    My last pull request has been a while, we now have:
    * connection quality monitoring with multiple thresholds
    * support for FILS shared key authentication offload
    * pre-CAC regulatory compliance - only ETSI allows this
    * sanity check for some rate confusion that hit ChromeOS
    (but nobody else uses it, evidently)
    * some documentation updates
    * lots of cleanups
    ====================

    Signed-off-by: David S. Miller <davem@davemloft.net>

    David S. Miller
     

18 Apr, 2017

2 commits


14 Apr, 2017

2 commits

  • This is an add-on to the previous patch that passes the extended ACK
    structure where it's already available by existing genl_info or extack
    function arguments.

    This was done with this spatch (with some manual adjustment of
    indentation):

    @@
    expression A, B, C, D, E;
    identifier fn, info;
    @@
    fn(..., struct genl_info *info, ...) {
    ...
    -nlmsg_parse(A, B, C, D, E, NULL)
    +nlmsg_parse(A, B, C, D, E, info->extack)
    ...
    }

    @@
    expression A, B, C, D, E;
    identifier fn, info;
    @@
    fn(..., struct genl_info *info, ...) {
    extack)
    ...>
    }

    @@
    expression A, B, C, D, E;
    identifier fn, extack;
    @@
    fn(..., struct netlink_ext_ack *extack, ...) {

    }

    @@
    expression A, B, C, D, E;
    identifier fn, extack;
    @@
    fn(..., struct netlink_ext_ack *extack, ...) {

    }

    @@
    expression A, B, C, D, E;
    identifier fn, extack;
    @@
    fn(..., struct netlink_ext_ack *extack, ...) {
    ...
    -nlmsg_parse(A, B, C, D, E, NULL)
    +nlmsg_parse(A, B, C, D, E, extack)
    ...
    }

    @@
    expression A, B, C, D;
    identifier fn, extack;
    @@
    fn(..., struct netlink_ext_ack *extack, ...) {

    }

    @@
    expression A, B, C, D;
    identifier fn, extack;
    @@
    fn(..., struct netlink_ext_ack *extack, ...) {

    }

    @@
    expression A, B, C, D;
    identifier fn, extack;
    @@
    fn(..., struct netlink_ext_ack *extack, ...) {

    }

    @@
    expression A, B, C;
    identifier fn, extack;
    @@
    fn(..., struct netlink_ext_ack *extack, ...) {

    }

    Signed-off-by: Johannes Berg
    Reviewed-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Johannes Berg
     
  • Pass the new extended ACK reporting struct to all of the generic
    netlink parsing functions. For now, pass NULL in almost all callers
    (except for some in the core.)

    Signed-off-by: Johannes Berg
    Signed-off-by: David S. Miller

    Johannes Berg
     

13 Apr, 2017

3 commits

  • Refactor the parsing of monitor flags and the MU-MIMO options.
    This will allow adding more things cleanly in the future and
    also allows setting the latter already when creating a monitor
    interface.

    Signed-off-by: Johannes Berg

    Johannes Berg
     
  • Instead passing both flags, which can be NULL, and vif_params,
    which are never NULL, move the flags into the vif_params and
    use BIT(0), which is invalid from userspace, to indicate that
    the flags were changed.

    While updating all drivers, fix a small bug in wil6210 where
    it was setting the flags to 0 instead of leaving them unchanged.

    Signed-off-by: Johannes Berg

    Johannes Berg
     
  • When changing monitor parameters, not setting the MU-MIMO attributes
    should mean that they're not changed - it's documented that to turn
    the feature off it's necessary to set all-zero group membership and
    an invalid follow-address. This isn't implemented.

    Fix this by making the parameters pointers, stop reusing the macaddr
    struct member, and documenting that NULL pointers mean unchanged.

    Signed-off-by: Johannes Berg

    Johannes Berg
     

31 Mar, 2017

2 commits

  • Enhance nl80211 and cfg80211 connect request and response APIs to
    support FILS shared key authentication offload. The new nl80211
    attributes can be used to provide additional information to the driver
    to establish a FILS connection. Also enhance the set/del PMKSA to allow
    support for adding and deleting PMKSA based on FILS cache identifier.

    Add a new feature flag that drivers can use to advertize support for
    FILS shared key authentication and association in station mode when
    using their own SME.

    Signed-off-by: Vidyullatha Kanchanapally
    Signed-off-by: Jouni Malinen
    Signed-off-by: Johannes Berg

    Vidyullatha Kanchanapally
     
  • Currently the connect event from driver takes all the connection
    response parameters as arguments. With support for new features these
    response parameters can grow. Use a structure to pass these parameters
    rather than passing them as function arguments.

    Signed-off-by: Vidyullatha Kanchanapally
    Signed-off-by: Jouni Malinen
    [add to documentation]
    Signed-off-by: Johannes Berg

    Vidyullatha Kanchanapally
     

16 Mar, 2017

2 commits

  • The rssi_threshold is defined as s32.

    Signed-off-by: Masashi Honma
    Signed-off-by: Johannes Berg

    Masashi Honma
     
  • Sowmini pointed out Dmitry's RTNL deadlock report to me, and it turns out
    to be perfectly accurate - there are various error paths that miss unlock
    of the RTNL.

    To fix those, change the locking a bit to not be conditional in all those
    nl80211_prepare_*_dump() functions, but make those require the RTNL to
    start with, and fix the buggy error paths. This also let me use sparse
    (by appropriately overriding the rtnl_lock/rtnl_unlock functions) to
    validate the changes.

    Cc: stable@vger.kernel.org
    Reported-by: Sowmini Varadhan
    Reported-by: Dmitry Vyukov
    Signed-off-by: Johannes Berg

    Johannes Berg