21 Sep, 2017

1 commit

  • In isdn_ppp_write(), the header (i.e., protobuf) of the buffer is
    fetched twice from userspace. The first fetch is used to peek at the
    protocol of the message and reset the huptimer if necessary; while the
    second fetch copies in the whole buffer. However, given that buf resides
    in userspace memory, a user process can race to change its memory content
    across fetches. By doing so, we can either avoid resetting the huptimer
    for any type of packets (by first setting proto to PPP_LCP and later
    change to the actual type) or force resetting the huptimer for LCP
    packets.

    This patch changes this double-fetch behavior into two single fetches
    decided by condition (lp->isdn_device < 0 || lp->isdn_channel
    Signed-off-by: David S. Miller

    Meng Xu
     

08 Sep, 2017

1 commit

  • gcc-7 found an ancient bug in the loop driver, leading to a condition that
    is always false, meaning we ignore the contents of 'card->flags' here:

    drivers/isdn/isdnloop/isdnloop.c:412:37: error: ?: using integer constants in boolean context, the expression will always evaluate to 'true' [-Werror=int-in-bool-context]

    This changes the braces in the expression to ensure we actually
    compare the flag bits, rather than comparing a constant. As Joe Perches
    pointed out, an earlier patch of mine incorrectly assumed this was a
    false-positive warning.

    Cc: Joe Perches
    Link: https://patchwork.kernel.org/patch/9840289/
    Signed-off-by: Arnd Bergmann
    Signed-off-by: David S. Miller

    Arnd Bergmann
     

16 Aug, 2017

1 commit


12 Aug, 2017

1 commit

  • If mISDN_FsmNew() fails to allocate memory for jumpmatrix
    then null pointer dereference will occur on any write to
    jumpmatrix.

    The patch adds check on successful allocation and
    corresponding error handling.

    Found by Linux Driver Verification project (linuxtesting.org).

    Signed-off-by: Anton Vasilyev
    Signed-off-by: David S. Miller

    Anton Vasilyev
     

10 Aug, 2017

2 commits

  • The UDP offload conflict is dealt with by simply taking what is
    in net-next where we have removed all of the UFO handling code
    entirely.

    The TCP conflict was a case of local variables in a function
    being removed from both net and net-next.

    In netvsc we had an assignment right next to where a missing
    set of u64 stats sync object inits were added.

    Signed-off-by: David S. Miller

    David S. Miller
     
  • Pull networking fixes from David Miller:
    "The pull requests are getting smaller, that's progress I suppose :-)

    1) Fix infinite loop in CIPSO option parsing, from Yujuan Qi.

    2) Fix remote checksum handling in VXLAN and GUE tunneling drivers,
    from Koichiro Den.

    3) Missing u64_stats_init() calls in several drivers, from Florian
    Fainelli.

    4) TCP can set the congestion window to an invalid ssthresh value
    after congestion window reductions, from Yuchung Cheng.

    5) Fix BPF jit branch generation on s390, from Daniel Borkmann.

    6) Correct MIPS ebpf JIT merge, from David Daney.

    7) Correct byte order test in BPF test_verifier.c, from Daniel
    Borkmann.

    8) Fix various crashes and leaks in ASIX driver, from Dean Jenkins.

    9) Handle SCTP checksums properly in mlx4 driver, from Davide
    Caratti.

    10) We can potentially enter tcp_connect() with a cached route
    already, due to fastopen, so we have to explicitly invalidate it.

    11) skb_warn_bad_offload() can bark in legitimate situations, fix from
    Willem de Bruijn"

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (52 commits)
    net: avoid skb_warn_bad_offload false positives on UFO
    qmi_wwan: fix NULL deref on disconnect
    ppp: fix xmit recursion detection on ppp channels
    rds: Reintroduce statistics counting
    tcp: fastopen: tcp_connect() must refresh the route
    net: sched: set xt_tgchk_param par.net properly in ipt_init_target
    net: dsa: mediatek: add adjust link support for user ports
    net/mlx4_en: don't set CHECKSUM_COMPLETE on SCTP packets
    qed: Fix a memory allocation failure test in 'qed_mcp_cmd_init()'
    hysdn: fix to a race condition in put_log_buffer
    s390/qeth: fix L3 next-hop in xmit qeth hdr
    asix: Fix small memory leak in ax88772_unbind()
    asix: Ensure asix_rx_fixup_info members are all reset
    asix: Add rx->ax_skb = NULL after usbnet_skb_return()
    bpf: fix selftest/bpf/test_pkt_md_access on s390x
    netvsc: fix race on sub channel creation
    bpf: fix byte order test in test_verifier
    xgene: Always get clk source, but ignore if it's missing for SGMII ports
    MIPS: Add missing file for eBPF JIT.
    bpf, s390: fix build for libbpf and selftest suite
    ...

    Linus Torvalds
     

