18 Sep, 2016

1 commit

  • Workqueue is currently initialized in an early init call; however,
    there are cases where early boot code has to be split and reordered to
    come after workqueue initialization or the same code path which makes
    use of workqueues is used both before workqueue initailization and
    after. The latter cases have to gate workqueue usages with
    keventd_up() tests, which is nasty and easy to get wrong.

    Workqueue usages have become widespread and it'd be a lot more
    convenient if it can be used very early from boot. This patch splits
    workqueue initialization into two steps. workqueue_init_early() which
    sets up the basic data structures so that workqueues can be created
    and work items queued, and workqueue_init() which actually brings up
    workqueues online and starts executing queued work items. The former
    step can be done very early during boot once memory allocation,
    cpumasks and idr are initialized. The latter right after kthreads
    become available.

    This allows work item queueing and canceling from very early boot
    which is what most of these use cases want.

    * As systemd_wq being initialized doesn't indicate that workqueue is
    fully online anymore, update keventd_up() to test wq_online instead.
    The follow-up patches will get rid of all its usages and the
    function itself.

    * Flushing doesn't make sense before workqueue is fully initialized.
    The flush functions trigger WARN and return immediately before fully
    online.

    * Work items are never in-flight before fully online. Canceling can
    always succeed by skipping the flush step.

    * Some code paths can no longer assume to be called with irq enabled
    as irq is disabled during early boot. Use irqsave/restore
    operations instead.

    v2: Watchdog init, which requires timer to be running, moved from
    workqueue_init_early() to workqueue_init().

    Signed-off-by: Tejun Heo
    Suggested-by: Linus Torvalds
    Link: http://lkml.kernel.org/r/CA+55aFx0vPuMuxn00rBSM192n-Du5uxy+4AvKa0SBSOVJeuCGg@mail.gmail.com

    Tejun Heo
     

15 Sep, 2016

1 commit

  • Pull uaccess fixes from Al Viro:
    "Fixes for broken uaccess primitives - mostly lack of proper zeroing
    in copy_from_user()/get_user()/__get_user(), but for several
    architectures there's more (broken clear_user() on frv and
    strncpy_from_user() on hexagon)"

    * 'uaccess-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (28 commits)
    avr32: fix copy_from_user()
    microblaze: fix __get_user()
    microblaze: fix copy_from_user()
    m32r: fix __get_user()
    blackfin: fix copy_from_user()
    sparc32: fix copy_from_user()
    sh: fix copy_from_user()
    sh64: failing __get_user() should zero
    score: fix copy_from_user() and friends
    score: fix __get_user/get_user
    s390: get_user() should zero on failure
    ppc32: fix copy_from_user()
    parisc: fix copy_from_user()
    openrisc: fix copy_from_user()
    nios2: fix __get_user()
    nios2: copy_from_user() should zero the tail of destination
    mn10300: copy_from_user() should zero on access_ok() failure...
    mn10300: failing __get_user() and get_user() should zero
    mips: copy_from_user() must zero the destination on access_ok() failure
    ARC: uaccess: get_user to zero out dest in cause of fault
    ...

    Linus Torvalds
     

14 Sep, 2016

3 commits


12 Sep, 2016

