12 Mar, 2017

40 commits

  • commit 95e91b831f87ac8e1f8ed50c14d709089b4e01b8 upstream.

    The issue is described here, with a nice testcase:

    https://bugzilla.kernel.org/show_bug.cgi?id=192931

    The problem is that shmat() calls do_mmap_pgoff() with MAP_FIXED, and
    the address rounded down to 0. For the regular mmap case, the
    protection mentioned above is that the kernel gets to generate the
    address -- arch_get_unmapped_area() will always check for MAP_FIXED and
    return that address. So by the time we do security_mmap_addr(0) things
    get funky for shmat().

    The testcase itself shows that while a regular user crashes, root will
    not have a problem attaching a nil-page. There are two possible fixes
    to this. The first, and which this patch does, is to simply allow root
    to crash as well -- this is also regular mmap behavior, ie when hacking
    up the testcase and adding mmap(... |MAP_FIXED). While this approach
    is the safer option, the second alternative is to ignore SHM_RND if the
    rounded address is 0, thus only having MAP_SHARED flags. This makes the
    behavior of shmat() identical to the mmap() case. The downside of this
    is obviously user visible, but does make sense in that it maintains
    semantics after the round-down wrt 0 address and mmap.

    Passes shm related ltp tests.

    Link: http://lkml.kernel.org/r/1486050195-18629-1-git-send-email-dave@stgolabs.net
    Signed-off-by: Davidlohr Bueso
    Reported-by: Gareth Evans
    Cc: Manfred Spraul
    Cc: Michael Kerrisk
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Davidlohr Bueso
     
  • commit 441398d378f29a5ad6d0fcda07918e54e4961800 upstream.

    Currently SS_AUTODISARM is not supported in compatibility mode, but does
    not return -EINVAL either. This makes dosemu built with -m32 on x86_64
    to crash. Also the kernel's sigaltstack selftest fails if compiled with
    -m32.

    This patch adds the needed support.

    Link: http://lkml.kernel.org/r/20170205101213.8163-2-stsp@list.ru
    Signed-off-by: Stas Sergeev
    Cc: Milosz Tanski
    Cc: Andy Lutomirski
    Cc: Al Viro
    Cc: Arnd Bergmann
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: Oleg Nesterov
    Cc: Nicolas Pitre
    Cc: Waiman Long
    Cc: Dave Hansen
    Cc: Dmitry Safonov
    Cc: Wang Xiaoqiang
    Cc: Oleg Nesterov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Stas Sergeev
     
  • commit 71ab6cfe88dcf9f6e6a65eb85cf2bda20a257682 upstream.

    get_scan_count() considers the whole node LRU size when

    - doing SCAN_FILE due to many page cache inactive pages
    - calculating the number of pages to scan

    In both cases this might lead to unexpected behavior especially on 32b
    systems where we can expect lowmem memory pressure very often.

    A large highmem zone can easily distort SCAN_FILE heuristic because
    there might be only few file pages from the eligible zones on the node
    lru and we would still enforce file lru scanning which can lead to
    trashing while we could still scan anonymous pages.

    The later use of lruvec_lru_size can be problematic as well. Especially
    when there are not many pages from the eligible zones. We would have to
    skip over many pages to find anything to reclaim but shrink_node_memcg
    would only reduce the remaining number to scan by SWAP_CLUSTER_MAX at
    maximum. Therefore we can end up going over a large LRU many times
    without actually having chance to reclaim much if anything at all. The
    closer we are out of memory on lowmem zone the worse the problem will
    be.

    Fix this by filtering out all the ineligible zones when calculating the
    lru size for both paths and consider only sc->reclaim_idx zones.

    The patch would need to be tweaked a bit to apply to 4.10 and older but
    I will do that as soon as it hits the Linus tree in the next merge
    window.

    Link: http://lkml.kernel.org/r/20170117103702.28542-3-mhocko@kernel.org
    Fixes: b2e18757f2c9 ("mm, vmscan: begin reclaiming pages on a per-node basis")
    Signed-off-by: Michal Hocko
    Tested-by: Trevor Cordes
    Acked-by: Minchan Kim
    Acked-by: Hillf Danton
    Acked-by: Mel Gorman
    Acked-by: Johannes Weiner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Michal Hocko
     
  • commit fd538803731e50367b7c59ce4ad3454426a3d671 upstream.

    lruvec_lru_size returns the full size of the LRU list while we sometimes
    need a value reduced only to eligible zones (e.g. for lowmem requests).
    inactive_list_is_low is one such user. Later patches will add more of
    them. Add a new parameter to lruvec_lru_size and allow it filter out
    zones which are not eligible for the given context.

    Link: http://lkml.kernel.org/r/20170117103702.28542-2-mhocko@kernel.org
    Signed-off-by: Michal Hocko
    Acked-by: Johannes Weiner
    Acked-by: Hillf Danton
    Acked-by: Minchan Kim
    Acked-by: Mel Gorman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Michal Hocko
     
  • commit 9c57b5808c625f4fc93da330b932647eaff321f7 upstream.

    With CONFIG_BALLOON_COMPACTION=y the kernel will mount balloon_mnt for
    balloon page migration when we probe a virtio_balloon device. However
    we do not unmount it when removing the device. Fix this.

    Fixes: b1123ea6d3b3 ("mm: balloon: use general non-lru movable page feature")
    Link: http://lkml.kernel.org/r/1486531318-35189-1-git-send-email-xieyisheng1@huawei.com
    Signed-off-by: Yisheng Xie
    Acked-by: Minchan Kim
    Cc: Rafael Aquini
    Cc: Konstantin Khlebnikov
    Cc: Gioh Kim
    Cc: Vlastimil Babka
    Cc: Michal Hocko
    Cc: Michael S. Tsirkin
    Cc: Jason Wang
    Cc: Hanjun Guo
    Cc: Xishi Qiu
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Yisheng Xie
     
  • commit dd8416c47715cf324c9a16f13273f9fda87acfed upstream.

    With rw_page, page_endio is used for completing IO on a page and it
    propagates write error to the address space if the IO fails. The
    problem is it accesses page->mapping directly which might be okay for
    file-backed pages but it shouldn't for anonymous page. Otherwise, it
    can corrupt one of field from anon_vma under us and system goes panic
    randomly.

    swap_writepage
    bdev_writepage
    ops->rw_page

    I encountered the BUG during developing new zram feature and it was
    really hard to figure it out because it made random crash, somtime
    mmap_sem lockdep, sometime other places where places never related to
    zram/zsmalloc, and not reproducible with some configuration.

    When I consider how that bug is subtle and people do fast-swap test with
    brd, it's worth to add stable mark, I think.

    Fixes: dd6bd0d9c7db ("swap: use bdev_read_page() / bdev_write_page()")
    Signed-off-by: Minchan Kim
    Acked-by: Michal Hocko
    Cc: Matthew Wilcox
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Minchan Kim
     
  • commit e1587a4945408faa58d0485002c110eb2454740c upstream.

    At the end of a window period, if the reclaimed pages is greater than
    scanned, an unsigned underflow can result in a huge pressure value and
    thus a critical event. Reclaimed pages is found to go higher than
    scanned because of the addition of reclaimed slab pages to reclaimed in
    shrink_node without a corresponding increment to scanned pages.

    Minchan Kim mentioned that this can also happen in the case of a THP
    page where the scanned is 1 and reclaimed could be 512.

    Link: http://lkml.kernel.org/r/1486641577-11685-1-git-send-email-vinmenon@codeaurora.org
    Signed-off-by: Vinayak Menon
    Acked-by: Minchan Kim
    Acked-by: Michal Hocko
    Cc: Johannes Weiner
    Cc: Mel Gorman
    Cc: Vlastimil Babka
    Cc: Rik van Riel
    Cc: Vladimir Davydov
    Cc: Anton Vorontsov
    Cc: Shiraz Hashim
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Vinayak Menon
     
  • commit e02dc017c3032dcdce1b993af0db135462e1b4b7 upstream.

    When @node_reclaim_node isn't 0, the page allocator tries to reclaim
    pages if the amount of free memory in the zones are below the low
    watermark. On Power platform, none of NUMA nodes are scanned for page
    reclaim because no nodes match the condition in zone_allows_reclaim().
    On Power platform, RECLAIM_DISTANCE is set to 10 which is the distance
    of Node-A to Node-A. So the preferred node even won't be scanned for
    page reclaim.

    __alloc_pages_nodemask()
    get_page_from_freelist()
    zone_allows_reclaim()

    Anton proposed the test code as below:

    # cat alloc.c
    :
    int main(int argc, char *argv[])
    {
    void *p;
    unsigned long size;
    unsigned long start, end;

    start = time(NULL);
    size = strtoul(argv[1], NULL, 0);
    printf("To allocate %ldGB memory\n", size);

    size < /proc/sys/vm/zone_reclaim_mode; \
    sync; \
    echo 3 > /proc/sys/vm/drop_caches; \
    # taskset -c 0 cat file.32G > /dev/null; \
    grep FilePages /sys/devices/system/node/node0/meminfo
    Node 0 FilePages: 33619712 kB
    # taskset -c 0 ./alloc 128
    # grep FilePages /sys/devices/system/node/node0/meminfo
    Node 0 FilePages: 33619840 kB
    # grep MemFree /sys/devices/system/node/node0/meminfo
    Node 0 MemFree: 186816 kB

    With the patch applied, the pagecache on node-0 is reclaimed when its
    free memory is running out. It's the expected behaviour.

    # echo 2 > /proc/sys/vm/zone_reclaim_mode; \
    sync; \
    echo 3 > /proc/sys/vm/drop_caches
    # taskset -c 0 cat file.32G > /dev/null; \
    grep FilePages /sys/devices/system/node/node0/meminfo
    Node 0 FilePages: 33605568 kB
    # taskset -c 0 ./alloc 128
    # grep FilePages /sys/devices/system/node/node0/meminfo
    Node 0 FilePages: 1379520 kB
    # grep MemFree /sys/devices/system/node/node0/meminfo
    Node 0 MemFree: 317120 kB

    Fixes: 5f7a75acdb24 ("mm: page_alloc: do not cache reclaim distances")
    Link: http://lkml.kernel.org/r/1486532455-29613-1-git-send-email-gwshan@linux.vnet.ibm.com
    Signed-off-by: Gavin Shan
    Acked-by: Mel Gorman
    Acked-by: Michal Hocko
    Cc: Anton Blanchard
    Cc: Michael Ellerman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Gavin Shan
     
  • commit b5d24fda9c3dce51fcb4eee459550a458eaaf1e2 upstream.

    The mem_hotplug_{begin,done} lock coordinates with {get,put}_online_mems()
    to hold off "readers" of the current state of memory from new hotplug
    actions. mem_hotplug_begin() expects exclusive access, via the
    device_hotplug lock, to set mem_hotplug.active_writer. Calling
    mem_hotplug_begin() without locking device_hotplug can lead to
    corrupting mem_hotplug.refcount and missed wakeups / soft lockups.

    [dan.j.williams@intel.com: v2]
    Link: http://lkml.kernel.org/r/148728203365.38457.17804568297887708345.stgit@dwillia2-desk3.amr.corp.intel.com
    Link: http://lkml.kernel.org/r/148693885680.16345.17802627926777862337.stgit@dwillia2-desk3.amr.corp.intel.com
    Fixes: f931ab479dd2 ("mm: fix devm_memremap_pages crash, use mem_hotplug_{begin, done}")
    Signed-off-by: Dan Williams
    Reported-by: Ben Hutchings
    Cc: Michal Hocko
    Cc: Toshi Kani
    Cc: Vlastimil Babka
    Cc: Logan Gunthorpe
    Cc: Masayoshi Mizuma
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Dan Williams
     
  • commit 9c25702cee1405099f982894c865c163de7909a8 upstream.

    Currently we call copy_page_to_iter() for uncached reading into a pipe.
    This is wrong because it treats pages as VFS cache pages and copies references
    rather than actual data. When we are trying to read from the pipe we end up
    calling page_cache_pipe_buf_confirm() which returns -ENODATA. This error
    is translated into 0 which is returned to a user.

    This issue is reproduced by running xfs-tests suite (generic test #249)
    against mount points with "cache=none". Fix it by mapping pages manually
    and calling copy_to_iter() that copies data into the pipe.

    Signed-off-by: Pavel Shilovsky
    Signed-off-by: Greg Kroah-Hartman

    Pavel Shilovsky
     
  • commit 21e722c4c8377b5bc82ad058fed12165af739c1b upstream.

    The check to set identity map for tylersburg is done too late. It needs
    to be done before the check for identity_map domain is done.

    To: Joerg Roedel
    To: David Woodhouse
    Cc: iommu@lists.linux-foundation.org
    Cc: linux-kernel@vger.kernel.org
    Cc: Ashok Raj

    Fixes: 86080ccc22 ("iommu/vt-d: Allocate si_domain in init_dmars()")
    Signed-off-by: Ashok Raj
    Reported-by: Yunhong Jiang
    Signed-off-by: Joerg Roedel
    Signed-off-by: Greg Kroah-Hartman

    Ashok Raj
     
  • commit aaa59306b0b7e0ca4ba92cc04c5db101cbb1c096 upstream.

    Some of the macros are incorrect with wrong bit-shifts resulting in picking
    the incorrect invalidation granularity. Incorrect Source-ID in extended
    devtlb invalidation caused device side errors.

    To: Joerg Roedel
    To: David Woodhouse
    Cc: iommu@lists.linux-foundation.org
    Cc: linux-kernel@vger.kernel.org
    Cc: CQ Tang
    Cc: Ashok Raj

    Fixes: 2f26e0a9 ("iommu/vt-d: Add basic SVM PASID support")
    Signed-off-by: CQ Tang
    Signed-off-by: Ashok Raj
    Tested-by: CQ Tang
    Signed-off-by: Joerg Roedel
    Signed-off-by: Greg Kroah-Hartman

    CQ Tang
     
  • commit 5939eaf4f9d432586dd2cdeea778506471e8088e upstream.

    Add the missing platform_driver_unregister() and remove the duplicate
    platform_device_unregister(force_pdev) in the error handling case.

    Fixes: 00194826e6be ("tpm_tis: Clean up the force=1 module parameter")
    Signed-off-by: Wei Yongjun
    Reviewed-by: Jason Gunthorpe
    Reviewed-by: Jarkko Sakkinen
    Signed-off-by: Jarkko Sakkinen
    Signed-off-by: Greg Kroah-Hartman

    Wei Yongjun
     
  • commit e42a46b6f52473661ad192f76a128a68fe301df4 upstream.

    It is allowed to call regulator_get with a NULL dev argument
    (_regulator_get explicitly checks for it) but this causes an error later
    when printing /sys/kernel/debug/regulator_summary.

    Fix this by explicitly handling "deviceless" consumers in the debugfs code.

    Signed-off-by: Leonard Crestez
    Signed-off-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Leonard Crestez
     
  • commit 4474f4c40a9c607c7317e686b23619b7b768004f upstream.

    The stm is automatically enabled when an application sets the policy
    via ->link() call back by using coresight_enable(), which keeps the
    refcount of the current users of the STM. However, the unlink() callback
    issues stm_disable() directly, which leaves the STM turned off, without
    the coresight layer knowing about it. This prevents any further uses
    of the STM hardware as the coresight layer still thinks the STM is
    turned on and doesn't enable the hardware when required. Even manually
    enabling the STM via sysfs can't really enable the hw.

    e.g,

    $ echo 1 > $CS_DEVS/$ETR/enable_sink
    $ mkdir -p $CONFIG_FS/stp-policy/$source.0/stm_test/
    $ echo 32768 65535 > $CONFIG_FS/stp-policy/$source.0/stm_test/channels
    $ echo 64 > $CS_DEVS/$source/traceid
    $ ./stm_app
    Sending 64000 byte blocks of pattern 0 at 0us intervals
    Success to map channel(32768~32783) to 0xffffa95fa000
    Sending on channel 32768
    $ dd if=/dev/$ETR of=~/trace.bin.1
    597+1 records in
    597+1 records out
    305920 bytes (306 kB) copied, 0.399952 s, 765 kB/s
    $ ./stm_app
    Sending 64000 byte blocks of pattern 0 at 0us intervals
    Success to map channel(32768~32783) to 0xffff7e9e2000
    Sending on channel 32768
    $ dd if=/dev/$ETR of=~/trace.bin.2
    0+0 records in
    0+0 records out
    0 bytes (0 B) copied, 0.0232083 s, 0.0 kB/s

    Note that we don't get any data from the ETR for the second session.

    Also dmesg shows :

    [ 77.520458] coresight-tmc 20800000.etr: TMC-ETR enabled
    [ 77.537097] coresight-replicator etr_replicator@20890000: REPLICATOR enabled
    [ 77.558828] coresight-replicator main_replicator@208a0000: REPLICATOR enabled
    [ 77.581068] coresight-funnel 208c0000.main_funnel: FUNNEL inport 0 enabled
    [ 77.602217] coresight-tmc 20840000.etf: TMC-ETF enabled
    [ 77.618422] coresight-stm 20860000.stm: STM tracing enabled
    [ 139.554252] coresight-stm 20860000.stm: STM tracing disabled
    # End of first tracing session
    [ 146.351135] coresight-tmc 20800000.etr: TMC read start
    [ 146.514486] coresight-tmc 20800000.etr: TMC read end
    # Note that the STM is not turned on via stm_generic_link()->coresight_enable()
    # and hence none of the components are turned on.
    [ 152.479080] coresight-tmc 20800000.etr: TMC read start
    [ 152.542632] coresight-tmc 20800000.etr: TMC read end

    This patch fixes the problem by balancing the unlink operation by using
    the coresight_disable(), keeping the coresight layer in sync with the
    hardware state and thus allowing normal usage of the STM component.

    Fixes: commit 237483aa5cf43 ("coresight: stm: adding driver for CoreSight STM component")
    Cc: Pratik Patel
    Cc: Greg Kroah-Hartman
    Acked-by: Mathieu Poirier
    Reviewed-by: Chunyan Zhang
    Reported-by: Robert Walker
    Signed-off-by: Suzuki K Poulose
    Signed-off-by: Greg Kroah-Hartman

    Suzuki K Poulose
     
  • commit 6e017006022abfea5d2466cad936065f45763ad1 upstream.

    gcc-7 detects that wlanhdr_to_ethhdr() in two drivers calls memcpy() with
    a destination argument that an earlier function call may have set to NULL:

    staging/rtl8188eu/core/rtw_recv.c: In function 'wlanhdr_to_ethhdr':
    staging/rtl8188eu/core/rtw_recv.c:1318:2: warning: argument 1 null where non-null expected [-Wnonnull]
    staging/rtl8712/rtl871x_recv.c: In function 'r8712_wlanhdr_to_ethhdr':
    staging/rtl8712/rtl871x_recv.c:649:2: warning: argument 1 null where non-null expected [-Wnonnull]

    I'm fixing this by adding a NULL pointer check and returning failure
    from the function, which is hopefully already handled properly.

    This seems to date back to when the drivers were originally added,
    so backporting the fix to stable seems appropriate. There are other
    related realtek drivers in the kernel, but none of them contain a
    function with a similar name or produce this warning.

    Fixes: 1cc18a22b96b ("staging: r8188eu: Add files for new driver - part 5")
    Fixes: 2865d42c78a9 ("staging: r8712u: Add the new driver to the mainline kernel")
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Greg Kroah-Hartman

    Arnd Bergmann
     
  • commit dc7ffefdcc28a45214aa707fdc3df6a5e611ba09 upstream.

    This is unbreaking another of those "stealth" janitor
    patches that got in and subtly broke some things.

    sv_cpt_data is a pointer to pointer, so need to
    dereference it twice to allocate the correct structure size.

    Fixes: 9899cb68c6c2 ("Staging: lustre: rpc: Use sizeof type *pointer instead of sizeof type.")
    CC: Sandhya Bankar
    Signed-off-by: Oleg Drokin
    Reviewed-by: James Simmons
    Reviewed-by: Doug Oucharek
    Signed-off-by: Greg Kroah-Hartman

    Oleg Drokin
     
  • commit 33b8807a6fe10d0e675e0704444373a6fad93188 upstream.

    The loopback driver allows the user to set a minimum delay of up to one
    second to be inserted between test iterations (i.e. request
    submissions). The delay is currently specified in microseconds and is
    implemented using udelay.

    Busy looping for long periods is not just anti-social; udelay must not
    be used for delays longer than a few milliseconds due to the risk of
    integer overflow.

    Replace the broken udelay with a usleep_range with a 100 us range for
    short delays (< 20 ms) and otherwise revert to using msleep.

    Fixes: b36f04fa9417 ("greybus: loopback: Convert thread delay to microseconds")
    Signed-off-by: Johan Hovold
    Signed-off-by: Greg Kroah-Hartman

    Johan Hovold
     
  • commit 82dbe987b70042b340f851bdc969a971081e5f02 upstream.

    If sensor attributes were never read, the pwm control data has not been
    initiialized, which can cause wrong driver behavior. Ensure that cached
    data is current before acting on it.

    Reported-by: Kevin Folz
    Signed-off-by: Guenter Roeck
    Signed-off-by: Greg Kroah-Hartman

    Guenter Roeck
     
  • commit 4c7b8ca1ae5ed9e27014732c8a918ba11a86cf09 upstream.

    In IT8620E, after setting pwm control to manual, it was observed that
    pwm values for fan 4..6 have reversed results (writing 0 results in fans
    running at full speed, writing 255 results in fans turned off).

    With the new PWM control, pwm polarity for pwm control 4..6 is specified
    in its pwm control registers. Those registers are overwritten when setting
    the pwm mode or the temperature mapping. Do not touch bit 2..6 of pwm
    control registers on register writes to fix the problem.

    Signed-off-by: Guenter Roeck
    Signed-off-by: Greg Kroah-Hartman

    Guenter Roeck
     
  • commit 29693efcea0f38cf40d0055d2401490a4f9bf8be upstream.

    On this machine, the micmute button is connected to Line2 of the
    codec and the micmute led is connected to GPIO2 of the codec.

    After applying this quirk, both hotkey and led work well.

    Signed-off-by: Hui Wang
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Hui Wang
     
  • commit 493de342748cc6f52938096f5480cf291da58a0b upstream.

    Dell Inspiron 17 7000 Gaming laptop needs a similar quirk like
    Inspiron 7599 to support its subwoofer speaker.

    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=194191
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     
  • commit f3ac9f737603da80c2da3e84b89e74429836bb6d upstream.

    The sequencer FIFO management has a bug that may lead to a corruption
    (shortage) of the cell linked list. When a sequencer client faces an
    error at the event delivery, it tries to put back the dequeued cell.
    When the first queue was put back, this forgot the tail pointer
    tracking, and the link will be screwed up.

    Although there is no memory corruption, the sequencer client may stall
    forever at exit while flushing the pending FIFO cells in
    snd_seq_pool_done(), as spotted by syzkaller.

    This patch addresses the missing tail pointer tracking at
    snd_seq_fifo_cell_putback(). Also the patch makes sure to clear the
    cell->enxt pointer at snd_seq_fifo_event_in() for avoiding a similar
    mess-up of the FIFO linked list.

    Reported-by: Dmitry Vyukov
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     
  • commit 15c75b09f8d190f89ab4db463b87d411ca349dfe upstream.

    Currently ctxfi driver tries to set only the 64bit DMA mask on 64bit
    architectures, and bails out if it fails. This causes a problem on
    some platforms since the 64bit DMA isn't always guaranteed. We should
    fall back to the default 32bit DMA when 64bit DMA fails.

    Fixes: 6d74b86d3c0f ("ALSA: ctxfi - Allow 64bit DMA")
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     
  • commit 71321eb3f2d0df4e6c327e0b936eec4458a12054 upstream.

    When a user sets a too small ticks with a fine-grained timer like
    hrtimer, the kernel tries to fire up the timer irq too frequently.
    This may lead to the condensed locks, eventually the kernel spinlock
    lockup with warnings.

    For avoiding such a situation, we define a lower limit of the
    resolution, namely 1ms. When the user passes a too small tick value
    that results in less than that, the kernel returns -EINVAL now.

    Reported-by: Dmitry Vyukov
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     
  • commit e7480b34ad1ab84a63540b2c884cb92c0764ab74 upstream.

    Like for Sunrise Point, the total stream number of Lewisburg's
    input and output stream exceeds 15 (GCAP is 0x9701), which will
    cause some streams do not work because of the overflow on
    SDxCTL.STRM field if using the legacy stream tag allocation method.

    Fixes: 5cf92c8b3dc5 ("ALSA: hda - Add Intel Lewisburg device IDs Audio")
    Signed-off-by: Jaroslav Kysela
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Jaroslav Kysela
     
  • commit 9f1bc2c4c58fcb2d86e0e26437dc8f3a18ac3276 upstream.

    The issue is the same as "dd9aa335c880 ALSA: hda/realtek - Can't adjust
    speaker's volume on a Dell AIO", the output requires to connect to a node
    with Amp-out capability.

    Applying the same fixup "ALC298_FIXUP_SPK_VOLUME" can fix the issue.

    Signed-off-by: Kai-Heng Feng
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Kai-Heng Feng
     
  • commit 78162d48466d23c45a784034630c5928af631e3d upstream.

    Enable DMA on uart1 to get a more reliable console.

    Acked-by: Nicolas Ferre
    Signed-off-by: Alexandre Belloni
    Signed-off-by: Greg Kroah-Hartman

    Alexandre Belloni
     
  • commit ef8d02d4a2c36f7a93e74c95a9c419353b310117 upstream.

    Enable DMA on usart3 to get a more reliable console. This is especially
    useful for automation and kernelci were a kernel with PROVE_LOCKING enabled
    is quite susceptible to character loss, resulting in tests failure.

    Acked-by: Nicolas Ferre
    Signed-off-by: Alexandre Belloni
    Signed-off-by: Greg Kroah-Hartman

    Alexandre Belloni
     
  • commit e3f0a4017c2143b4b813df6a93e8cf79e3f76936 upstream.

    The Atmel MPDDR controller support LPDDR2 and LPDDR3 memories, add their
    types.

    Signed-off-by: Alexandre Belloni
    Signed-off-by: Sebastian Reichel
    Signed-off-by: Greg Kroah-Hartman

    Alexandre Belloni
     
  • commit 379f831a927817c130a62e3ca0082ae685557324 upstream.

    Commit a92e7c3d82a1 ("spi: s3c64xx: consider the case when the CS
    line is not connected") introduced an inconsistency between the
    binding, where the disconnected CS line was marked as
    'no-cs-readback', and the driver.

    The driver is erroneously checking for that attribute with
    property name of 'broken-cs'.

    Check for 'no-cs-readback' in the driver as well.

    Fixes: a92e7c3d82a1 ("spi: s3c64xx: consider the case when the CS line is not connected")
    Signed-off-by: Andi Shyti
    Reviewed-by: Krzysztof Kozlowski
    Signed-off-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Andi Shyti
     
  • commit c755e251357a0cee0679081f08c3f4ba797a8009 upstream.

    The xattr_sem deadlock problems fixed in commit 2e81a4eeedca: "ext4:
    avoid deadlock when expanding inode size" didn't include the use of
    xattr_sem in fs/ext4/inline.c. With the addition of project quota
    which added a new extra inode field, this exposed deadlocks in the
    inline_data code similar to the ones fixed by 2e81a4eeedca.

    The deadlock can be reproduced via:

    dmesg -n 7
    mke2fs -t ext4 -O inline_data -Fq -I 256 /dev/vdc 32768
    mount -t ext4 -o debug_want_extra_isize=24 /dev/vdc /vdc
    mkdir /vdc/a
    umount /vdc
    mount -t ext4 /dev/vdc /vdc
    echo foo > /vdc/a/foo

    and looks like this:

    [ 11.158815]
    [ 11.160276] =============================================
    [ 11.161960] [ INFO: possible recursive locking detected ]
    [ 11.161960] 4.10.0-rc3-00015-g011b30a8a3cf #160 Tainted: G W
    [ 11.161960] ---------------------------------------------
    [ 11.161960] bash/2519 is trying to acquire lock:
    [ 11.161960] (&ei->xattr_sem){++++..}, at: [] ext4_expand_extra_isize_ea+0x3d/0x4cd
    [ 11.161960]
    [ 11.161960] but task is already holding lock:
    [ 11.161960] (&ei->xattr_sem){++++..}, at: [] ext4_try_add_inline_entry+0x3a/0x152
    [ 11.161960]
    [ 11.161960] other info that might help us debug this:
    [ 11.161960] Possible unsafe locking scenario:
    [ 11.161960]
    [ 11.161960] CPU0
    [ 11.161960] ----
    [ 11.161960] lock(&ei->xattr_sem);
    [ 11.161960] lock(&ei->xattr_sem);
    [ 11.161960]
    [ 11.161960] *** DEADLOCK ***
    [ 11.161960]
    [ 11.161960] May be due to missing lock nesting notation
    [ 11.161960]
    [ 11.161960] 4 locks held by bash/2519:
    [ 11.161960] #0: (sb_writers#3){.+.+.+}, at: [] mnt_want_write+0x1e/0x3e
    [ 11.161960] #1: (&type->i_mutex_dir_key){++++++}, at: [] path_openat+0x338/0x67a
    [ 11.161960] #2: (jbd2_handle){++++..}, at: [] start_this_handle+0x582/0x622
    [ 11.161960] #3: (&ei->xattr_sem){++++..}, at: [] ext4_try_add_inline_entry+0x3a/0x152
    [ 11.161960]
    [ 11.161960] stack backtrace:
    [ 11.161960] CPU: 0 PID: 2519 Comm: bash Tainted: G W 4.10.0-rc3-00015-g011b30a8a3cf #160
    [ 11.161960] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.1-1 04/01/2014
    [ 11.161960] Call Trace:
    [ 11.161960] dump_stack+0x72/0xa3
    [ 11.161960] __lock_acquire+0xb7c/0xcb9
    [ 11.161960] ? kvm_clock_read+0x1f/0x29
    [ 11.161960] ? __lock_is_held+0x36/0x66
    [ 11.161960] ? __lock_is_held+0x36/0x66
    [ 11.161960] lock_acquire+0x106/0x18a
    [ 11.161960] ? ext4_expand_extra_isize_ea+0x3d/0x4cd
    [ 11.161960] down_write+0x39/0x72
    [ 11.161960] ? ext4_expand_extra_isize_ea+0x3d/0x4cd
    [ 11.161960] ext4_expand_extra_isize_ea+0x3d/0x4cd
    [ 11.161960] ? _raw_read_unlock+0x22/0x2c
    [ 11.161960] ? jbd2_journal_extend+0x1e2/0x262
    [ 11.161960] ? __ext4_journal_get_write_access+0x3d/0x60
    [ 11.161960] ext4_mark_inode_dirty+0x17d/0x26d
    [ 11.161960] ? ext4_add_dirent_to_inline.isra.12+0xa5/0xb2
    [ 11.161960] ext4_add_dirent_to_inline.isra.12+0xa5/0xb2
    [ 11.161960] ext4_try_add_inline_entry+0x69/0x152
    [ 11.161960] ext4_add_entry+0xa3/0x848
    [ 11.161960] ? __brelse+0x14/0x2f
    [ 11.161960] ? _raw_spin_unlock_irqrestore+0x44/0x4f
    [ 11.161960] ext4_add_nondir+0x17/0x5b
    [ 11.161960] ext4_create+0xcf/0x133
    [ 11.161960] ? ext4_mknod+0x12f/0x12f
    [ 11.161960] lookup_open+0x39e/0x3fb
    [ 11.161960] ? __wake_up+0x1a/0x40
    [ 11.161960] ? lock_acquire+0x11e/0x18a
    [ 11.161960] path_openat+0x35c/0x67a
    [ 11.161960] ? sched_clock_cpu+0xd7/0xf2
    [ 11.161960] do_filp_open+0x36/0x7c
    [ 11.161960] ? _raw_spin_unlock+0x22/0x2c
    [ 11.161960] ? __alloc_fd+0x169/0x173
    [ 11.161960] do_sys_open+0x59/0xcc
    [ 11.161960] SyS_open+0x1d/0x1f
    [ 11.161960] do_int80_syscall_32+0x4f/0x61
    [ 11.161960] entry_INT80_32+0x2f/0x2f
    [ 11.161960] EIP: 0xb76ad469
    [ 11.161960] EFLAGS: 00000286 CPU: 0
    [ 11.161960] EAX: ffffffda EBX: 08168ac8 ECX: 00008241 EDX: 000001b6
    [ 11.161960] ESI: b75e46bc EDI: b7755000 EBP: bfbdb108 ESP: bfbdafc0
    [ 11.161960] DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 007b

    Reported-by: George Spelvin
    Signed-off-by: Theodore Ts'o
    Signed-off-by: Greg Kroah-Hartman

    Theodore Ts'o
     
  • commit 98d85f3cb912fde14593ead54dea4c1a00b3966f upstream.

    When the functions replaced media entity types, the range which was
    allowed for the types was incorrect. This meant that media entity types
    for specific devices were not passed correctly to the userspace through
    MEDIA_IOC_ENUM_ENTITIES. Fix it.

    Fixes: commit b2cd27448b33 ("[media] media-device: map new functions into old types for legacy API")
    Reported-and-tested-by: Antti Laakso

    Signed-off-by: Sakari Ailus
    Acked-by: Laurent Pinchart
    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Greg Kroah-Hartman

    Sakari Ailus
     
  • commit bd291208d7f5d6b2d6a033fee449a429230b06df upstream.

    Since "273b902 [media] lirc_dev: use LIRC_CAN_REC() define" these
    ioctls no longer work.

    Signed-off-by: Sean Young
    Reviewed-by: Andi Shyti
    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Greg Kroah-Hartman

    Sean Young
     
  • commit 0ffb94b6cc5df6376ab6bff5b80075641f6716f8 upstream.

    Setting GPIOs during probe causes null pointer deference when
    GPIOLIB was not selected by Kconfig. Initialize driver private
    field before calling set gpios.

    It is regressing bug since 4.9.

    Fixes: 07fdf7d9f19f ("[media] cxd2820r: add I2C driver bindings")

    Reported-by: Chris Rankin
    Tested-by: Chris Rankin
    Tested-by: Håkan Lennestål
    Signed-off-by: Antti Palosaari
    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Greg Kroah-Hartman

    Antti Palosaari
     
  • commit e3bb3cddd177550d63a3e4909cf1a7782f13414d upstream.

    Fix dm1105 build error when CONFIG_I2C_ALGOBIT=m and
    CONFIG_DVB_DM1105=y.

    drivers/built-in.o: In function `dm1105_probe':
    dm1105.c:(.text+0x2836e7): undefined reference to `i2c_bit_add_bus'

    Signed-off-by: Randy Dunlap
    Reported-by: kbuild test robot
    Cc: Javier Martinez Canillas
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Greg Kroah-Hartman

    Randy Dunlap
     
  • commit 17c341ec0115837a610b2da15e32546e26068234 upstream.

    Don't mix up UVC_BUF_STATE_* and VB2_BUF_STATE_* codes.

    Fixes: 6998b6fb4b1c ("[media] uvcvideo: Use videobuf2-vmalloc")

    Signed-off-by: Guennadi Liakhovetski
    Signed-off-by: Laurent Pinchart
    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Greg Kroah-Hartman

    Guennadi Liakhovetski
     
  • commit 6ebf75774f823ddbdbd10921006989d4df222f4a upstream.

    In vpfe_s_fmt(), when the sensor format and the requested format were
    the same, bpp was assigned to vpfe->bpp without being initialized first.

    Grab the bpp value that is currently used by using __vpfe_get_format()
    instead of its wrapper, vpfe_try_fmt().

    This use of uninitialized variable has been found by compiling the
    kernel with clang.

    Fixes: 417d2e507edc ("[media] media: platform: add VPFE capture driver
    support for AM437X")

    Signed-off-by: Nicolas Iooss
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Greg Kroah-Hartman

    Nicolas Iooss
     
  • commit e28d6f048799acb0014491e6b74e580d84bd7916 upstream.

    With commit 67bf5156edc4 ("gpio / ACPI: fix returned error from
    acpi_dev_gpio_irq_get()"), mmc_gpiod_request_cd() returns -EPROBE_DEFER if
    GPIO is not ready when sdhci-acpi driver is probed, and sdhci-acpi driver
    should be probed again later in this case.

    This fixes an order issue when both GPIO and sdhci-acpi drivers are built
    as modules.

    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=177101
    Tested-by: Jonas Aaberg
    Signed-off-by: Zhang Rui
    Acked-by: Adrian Hunter
    Signed-off-by: Ulf Hansson
    Signed-off-by: Greg Kroah-Hartman

    Zhang Rui
     
  • commit 096a0de427ea333f56f0ee00328cff2a2731bcf1 upstream.

    is_jump_ins() checks for plain jump ("j") instructions since commit
    e7438c4b893e ("MIPS: Fix sibling call handling in get_frame_info") but
    that commit didn't make the same change to the microMIPS code, leaving
    it inconsistent with the MIPS32/MIPS64 code. Handle the microMIPS
    encoding of the jump instruction too such that it behaves consistently.

    Signed-off-by: Paul Burton
    Fixes: e7438c4b893e ("MIPS: Fix sibling call handling in get_frame_info")
    Cc: Tony Wu
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/14533/
    Signed-off-by: Ralf Baechle
    Signed-off-by: Greg Kroah-Hartman

    Paul Burton