09 Aug, 2017

2 commits


08 Aug, 2017

3 commits

  • Declare this structure as const as it is only used during a copy
    operation.

    Signed-off-by: Bhumika Goyal
    Signed-off-by: David S. Miller

    Bhumika Goyal
     
  • The synchronization type that was used earlier to guard the loop that
    deletes unused log buffers may lead to a situation that prevents any
    thread from going through the loop.

    The patch deletes previously used synchronization mechanism and moves
    the loop under the spin_lock so the similar cases won't be feasible in
    the future.

    Found by by Linux Driver Verification project (linuxtesting.org).

    Signed-off-by: Anton Volkov
    Signed-off-by: David S. Miller

    Anton Volkov
     
  • Saeed Mahameed says:

    ====================
    mlx5-shared-2017-08-07

    This series includes some mlx5 updates for both net-next and rdma trees.

    From Saeed,
    Core driver updates to allow selectively building the driver with
    or without some large driver components, such as
    - E-Switch (Ethernet SRIOV support).
    - Multi-Physical Function Switch (MPFs) support.
    For that we split E-Switch and MPFs functionalities into separate files.

    From Erez,
    Delay mlx5_core events when mlx5 interfaces, namely mlx5_ib, registration
    is taking place and until it completes.

    From Rabie,
    Increase the maximum supported flow counters.
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     

03 Aug, 2017

1 commit

  • This fixes a potential buffer overflow in isdn_net.c caused by an
    unbounded strcpy.

    [ ISDN seems to be effectively unmaintained, and the I4L driver in
    particular is long deprecated, but in case somebody uses this..
    - Linus ]

    Signed-off-by: Jiten Thakkar
    Signed-off-by: Annie Cherkaev
    Cc: Karsten Keil
    Cc: Kees Cook
    Cc: stable@kernel.org
    Signed-off-by: Linus Torvalds

    Annie Cherkaev
     

21 Jul, 2017

1 commit


20 Jul, 2017

1 commit

  • Two arrays are clearly bit maps, so, make that explicit by converting to
    bitmap API and remove custom helpers.

    Note sig_ind() uses out of boundary bit to (looks like) protect against
    potential bitmap_empty() checks for the same bitmap.

    This patch removes that since:
    1) that didn't guarantee atomicity anyway;
    2) the first operation inside the for-loop is set bit in the bitmap
    (which effectively makes it non-empty);
    3) group_optimization() doesn't utilize possible emptiness of the bitmap
    in question.

    Thus, if there is a protection needed it should be implemented properly.

    Signed-off-by: Andy Shevchenko
    Signed-off-by: David S. Miller

    Andy Shevchenko
     

16 Jul, 2017

