29 Oct, 2018

2 commits

  • During insmod/rmmod test, the phy index increases that cause troube
    for test case. To make global variable wiphy_counter match between
    creat and free wiphy device, it needs to decrease the atomic counter
    when wiphy device is freed.

    Reviewed-by: Richard Zhu
    Signed-off-by: Fugang Duan

    Andy Duan
     
  • [Patch] Pulling the following commits and some general changes
    from custom v3.10 kernel for supporting qcacld2.0 on kernel v4.9.11.
    1. cfg80211: Using new wiphy flag WIPHY_FLAG_DFS_OFFLOAD
    When flag WIPHY_FLAG_DFS_OFFLOAD is defined, the driver would handle
    all the DFS related operations. Therefore the kernel needs to ignore
    the DFS state that it uses to block the userspace calls to the driver
    through cfg80211 APIs. Also it should treat the userspace calls to
    start radar detection as a no-op.

    Please note that changes in util.c is not picked up explicitly.
    Kernel v4.9.11 uses wrapper cfg80211_get_chans_dfs_required which takes
    care of this change.

    Change-Id: I9dd2076945581ca67e54dfc96dd3dbc526c6f0a2
    IRs-Fixed: 202686

    2. New db.txt from git/sforshee/wireless-regdb.git
    CONFIG_CFG80211_INTERNAL_REGDB is enabled in build. This causes
    kernel warn messages as db.txt is empty. A new db.txt is added
    from:
    git://git.kernel.org/pub/scm/linux/kernel/git/sforshee/wireless-regdb.git

    IRs-Fixed: 202686

    3. Picked up the declaration and definition of the function
    cfg80211_is_gratuitous_arp_unsolicited_na

    Change-Id: I1e4083a2327c121073226aa6b75bb6b5b97cec00
    CRs-fixed: 1079453

    Signed-off-by: Nakul Kachhwaha
    Signed-off-by: Fugang Duan

    Nakul Kachhwaha
     

10 Oct, 2018