1 commit

  • Pull networking fixes from David Miller:
    "Mostly small sets of driver fixes scattered all over the place.

    1) Mediatek driver fixes from Sean Wang. Forward port not written
    correctly during TX map, missed handling of EPROBE_DEFER, and
    mistaken use of put_page() instead of skb_free_frag().

    2) Fix socket double-free in KCM code, from WANG Cong.

    3) QED driver fixes from Sudarsana Reddy Kalluru, including a fix for
    using the dcbx buffers before initializing them.

    4) Mellanox Switch driver fixes from Jiri Pirko, including a fix for
    double fib removals and an error handling fix in
    mlxsw_sp_module_init().

    5) Fix kernel panic when enabling LLDP in i40e driver, from Dave
    Ertman.

    6) Fix padding of TSO packets in thunderx driver, from Sunil Goutham.

    7) TCP's rcv_wup not initialized properly when using fastopen, from
    Neal Cardwell.

    8) Don't use uninitialized flow keys in flow dissector, from Gao
    Feng.

    9) Use after free in l2tp module unload, from Sabrina Dubroca.

    10) Fix interrupt registry ordering issues in smsc911x driver, from
    Jeremy Linton.

    11) Fix crashes in bonding having to do with enslaving and rx_handler,
    from Mahesh Bandewar.

    12) AF_UNIX deadlock fixes from Linus.

    13) In mlx5 driver, don't read skb->xmit_mode after it might have been
    freed from the TX reclaim path. From Tariq Toukan.

    14) Fix a bug from 2015 in TCP Yeah where the congestion window does
    not increase, from Artem Germanov.

    15) Don't pad frames on receive in NFP driver, from Jakub Kicinski.

    16) Fix chunk fragmenting in SCTP wrt. GSO, from Marcelo Ricardo
    Leitner.

    17) Fix deletion of VRF routes, from Mark Tomlinson.

    18) Fix device refcount leak when DAD fails in ipv6, from Wei Yongjun"

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (101 commits)
    net/mlx4_en: Fix panic on xmit while port is down
    net/mlx4_en: Fixes for DCBX
    net/mlx4_en: Fix the return value of mlx4_en_dcbnl_set_state()
    net/mlx4_en: Fix the return value of mlx4_en_dcbnl_set_all()
    net: ethernet: renesas: sh_eth: add POST registers for rz
    drivers: net: phy: mdio-xgene: Add hardware dependency
    dwc_eth_qos: do not register semi-initialized device
    sctp: identify chunks that need to be fragmented at IP level
    mlxsw: spectrum: Set port type before setting its address
    mlxsw: spectrum_router: Fix error path in mlxsw_sp_router_init
    nfp: don't pad frames on receive
    nfp: drop support for old firmware ABIs
    nfp: remove linux/version.h includes
    tcp: cwnd does not increase in TCP YeAH
    net/mlx5e: Fix parsing of vlan packets when updating lro header
    net/mlx5e: Fix global PFC counters replication
    net/mlx5e: Prevent casting overflow
    net/mlx5e: Move an_disable_cap bit to a new position
    net/mlx5e: Fix xmit_more counter race issue
    tcp: fastopen: avoid negative sk_forward_alloc
    ...

    Linus Torvalds
     

11 Sep, 2016

1 commit

  • Pull fscrypto fixes fromTed Ts'o:
    "Fix some brown-paper-bag bugs for fscrypto, including one one which
    allows a malicious user to set an encryption policy on an empty
    directory which they do not own"

    * tag 'for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
    fscrypto: require write access to mount to set encryption policy
    fscrypto: only allow setting encryption policy on directories
    fscrypto: add authorization check for setting encryption policy

    Linus Torvalds
     

10 Sep, 2016

2 commits

  • Since setting an encryption policy requires writing metadata to the
    filesystem, it should be guarded by mnt_want_write/mnt_drop_write.
    Otherwise, a user could cause a write to a frozen or readonly
    filesystem. This was handled correctly by f2fs but not by ext4. Make
    fscrypt_process_policy() handle it rather than relying on the filesystem
    to get it right.

    Signed-off-by: Eric Biggers
    Cc: stable@vger.kernel.org # 4.1+; check fs/{ext4,f2fs}
    Signed-off-by: Theodore Ts'o
    Acked-by: Jaegeuk Kim

    Eric Biggers
     
  • ... in all cases, including the failing access_ok()

    Note that some architectures using asm-generic/uaccess.h have
    __copy_from_user() not zeroing the tail on failure halfway
    through. This variant works either way.

    Cc: stable@vger.kernel.org
    Signed-off-by: Al Viro

    Al Viro
     

09 Sep, 2016

1 commit

  • Previous an_disable_cap position bit31 is deprecated to be use in driver
    with newer firmware. New firmware will advertise the same capability
    in bit29.

    Old capability didn't allow setting more than one protocol for a
    specific speed when autoneg is off, while newer firmware will allow
    this and it is indicated in the new capability location.

    Signed-off-by: Bodong Wang
    Signed-off-by: Saeed Mahameed
    Signed-off-by: David S. Miller

    Bodong Wang
     

08 Sep, 2016

1 commit


07 Sep, 2016