10 commits

  • pci_device_id are not supposed to change at runtime. All functions
    working with pci_device_id provided by work with
    const pci_device_id. So mark the non-const structs as const.

    File size before:
    text data bss dec hex filename
    11803 544 1 12348 303c isdn/hardware/avm/c4.o

    File size After adding 'const':
    text data bss dec hex filename
    11931 416 1 12348 303c isdn/hardware/avm/c4.o

    Signed-off-by: Arvind Yadav
    Signed-off-by: David S. Miller

    Arvind Yadav
     
  • pci_device_id are not supposed to change at runtime. All functions
    working with pci_device_id provided by work with
    const pci_device_id. So mark the non-const structs as const.

    File size before:
    text data bss dec hex filename
    21656 1024 96 22776 58f8 isdn/hardware/mISDN/hfcpci.o

    File size After adding 'const':
    text data bss dec hex filename
    22424 256 96 22776 58f8 isdn/hardware/mISDN/hfcpci.o

    Signed-off-by: Arvind Yadav
    Signed-off-by: David S. Miller

    Arvind Yadav
     
  • pci_device_id are not supposed to change at runtime. All functions
    working with pci_device_id provided by work with
    const pci_device_id. So mark the non-const structs as const.

    File size before:
    text data bss dec hex filename
    9963 1936 16 11915 2e8b isdn/hardware/mISDN/avmfritz.o

    File size After adding 'const':
    text data bss dec hex filename
    10091 1808 16 11915 2e8b isdn/hardware/mISDN/avmfritz.o

    Signed-off-by: Arvind Yadav
    Signed-off-by: David S. Miller

    Arvind Yadav
     
  • pci_device_id are not supposed to change at runtime. All functions
    working with pci_device_id provided by work with
    const pci_device_id. So mark the non-const structs as const.

    File size before:
    text data bss dec hex filename
    13959 4080 24 18063 468f isdn/hardware/mISDN/w6692.o

    File size After adding 'const':
    text data bss dec hex filename
    14087 3952 24 18063 468f isdn/hardware/mISDN/w6692.o

    Signed-off-by: Arvind Yadav
    Signed-off-by: David S. Miller

    Arvind Yadav
     
  • pci_device_id are not supposed to change at runtime. All functions
    working with pci_device_id provided by work with
    const pci_device_id. So mark the non-const structs as const.

    File size before:
    text data bss dec hex filename
    63450 1536 1492 66478 103ae isdn/hardware/mISDN/hfcmulti.o

    File size After adding 'const':
    text data bss dec hex filename
    64698 288 1492 66478 103ae isdn/hardware/mISDN/hfcmulti.o

    Signed-off-by: Arvind Yadav
    Signed-off-by: David S. Miller

    Arvind Yadav
     
  • pci_device_id are not supposed to change at runtime. All functions
    working with pci_device_id provided by work with
    const pci_device_id. So mark the non-const structs as const.

    File size before:
    text data bss dec hex filename
    10941 1776 16 12733 31bd isdn/hardware/mISDN/netjet.o

    File size After adding 'const':
    text data bss dec hex filename
    11005 1712 16 12733 31bd isdn/hardware/mISDN/netjet.o

    Signed-off-by: Arvind Yadav
    Signed-off-by: David S. Miller

    Arvind Yadav
     
  • pci_device_id are not supposed to change at runtime. All functions
    working with pci_device_id provided by work with
    const pci_device_id. So mark the non-const structs as const.

    File size before:
    text data bss dec hex filename
    6224 655 8 6887 1ae7 isdn/hardware/eicon/divasmain.o

    File size After adding 'const':
    text data bss dec hex filename
    6608 271 8 6887 1ae7 isdn/hardware/eicon/divasmain.o

    Signed-off-by: Arvind Yadav
    Signed-off-by: David S. Miller

    Arvind Yadav
     
  • pci_device_id are not supposed to change at runtime. All functions
    working with pci_device_id provided by work with
    const pci_device_id. So mark the non-const structs as const.

    File size before:
    text data bss dec hex filename
    5989 576 0 6565 19a5 isdn/hisax/hisax_fcpcipnp.o

    File size After adding 'const':
    text data bss dec hex filename
    6085 480 0 6565 19a5 isdn/hisax/hisax_fcpcipnp.o

    Signed-off-by: Arvind Yadav
    Signed-off-by: David S. Miller

    Arvind Yadav
     
  • pci_device_id are not supposed to change at runtime. All functions
    working with pci_device_id provided by work with
    const pci_device_id. So mark the non-const structs as const.

    File size before:
    text data bss dec hex filename
    10512 536 4 11052 2b2c drivers/isdn/hisax/hfc4s8s_l1.o

    File size After adding 'const':
    text data bss dec hex filename
    10672 376 4 11052 2b2c drivers/isdn/hisax/hfc4s8s_l1.o

    Signed-off-by: Arvind Yadav
    Signed-off-by: David S. Miller

    Arvind Yadav
     
  • pci_device_id are not supposed to change at runtime. All functions
    working with pci_device_id provided by work with
    const pci_device_id. So mark the non-const structs as const.

    File size before:
    text data bss dec hex filename
    13686 2064 4416 20166 4ec6 drivers/isdn/hisax/config.o

    File size After adding 'const':
    text data bss dec hex filename
    15030 720 4416 20166 4ec6 drivers/isdn/hisax/config.o

    Signed-off-by: Arvind Yadav
    Signed-off-by: David S. Miller

    Arvind Yadav
     

15 Jul, 2017