2 commits

  • [ Upstream commit 8442938c3a2177ba16043b3a935f2c78266ad399 ]

    The "chandef->center_freq1" variable is a u32 but "freq" is a u16 so we
    are truncating away the high bits. I noticed this bug because in commit
    9cf0a0b4b64a ("cfg80211: Add support for 60GHz band channels 5 and 6")
    we made "freq
    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Dan Carpenter
     
  • [ 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
     

30 May, 2018

1 commit

  • [ Upstream commit 3027a8e799b20fc922496a12f8ad2f9f36a8a696 ]

    When a low level driver calls cfg80211_disconnected(), wep keys are
    not cleared. As a result, following connection requests will fail
    since cfg80211 internal state shows a connection is still in progress.

    Fix this by clearing the wep keys when disconnecting.

    Signed-off-by: Avraham Stern
    Signed-off-by: Luca Coelho
    Signed-off-by: Johannes Berg
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Avraham Stern
     

25 May, 2018

1 commit

  • commit a7cfebcb7594a24609268f91299ab85ba064bf82 upstream.

    There's currently no limit on wiphy names, other than netlink
    message size and memory limitations, but that causes issues when,
    for example, the wiphy name is used in a uevent, e.g. in rfkill
    where we use the same name for the rfkill instance, and then the
    buffer there is "only" 2k for the environment variables.

    This was reported by syzkaller, which used a 4k name.

    Limit the name to something reasonable, I randomly picked 128.

    Reported-by: syzbot+230d9e642a85d3fec29c@syzkaller.appspotmail.com
    Signed-off-by: Johannes Berg
    Signed-off-by: Greg Kroah-Hartman

    Johannes Berg
     

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
     

25 Feb, 2018

2 commits

  • commit 51a1aaa631c90223888d8beac4d649dc11d2ca55 upstream.

    When creating a new radio on the fly, hwsim allows this
    to be done with an arbitrary number of channels, but
    cfg80211 only supports a limited number of simultaneous
    channels, leading to a warning.

    Fix this by validating the number - this requires moving
    the define for the maximum out to a visible header file.

    Reported-by: syzbot+8dd9051ff19940290931@syzkaller.appspotmail.com
    Fixes: b59ec8dd4394 ("mac80211_hwsim: fix number of channels in interface combinations")
    Signed-off-by: Johannes Berg
    Signed-off-by: Greg Kroah-Hartman

    Johannes Berg
     
  • commit 59b179b48ce2a6076448a44531242ac2b3f6cef2 upstream.

    syzbot reported a warning from rfkill_alloc(), and after a while
    I think that the reason is that it was doing fault injection and
    the dev_set_name() failed, leaving the name NULL, and we didn't
    check the return value and got to rfkill_alloc() with a NULL name.
    Since we really don't want a NULL name, we ought to check the
    return value.

    Fixes: fb28ad35906a ("net: struct device - replace bus_id with dev_name(), dev_set_name()")
    Reported-by: syzbot+1ddfb3357e1d7bb5b5d3@syzkaller.appspotmail.com
    Signed-off-by: Johannes Berg
    Signed-off-by: Greg Kroah-Hartman

    Johannes Berg
     

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
     

03 Nov, 2017

1 commit

  • …el/git/gregkh/driver-core

    Pull initial SPDX identifiers from Greg KH:
    "License cleanup: add SPDX license identifiers to some files

    Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the
    'GPL-2.0' SPDX license identifier. The SPDX identifier is a legally
    binding shorthand, which can be used instead of the full boiler plate
    text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart
    and Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset
    of the use cases:

    - file had no licensing information it it.

    - file was a */uapi/* one with no licensing information in it,

    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to
    license had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied
    to a file was done in a spreadsheet of side by side results from of
    the output of two independent scanners (ScanCode & Windriver)
    producing SPDX tag:value files created by Philippe Ombredanne.
    Philippe prepared the base worksheet, and did an initial spot review
    of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537
    files assessed. Kate Stewart did a file by file comparison of the
    scanner results in the spreadsheet to determine which SPDX license
    identifier(s) to be applied to the file. She confirmed any
    determination that was not immediately clear with lawyers working with
    the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:

    - Files considered eligible had to be source code files.

    - Make and config files were included as candidates if they contained
    >5 lines of source

    - File already had some variant of a license header in it (even if <5
    lines).

    All documentation files were explicitly excluded.

    The following heuristics were used to determine which SPDX license
    identifiers to apply.

    - when both scanners couldn't find any license traces, file was
    considered to have no license information in it, and the top level
    COPYING file license applied.

    For non */uapi/* files that summary was:

    SPDX license identifier # files
    ---------------------------------------------------|-------
    GPL-2.0 11139

    and resulted in the first patch in this series.

    If that file was a */uapi/* path one, it was "GPL-2.0 WITH
    Linux-syscall-note" otherwise it was "GPL-2.0". Results of that
    was:

    SPDX license identifier # files
    ---------------------------------------------------|-------
    GPL-2.0 WITH Linux-syscall-note 930

    and resulted in the second patch in this series.

    - if a file had some form of licensing information in it, and was one
    of the */uapi/* ones, it was denoted with the Linux-syscall-note if
    any GPL family license was found in the file or had no licensing in
    it (per prior point). Results summary:

    SPDX license identifier # files
    ---------------------------------------------------|------
    GPL-2.0 WITH Linux-syscall-note 270
    GPL-2.0+ WITH Linux-syscall-note 169
    ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
    ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
    LGPL-2.1+ WITH Linux-syscall-note 15
    GPL-1.0+ WITH Linux-syscall-note 14
    ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
    LGPL-2.0+ WITH Linux-syscall-note 4
    LGPL-2.1 WITH Linux-syscall-note 3
    ((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
    ((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1

    and that resulted in the third patch in this series.

    - when the two scanners agreed on the detected license(s), that
    became the concluded license(s).

    - when there was disagreement between the two scanners (one detected
    a license but the other didn't, or they both detected different
    licenses) a manual inspection of the file occurred.

    - In most cases a manual inspection of the information in the file
    resulted in a clear resolution of the license that should apply
    (and which scanner probably needed to revisit its heuristics).

    - When it was not immediately clear, the license identifier was
    confirmed with lawyers working with the Linux Foundation.

    - If there was any question as to the appropriate license identifier,
    the file was flagged for further research and to be revisited later
    in time.

    In total, over 70 hours of logged manual review was done on the
    spreadsheet to determine the SPDX license identifiers to apply to the
    source files by Kate, Philippe, Thomas and, in some cases,
    confirmation by lawyers working with the Linux Foundation.

    Kate also obtained a third independent scan of the 4.13 code base from
    FOSSology, and compared selected files where the other two scanners
    disagreed against that SPDX file, to see if there was new insights.
    The Windriver scanner is based on an older version of FOSSology in
    part, so they are related.

    Thomas did random spot checks in about 500 files from the spreadsheets
    for the uapi headers and agreed with SPDX license identifier in the
    files he inspected. For the non-uapi files Thomas did random spot
    checks in about 15000 files.

    In initial set of patches against 4.14-rc6, 3 files were found to have
    copy/paste license identifier errors, and have been fixed to reflect
    the correct identifier.

    Additionally Philippe spent 10 hours this week doing a detailed manual
    inspection and review of the 12,461 patched files from the initial
    patch version early this week with:

    - a full scancode scan run, collecting the matched texts, detected
    license ids and scores

    - reviewing anything where there was a license detected (about 500+
    files) to ensure that the applied SPDX license was correct

    - reviewing anything where there was no detection but the patch
    license was not GPL-2.0 WITH Linux-syscall-note to ensure that the
    applied SPDX license was correct

    This produced a worksheet with 20 files needing minor correction. This
    worksheet was then exported into 3 different .csv files for the
    different types of files to be modified.

    These .csv files were then reviewed by Greg. Thomas wrote a script to
    parse the csv files and add the proper SPDX tag to the file, in the
    format that the file expected. This script was further refined by Greg
    based on the output to detect more types of files automatically and to
    distinguish between header and source .c files (which need different
    comment types.) Finally Greg ran the script using the .csv files to
    generate the patches.

    Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
    Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
    Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"

    * tag 'spdx_identifiers-4.14-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
    License cleanup: add SPDX license identifier to uapi header files with a license
    License cleanup: add SPDX license identifier to uapi header files with no license
    License cleanup: add SPDX GPL-2.0 license identifier to files with no license

    Linus Torvalds
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

18 Oct, 2017

1 commit

  • If we try to connect while already connected/connecting, but
    this fails, we set ssid_len=0 but leave current_bss hanging,
    leading to errors.

    Check all of this better, first of all ensuring that we can't
    try to connect to a different SSID while connected/ing; ensure
    that prev_bssid is set for re-association attempts even in the
    case of the driver supporting the connect() method, and don't
    reset ssid_len in the failure cases.

    While at it, also reset ssid_len while disconnecting unless we
    were connected and expect a disconnected event, and warn on a
    successful connection without ssid_len being set.

    Cc: stable@vger.kernel.org
    Signed-off-by: Johannes Berg

    Johannes Berg
     

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
     

06 Sep, 2017

1 commit

  • Honor the NL80211_RRF_NO_HT40{MINUS,PLUS} flags in
    reg_process_ht_flags_channel. Not doing so leads can lead
    to a firmware assert in iwlwifi for example.

    Fixes: b0d7aa59592b ("cfg80211: allow wiphy specific regdomain management")
    Signed-off-by: Emmanuel Grumbach
    Signed-off-by: Johannes Berg

    Emmanuel Grumbach
     

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
     

22 Jun, 2017

1 commit


16 Jun, 2017

1 commit

  • It seems like a historic accident that these return unsigned char *,
    and in many places that means casts are required, more often than not.

    Make these functions return void * and remove all the casts across
    the tree, adding a (u8 *) cast only where the unsigned char pointer
    was used directly, all done with the following spatch:

    @@
    expression SKB, LEN;
    typedef u8;
    identifier fn = { skb_push, __skb_push, skb_push_rcsum };
    @@
    - *(fn(SKB, LEN))
    + *(u8 *)fn(SKB, LEN)

    @@
    expression E, SKB, LEN;
    identifier fn = { skb_push, __skb_push, skb_push_rcsum };
    type T;
    @@
    - E = ((T *)(fn(SKB, LEN)))
    + E = fn(SKB, LEN)

    @@
    expression SKB, LEN;
    identifier fn = { skb_push, __skb_push, skb_push_rcsum };
    @@
    - fn(SKB, LEN)[0]
    + *(u8 *)fn(SKB, LEN)

    Note that the last part there converts from push(...)[0] to the
    more idiomatic *(u8 *)push(...).

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

    Johannes Berg
     

14 Jun, 2017

3 commits

  • Unfortunately, struct iwreq isn't a proper subset of struct ifreq,
    but is still handled by the same code path. Robert reported that
    then applications may (randomly) fault if the struct iwreq they
    pass happens to land within 8 bytes of the end of a mapping (the
    struct is only 32 bytes, vs. struct ifreq's 40 bytes).

    To fix this, pull out the code handling wireless extension ioctls
    and copy only the smaller structure in this case.

    This bug goes back a long time, I tracked that it was introduced
    into mainline in 2.1.15, over 20 years ago!

    This fixes https://bugzilla.kernel.org/show_bug.cgi?id=195869

    Reported-by: Robert O'Callahan
    Signed-off-by: Johannes Berg

    Johannes Berg
     
  • To make it clear that we never use struct ifreq, cast from it
    directly in the wext entrypoint and use struct iwreq from there
    on. The next patch will remove the cast again and pass the
    correct struct from the beginning.

    Signed-off-by: Johannes Berg

    Johannes Berg
     
  • There are no longer any drivers (in the tree proper, I didn't
    check all the staging drivers) that take WEXT ioctls through
    this API, the only remaining ones that even have ndo_do_ioctl
    are using it only for private ioctls.

    Therefore, we can remove this call.

    Signed-off-by: Johannes Berg

    Johannes Berg
     

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
     

08 Jun, 2017

1 commit


23 May, 2017

1 commit

  • Drivers should be able to call cfg80211_sched_scan_results() from atomic
    context. However, with the introduction of multiple scheduled scan feature
    this requirement was not taken into account resulting in regression shown
    below.

    [ 119.021594] BUG: scheduling while atomic: irq/47-iwlwifi/517/0x00000200
    [ 119.021604] Modules linked in: [...]
    [ 119.021759] CPU: 1 PID: 517 Comm: irq/47-iwlwifi Not tainted 4.12.0-rc2-t440s-20170522+ #1
    [ 119.021763] Hardware name: LENOVO 20AQS03H00/20AQS03H00, BIOS GJET91WW (2.41 ) 09/21/2016
    [ 119.021766] Call Trace:
    [ 119.021778] ? dump_stack+0x5c/0x84
    [ 119.021784] ? __schedule_bug+0x4c/0x70
    [ 119.021792] ? __schedule+0x496/0x5c0
    [ 119.021798] ? schedule+0x2d/0x80
    [ 119.021804] ? schedule_preempt_disabled+0x5/0x10
    [ 119.021810] ? __mutex_lock.isra.0+0x18e/0x4c0
    [ 119.021817] ? __wake_up+0x2f/0x50
    [ 119.021833] ? cfg80211_sched_scan_results+0x19/0x60 [cfg80211]
    [ 119.021844] ? cfg80211_sched_scan_results+0x19/0x60 [cfg80211]
    [ 119.021859] ? iwl_mvm_rx_lmac_scan_iter_complete_notif+0x17/0x30 [iwlmvm]
    [ 119.021869] ? iwl_pcie_rx_handle+0x2a9/0x7e0 [iwlwifi]
    [ 119.021878] ? iwl_pcie_irq_handler+0x17c/0x730 [iwlwifi]
    [ 119.021884] ? irq_forced_thread_fn+0x60/0x60
    [ 119.021887] ? irq_thread_fn+0x16/0x40
    [ 119.021892] ? irq_thread+0x109/0x180
    [ 119.021896] ? wake_threads_waitq+0x30/0x30
    [ 119.021901] ? kthread+0xf2/0x130
    [ 119.021905] ? irq_thread_dtor+0x90/0x90
    [ 119.021910] ? kthread_create_on_node+0x40/0x40
    [ 119.021915] ? ret_from_fork+0x26/0x40

    Fixes: b34939b98369 ("cfg80211: add request id to cfg80211_sched_scan_*() api")
    Reported-by: Sander Eikelenboom
    Signed-off-by: Arend van Spriel
    Signed-off-by: Johannes Berg

    Arend Van Spriel
     

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
     

17 May, 2017

1 commit