3 commits

  • When deleting an IP address from an interface, there is a clean-up of
    routes which refer to this local address. However, there was no check to
    see that the VRF matched. This meant that deletion wasn't confined to
    the VRF it should have been.

    To solve this, a new field has been added to fib_info to hold a table
    id. When removing fib entries corresponding to a local ip address, this
    table id is also used in the comparison.

    The table id is populated when the fib_info is created. This was already
    done in some places, but not in ip_rt_ioctl(). This has now been fixed.

    Fixes: 021dd3b8a142 ("net: Add routes to the table associated with the device")
    Acked-by: David Ahern
    Tested-by: David Ahern
    Signed-off-by: Mark Tomlinson
    Signed-off-by: David S. Miller

    Mark Tomlinson
     
  • Instead of having each caller of check_object_size() need to remember to
    check for a const size parameter, move the check into check_object_size()
    itself. This actually matches the original implementation in PaX, though
    this commit cleans up the now-redundant builtin_const() calls in the
    various architectures.

    Signed-off-by: Kees Cook

    Kees Cook
     
  • Pull SCSI fixes from James Bottomley:
    "This is really three fixes, but the SES one comes in a bundle of three
    (making the replacement API available properly, using it and removing
    the non-working one). The SES problem causes an oops on hpsa devices
    because they attach virtual disks to the host which aren't SAS
    attached (the replacement API ignores them).

    The other two fixes are fairly minor: the sense key one means we
    actually resolve a newly added sense key and the RDAC device
    blacklisting is needed to prevent us annoying the universal XPORT lun
    of various RDAC arrays"

    * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
    scsi: sas: remove is_sas_attached()
    scsi: ses: use scsi_is_sas_rphy instead of is_sas_attached
    scsi: sas: provide stub implementation for scsi_is_sas_rphy
    scsi: blacklist all RDAC devices for BLIST_NO_ULD_ATTACH
    scsi: fix upper bounds check of sense key in scsi_sense_key_string()

    Linus Torvalds
     

05 Sep, 2016