1 commit

  • One string we pass into the cs->info buffer might be too long,
    as pointed out by gcc:

    drivers/isdn/divert/isdn_divert.c: In function 'll_callback':
    drivers/isdn/divert/isdn_divert.c:488:22: error: '%d' directive writing between 1 and 3 bytes into a region of size between 1 and 69 [-Werror=format-overflow=]
    sprintf(cs->info, "%d 0x%lx %s %s %s %s 0x%x 0x%x %d %d %s\n",
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    drivers/isdn/divert/isdn_divert.c:488:22: note: directive argument in the range [0, 255]
    drivers/isdn/divert/isdn_divert.c:488:4: note: 'sprintf' output 25 or more bytes (assuming 129) into a destination of size 90

    This is unlikely to actually cause problems, so let's use snprintf
    as a simple workaround to shut up the warning and truncate the
    buffer instead.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: David S. Miller

    Arnd Bergmann
     

06 Jul, 2017

1 commit

  • Pull misc user access cleanups from Al Viro:
    "The first pile is assorted getting rid of cargo-culted access_ok(),
    cargo-culted set_fs() and field-by-field copyouts.

    The same description applies to a lot of stuff in other branches -
    this is just the stuff that didn't fit into a more specific topical
    branch"

    * 'work.misc-set_fs' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    Switch flock copyin/copyout primitives to copy_{from,to}_user()
    fs/fcntl: return -ESRCH in f_setown when pid/pgid can't be found
    fs/fcntl: f_setown, avoid undefined behaviour
    fs/fcntl: f_setown, allow returning error
    lpfc debugfs: get rid of pointless access_ok()
    adb: get rid of pointless access_ok()
    isdn: get rid of pointless access_ok()
    compat statfs: switch to copy_to_user()
    fs/locks: don't mess with the address limit in compat_fcntl64
    nfsd_readlink(): switch to vfs_get_link()
    drbd: ->sendpage() never needed set_fs()
    fs/locks: pass kernel struct flock to fcntl_getlk/setlk
    fs: locks: Fix some troubles at kernel-doc comments

    Linus Torvalds
     

01 Jul, 2017

1 commit

  • refcount_t type and corresponding API should be
    used instead of atomic_t when the variable is used as
    a reference counter. This allows to avoid accidental
    refcounter overflows that might lead to use-after-free
    situations.

    Signed-off-by: Elena Reshetova
    Signed-off-by: Hans Liljestrand
    Signed-off-by: Kees Cook
    Signed-off-by: David Windsor
    Signed-off-by: David S. Miller

    Reshetova, Elena
     

21 Jun, 2017

3 commits

  • in my commit b952f4dff2751252db073c27c0f8a16a416a2ddc,
    - *(u8 *)skb_put(skb_out, 1) = (u8)(accm >> 24); \
    + skb_put(skb_out, (u8)(accm >> 24)); \
    it should skb_put_u8()

    Fixes: b952f4dff275 ("net: manual clean code which call skb_put_[data:zero])")
    Signed-off-by: yuan linyu
    Signed-off-by: David S. Miller

    yuan linyu
     
  • Signed-off-by: yuan linyu
    Signed-off-by: David S. Miller

    yuan linyu
     
  • follow Johannes Berg, semantic patch file as below,
    @@
    identifier p, p2;
    expression len;
    expression skb;
    type t, t2;
    @@
    (
    -p = __skb_put(skb, len);
    +p = __skb_put_zero(skb, len);
    |
    -p = (t)__skb_put(skb, len);
    +p = __skb_put_zero(skb, len);
    )
    ... when != p
    (
    p2 = (t2)p;
    -memset(p2, 0, len);
    |
    -memset(p, 0, len);
    )

    @@
    identifier p;
    expression len;
    expression skb;
    type t;
    @@
    (
    -t p = __skb_put(skb, len);
    +t p = __skb_put_zero(skb, len);
    )
    ... when != p
    (
    -memset(p, 0, len);
    )

    @@
    type t, t2;
    identifier p, p2;
    expression skb;
    @@
    t *p;
    ...
    (
    -p = __skb_put(skb, sizeof(t));
    +p = __skb_put_zero(skb, sizeof(t));
    |
    -p = (t *)__skb_put(skb, sizeof(t));
    +p = __skb_put_zero(skb, sizeof(t));
    )
    ... when != p
    (
    p2 = (t2)p;
    -memset(p2, 0, sizeof(*p));
    |
    -memset(p, 0, sizeof(*p));
    )

    @@
    expression skb, len;
    @@
    -memset(__skb_put(skb, len), 0, len);
    +__skb_put_zero(skb, len);

    @@
    expression skb, len, data;
    @@
    -memcpy(__skb_put(skb, len), data, len);
    +__skb_put_data(skb, data, len);

    @@
    expression SKB, C, S;
    typedef u8;
    identifier fn = {__skb_put};
    fresh identifier fn2 = fn ## "_u8";
    @@
    - *(u8 *)fn(SKB, S) = C;
    + fn2(SKB, C);

    Signed-off-by: yuan linyu
    Signed-off-by: David S. Miller

    yuan linyu
     

16 Jun, 2017

5 commits

  • Joe and Bjørn suggested that it'd be nicer to not have the
    cast in the fairly common case of doing
    *(u8 *)skb_put(skb, 1) = c;

    Add skb_put_u8() for this case, and use it across the code,
    using the following spatch:

    @@
    expression SKB, C, S;
    typedef u8;
    identifier fn = {skb_put};
    fresh identifier fn2 = fn ## "_u8";
    @@
    - *(u8 *)fn(SKB, S) = C;
    + fn2(SKB, C);

    Note that due to the "S", the spatch isn't perfect, it should
    have checked that S is 1, but there's also places that use a
    sizeof expression like sizeof(var) or sizeof(u8) etc. Turns
    out that nobody ever did something like
    *(u8 *)skb_put(skb, 2) = c;

    which would be wrong anyway since the second byte wouldn't be
    initialized.

    Suggested-by: Joe Perches
    Suggested-by: Bjørn Mork
    Signed-off-by: Johannes Berg
    Signed-off-by: David S. Miller

    Johannes Berg
     
  • 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
     
  • 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_pull,
    __skb_pull,
    skb_pull_inline,
    __pskb_pull_tail,
    __pskb_pull,
    pskb_pull
    };
    @@
    - *(fn(SKB, LEN))
    + *(u8 *)fn(SKB, LEN)

    @@
    expression E, SKB, LEN;
    identifier fn = {
    skb_pull,
    __skb_pull,
    skb_pull_inline,
    __pskb_pull_tail,
    __pskb_pull,
    pskb_pull
    };
    type T;
    @@
    - E = ((T *)(fn(SKB, LEN)))
    + E = fn(SKB, LEN)

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

    Johannes Berg
     
  • 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 (skb_put, __skb_put and pskb_put) 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_put, __skb_put };
    @@
    - *(fn(SKB, LEN))
    + *(u8 *)fn(SKB, LEN)

    @@
    expression E, SKB, LEN;
    identifier fn = { skb_put, __skb_put };
    type T;
    @@
    - E = ((T *)(fn(SKB, LEN)))
    + E = fn(SKB, LEN)

    which actually doesn't cover pskb_put since there are only three
    users overall.

    A handful of stragglers were converted manually, notably a macro in
    drivers/isdn/i4l/isdn_bsdcomp.c and, oddly enough, one of the many
    instances in net/bluetooth/hci_sock.c. In the former file, I also
    had to fix one whitespace problem spatch introduced.

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

    Johannes Berg
     
  • A common pattern with skb_put() is to just want to memcpy()
    some data into the new space, introduce skb_put_data() for
    this.

    An spatch similar to the one for skb_put_zero() converts many
    of the places using it:

    @@
    identifier p, p2;
    expression len, skb, data;
    type t, t2;
    @@
    (
    -p = skb_put(skb, len);
    +p = skb_put_data(skb, data, len);
    |
    -p = (t)skb_put(skb, len);
    +p = skb_put_data(skb, data, len);
    )
    (
    p2 = (t2)p;
    -memcpy(p2, data, len);
    |
    -memcpy(p, data, len);
    )

    @@
    type t, t2;
    identifier p, p2;
    expression skb, data;
    @@
    t *p;
    ...
    (
    -p = skb_put(skb, sizeof(t));
    +p = skb_put_data(skb, data, sizeof(t));
    |
    -p = (t *)skb_put(skb, sizeof(t));
    +p = skb_put_data(skb, data, sizeof(t));
    )
    (
    p2 = (t2)p;
    -memcpy(p2, data, sizeof(*p));
    |
    -memcpy(p, data, sizeof(*p));
    )

    @@
    expression skb, len, data;
    @@
    -memcpy(skb_put(skb, len), data, len);
    +skb_put_data(skb, data, len);

    (again, manually post-processed to retain some comments)

    Reviewed-by: Stephen Hemminger
    Signed-off-by: Johannes Berg
    Signed-off-by: David S. Miller

    Johannes Berg
     