6 commits

  • The spec allows ExitBootServices to fail with EFI_INVALID_PARAMETER if a
    race condition has occurred where the EFI has updated the memory map after
    the stub grabbed a reference to the map. The spec defines a retry
    proceedure with specific requirements to handle this scenario.

    This scenario was previously observed on x86 - commit d3768d885c6c ("x86,
    efi: retry ExitBootServices() on failure") but the current fix is not spec
    compliant and the scenario is now observed on the Qualcomm Technologies
    QDF2432 via the FDT stub which does not handle the error and thus causes
    boot failures. The user will notice the boot failure as the kernel is not
    executed and the system may drop back to a UEFI shell, but will be
    unresponsive to input and the system will require a power cycle to recover.

    Add a helper to the stub library that correctly adheres to the spec in the
    case of EFI_INVALID_PARAMETER from ExitBootServices and can be universally
    used across all stub implementations.

    Signed-off-by: Jeffrey Hugo
    Cc: Ard Biesheuvel
    Cc: Mark Rutland
    Cc: Leif Lindholm
    Cc: Ingo Molnar
    Cc:
    Signed-off-by: Matt Fleming

    Jeffrey Hugo
     
  • efi_get_memory_map() allocates a buffer to store the memory map that it
    retrieves. This buffer may need to be reused by the client after
    ExitBootServices() is called, at which point allocations are not longer
    permitted. To support this usecase, provide the allocated buffer size back
    to the client, and allocate some additional headroom to account for any
    reasonable growth in the map that is likely to happen between the call to
    efi_get_memory_map() and the client reusing the buffer.

    Signed-off-by: Jeffrey Hugo
    Cc: Ard Biesheuvel
    Cc: Mark Rutland
    Cc: Leif Lindholm
    Cc: Ingo Molnar
    Cc:
    Signed-off-by: Matt Fleming

    Jeffrey Hugo
     
  • While commit 55f1ea15216 ("efi: Fix for_each_efi_memory_desc_in_map()
    for empty memmaps") made an attempt to deal with empty memory maps, it
    didn't address the case where the map field never gets set, as is
    apparently the case when running under Xen.

    Reported-by:
    Tested-by:
    Cc: Vitaly Kuznetsov
    Cc: Jiri Slaby
    Cc: Mark Rutland
    Cc: # v4.7+
    Signed-off-by: Jan Beulich
    [ Guard the loop with a NULL check instead of pointer underflow ]
    Signed-off-by: Matt Fleming

    Jan Beulich
     
  • My previous commit:

    112dc0c8069e ("locking/barriers: Suppress sparse warnings in lockless_dereference()")

    caused sparse to complain that (in radix-tree.h) we use sizeof(void)
    since that rcu_dereference()s a void *.

    Really, all we need is to have the expression *p in here somewhere
    to make sure p is a pointer type, and sizeof(*p) was the thing that
    came to my mind first to make sure that's done without really doing
    anything at runtime.

    Another thing I had considered was using typeof(*p), but obviously
    we can't just declare a typeof(*p) variable either, since that may
    end up being void. Declaring a variable as typeof(*p)* gets around
    that, and still checks that typeof(*p) is valid, so do that. This
    type construction can't be done for _________p1 because that will
    actually be used and causes sparse address space warnings, so keep
    a separate unused variable for it.

    Reported-by: Fengguang Wu
    Signed-off-by: Johannes Berg
    Signed-off-by: Peter Zijlstra (Intel)
    Cc: Linus Torvalds
    Cc: Paul E . McKenney
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: kbuild-all@01.org
    Fixes: 112dc0c8069e ("locking/barriers: Suppress sparse warnings in lockless_dereference()")
    Link: http://lkml.kernel.org/r/1472192160-4049-1-git-send-email-johannes@sipsolutions.net
    Signed-off-by: Ingo Molnar

    Johannes Berg
     
  • Right now we use the 'readlock' both for protecting some of the af_unix
    IO path and for making the bind be single-threaded.

    The two are independent, but using the same lock makes for a nasty
    deadlock due to ordering with regards to filesystem locking. The bind
    locking would want to nest outside the VSF pathname locking, but the IO
    locking wants to nest inside some of those same locks.

    We tried to fix this earlier with commit c845acb324aa ("af_unix: Fix
    splice-bind deadlock") which moved the readlock inside the vfs locks,
    but that caused problems with overlayfs that will then call back into
    filesystem routines that take the lock in the wrong order anyway.

    Splitting the locks means that we can go back to having the bind lock be
    the outermost lock, and we don't have any deadlocks with lock ordering.

    Acked-by: Rainer Weikusat
    Acked-by: Al Viro
    Signed-off-by: Linus Torvalds
    Acked-by: Hannes Frederic Sowa
    Signed-off-by: David S. Miller

    Linus Torvalds
     
  • Following few steps will crash kernel -

    (a) Create bonding master
    > modprobe bonding miimon=50
    (b) Create macvlan bridge on eth2
    > ip link add link eth2 dev mvl0 address aa:0:0:0:0:01 \
    type macvlan
    (c) Now try adding eth2 into the bond
    > echo +eth2 > /sys/class/net/bond0/bonding/slaves

    Bonding does lots of things before checking if the device enslaved is
    busy or not.

    In this case when the notifier call-chain sends notifications, the
    bond_netdev_event() assumes that the rx_handler /rx_handler_data is
    registered while the bond_enslave() hasn't progressed far enough to
    register rx_handler for the new slave.

    This patch adds a rx_handler check that can be performed right at the
    beginning of the enslave code to avoid getting into this situation.

    Signed-off-by: Mahesh Bandewar
    Acked-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Mahesh Bandewar
     

04 Sep, 2016

3 commits

  • Pull staging/IIO driver fixes from Greg KH:
    "Here are a number of small fixes for staging and IIO drivers that
    resolve reported problems.

    Full details are in the shortlog. All of these have been in
    linux-next with no reported issues"

    * tag 'staging-4.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (35 commits)
    arm: dts: rockchip: add reset node for the exist saradc SoCs
    arm64: dts: rockchip: add reset saradc node for rk3368 SoCs
    iio: adc: rockchip_saradc: reset saradc controller before programming it
    iio: accel: kxsd9: Fix raw read return
    iio: adc: ti_am335x_adc: Increase timeout value waiting for ADC sample
    iio: adc: ti_am335x_adc: Protect FIFO1 from concurrent access
    include/linux: fix excess fence.h kernel-doc notation
    staging: wilc1000: correctly check if associatedsta has not been found
    staging: wilc1000: NULL dereference on error
    staging: wilc1000: txq_event: Fix coding error
    MAINTAINERS: Add file patterns for ion device tree bindings
    MAINTAINERS: Update maintainer entry for wilc1000
    iio: chemical: atlas-ph-sensor: fix typo in val assignment
    iio: fix sched WARNING "do not call blocking ops when !TASK_RUNNING"
    staging: comedi: ni_mio_common: fix AO inttrig backwards compatibility
    staging: comedi: dt2811: fix a precedence bug
    staging: comedi: adv_pci1760: Do not return EINVAL for CMDF_ROUND_DOWN.
    staging: comedi: ni_mio_common: fix wrong insn_write handler
    staging: comedi: comedi_test: fix timer race conditions
    staging: comedi: daqboard2000: bug fix board type matching code
    ...

    Linus Torvalds
     
  • Pull serial driver fixes from Greg KH:
    "Here are some small serial driver fixes for 4.8-rc5. One fixes an
    oft-reported build issue with the fintek driver, another reverts a
    patch that was causing problems, one fixes a crash, and some new
    device ids were added.

    All of these have been in linux-next for a while"

    * tag 'tty-4.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
    serial: 8250: added acces i/o products quad and octal serial cards
    serial: 8250_mid: fix divide error bug if baud rate is 0
    Revert "tty/serial/8250: use mctrl_gpio helpers"
    8250/fintek: rename IRQ_MODE macro

    Linus Torvalds
     
  • Pull USB/PHY fixes from Greg KH:
    "Here are some USB and PHY driver fixes for 4.8-rc5

    Nothing major, lots of little fixes for reported bugs, and a build fix
    for a missing .h file that the phy drivers needed. All of these have
    been in linux-next for a while with no reported issues"

    * tag 'usb-4.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (24 commits)
    usb: musb: Fix locking errors for host only mode
    usb: dwc3: gadget: always decrement by 1
    usb: dwc3: debug: fix ep name on trace output
    usb: gadget: udc: core: don't starve DMA resources
    USB: serial: option: add WeTelecom 0x6802 and 0x6803 products
    USB: avoid left shift by -1
    USB: fix typo in wMaxPacketSize validation
    usb: gadget: Add the gserial port checking in gs_start_tx()
    usb: dwc3: gadget: don't rely on jiffies while holding spinlock
    usb: gadget: fsl_qe_udc: signedness bug in qe_get_frame()
    usb: gadget: function: f_rndis: socket buffer may be NULL
    usb: gadget: function: f_eem: socket buffer may be NULL
    usb: renesas_usbhs: gadget: fix return value check in usbhs_mod_gadget_probe()
    usb: dwc2: Add reset control to dwc2
    usb: dwc3: core: allow device to runtime_suspend several times
    usb: dwc3: pci: runtime_resume child device
    USB: serial: option: add WeTelecom WM-D200
    usb: chipidea: udc: don't touch DP when controller is in host mode
    USB: serial: mos7840: fix non-atomic allocation in write path
    USB: serial: mos7720: fix non-atomic allocation in write path
    ...

    Linus Torvalds
     

03 Sep, 2016

4 commits

  • Pull block fixes from Jens Axboe:
    "A collection of fixes for the nvme over fabrics code"

    * 'for-linus' of git://git.kernel.dk/linux-block:
    nvme-rdma: Get rid of redundant defines
    nvme-rdma: Get rid of duplicate variable
    nvme: fabrics drivers don't need the nvme-pci driver
    nvme-fabrics: get a reference when reusing a nvme_host structure
    nvme-fabrics: change NQN UUID to big-endian format
    nvme-loop: set sqsize to 0-based value, per spec
    nvme-rdma: fix sqsize/hsqsize per spec
    fabrics: define admin sqsize min default, per spec
    nvmet-rdma: +1 to *queue_size from hsqsize/hrqsize
    nvmet-rdma: Fix use after free
    nvme-rdma: initialize ret to zero to avoid returning garbage

    Linus Torvalds
     
  • Pull ACPI fixes ffrom Rafael Wysocki:
    "Two stable-candidate fixes for the ACPI early device probing code
    added during the 4.4 cycle, one fixing a typo in a stub macro used
    when CONFIG_ACPI is unset and one that prevents sleeping functions
    from being called under a spinlock (Lorenzo Pieralisi)"

    * tag 'acpi-4.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
    ACPI / drivers: replace acpi_probe_lock spinlock with mutex
    ACPI / drivers: fix typo in ACPI_DECLARE_PROBE_ENTRY macro

    Linus Torvalds
     
  • When the ACPI_DECLARE_PROBE_ENTRY macro was added in
    commit e647b532275b ("ACPI: Add early device probing infrastructure"),
    a stub macro adding an unused entry was added for the !CONFIG_ACPI
    Kconfig option case to make sure kernel code making use of the
    macro did not require to be guarded within CONFIG_ACPI in order to
    be compiled.

    The stub macro was never used since all kernel code that defines
    ACPI_DECLARE_PROBE_ENTRY entries is currently guarded within
    CONFIG_ACPI; it contains a typo that should be nonetheless fixed.

    Fix the typo in the stub (ie !CONFIG_ACPI) ACPI_DECLARE_PROBE_ENTRY()
    macro so that it can actually be used if needed.

    Signed-off-by: Lorenzo Pieralisi
    Fixes: e647b532275b (ACPI: Add early device probing infrastructure)
    Cc: 4.4+ # 4.4+
    Signed-off-by: Rafael J. Wysocki

    Lorenzo Pieralisi
     
  • Pull overlayfs fixes from Miklos Szeredi:
    "Most of this is regression fixes for posix acl behavior introduced in
    4.8-rc1 (these were caught by the pjd-fstest suite). The are also
    miscellaneous fixes marked as stable material and cleanups.

    Other than overlayfs code, it touches to add a constant
    with which to disable posix acl caching. No changes needed to the
    actual caching code, it automatically does the right thing, although
    later we may want to optimize this case.

    I'm now testing overlayfs with the following test suites to catch
    regressions:

    - unionmount-testsuite
    - xfstests
    - pjd-fstest"

    * 'overlayfs-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs:
    ovl: update doc
    ovl: listxattr: use strnlen()
    ovl: Switch to generic_getxattr
    ovl: copyattr after setting POSIX ACL
    ovl: Switch to generic_removexattr
    ovl: Get rid of ovl_xattr_noacl_handlers array
    ovl: Fix OVL_XATTR_PREFIX
    ovl: fix spelling mistake: "directries" -> "directories"
    ovl: don't cache acl on overlay layer
    ovl: use cached acl on underlying layer
    ovl: proper cleanup of workdir
    ovl: remove posix_acl_default from workdir
    ovl: handle umask and posix_acl_default correctly on creation
    ovl: don't copy up opaqueness

    Linus Torvalds
     

02 Sep, 2016

6 commits

  • Merge fixes from Andrew Morton:
    "14 fixes"

    * emailed patches from Andrew Morton :
    rapidio/tsi721: fix incorrect detection of address translation condition
    rapidio/documentation/mport_cdev: add missing parameter description
    kernel/fork: fix CLONE_CHILD_CLEARTID regression in nscd
    MAINTAINERS: Vladimir has moved
    mm, mempolicy: task->mempolicy must be NULL before dropping final reference
    printk/nmi: avoid direct printk()-s from __printk_nmi_flush()
    treewide: remove references to the now unnecessary DEFINE_PCI_DEVICE_TABLE
    drivers/scsi/wd719x.c: remove last declaration using DEFINE_PCI_DEVICE_TABLE
    mm, vmscan: only allocate and reclaim from zones with pages managed by the buddy allocator
    lib/test_hash.c: fix warning in preprocessor symbol evaluation
    lib/test_hash.c: fix warning in two-dimensional array init
    kconfig: tinyconfig: provide whole choice blocks to avoid warnings
    kexec: fix double-free when failing to relocate the purgatory
    mm, oom: prevent premature OOM killer invocation for high order request

    Linus Torvalds
     
  • KASAN allocates memory from the page allocator as part of
    kmem_cache_free(), and that can reference current->mempolicy through any
    number of allocation functions. It needs to be NULL'd out before the
    final reference is dropped to prevent a use-after-free bug:

    BUG: KASAN: use-after-free in alloc_pages_current+0x363/0x370 at addr ffff88010b48102c
    CPU: 0 PID: 15425 Comm: trinity-c2 Not tainted 4.8.0-rc2+ #140
    ...
    Call Trace:
    dump_stack
    kasan_object_err
    kasan_report_error
    __asan_report_load2_noabort
    alloc_pages_current mempolicy to NULL before dropping the final
    reference.

    Link: http://lkml.kernel.org/r/alpine.DEB.2.10.1608301442180.63329@chino.kir.corp.google.com
    Fixes: cd11016e5f52 ("mm, kasan: stackdepot implementation. Enable stackdepot for SLAB")
    Signed-off-by: David Rientjes
    Reported-by: Vegard Nossum
    Acked-by: Andrey Ryabinin
    Cc: Alexander Potapenko
    Cc: Dmitry Vyukov
    Cc: [4.6+]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Rientjes
     
  • It's been eliminated from the sources, remove it from everywhere else.

    Link: http://lkml.kernel.org/r/076eff466fd7edb550c25c8b25d76924ca0eba62.1472660229.git.joe@perches.com
    Signed-off-by: Joe Perches
    Cc: "James E.J. Bottomley"
    Cc: "Martin K. Petersen"
    Cc: Bjorn Helgaas
    Cc: Andy Whitcroft
    Cc: Jonathan Corbet
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Firmware Assisted Dump (FA_DUMP) on ppc64 reserves substantial amounts
    of memory when booting a secondary kernel. Srikar Dronamraju reported
    that multiple nodes may have no memory managed by the buddy allocator
    but still return true for populated_zone().

    Commit 1d82de618ddd ("mm, vmscan: make kswapd reclaim in terms of
    nodes") was reported to cause kswapd to spin at 100% CPU usage when
    fadump was enabled. The old code happened to deal with the situation of
    a populated node with zero free pages by co-incidence but the current
    code tries to reclaim populated zones without realising that is
    impossible.

    We cannot just convert populated_zone() as many existing users really
    need to check for present_pages. This patch introduces a managed_zone()
    helper and uses it in the few cases where it is critical that the check
    is made for managed pages -- zonelist construction and page reclaim.

    Link: http://lkml.kernel.org/r/20160831195104.GB8119@techsingularity.net
    Signed-off-by: Mel Gorman
    Reported-by: Srikar Dronamraju
    Tested-by: Srikar Dronamraju
    Acked-by: Michal Hocko
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mel Gorman
     
  • Pull audit fixes from Paul Moore:
    "Two small patches to fix some bugs with the audit-by-executable
    functionality we introduced back in v4.3 (both patches are marked
    for the stable folks)"

    * 'stable-4.8' of git://git.infradead.org/users/pcmoore/audit:
    audit: fix exe_file access in audit_exe_compare
    mm: introduce get_task_exe_file

    Linus Torvalds
     
  • …rnel/git/dgc/linux-xfs

    Pull xfs and iomap fixes from Dave Chinner:
    "Most of these changes are small regression fixes that address problems
    introduced in the 4.8-rc1 window. The two fixes that aren't (IO
    completion fix and superblock inprogress check) are fixes for problems
    introduced some time ago and need to be pushed back to stable kernels.

    Changes in this update:
    - iomap FIEMAP_EXTENT_MERGED usage fix
    - additional mount-time feature restrictions
    - rmap btree query fixes
    - freeze/unmount io completion workqueue fix
    - memory corruption fix for deferred operations handling"

    * tag 'xfs-iomap-for-linus-4.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/dgc/linux-xfs:
    xfs: track log done items directly in the deferred pending work item
    iomap: don't set FIEMAP_EXTENT_MERGED for extent based filesystems
    xfs: prevent dropping ioend completions during buftarg wait
    xfs: fix superblock inprogress check
    xfs: simple btree query range should look right if LE lookup fails
    xfs: fix some key handling problems in _btree_simple_query_range
    xfs: don't log the entire end of the AGF
    xfs: disallow mounting of realtime + rmap filesystems
    xfs: don't perform lookups on zero-height btrees

    Linus Torvalds
     

01 Sep, 2016

2 commits

  • Some operations (setxattr/chmod) can make the cached acl stale. We either
    need to clear overlay's acl cache for the affected inode or prevent acl
    caching on the overlay altogether. Preventing caching has the following
    advantages:

    - no double caching, less memory used

    - overlay cache doesn't go stale when fs clears it's own cache

    Possible disadvantage is performance loss. If that becomes a problem
    get_acl() can be optimized for overlayfs.

    This patch disables caching by pre setting i_*acl to a value that

    - has bit 0 set, so is_uncached_acl() will return true

    - is not equal to ACL_NOT_CACHED, so get_acl() will not overwrite it

    The constant -3 was chosen for this purpose.

    Fixes: 39a25b2b3762 ("ovl: define ->get_acl() for overlay inodes")
    Signed-off-by: Miklos Szeredi

    Miklos Szeredi
     
  • For more convenient access if one has a pointer to the task.

    As a minor nit take advantage of the fact that only task lock + rcu are
    needed to safely grab ->exe_file. This saves mm refcount dance.

    Use the helper in proc_exe_link.

    Signed-off-by: Mateusz Guzik
    Acked-by: Konstantin Khlebnikov
    Acked-by: Richard Guy Briggs
    Cc: # 4.3.x
    Signed-off-by: Paul Moore

    Mateusz Guzik
     

31 Aug, 2016

4 commits

  • Serial console is broken in v4.8-rcX. Mika and I independently bisected down to
    commit 4ef03d328769 ("tty/serial/8250: use mctrl_gpio helpers").

    Since neither author nor anyone else didn't propose a solution we better revert
    it for now.

    This reverts commit 4ef03d328769eddbfeca1f1c958fdb181a69c341.

    Link: https://lkml.kernel.org/r/20160809130229.GN1729@lahna.fi.intel.com
    Signed-off-by: Andy Shevchenko
    Tested-by: Heikki Krogerus
    Tested-by: Mika Westerberg
    Signed-off-by: Greg Kroah-Hartman

    Andy Shevchenko
     
  • Pablo Neira Ayuso says:

    ====================
    Netfilter fixes for net

    The following patchset contains Netfilter fixes for your net tree,
    they are:

    1) Allow nf_tables reject expression from input, forward and output hooks,
    since only there the routing information is available, otherwise we crash.

    2) Fix unsafe list iteration when flushing timeout and accouting objects.

    3) Fix refcount leak on timeout policy parsing failure.

    4) Unlink timeout object for unconfirmed conntracks too

    5) Missing validation of pkttype mangling from bridge family.

    6) Fix refcount leak on ebtables on second lookup for the specific
    bridge match extension, this patch from Sabrina Dubroca.

    7) Remove unnecessary ip_hdr() in nf_tables_netdev family.

    Patches from 1-5 and 7 from Liping Zhang.
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     
  • …kernel/git/jberg/mac80211

    Johannes Berg says:

    ====================
    Three little fixes:
    * revert a recent wext patch, which Ben Hutchings noticed was
    wrong, and it turns out not to be necessary for any driver

    * fix an infinite loop that can occur under certain conditions
    in mac80211's TDLS code (depending on regulatory information)

    * add a cfg80211_get_station() static inline when cfg80211 isn't
    built, to allow other modules to not have to depend on it for it
    ====================

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

    David S. Miller
     
  • There are three usercopy warnings which are currently being silenced for
    gcc 4.6 and newer:

    1) "copy_from_user() buffer size is too small" compile warning/error

    This is a static warning which happens when object size and copy size
    are both const, and copy size > object size. I didn't see any false
    positives for this one. So the function warning attribute seems to
    be working fine here.

    Note this scenario is always a bug and so I think it should be
    changed to *always* be an error, regardless of
    CONFIG_DEBUG_STRICT_USER_COPY_CHECKS.

    2) "copy_from_user() buffer size is not provably correct" compile warning

    This is another static warning which happens when I enable
    __compiletime_object_size() for new compilers (and
    CONFIG_DEBUG_STRICT_USER_COPY_CHECKS). It happens when object size
    is const, but copy size is *not*. In this case there's no way to
    compare the two at build time, so it gives the warning. (Note the
    warning is a byproduct of the fact that gcc has no way of knowing
    whether the overflow function will be called, so the call isn't dead
    code and the warning attribute is activated.)

    So this warning seems to only indicate "this is an unusual pattern,
    maybe you should check it out" rather than "this is a bug".

    I get 102(!) of these warnings with allyesconfig and the
    __compiletime_object_size() gcc check removed. I don't know if there
    are any real bugs hiding in there, but from looking at a small
    sample, I didn't see any. According to Kees, it does sometimes find
    real bugs. But the false positive rate seems high.

    3) "Buffer overflow detected" runtime warning

    This is a runtime warning where object size is const, and copy size >
    object size.

    All three warnings (both static and runtime) were completely disabled
    for gcc 4.6 with the following commit:

    2fb0815c9ee6 ("gcc4: disable __compiletime_object_size for GCC 4.6+")

    That commit mistakenly assumed that the false positives were caused by a
    gcc bug in __compiletime_object_size(). But in fact,
    __compiletime_object_size() seems to be working fine. The false
    positives were instead triggered by #2 above. (Though I don't have an
    explanation for why the warnings supposedly only started showing up in
    gcc 4.6.)

    So remove warning #2 to get rid of all the false positives, and re-enable
    warnings #1 and #3 by reverting the above commit.

    Furthermore, since #1 is a real bug which is detected at compile time,
    upgrade it to always be an error.

    Having done all that, CONFIG_DEBUG_STRICT_USER_COPY_CHECKS is no longer
    needed.

    Signed-off-by: Josh Poimboeuf
    Cc: Kees Cook
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: "H . Peter Anvin"
    Cc: Andy Lutomirski
    Cc: Steven Rostedt
    Cc: Brian Gerst
    Cc: Peter Zijlstra
    Cc: Frederic Weisbecker
    Cc: Byungchul Park
    Cc: Nilay Vaish
    Signed-off-by: Linus Torvalds

    Josh Poimboeuf
     

30 Aug, 2016

1 commit