08 Jun, 2017

1 commit


05 Jun, 2017

1 commit


02 Jun, 2017

1 commit

  • The driver may sleep under a read spin lock, and the function call path is:
    send_socklist (acquire the lock by read_lock)
    skb_copy(GFP_KERNEL) --> may sleep

    To fix it, the "GFP_KERNEL" is replaced with "GFP_ATOMIC".

    Signed-off-by: Jia-Ju Bai
    Signed-off-by: David S. Miller

    Jia-Ju Bai
     

01 Jun, 2017

1 commit

  • The driver may sleep under a spin lock, the function call path is:
    isdn_ppp_mp_receive (acquire the lock)
    isdn_ppp_mp_reassembly
    isdn_ppp_push_higher
    isdn_ppp_decompress
    isdn_ppp_ccp_reset_trans
    isdn_ppp_ccp_reset_alloc_state
    kzalloc(GFP_KERNEL) --> may sleep

    To fixed it, the "GFP_KERNEL" is replaced with "GFP_ATOMIC".

    Signed-off-by: Jia-Ju Bai
    Signed-off-by: David S. Miller

    Jia-Ju Bai
     

11 May, 2017

1 commit

  • Pull hw lockdown support from David Howells:
    "Annotation of module parameters that configure hardware resources
    including ioports, iomem addresses, irq lines and dma channels.

    This allows a future patch to prohibit the use of such module
    parameters to prevent that hardware from being abused to gain access
    to the running kernel image as part of locking the kernel down under
    UEFI secure boot conditions.

    Annotations are made by changing:

    module_param(n, t, p)
    module_param_named(n, v, t, p)
    module_param_array(n, t, m, p)

    to:

    module_param_hw(n, t, hwtype, p)
    module_param_hw_named(n, v, t, hwtype, p)
    module_param_hw_array(n, t, hwtype, m, p)

    where the module parameter refers to a hardware setting

    hwtype specifies the type of the resource being configured. This can
    be one of:

    ioport Module parameter configures an I/O port
    iomem Module parameter configures an I/O mem address
    ioport_or_iomem Module parameter could be either (runtime set)
    irq Module parameter configures an I/O port
    dma Module parameter configures a DMA channel
    dma_addr Module parameter configures a DMA buffer address
    other Module parameter configures some other value

    Note that the hwtype is compile checked, but not currently stored (the
    lockdown code probably won't require it). It is, however, there for
    future use.

    A bonus is that the hwtype can also be used for grepping.

    The intention is for the kernel to ignore or reject attempts to set
    annotated module parameters if lockdown is enabled. This applies to
    options passed on the boot command line, passed to insmod/modprobe or
    direct twiddling in /sys/module/ parameter files.

    The module initialisation then needs to handle the parameter not being
    set, by (1) giving an error, (2) probing for a value or (3) using a
    reasonable default.

    What I can't do is just reject a module out of hand because it may
    take a hardware setting in the module parameters. Some important
    modules, some ipmi stuff for instance, both probe for hardware and
    allow hardware to be manually specified; if the driver is aborts with
    any error, you don't get any ipmi hardware.

    Further, trying to do this entirely in the module initialisation code
    doesn't protect against sysfs twiddling.

    [!] Note that in and of itself, this series of patches should have no
    effect on the the size of the kernel or code execution - that is
    left to a patch in the next series to effect. It does mark
    annotated kernel parameters with a KERNEL_PARAM_FL_HWPARAM flag in
    an already existing field"

    * tag 'hwparam-20170420' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs: (38 commits)
    Annotate hardware config module parameters in sound/pci/
    Annotate hardware config module parameters in sound/oss/
    Annotate hardware config module parameters in sound/isa/
    Annotate hardware config module parameters in sound/drivers/
    Annotate hardware config module parameters in fs/pstore/
    Annotate hardware config module parameters in drivers/watchdog/
    Annotate hardware config module parameters in drivers/video/
    Annotate hardware config module parameters in drivers/tty/
    Annotate hardware config module parameters in drivers/staging/vme/
    Annotate hardware config module parameters in drivers/staging/speakup/
    Annotate hardware config module parameters in drivers/staging/media/
    Annotate hardware config module parameters in drivers/scsi/
    Annotate hardware config module parameters in drivers/pcmcia/
    Annotate hardware config module parameters in drivers/pci/hotplug/
    Annotate hardware config module parameters in drivers/parport/
    Annotate hardware config module parameters in drivers/net/wireless/
    Annotate hardware config module parameters in drivers/net/wan/
    Annotate hardware config module parameters in drivers/net/irda/
    Annotate hardware config module parameters in drivers/net/hamradio/
    Annotate hardware config module parameters in drivers/net/ethernet/
    ...

    Linus Torvalds