Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.8.x+fslc #7

Merged
merged 184 commits into from
Jan 23, 2017
Merged

4.8.x+fslc #7

merged 184 commits into from
Jan 23, 2017

Commits on Jan 6, 2017

  1. aoe: fix crash in page count manipulation

    commit 0cbc72a upstream.
    
    aoeblk contains some mysterious code, that wants to elevate the bio
    vec page counts while it's under IO. That is not needed, it's
    fragile, and it's causing kernel oopses for some.
    
    Reported-by: Tested-by: Don Koch <[email protected]>
    Tested-by: Tested-by: Don Koch <[email protected]>
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    axboe authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    f080d70 View commit details
    Browse the repository at this point in the history
  2. btrfs: limit async_work allocation and worker func duration

    commit 2939e1a upstream.
    
    Problem statement: unprivileged user who has read-write access to more than
    one btrfs subvolume may easily consume all kernel memory (eventually
    triggering oom-killer).
    
    Reproducer (./mkrmdir below essentially loops over mkdir/rmdir):
    
    [root@kteam1 ~]# cat prep.sh
    
    DEV=/dev/sdb
    mkfs.btrfs -f $DEV
    mount $DEV /mnt
    for i in `seq 1 16`
    do
    	mkdir /mnt/$i
    	btrfs subvolume create /mnt/SV_$i
    	ID=`btrfs subvolume list /mnt |grep "SV_$i$" |cut -d ' ' -f 2`
    	mount -t btrfs -o subvolid=$ID $DEV /mnt/$i
    	chmod a+rwx /mnt/$i
    done
    
    [root@kteam1 ~]# sh prep.sh
    
    [maxim@kteam1 ~]$ for i in `seq 1 16`; do ./mkrmdir /mnt/$i 2000 2000 & done
    
    [root@kteam1 ~]# for i in `seq 1 4`; do grep "kmalloc-128" /proc/slabinfo | grep -v dma; sleep 60; done
    kmalloc-128        10144  10144    128   32    1 : tunables    0    0    0 : slabdata    317    317      0
    kmalloc-128       9992352 9992352    128   32    1 : tunables    0    0    0 : slabdata 312261 312261      0
    kmalloc-128       24226752 24226752    128   32    1 : tunables    0    0    0 : slabdata 757086 757086      0
    kmalloc-128       42754240 42754240    128   32    1 : tunables    0    0    0 : slabdata 1336070 1336070      0
    
    The huge numbers above come from insane number of async_work-s allocated
    and queued by btrfs_wq_run_delayed_node.
    
    The problem is caused by btrfs_wq_run_delayed_node() queuing more and more
    works if the number of delayed items is above BTRFS_DELAYED_BACKGROUND. The
    worker func (btrfs_async_run_delayed_root) processes at least
    BTRFS_DELAYED_BATCH items (if they are present in the list). So, the machinery
    works as expected while the list is almost empty. As soon as it is getting
    bigger, worker func starts to process more than one item at a time, it takes
    longer, and the chances to have async_works queued more than needed is getting
    higher.
    
    The problem above is worsened by another flaw of delayed-inode implementation:
    if async_work was queued in a throttling branch (number of items >=
    BTRFS_DELAYED_WRITEBACK), corresponding worker func won't quit until
    the number of items < BTRFS_DELAYED_BACKGROUND / 2. So, it is possible that
    the func occupies CPU infinitely (up to 30sec in my experiments): while the
    func is trying to drain the list, the user activity may add more and more
    items to the list.
    
    The patch fixes both problems in straightforward way: refuse queuing too
    many works in btrfs_wq_run_delayed_node and bail out of worker func if
    at least BTRFS_DELAYED_WRITEBACK items are processed.
    
    Changed in v2: remove support of thresh == NO_THRESHOLD.
    
    Signed-off-by: Maxim Patlasov <[email protected]>
    Signed-off-by: Chris Mason <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Maxim Patlasov authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    562de9c View commit details
    Browse the repository at this point in the history
  3. Btrfs: fix BUG_ON in btrfs_mark_buffer_dirty

    commit ef85b25 upstream.
    
    This can only happen with CONFIG_BTRFS_FS_CHECK_INTEGRITY=y.
    
    Commit 1ba98d0 ("Btrfs: detect corruption when non-root leaf has zero item")
    assumes that a leaf is its root when leaf->bytenr == btrfs_root_bytenr(root),
    however, we should not use btrfs_root_bytenr(root) since it's mainly got
    updated during committing transaction.  So the check can fail when doing
    COW on this leaf while it is a root.
    
    This changes to use "if (leaf == btrfs_root_node(root))" instead, just like
    how we check whether leaf is a root in __btrfs_cow_block().
    
    Fixes: 1ba98d0 (Btrfs: detect corruption when non-root leaf has zero item)
    Reported-by: Jeff Mahoney <[email protected]>
    Signed-off-by: Liu Bo <[email protected]>
    Reviewed-by: Filipe Manana <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Liu Bo authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    361e821 View commit details
    Browse the repository at this point in the history
  4. Btrfs: fix deadlock caused by fsync when logging directory entries

    commit ec125cf upstream.
    
    While logging new directory entries, at tree-log.c:log_new_dir_dentries(),
    after we call btrfs_search_forward() we get a leaf with a read lock on it,
    and without unlocking that leaf we can end up calling btrfs_iget() to get
    an inode pointer. The later (btrfs_iget()) can end up doing a read-only
    search on the same tree again, if the inode is not in memory already, which
    ends up causing a deadlock if some other task in the meanwhile started a
    write search on the tree and is attempting to write lock the same leaf
    that btrfs_search_forward() locked while holding write locks on upper
    levels of the tree blocking the read search from btrfs_iget(). In this
    scenario we get a deadlock.
    
    So fix this by releasing the search path before calling btrfs_iget() at
    tree-log.c:log_new_dir_dentries().
    
    Example trace of such deadlock:
    
    [ 4077.478852] kworker/u24:10  D ffff88107fc90640     0 14431      2 0x00000000
    [ 4077.486752] Workqueue: btrfs-endio-write btrfs_endio_write_helper [btrfs]
    [ 4077.494346]  ffff880ffa56bad0 0000000000000046 0000000000009000 ffff880ffa56bfd8
    [ 4077.502629]  ffff880ffa56bfd8 ffff881016ce21c0 ffffffffa06ecb26 ffff88101a5d6138
    [ 4077.510915]  ffff880ebb5173b0 ffff880ffa56baf8 ffff880ebb517410 ffff881016ce21c0
    [ 4077.519202] Call Trace:
    [ 4077.528752]  [<ffffffffa06ed5ed>] ? btrfs_tree_lock+0xdd/0x2f0 [btrfs]
    [ 4077.536049]  [<ffffffff81053680>] ? wake_up_atomic_t+0x30/0x30
    [ 4077.542574]  [<ffffffffa068cc1f>] ? btrfs_search_slot+0x79f/0xb10 [btrfs]
    [ 4077.550171]  [<ffffffffa06a5073>] ? btrfs_lookup_file_extent+0x33/0x40 [btrfs]
    [ 4077.558252]  [<ffffffffa06c600b>] ? __btrfs_drop_extents+0x13b/0xdf0 [btrfs]
    [ 4077.566140]  [<ffffffffa06fc9e2>] ? add_delayed_data_ref+0xe2/0x150 [btrfs]
    [ 4077.573928]  [<ffffffffa06fd629>] ? btrfs_add_delayed_data_ref+0x149/0x1d0 [btrfs]
    [ 4077.582399]  [<ffffffffa06cf3c0>] ? __set_extent_bit+0x4c0/0x5c0 [btrfs]
    [ 4077.589896]  [<ffffffffa06b4a64>] ? insert_reserved_file_extent.constprop.75+0xa4/0x320 [btrfs]
    [ 4077.599632]  [<ffffffffa06b206d>] ? start_transaction+0x8d/0x470 [btrfs]
    [ 4077.607134]  [<ffffffffa06bab57>] ? btrfs_finish_ordered_io+0x2e7/0x600 [btrfs]
    [ 4077.615329]  [<ffffffff8104cbc2>] ? process_one_work+0x142/0x3d0
    [ 4077.622043]  [<ffffffff8104d729>] ? worker_thread+0x109/0x3b0
    [ 4077.628459]  [<ffffffff8104d620>] ? manage_workers.isra.26+0x270/0x270
    [ 4077.635759]  [<ffffffff81052b0f>] ? kthread+0xaf/0xc0
    [ 4077.641404]  [<ffffffff81052a60>] ? kthread_create_on_node+0x110/0x110
    [ 4077.648696]  [<ffffffff814a9ac8>] ? ret_from_fork+0x58/0x90
    [ 4077.654926]  [<ffffffff81052a60>] ? kthread_create_on_node+0x110/0x110
    
    [ 4078.358087] kworker/u24:15  D ffff88107fcd0640     0 14436      2 0x00000000
    [ 4078.365981] Workqueue: btrfs-endio-write btrfs_endio_write_helper [btrfs]
    [ 4078.373574]  ffff880ffa57fad0 0000000000000046 0000000000009000 ffff880ffa57ffd8
    [ 4078.381864]  ffff880ffa57ffd8 ffff88103004d0a0 ffffffffa06ecb26 ffff88101a5d6138
    [ 4078.390163]  ffff880fbeffc298 ffff880ffa57faf8 ffff880fbeffc2f8 ffff88103004d0a0
    [ 4078.398466] Call Trace:
    [ 4078.408019]  [<ffffffffa06ed5ed>] ? btrfs_tree_lock+0xdd/0x2f0 [btrfs]
    [ 4078.415322]  [<ffffffff81053680>] ? wake_up_atomic_t+0x30/0x30
    [ 4078.421844]  [<ffffffffa068cc1f>] ? btrfs_search_slot+0x79f/0xb10 [btrfs]
    [ 4078.429438]  [<ffffffffa06a5073>] ? btrfs_lookup_file_extent+0x33/0x40 [btrfs]
    [ 4078.437518]  [<ffffffffa06c600b>] ? __btrfs_drop_extents+0x13b/0xdf0 [btrfs]
    [ 4078.445404]  [<ffffffffa06fc9e2>] ? add_delayed_data_ref+0xe2/0x150 [btrfs]
    [ 4078.453194]  [<ffffffffa06fd629>] ? btrfs_add_delayed_data_ref+0x149/0x1d0 [btrfs]
    [ 4078.461663]  [<ffffffffa06cf3c0>] ? __set_extent_bit+0x4c0/0x5c0 [btrfs]
    [ 4078.469161]  [<ffffffffa06b4a64>] ? insert_reserved_file_extent.constprop.75+0xa4/0x320 [btrfs]
    [ 4078.478893]  [<ffffffffa06b206d>] ? start_transaction+0x8d/0x470 [btrfs]
    [ 4078.486388]  [<ffffffffa06bab57>] ? btrfs_finish_ordered_io+0x2e7/0x600 [btrfs]
    [ 4078.494561]  [<ffffffff8104cbc2>] ? process_one_work+0x142/0x3d0
    [ 4078.501278]  [<ffffffff8104a507>] ? pwq_activate_delayed_work+0x27/0x40
    [ 4078.508673]  [<ffffffff8104d729>] ? worker_thread+0x109/0x3b0
    [ 4078.515098]  [<ffffffff8104d620>] ? manage_workers.isra.26+0x270/0x270
    [ 4078.522396]  [<ffffffff81052b0f>] ? kthread+0xaf/0xc0
    [ 4078.528032]  [<ffffffff81052a60>] ? kthread_create_on_node+0x110/0x110
    [ 4078.535325]  [<ffffffff814a9ac8>] ? ret_from_fork+0x58/0x90
    [ 4078.541552]  [<ffffffff81052a60>] ? kthread_create_on_node+0x110/0x110
    
    [ 4079.355824] user-space-program D ffff88107fd30640     0 32020      1 0x00000000
    [ 4079.363716]  ffff880eae8eba10 0000000000000086 0000000000009000 ffff880eae8ebfd8
    [ 4079.372003]  ffff880eae8ebfd8 ffff881016c162c0 ffffffffa06ecb26 ffff88101a5d6138
    [ 4079.380294]  ffff880fbed4b4c8 ffff880eae8eba38 ffff880fbed4b528 ffff881016c162c0
    [ 4079.388586] Call Trace:
    [ 4079.398134]  [<ffffffffa06ed595>] ? btrfs_tree_lock+0x85/0x2f0 [btrfs]
    [ 4079.405431]  [<ffffffff81053680>] ? wake_up_atomic_t+0x30/0x30
    [ 4079.411955]  [<ffffffffa06876fb>] ? btrfs_lock_root_node+0x2b/0x40 [btrfs]
    [ 4079.419644]  [<ffffffffa068ce83>] ? btrfs_search_slot+0xa03/0xb10 [btrfs]
    [ 4079.427237]  [<ffffffffa06aba52>] ? btrfs_buffer_uptodate+0x52/0x70 [btrfs]
    [ 4079.435041]  [<ffffffffa0689b60>] ? generic_bin_search.constprop.38+0x80/0x190 [btrfs]
    [ 4079.443897]  [<ffffffffa068ea44>] ? btrfs_insert_empty_items+0x74/0xd0 [btrfs]
    [ 4079.451975]  [<ffffffffa072c443>] ? copy_items+0x128/0x850 [btrfs]
    [ 4079.458890]  [<ffffffffa072da10>] ? btrfs_log_inode+0x629/0xbf3 [btrfs]
    [ 4079.466292]  [<ffffffffa06f34a1>] ? btrfs_log_inode_parent+0xc61/0xf30 [btrfs]
    [ 4079.474373]  [<ffffffffa06f45a9>] ? btrfs_log_dentry_safe+0x59/0x80 [btrfs]
    [ 4079.482161]  [<ffffffffa06c298d>] ? btrfs_sync_file+0x20d/0x330 [btrfs]
    [ 4079.489558]  [<ffffffff8112777c>] ? do_fsync+0x4c/0x80
    [ 4079.495300]  [<ffffffff81127a0a>] ? SyS_fdatasync+0xa/0x10
    [ 4079.501422]  [<ffffffff814a9b72>] ? system_call_fastpath+0x16/0x1b
    
    [ 4079.508334] user-space-program D ffff88107fc30640     0 32021      1 0x00000004
    [ 4079.516226]  ffff880eae8efbf8 0000000000000086 0000000000009000 ffff880eae8effd8
    [ 4079.524513]  ffff880eae8effd8 ffff881030279610 ffffffffa06ecb26 ffff88101a5d6138
    [ 4079.532802]  ffff880ebb671d88 ffff880eae8efc20 ffff880ebb671de8 ffff881030279610
    [ 4079.541092] Call Trace:
    [ 4079.550642]  [<ffffffffa06ed595>] ? btrfs_tree_lock+0x85/0x2f0 [btrfs]
    [ 4079.557941]  [<ffffffff81053680>] ? wake_up_atomic_t+0x30/0x30
    [ 4079.564463]  [<ffffffffa068cc1f>] ? btrfs_search_slot+0x79f/0xb10 [btrfs]
    [ 4079.572058]  [<ffffffffa06bb7d8>] ? btrfs_truncate_inode_items+0x168/0xb90 [btrfs]
    [ 4079.580526]  [<ffffffffa06b04be>] ? join_transaction.isra.15+0x1e/0x3a0 [btrfs]
    [ 4079.588701]  [<ffffffffa06b206d>] ? start_transaction+0x8d/0x470 [btrfs]
    [ 4079.596196]  [<ffffffffa0690ac6>] ? block_rsv_add_bytes+0x16/0x50 [btrfs]
    [ 4079.603789]  [<ffffffffa06bc2e9>] ? btrfs_truncate+0xe9/0x2e0 [btrfs]
    [ 4079.610994]  [<ffffffffa06bd00b>] ? btrfs_setattr+0x30b/0x410 [btrfs]
    [ 4079.618197]  [<ffffffff81117c1c>] ? notify_change+0x1dc/0x680
    [ 4079.624625]  [<ffffffff8123c8a4>] ? aa_path_perm+0xd4/0x160
    [ 4079.630854]  [<ffffffff810f4fcb>] ? do_truncate+0x5b/0x90
    [ 4079.636889]  [<ffffffff810f59fa>] ? do_sys_ftruncate.constprop.15+0x10a/0x160
    [ 4079.644869]  [<ffffffff8110d87b>] ? SyS_fcntl+0x5b/0x570
    [ 4079.650805]  [<ffffffff814a9b72>] ? system_call_fastpath+0x16/0x1b
    
    [ 4080.410607] user-space-program D ffff88107fc70640     0 32028  12639 0x00000004
    [ 4080.418489]  ffff880eaeccbbe0 0000000000000086 0000000000009000 ffff880eaeccbfd8
    [ 4080.426778]  ffff880eaeccbfd8 ffff880f317ef1e0 ffffffffa06ecb26 ffff88101a5d6138
    [ 4080.435067]  ffff880ef7e93928 ffff880f317ef1e0 ffff880eaeccbc08 ffff880f317ef1e0
    [ 4080.443353] Call Trace:
    [ 4080.452920]  [<ffffffffa06ed15d>] ? btrfs_tree_read_lock+0xdd/0x190 [btrfs]
    [ 4080.460703]  [<ffffffff81053680>] ? wake_up_atomic_t+0x30/0x30
    [ 4080.467225]  [<ffffffffa06876bb>] ? btrfs_read_lock_root_node+0x2b/0x40 [btrfs]
    [ 4080.475400]  [<ffffffffa068cc81>] ? btrfs_search_slot+0x801/0xb10 [btrfs]
    [ 4080.482994]  [<ffffffffa06b2df0>] ? btrfs_clean_one_deleted_snapshot+0xe0/0xe0 [btrfs]
    [ 4080.491857]  [<ffffffffa06a70a6>] ? btrfs_lookup_inode+0x26/0x90 [btrfs]
    [ 4080.499353]  [<ffffffff810ec42f>] ? kmem_cache_alloc+0xaf/0xc0
    [ 4080.505879]  [<ffffffffa06bd905>] ? btrfs_iget+0xd5/0x5d0 [btrfs]
    [ 4080.512696]  [<ffffffffa06caf04>] ? btrfs_get_token_64+0x104/0x120 [btrfs]
    [ 4080.520387]  [<ffffffffa06f341f>] ? btrfs_log_inode_parent+0xbdf/0xf30 [btrfs]
    [ 4080.528469]  [<ffffffffa06f45a9>] ? btrfs_log_dentry_safe+0x59/0x80 [btrfs]
    [ 4080.536258]  [<ffffffffa06c298d>] ? btrfs_sync_file+0x20d/0x330 [btrfs]
    [ 4080.543657]  [<ffffffff8112777c>] ? do_fsync+0x4c/0x80
    [ 4080.549399]  [<ffffffff81127a0a>] ? SyS_fdatasync+0xa/0x10
    [ 4080.555534]  [<ffffffff814a9b72>] ? system_call_fastpath+0x16/0x1b
    
    Signed-off-by: Robbie Ko <[email protected]>
    Reviewed-by: Filipe Manana <[email protected]>
    Fixes: 2f2ff0e (Btrfs: fix metadata inconsistencies after directory fsync)
    Signed-off-by: Filipe Manana <[email protected]>
    [Modified changelog for clarity and correctness]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Robbie Ko authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    65553a0 View commit details
    Browse the repository at this point in the history
  5. Btrfs: fix tree search logic when replaying directory entry deletes

    commit 2a7bf53 upstream.
    
    If a log tree has a layout like the following:
    
    leaf N:
            ...
            item 240 key (282 DIR_LOG_ITEM 0) itemoff 8189 itemsize 8
                    dir log end 1275809046
    leaf N + 1:
            item 0 key (282 DIR_LOG_ITEM 3936149215) itemoff 16275 itemsize 8
                    dir log end 18446744073709551615
            ...
    
    When we pass the value 1275809046 + 1 as the parameter start_ret to the
    function tree-log.c:find_dir_range() (done by replay_dir_deletes()), we
    end up with path->slots[0] having the value 239 (points to the last item
    of leaf N, item 240). Because the dir log item in that position has an
    offset value smaller than *start_ret (1275809046 + 1) we need to move on
    to the next leaf, however the logic for that is wrong since it compares
    the current slot to the number of items in the leaf, which is smaller
    and therefore we don't lookup for the next leaf but instead we set the
    slot to point to an item that does not exist, at slot 240, and we later
    operate on that slot which has unexpected content or in the worst case
    can result in an invalid memory access (accessing beyond the last page
    of leaf N's extent buffer).
    
    So fix the logic that checks when we need to lookup at the next leaf
    by first incrementing the slot and only after to check if that slot
    is beyond the last item of the current leaf.
    
    Signed-off-by: Robbie Ko <[email protected]>
    Reviewed-by: Filipe Manana <[email protected]>
    Fixes: e02119d (Btrfs: Add a write ahead tree log to optimize synchronous operations)
    Signed-off-by: Filipe Manana <[email protected]>
    [Modified changelog for clarity and correctness]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Robbie Ko authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    f1b268d View commit details
    Browse the repository at this point in the history
  6. Btrfs: fix relocation incorrectly dropping data references

    commit 054570a upstream.
    
    During relocation of a data block group we create a relocation tree
    for each fs/subvol tree by making a snapshot of each tree using
    btrfs_copy_root() and the tree's commit root, and then setting the last
    snapshot field for the fs/subvol tree's root to the value of the current
    transaction id minus 1. However this can lead to relocation later
    dropping references that it did not create if we have qgroups enabled,
    leaving the filesystem in an inconsistent state that keeps aborting
    transactions.
    
    Lets consider the following example to explain the problem, which requires
    qgroups to be enabled.
    
    We are relocating data block group Y, we have a subvolume with id 258 that
    has a root at level 1, that subvolume is used to store directory entries
    for snapshots and we are currently at transaction 3404.
    
    When committing transaction 3404, we have a pending snapshot and therefore
    we call btrfs_run_delayed_items() at transaction.c:create_pending_snapshot()
    in order to create its dentry at subvolume 258. This results in COWing
    leaf A from root 258 in order to add the dentry. Note that leaf A
    also contains file extent items referring to extents from some other
    block group X (we are currently relocating block group Y). Later on, still
    at create_pending_snapshot() we call qgroup_account_snapshot(), which
    switches the commit root for root 258 when it calls switch_commit_roots(),
    so now the COWed version of leaf A, lets call it leaf A', is accessible
    from the commit root of tree 258. At the end of qgroup_account_snapshot(),
    we call record_root_in_trans() with 258 as its argument, which results
    in btrfs_init_reloc_root() being called, which in turn calls
    relocation.c:create_reloc_root() in order to create a relocation tree
    associated to root 258, which results in assigning the value of 3403
    (which is the current transaction id minus 1 = 3404 - 1) to the
    last_snapshot field of root 258. When creating the relocation tree root
    at ctree.c:btrfs_copy_root() we add a shared reference for leaf A',
    corresponding to the relocation tree's root, when we call btrfs_inc_ref()
    against the COWed root (a copy of the commit root from tree 258), which
    is at level 1. So at this point leaf A' has 2 references, one normal
    reference corresponding to root 258 and one shared reference corresponding
    to the root of the relocation tree.
    
    Transaction 3404 finishes its commit and transaction 3405 is started by
    relocation when calling merge_reloc_root() for the relocation tree
    associated to root 258. In the meanwhile leaf A' is COWed again, in
    response to some filesystem operation, when we are still at transaction
    3405. However when we COW leaf A', at ctree.c:update_ref_for_cow(), we
    call btrfs_block_can_be_shared() in order to figure out if other trees
    refer to the leaf and if any such trees exists, add a full back reference
    to leaf A' - but btrfs_block_can_be_shared() incorrectly returns false
    because the following condition is false:
    
      btrfs_header_generation(buf) <= btrfs_root_last_snapshot(&root->root_item)
    
    which evaluates to 3404 <= 3403. So after leaf A' is COWed, it stays with
    only one reference, corresponding to the shared reference we created when
    we called btrfs_copy_root() to create the relocation tree's root and
    btrfs_inc_ref() ends up not being called for leaf A' nor we end up setting
    the flag BTRFS_BLOCK_FLAG_FULL_BACKREF in leaf A'. This results in not
    adding shared references for the extents from block group X that leaf A'
    refers to with its file extent items.
    
    Later, after merging the relocation root we do a call to to
    btrfs_drop_snapshot() in order to delete the relocation tree. This ends
    up calling do_walk_down() when path->slots[1] points to leaf A', which
    results in calling btrfs_lookup_extent_info() to get the number of
    references for leaf A', which is 1 at this time (only the shared reference
    exists) and this value is stored at wc->refs[0]. After this walk_up_proc()
    is called when wc->level is 0 and path->nodes[0] corresponds to leaf A'.
    Because the current level is 0 and wc->refs[0] is 1, it does call
    btrfs_dec_ref() against leaf A', which results in removing the single
    references that the extents from block group X have which are associated
    to root 258 - the expectation was to have each of these extents with 2
    references - one reference for root 258 and one shared reference related
    to the root of the relocation tree, and so we would drop only the shared
    reference (because leaf A' was supposed to have the flag
    BTRFS_BLOCK_FLAG_FULL_BACKREF set).
    
    This leaves the filesystem in an inconsistent state as we now have file
    extent items in a subvolume tree that point to extents from block group X
    without references in the extent tree. So later on when we try to decrement
    the references for these extents, for example due to a file unlink operation,
    truncate operation or overwriting ranges of a file, we fail because the
    expected references do not exist in the extent tree.
    
    This leads to warnings and transaction aborts like the following:
    
    [  588.965795] ------------[ cut here ]------------
    [  588.965815] WARNING: CPU: 2 PID: 2479 at fs/btrfs/extent-tree.c:1625 lookup_inline_extent_backref+0x432/0x5b0 [btrfs]
    [  588.965816] Modules linked in: af_packet iscsi_ibft iscsi_boot_sysfs xfs libcrc32c ppdev acpi_cpufreq button tpm_tis e1000 i2c_piix4 pcspkr parport_pc
    parport tpm qemu_fw_cfg joydev btrfs xor raid6_pq sr_mod cdrom ata_generic virtio_scsi ata_piix virtio_pci bochs_drm virtio_ring drm_kms_helper syscopyarea
    sysfillrect sysimgblt fb_sys_fops virtio ttm serio_raw drm floppy sg
    [  588.965831] CPU: 2 PID: 2479 Comm: kworker/u8:7 Not tainted 4.7.3-3-default-fdm+ Freescale#1
    [  588.965832] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.1-0-gb3ef39f-prebuilt.qemu-project.org 04/01/2014
    [  588.965844] Workqueue: btrfs-extent-refs btrfs_extent_refs_helper [btrfs]
    [  588.965845]  0000000000000000 ffff8802263bfa28 ffffffff813af542 0000000000000000
    [  588.965847]  0000000000000000 ffff8802263bfa68 ffffffff81081e8b 0000065900000000
    [  588.965848]  ffff8801db2af000 000000012bbe2000 0000000000000000 ffff880215703b48
    [  588.965849] Call Trace:
    [  588.965852]  [<ffffffff813af542>] dump_stack+0x63/0x81
    [  588.965854]  [<ffffffff81081e8b>] __warn+0xcb/0xf0
    [  588.965855]  [<ffffffff81081f7d>] warn_slowpath_null+0x1d/0x20
    [  588.965863]  [<ffffffffa0175042>] lookup_inline_extent_backref+0x432/0x5b0 [btrfs]
    [  588.965865]  [<ffffffff81143220>] ? trace_clock_local+0x10/0x30
    [  588.965867]  [<ffffffff8114c5df>] ? rb_reserve_next_event+0x6f/0x460
    [  588.965875]  [<ffffffffa0175215>] insert_inline_extent_backref+0x55/0xd0 [btrfs]
    [  588.965882]  [<ffffffffa017531f>] __btrfs_inc_extent_ref.isra.55+0x8f/0x240 [btrfs]
    [  588.965890]  [<ffffffffa017acea>] __btrfs_run_delayed_refs+0x74a/0x1260 [btrfs]
    [  588.965892]  [<ffffffff810cb046>] ? cpuacct_charge+0x86/0xa0
    [  588.965900]  [<ffffffffa017e74f>] btrfs_run_delayed_refs+0x9f/0x2c0 [btrfs]
    [  588.965908]  [<ffffffffa017ea04>] delayed_ref_async_start+0x94/0xb0 [btrfs]
    [  588.965918]  [<ffffffffa01c799a>] btrfs_scrubparity_helper+0xca/0x350 [btrfs]
    [  588.965928]  [<ffffffffa01c7c5e>] btrfs_extent_refs_helper+0xe/0x10 [btrfs]
    [  588.965930]  [<ffffffff8109b323>] process_one_work+0x1f3/0x4e0
    [  588.965931]  [<ffffffff8109b658>] worker_thread+0x48/0x4e0
    [  588.965932]  [<ffffffff8109b610>] ? process_one_work+0x4e0/0x4e0
    [  588.965934]  [<ffffffff810a1659>] kthread+0xc9/0xe0
    [  588.965936]  [<ffffffff816f2f1f>] ret_from_fork+0x1f/0x40
    [  588.965937]  [<ffffffff810a1590>] ? kthread_worker_fn+0x170/0x170
    [  588.965938] ---[ end trace 34e5232c933a1749 ]---
    [  588.966187] ------------[ cut here ]------------
    [  588.966196] WARNING: CPU: 2 PID: 2479 at fs/btrfs/extent-tree.c:2966 btrfs_run_delayed_refs+0x28c/0x2c0 [btrfs]
    [  588.966196] BTRFS: Transaction aborted (error -5)
    [  588.966197] Modules linked in: af_packet iscsi_ibft iscsi_boot_sysfs xfs libcrc32c ppdev acpi_cpufreq button tpm_tis e1000 i2c_piix4 pcspkr parport_pc
    parport tpm qemu_fw_cfg joydev btrfs xor raid6_pq sr_mod cdrom ata_generic virtio_scsi ata_piix virtio_pci bochs_drm virtio_ring drm_kms_helper syscopyarea
    sysfillrect sysimgblt fb_sys_fops virtio ttm serio_raw drm floppy sg
    [  588.966206] CPU: 2 PID: 2479 Comm: kworker/u8:7 Tainted: G        W       4.7.3-3-default-fdm+ Freescale#1
    [  588.966207] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.1-0-gb3ef39f-prebuilt.qemu-project.org 04/01/2014
    [  588.966217] Workqueue: btrfs-extent-refs btrfs_extent_refs_helper [btrfs]
    [  588.966217]  0000000000000000 ffff8802263bfc98 ffffffff813af542 ffff8802263bfce8
    [  588.966219]  0000000000000000 ffff8802263bfcd8 ffffffff81081e8b 00000b96345ee000
    [  588.966220]  ffffffffa021ae1c ffff880215703b48 00000000000005fe ffff8802345ee000
    [  588.966221] Call Trace:
    [  588.966223]  [<ffffffff813af542>] dump_stack+0x63/0x81
    [  588.966224]  [<ffffffff81081e8b>] __warn+0xcb/0xf0
    [  588.966225]  [<ffffffff81081eff>] warn_slowpath_fmt+0x4f/0x60
    [  588.966233]  [<ffffffffa017e93c>] btrfs_run_delayed_refs+0x28c/0x2c0 [btrfs]
    [  588.966241]  [<ffffffffa017ea04>] delayed_ref_async_start+0x94/0xb0 [btrfs]
    [  588.966250]  [<ffffffffa01c799a>] btrfs_scrubparity_helper+0xca/0x350 [btrfs]
    [  588.966259]  [<ffffffffa01c7c5e>] btrfs_extent_refs_helper+0xe/0x10 [btrfs]
    [  588.966260]  [<ffffffff8109b323>] process_one_work+0x1f3/0x4e0
    [  588.966261]  [<ffffffff8109b658>] worker_thread+0x48/0x4e0
    [  588.966263]  [<ffffffff8109b610>] ? process_one_work+0x4e0/0x4e0
    [  588.966264]  [<ffffffff810a1659>] kthread+0xc9/0xe0
    [  588.966265]  [<ffffffff816f2f1f>] ret_from_fork+0x1f/0x40
    [  588.966267]  [<ffffffff810a1590>] ? kthread_worker_fn+0x170/0x170
    [  588.966268] ---[ end trace 34e5232c933a174a ]---
    [  588.966269] BTRFS: error (device sda2) in btrfs_run_delayed_refs:2966: errno=-5 IO failure
    [  588.966270] BTRFS info (device sda2): forced readonly
    
    This was happening often on openSUSE and SLE systems using btrfs as the
    root filesystem (with its default layout where multiple subvolumes are
    used) where balance happens in the background triggered by a cron job and
    snapshots are automatically created before/after package installations,
    upgrades and removals. The issue could be triggered simply by running the
    following loop on the first system boot post installation:
    
      while true; do
         zypper -n in nfs-kernel-server
         zypper -n rm nfs-kernel-server
      done
    
    (If we were fast enough and made that loop before the cron job triggered
    a balance operation and the balance finished)
    
    So fix by setting the last_snapshot field of the root to the value of the
    generation of its commit root. Like this btrfs_block_can_be_shared()
    behaves correctly for the case where the relocation root is created during
    a transaction commit and for the case where it's created before a
    transaction commit.
    
    Fixes: 6426c7a (btrfs: qgroup: Fix qgroup accounting when creating snapshot)
    Signed-off-by: Filipe Manana <[email protected]>
    Reviewed-by: Josef Bacik <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    fdmanana authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    80f7d28 View commit details
    Browse the repository at this point in the history
  7. btrfs: store and load values of stripes_min/stripes_max in balance st…

    …atus item
    
    commit ed0df61 upstream.
    
    The balance status item contains currently known filter values, but the
    stripes filter was unintentionally not among them. This would mean, that
    interrupted and automatically restarted balance does not apply the
    stripe filters.
    
    Fixes: dee32d0
    Signed-off-by: David Sterba <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    kdave authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    0695d8b View commit details
    Browse the repository at this point in the history
  8. Btrfs: fix emptiness check for dirtied extent buffers at check_leaf()

    commit f177d73 upstream.
    
    We can not simply use the owner field from an extent buffer's header to
    get the id of the respective tree when the extent buffer is from a
    relocation tree. When we create the root for a relocation tree we leave
    (on purpose) the owner field with the same value as the subvolume's tree
    root (we do this at ctree.c:btrfs_copy_root()). So we must ignore extent
    buffers from relocation trees, which have the BTRFS_HEADER_FLAG_RELOC
    flag set, because otherwise we will always consider the extent buffer
    as not being the root of the tree (the root of original subvolume tree
    is always different from the root of the respective relocation tree).
    
    This lead to assertion failures when running with the integrity checker
    enabled (CONFIG_BTRFS_FS_CHECK_INTEGRITY=y) such as the following:
    
    [  643.393409] BTRFS critical (device sdg): corrupt leaf, non-root leaf's nritems is 0: block=38506496, root=260, slot=0
    [  643.397609] BTRFS info (device sdg): leaf 38506496 total ptrs 0 free space 3995
    [  643.407075] assertion failed: 0, file: fs/btrfs/disk-io.c, line: 4078
    [  643.408425] ------------[ cut here ]------------
    [  643.409112] kernel BUG at fs/btrfs/ctree.h:3419!
    [  643.409773] invalid opcode: 0000 [Freescale#1] PREEMPT SMP
    [  643.410447] Modules linked in: dm_flakey dm_mod crc32c_generic btrfs xor raid6_pq ppdev psmouse acpi_cpufreq parport_pc evdev parport tpm_tis tpm_tis_core pcspkr serio_raw i2c_piix4 sg tpm i2c_core button processor loop autofs4 ext4 crc16 jbd2 mbcache sr_mod cdrom sd_mod ata_generic virtio_scsi ata_piix libata virtio_pci virtio_ring scsi_mod virtio e1000 floppy
    [  643.414356] CPU: 11 PID: 32726 Comm: btrfs Not tainted 4.8.0-rc8-btrfs-next-35+ Freescale#1
    [  643.414356] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.1-0-gb3ef39f-prebuilt.qemu-project.org 04/01/2014
    [  643.414356] task: ffff880145e95b00 task.stack: ffff88014826c000
    [  643.414356] RIP: 0010:[<ffffffffa0352759>]  [<ffffffffa0352759>] assfail.constprop.41+0x1c/0x1e [btrfs]
    [  643.414356] RSP: 0018:ffff88014826fa28  EFLAGS: 00010292
    [  643.414356] RAX: 0000000000000039 RBX: ffff88014e2d7c38 RCX: 0000000000000001
    [  643.414356] RDX: ffff88023f4d2f58 RSI: ffffffff81806c63 RDI: 00000000ffffffff
    [  643.414356] RBP: ffff88014826fa28 R08: 0000000000000001 R09: 0000000000000000
    [  643.414356] R10: ffff88014826f918 R11: ffffffff82f3c5ed R12: ffff880172910000
    [  643.414356] R13: ffff880233992230 R14: ffff8801a68a3310 R15: fffffffffffffff8
    [  643.414356] FS:  00007f9ca305e8c0(0000) GS:ffff88023f4c0000(0000) knlGS:0000000000000000
    [  643.414356] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [  643.414356] CR2: 00007f9ca3071000 CR3: 000000015d01b000 CR4: 00000000000006e0
    [  643.414356] Stack:
    [  643.414356]  ffff88014826fa50 ffffffffa02d655a 000000000000000a ffff88014e2d7c38
    [  643.414356]  0000000000000000 ffff88014826faa8 ffffffffa02b72f3 ffff88014826fab8
    [  643.414356]  00ffffffa03228e4 0000000000000000 0000000000000000 ffff8801bbd4e000
    [  643.414356] Call Trace:
    [  643.414356]  [<ffffffffa02d655a>] btrfs_mark_buffer_dirty+0xdf/0xe5 [btrfs]
    [  643.414356]  [<ffffffffa02b72f3>] btrfs_copy_root+0x18a/0x1d1 [btrfs]
    [  643.414356]  [<ffffffffa0322921>] create_reloc_root+0x72/0x1ba [btrfs]
    [  643.414356]  [<ffffffffa03267c2>] btrfs_init_reloc_root+0x7b/0xa7 [btrfs]
    [  643.414356]  [<ffffffffa02d9e44>] record_root_in_trans+0xdf/0xed [btrfs]
    [  643.414356]  [<ffffffffa02db04e>] btrfs_record_root_in_trans+0x50/0x6a [btrfs]
    [  643.414356]  [<ffffffffa030ad2b>] create_subvol+0x472/0x773 [btrfs]
    [  643.414356]  [<ffffffffa030b406>] btrfs_mksubvol+0x3da/0x463 [btrfs]
    [  643.414356]  [<ffffffffa030b406>] ? btrfs_mksubvol+0x3da/0x463 [btrfs]
    [  643.414356]  [<ffffffff810781ac>] ? preempt_count_add+0x65/0x68
    [  643.414356]  [<ffffffff811a6e97>] ? __mnt_want_write+0x62/0x77
    [  643.414356]  [<ffffffffa030b55d>] btrfs_ioctl_snap_create_transid+0xce/0x187 [btrfs]
    [  643.414356]  [<ffffffffa030b67d>] btrfs_ioctl_snap_create+0x67/0x81 [btrfs]
    [  643.414356]  [<ffffffffa030ecfd>] btrfs_ioctl+0x508/0x20dd [btrfs]
    [  643.414356]  [<ffffffff81293e39>] ? __this_cpu_preempt_check+0x13/0x15
    [  643.414356]  [<ffffffff81155eca>] ? handle_mm_fault+0x976/0x9ab
    [  643.414356]  [<ffffffff81091300>] ? arch_local_irq_save+0x9/0xc
    [  643.414356]  [<ffffffff8119a2b0>] vfs_ioctl+0x18/0x34
    [  643.414356]  [<ffffffff8119a8e8>] do_vfs_ioctl+0x581/0x600
    [  643.414356]  [<ffffffff814b9552>] ? entry_SYSCALL_64_fastpath+0x5/0xa8
    [  643.414356]  [<ffffffff81093fe9>] ? trace_hardirqs_on_caller+0x17b/0x197
    [  643.414356]  [<ffffffff8119a9be>] SyS_ioctl+0x57/0x79
    [  643.414356]  [<ffffffff814b9565>] entry_SYSCALL_64_fastpath+0x18/0xa8
    [  643.414356]  [<ffffffff81091b08>] ? trace_hardirqs_off_caller+0x3f/0xaa
    [  643.414356] Code: 89 83 88 00 00 00 31 c0 5b 41 5c 41 5d 5d c3 55 89 f1 48 c7 c2 98 bc 35 a0 48 89 fe 48 c7 c7 05 be 35 a0 48 89 e5 e8 13 46 dd e0 <0f> 0b 55 89 f1 48 c7 c2 9f d3 35 a0 48 89 fe 48 c7 c7 7a d5 35
    [  643.414356] RIP  [<ffffffffa0352759>] assfail.constprop.41+0x1c/0x1e [btrfs]
    [  643.414356]  RSP <ffff88014826fa28>
    [  643.468267] ---[ end trace 6a1b3fb1a9d7d6e3 ]---
    
    This can be easily reproduced by running xfstests with the integrity
    checker enabled.
    
    Fixes: 1ba98d0 (Btrfs: detect corruption when non-root leaf has zero item)
    Signed-off-by: Filipe Manana <[email protected]>
    Reviewed-by: Liu Bo <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    fdmanana authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    691ea6c View commit details
    Browse the repository at this point in the history
  9. Btrfs: fix qgroup rescan worker initialization

    commit 8d9edda upstream.
    
    We were setting the qgroup_rescan_running flag to true only after the
    rescan worker started (which is a task run by a queue). So if a user
    space task starts a rescan and immediately after asks to wait for the
    rescan worker to finish, this second call might happen before the rescan
    worker task starts running, in which case the rescan wait ioctl returns
    immediatley, not waiting for the rescan worker to finish.
    
    This was making the fstest btrfs/022 fail very often.
    
    Fixes: d2c609b (btrfs: properly track when rescan worker is running)
    Signed-off-by: Filipe Manana <[email protected]>
    Reviewed-by: David Sterba <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    fdmanana authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    3aa3cb9 View commit details
    Browse the repository at this point in the history
  10. USB: serial: option: add support for Telit LE922A PIDs 0x1040, 0x1041

    commit 5b09eff upstream.
    
    This patch adds support for PIDs 0x1040, 0x1041 of Telit LE922A.
    
    Since the interface positions are the same than the ones used
    for other Telit compositions, previous defined blacklists are used.
    
    Signed-off-by: Daniele Palmas <[email protected]>
    Signed-off-by: Johan Hovold <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    dnlplm authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    e47e81c View commit details
    Browse the repository at this point in the history
  11. USB: serial: option: add dlink dwm-158

    commit d8a12b7 upstream.
    
    Adding registration for 3G modem DWM-158 in usb-serial-option
    
    Signed-off-by: Giuseppe Lippolis <[email protected]>
    Signed-off-by: Johan Hovold <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    fid0did0 authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    f34b7e0 View commit details
    Browse the repository at this point in the history
  12. USB: serial: kl5kusb105: fix open error path

    commit 6774d5f upstream.
    
    Kill urbs and disable read before returning from open on failure to
    retrieve the line state.
    
    Fixes: 1da177e ("Linux-2.6.12-rc2")
    Signed-off-by: Johan Hovold <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    jhovold authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    741523f View commit details
    Browse the repository at this point in the history
  13. USB: cdc-acm: add device id for GW Instek AFG-125

    commit 3012160 upstream.
    
    Add device-id entry for GW Instek AFG-125, which has a byte swapped
    bInterfaceSubClass (0x20).
    
    Signed-off-by: Nathaniel Quillin <[email protected]>
    Acked-by: Oliver Neukum <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Nathaniel Quillin authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    269edae View commit details
    Browse the repository at this point in the history
  14. usb: dwc3: gadget: set PCM1 field of isochronous-first TRBs

    commit 6b9018d upstream.
    
    In case of High-Speed, High-Bandwidth endpoints, we
    need to tell DWC3 that we have more than one packet
    per interval. We do that by setting PCM1 field of
    Isochronous-First TRB.
    
    Signed-off-by: Felipe Balbi <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Felipe Balbi authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    e3dfbc8 View commit details
    Browse the repository at this point in the history
  15. usb: hub: Fix auto-remount of safely removed or ejected USB-3 devices

    commit 37be667 upstream.
    
    USB-3 does not have any link state that will avoid negotiating a connection
    with a plugged-in cable but will signal the host when the cable is
    unplugged.
    
    For USB-3 we used to first set the link to Disabled, then to RxDdetect to
    be able to detect cable connects or disconnects. But in RxDetect the
    connected device is detected again and eventually enabled.
    
    Instead set the link into U3 and disable remote wakeups for the device.
    This is what Windows does, and what Alan Stern suggested.
    
    Cc: Alan Stern <[email protected]>
    Acked-by: Alan Stern <[email protected]>
    Signed-off-by: Mathias Nyman <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    matnyman authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    79d5a30 View commit details
    Browse the repository at this point in the history
  16. usb: gadget: f_uac2: fix error handling at afunc_bind

    commit f1d3861 upstream.
    
    The current error handling flow uses incorrect goto label, fix it
    
    Fixes: d12a872 ("usb: gadget: function: Remove redundant usb_free_all_descriptors")
    Signed-off-by: Peter Chen <[email protected]>
    Signed-off-by: Felipe Balbi <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Peter Chen authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    be8f1c4 View commit details
    Browse the repository at this point in the history
  17. usb: gadget: composite: correctly initialize ep->maxpacket

    commit e8f29bb upstream.
    
    usb_endpoint_maxp() returns wMaxPacketSize in its
    raw form. Without taking into consideration that it
    also contains other bits reserved for isochronous
    endpoints.
    
    This patch fixes one occasion where this is a
    problem by making sure that we initialize
    ep->maxpacket only with lower 10 bits of the value
    returned by usb_endpoint_maxp(). Note that seperate
    patches will be necessary to audit all call sites of
    usb_endpoint_maxp() and make sure that
    usb_endpoint_maxp() only returns lower 10 bits of
    wMaxPacketSize.
    
    Signed-off-by: Felipe Balbi <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Felipe Balbi authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    4422a26 View commit details
    Browse the repository at this point in the history
  18. USB: UHCI: report non-PME wakeup signalling for Intel hardware

    commit ccdb6be upstream.
    
    The UHCI controllers in Intel chipsets rely on a platform-specific non-PME
    mechanism for wakeup signalling.  They can generate wakeup signals even
    though they don't support PME.
    
    We need to let the USB core know this so that it will enable runtime
    suspend for UHCI controllers.
    
    Signed-off-by: Alan Stern <[email protected]>
    Signed-off-by: Bjorn Helgaas <[email protected]>
    Acked-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    AlanStern authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    a9143e5 View commit details
    Browse the repository at this point in the history
  19. usbip: vudc: fix: Clear already_seen flag also for ep0

    commit 3e448e1 upstream.
    
    ep_list inside gadget structure doesn't contain ep0.
    It is stored separately in ep0 field.
    
    This causes an urb hang if gadget driver decides to
    delay setup handling. On host side this is visible as
    timeout error when setting configuration.
    
    This bug can be reproduced using for example any gadget
    with mass storage function.
    
    Fixes: abdb295 ("usbip: vudc: Add vudc_transfer")
    Signed-off-by: Krzysztof Opasiak <[email protected]>
    Acked-by: Shuah Khan <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    kopasiak authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    6b0a56e View commit details
    Browse the repository at this point in the history
  20. ALSA: usb-audio: Add QuickCam Communicate Deluxe/S7500 to volume_cont…

    …rol_quirks
    
    commit 82ffb6f upstream.
    
    The Logitech QuickCam Communicate Deluxe/S7500 microphone fails with the
    following warning.
    
    [    6.778995] usb 2-1.2.2.2: Warning! Unlikely big volume range (=3072),
    cval->res is probably wrong.
    [    6.778996] usb 2-1.2.2.2: [5] FU [Mic Capture Volume] ch = 1, val =
    4608/7680/1
    
    Adding it to the list of devices in volume_control_quirks makes it work
    properly, fixing related typo.
    
    Signed-off-by: Con Kolivas <[email protected]>
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Con Kolivas authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    abf549a View commit details
    Browse the repository at this point in the history
  21. ALSA: hiface: Fix M2Tech hiFace driver sampling rate change

    commit 995c6a7 upstream.
    
    Sampling rate changes after first set one are not reflected to the
    hardware, while driver and ALSA think the rate has been changed.
    
    Fix the problem by properly stopping the interface at the beginning of
    prepare call, allowing new rate to be set to the hardware. This keeps
    the hardware in sync with the driver.
    
    Signed-off-by: Jussi Laako <[email protected]>
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    jlaako authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    5496ec4 View commit details
    Browse the repository at this point in the history
  22. ALSA: hda/ca0132 - Add quirk for Alienware 15 R2 2016

    commit b5337cf upstream.
    
    I'm using an Alienware 15 R2 and had to use the alienware quirks to
    get my headphone output working.
    
    I fixed it by adding, SND_PCI_QUIRK(0x1028, 0x0708, "Alienware 15 R2
    2016", QUIRK_ALIENWARE) to the patch.
    
    Signed-off-by: Sven Hahne <[email protected]>
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Sven Hahne authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    38c6095 View commit details
    Browse the repository at this point in the history
  23. ALSA: hda - ignore the assoc and seq when comparing pin configurations

    commit 64047d7 upstream.
    
    More and more pin configurations have been adding to the pin quirk
    table, lots of them are only different from assoc and seq, but they
    all apply to the same QUIRK_FIXUP, if we don't compare assoc and seq
    when matching pin configurations, it will greatly reduce the pin
    quirk table size.
    
    We have tested this change on a couple of Dell laptops, it worked
    well.
    
    Signed-off-by: Hui Wang <[email protected]>
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    jason77-wang authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    b757fc0 View commit details
    Browse the repository at this point in the history
  24. ALSA: hda - fix headset-mic problem on a Dell laptop

    commit 989dbe4 upstream.
    
    This group of new pins is not in the pin quirk table yet, adding
    them to the pin quirk table to fix the headset-mic problem.
    
    Signed-off-by: Hui Wang <[email protected]>
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    jason77-wang authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    685c4db View commit details
    Browse the repository at this point in the history
  25. ALSA: hda - Gate the mic jack on HP Z1 Gen3 AiO

    commit f73cd43 upstream.
    
    HP Z1 Gen3 AiO with Conexant codec doesn't give an unsolicited event
    to the headset mic pin upon the jack plugging, it reports only to the
    headphone pin.  It results in the missing mic switching.  Let's fix up
    by simply gating the jack event.
    
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    tiwai authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    dc8144f View commit details
    Browse the repository at this point in the history
  26. ALSA: hda: when comparing pin configurations, ignore assoc in additio…

    …n to seq
    
    commit 5e0ad0d upstream.
    
    Commit [64047d7 ALSA: hda - ignore the assoc and seq when comparing
    pin configurations] intented to ignore both seq and assoc at pin
    comparing, but it only ignored seq. So that commit may still fail to
    match pins on some machines.
    Change the bitmask to also ignore assoc.
    
    v2: Use macro to do bit masking.
    
    Thanks to Hui Wang for the analysis.
    
    Fixes: 64047d7 ("ALSA: hda - ignore the assoc and seq when comparing...")
    Signed-off-by: Kai-Heng Feng <[email protected]>
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    khfeng authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    2b96c4b View commit details
    Browse the repository at this point in the history
  27. clk: ti: omap36xx: Work around sprz319 advisory 2.1

    commit 035cd48 upstream.
    
    The OMAP36xx DPLL5, driving EHCI USB, can be subject to a long-term
    frequency drift. The frequency drift magnitude depends on the VCO update
    rate, which is inversely proportional to the PLL divider. The kernel
    DPLL configuration code results in a high value for the divider, leading
    to a long term drift high enough to cause USB transmission errors. In
    the worst case the USB PHY's ULPI interface can stop responding,
    breaking USB operation completely. This manifests itself on the
    Beagleboard xM by the LAN9514 reporting 'Cannot enable port 2. Maybe the
    cable is bad?' in the kernel log.
    
    Errata sprz319 advisory 2.1 documents PLL values that minimize the
    drift. Use them automatically when DPLL5 is used for USB operation,
    which we detect based on the requested clock rate. The clock framework
    will still compute the PLL parameters and resulting rate as usual, but
    the PLL M and N values will then be overridden. This can result in the
    effective clock rate being slightly different than the rate cached by
    the clock framework, but won't cause any adverse effect to USB
    operation.
    
    Signed-off-by: Richard Watts <[email protected]>
    [Upported from v3.2 to v4.9]
    Signed-off-by: Laurent Pinchart <[email protected]>
    Tested-by: Ladislav Michl <[email protected]>
    Signed-off-by: Stephen Boyd <[email protected]>
    Cc: Adam Ford <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    rrw1000w authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    1a087cd View commit details
    Browse the repository at this point in the history
  28. Btrfs: fix memory leak in reading btree blocks

    commit 2571e73 upstream.
    
    So we can read a btree block via readahead or intentional read,
    and we can end up with a memory leak when something happens as
    follows,
    1) readahead starts to read block A but does not wait for read
       completion,
    2) btree_readpage_end_io_hook finds that block A is corrupted,
       and it needs to clear all block A's pages' uptodate bit.
    3) meanwhile an intentional read kicks in and checks block A's
       pages' uptodate to decide which page needs to be read.
    4) when some pages have the uptodate bit during 3)'s check so
       3) doesn't count them for eb->io_pages, but they are later
       cleared by 2) so we has to readpage on the page, we get
       the wrong eb->io_pages which results in a memory leak of
       this block.
    
    This fixes the problem by firstly getting all pages's locking and
    then checking pages' uptodate bit.
    
       t1(readahead)                              t2(readahead endio)                                       t3(the following read)
    read_extent_buffer_pages                    end_bio_extent_readpage
      for pg in eb:                                for page 0,1,2 in eb:
          if pg is uptodate:                           btree_readpage_end_io_hook(pg)
              num_reads++                              if uptodate:
      eb->io_pages = num_reads                             SetPageUptodate(pg)              _______________
      for pg in eb:                                for page 3 in eb:                                     read_extent_buffer_pages
           if pg is NOT uptodate:                      btree_readpage_end_io_hook(pg)                       for pg in eb:
               __extent_read_full_page(pg)                 sanity check reports something wrong                 if pg is uptodate:
                                                           clear_extent_buffer_uptodate(eb)                         num_reads++
                                                               for pg in eb:                                eb->io_pages = num_reads
                                                                   ClearPageUptodate(page)  _______________
                                                                                                            for pg in eb:
                                                                                                                if pg is NOT uptodate:
                                                                                                                    __extent_read_full_page(pg)
    
    So t3's eb->io_pages is not consistent with the number of pages it's reading,
    and during endio(), atomic_dec_and_test(&eb->io_pages) will get a negative
    number so that we're not able to free the eb.
    
    Signed-off-by: Liu Bo <[email protected]>
    Reviewed-by: David Sterba <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Liu Bo authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    d7839ad View commit details
    Browse the repository at this point in the history
  29. Btrfs: bail out if block group has different mixed flag

    commit 4930338 upstream.
    
    Currently we allow inconsistence about mixed flag
     (BTRFS_BLOCK_GROUP_METADATA | BTRFS_BLOCK_GROUP_DATA).
    
    We'd get ENOSPC if block group has mixed flag and btrfs doesn't.
    If that happens, we have one space_info with mixed flag and another
    space_info only with BTRFS_BLOCK_GROUP_METADATA, and
    global_block_rsv.space_info points to the latter one, but all bytes
    from block_group contributes to the mixed space_info, thus all the
    allocation will fail with ENOSPC.
    
    This adds a check for the above case.
    
    Reported-by: Vegard Nossum <[email protected]>
    Signed-off-by: Liu Bo <[email protected]>
    [ updated message ]
    Reviewed-by: David Sterba <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Liu Bo authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    a6522e4 View commit details
    Browse the repository at this point in the history
  30. Btrfs: return gracefully from balance if fs tree is corrupted

    commit 3561b9d upstream.
    
    When relocating tree blocks, we firstly get block information from
    back references in the extent tree, we then search fs tree to try to
    find all parents of a block.
    
    However, if fs tree is corrupted, eg. if there're some missing
    items, we could come across these WARN_ONs and BUG_ONs.
    
    This makes us print some error messages and return gracefully
    from balance.
    
    Signed-off-by: Liu Bo <[email protected]>
    Reviewed-by: Josef Bacik <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Liu Bo authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    4d3d9b5 View commit details
    Browse the repository at this point in the history
  31. Btrfs: don't leak reloc root nodes on error

    commit 6bdf131 upstream.
    
    We don't track the reloc roots in any sort of normal way, so the only way the
    root/commit_root nodes get free'd is if the relocation finishes successfully and
    the reloc root is deleted.  Fix this by free'ing them in free_reloc_roots.
    Thanks,
    
    Signed-off-by: Josef Bacik <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Josef Bacik authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    6a6e927 View commit details
    Browse the repository at this point in the history
  32. btrfs: clean the old superblocks before freeing the device

    commit cea67ab upstream.
    
    btrfs_rm_device frees the block device but then re-opens it using
    the saved device name.  A race exists between the close and the
    re-open that allows the block size to be changed.  The result
    is getting stuck forever in the reclaim loop in __getblk_slow.
    
    This patch moves the superblock cleanup before closing the block
    device, which is also consistent with other callers.  We also don't
    need a private copy of dev_name as the whole routine operates under
    the uuid_mutex.
    
    Signed-off-by: Jeff Mahoney <[email protected]>
    Reviewed-by: David Sterba <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    jeffmahoney authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    364b85c View commit details
    Browse the repository at this point in the history
  33. Btrfs: fix memory leak in do_walk_down

    commit a958eab upstream.
    
    The extent buffer 'next' needs to be free'd conditionally.
    
    Signed-off-by: Liu Bo <[email protected]>
    Reviewed-by: David Sterba <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Liu Bo authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    65563ab View commit details
    Browse the repository at this point in the history
  34. btrfs: fix a possible umount deadlock

    commit 0ccd052 upstream.
    
    btrfs_show_devname() is using the device_list_mutex, sometimes
    a call to blkdev_put() leads vfs calling into this func. So
    call blkdev_put() outside of device_list_mutex, as of now.
    
    [  983.284212] ======================================================
    [  983.290401] [ INFO: possible circular locking dependency detected ]
    [  983.296677] 4.8.0-rc5-ceph-00023-g1b39cec2 Freescale#1 Not tainted
    [  983.302081] -------------------------------------------------------
    [  983.308357] umount/21720 is trying to acquire lock:
    [  983.313243]  (&bdev->bd_mutex){+.+.+.}, at: [<ffffffff9128ec51>] blkdev_put+0x31/0x150
    [  983.321264]
    [  983.321264] but task is already holding lock:
    [  983.327101]  (&fs_devs->device_list_mutex){+.+...}, at: [<ffffffffc033d6f6>] __btrfs_close_devices+0x46/0x200 [btrfs]
    [  983.337839]
    [  983.337839] which lock already depends on the new lock.
    [  983.337839]
    [  983.346024]
    [  983.346024] the existing dependency chain (in reverse order) is:
    [  983.353512]
    -> Freescale#4 (&fs_devs->device_list_mutex){+.+...}:
    [  983.359096]        [<ffffffff910dfd0c>] lock_acquire+0x1bc/0x1f0
    [  983.365143]        [<ffffffff91823125>] mutex_lock_nested+0x65/0x350
    [  983.371521]        [<ffffffffc02d8116>] btrfs_show_devname+0x36/0x1f0 [btrfs]
    [  983.378710]        [<ffffffff9129523e>] show_vfsmnt+0x4e/0x150
    [  983.384593]        [<ffffffff9126ffc7>] m_show+0x17/0x20
    [  983.389957]        [<ffffffff91276405>] seq_read+0x2b5/0x3b0
    [  983.395669]        [<ffffffff9124c808>] __vfs_read+0x28/0x100
    [  983.401464]        [<ffffffff9124eb3b>] vfs_read+0xab/0x150
    [  983.407080]        [<ffffffff9124ec32>] SyS_read+0x52/0xb0
    [  983.412609]        [<ffffffff91825fc0>] entry_SYSCALL_64_fastpath+0x23/0xc1
    [  983.419617]
    -> Freescale#3 (namespace_sem){++++++}:
    [  983.424024]        [<ffffffff910dfd0c>] lock_acquire+0x1bc/0x1f0
    [  983.430074]        [<ffffffff918239e9>] down_write+0x49/0x80
    [  983.435785]        [<ffffffff91272457>] lock_mount+0x67/0x1c0
    [  983.441582]        [<ffffffff91272ab2>] do_add_mount+0x32/0xf0
    [  983.447458]        [<ffffffff9127363a>] finish_automount+0x5a/0xc0
    [  983.453682]        [<ffffffff91259513>] follow_managed+0x1b3/0x2a0
    [  983.459912]        [<ffffffff9125b750>] lookup_fast+0x300/0x350
    [  983.465875]        [<ffffffff9125d6e7>] path_openat+0x3a7/0xaa0
    [  983.471846]        [<ffffffff9125ef75>] do_filp_open+0x85/0xe0
    [  983.477731]        [<ffffffff9124c41c>] do_sys_open+0x14c/0x1f0
    [  983.483702]        [<ffffffff9124c4de>] SyS_open+0x1e/0x20
    [  983.489240]        [<ffffffff91825fc0>] entry_SYSCALL_64_fastpath+0x23/0xc1
    [  983.496254]
    -> Freescale#2 (&sb->s_type->i_mutex_key#3){+.+.+.}:
    [  983.501798]        [<ffffffff910dfd0c>] lock_acquire+0x1bc/0x1f0
    [  983.507855]        [<ffffffff918239e9>] down_write+0x49/0x80
    [  983.513558]        [<ffffffff91366237>] start_creating+0x87/0x100
    [  983.519703]        [<ffffffff91366647>] debugfs_create_dir+0x17/0x100
    [  983.526195]        [<ffffffff911df153>] bdi_register+0x93/0x210
    [  983.532165]        [<ffffffff911df313>] bdi_register_owner+0x43/0x70
    [  983.538570]        [<ffffffff914080fb>] device_add_disk+0x1fb/0x450
    [  983.544888]        [<ffffffff91580226>] loop_add+0x1e6/0x290
    [  983.550596]        [<ffffffff91fec358>] loop_init+0x10b/0x14f
    [  983.556394]        [<ffffffff91002207>] do_one_initcall+0xa7/0x180
    [  983.562618]        [<ffffffff91f932e0>] kernel_init_freeable+0x1cc/0x266
    [  983.569370]        [<ffffffff918174be>] kernel_init+0xe/0x100
    [  983.575166]        [<ffffffff9182620f>] ret_from_fork+0x1f/0x40
    [  983.581131]
    -> Freescale#1 (loop_index_mutex){+.+.+.}:
    [  983.585801]        [<ffffffff910dfd0c>] lock_acquire+0x1bc/0x1f0
    [  983.591858]        [<ffffffff91823125>] mutex_lock_nested+0x65/0x350
    [  983.598256]        [<ffffffff9157ed3f>] lo_open+0x1f/0x60
    [  983.603704]        [<ffffffff9128eec3>] __blkdev_get+0x123/0x400
    [  983.609757]        [<ffffffff9128f4ea>] blkdev_get+0x34a/0x350
    [  983.615639]        [<ffffffff9128f554>] blkdev_open+0x64/0x80
    [  983.621428]        [<ffffffff9124aff6>] do_dentry_open+0x1c6/0x2d0
    [  983.627651]        [<ffffffff9124c029>] vfs_open+0x69/0x80
    [  983.633181]        [<ffffffff9125db74>] path_openat+0x834/0xaa0
    [  983.639152]        [<ffffffff9125ef75>] do_filp_open+0x85/0xe0
    [  983.645035]        [<ffffffff9124c41c>] do_sys_open+0x14c/0x1f0
    [  983.650999]        [<ffffffff9124c4de>] SyS_open+0x1e/0x20
    [  983.656535]        [<ffffffff91825fc0>] entry_SYSCALL_64_fastpath+0x23/0xc1
    [  983.663541]
    -> #0 (&bdev->bd_mutex){+.+.+.}:
    [  983.668107]        [<ffffffff910def43>] __lock_acquire+0x1003/0x17b0
    [  983.674510]        [<ffffffff910dfd0c>] lock_acquire+0x1bc/0x1f0
    [  983.680561]        [<ffffffff91823125>] mutex_lock_nested+0x65/0x350
    [  983.686967]        [<ffffffff9128ec51>] blkdev_put+0x31/0x150
    [  983.692761]        [<ffffffffc033481f>] btrfs_close_bdev+0x4f/0x60 [btrfs]
    [  983.699699]        [<ffffffffc033d77b>] __btrfs_close_devices+0xcb/0x200 [btrfs]
    [  983.707178]        [<ffffffffc033d8db>] btrfs_close_devices+0x2b/0xa0 [btrfs]
    [  983.714380]        [<ffffffffc03081c5>] close_ctree+0x265/0x340 [btrfs]
    [  983.721061]        [<ffffffffc02d7959>] btrfs_put_super+0x19/0x20 [btrfs]
    [  983.727908]        [<ffffffff91250e2f>] generic_shutdown_super+0x6f/0x100
    [  983.734744]        [<ffffffff91250f56>] kill_anon_super+0x16/0x30
    [  983.740888]        [<ffffffffc02da97e>] btrfs_kill_super+0x1e/0x130 [btrfs]
    [  983.747909]        [<ffffffff91250fe9>] deactivate_locked_super+0x49/0x80
    [  983.754745]        [<ffffffff912515fd>] deactivate_super+0x5d/0x70
    [  983.760977]        [<ffffffff91270a1c>] cleanup_mnt+0x5c/0x80
    [  983.766773]        [<ffffffff91270a92>] __cleanup_mnt+0x12/0x20
    [  983.772738]        [<ffffffff910aa2fe>] task_work_run+0x7e/0xc0
    [  983.778708]        [<ffffffff91081b5a>] exit_to_usermode_loop+0x7e/0xb4
    [  983.785373]        [<ffffffff910039eb>] syscall_return_slowpath+0xbb/0xd0
    [  983.792212]        [<ffffffff9182605c>] entry_SYSCALL_64_fastpath+0xbf/0xc1
    [  983.799225]
    [  983.799225] other info that might help us debug this:
    [  983.799225]
    [  983.807291] Chain exists of:
      &bdev->bd_mutex --> namespace_sem --> &fs_devs->device_list_mutex
    
    [  983.816521]  Possible unsafe locking scenario:
    [  983.816521]
    [  983.822489]        CPU0                    CPU1
    [  983.827043]        ----                    ----
    [  983.831599]   lock(&fs_devs->device_list_mutex);
    [  983.836289]                                lock(namespace_sem);
    [  983.842268]                                lock(&fs_devs->device_list_mutex);
    [  983.849478]   lock(&bdev->bd_mutex);
    [  983.853127]
    [  983.853127]  *** DEADLOCK ***
    [  983.853127]
    [  983.859113] 3 locks held by umount/21720:
    [  983.863145]  #0:  (&type->s_umount_key#35){++++..}, at: [<ffffffff912515f5>] deactivate_super+0x55/0x70
    [  983.872713]  Freescale#1:  (uuid_mutex){+.+.+.}, at: [<ffffffffc033d8d3>] btrfs_close_devices+0x23/0xa0 [btrfs]
    [  983.882206]  Freescale#2:  (&fs_devs->device_list_mutex){+.+...}, at: [<ffffffffc033d6f6>] __btrfs_close_devices+0x46/0x200 [btrfs]
    [  983.893422]
    [  983.893422] stack backtrace:
    [  983.897824] CPU: 6 PID: 21720 Comm: umount Not tainted 4.8.0-rc5-ceph-00023-g1b39cec2 Freescale#1
    [  983.905958] Hardware name: Supermicro SYS-5018R-WR/X10SRW-F, BIOS 1.0c 09/07/2015
    [  983.913492]  0000000000000000 ffff8c8a53c17a38 ffffffff91429521 ffffffff9260f4f0
    [  983.921018]  ffffffff92642760 ffff8c8a53c17a88 ffffffff911b2b04 0000000000000050
    [  983.928542]  ffffffff9237d620 ffff8c8a5294aee0 ffff8c8a5294aeb8 ffff8c8a5294aee0
    [  983.936072] Call Trace:
    [  983.938545]  [<ffffffff91429521>] dump_stack+0x85/0xc4
    [  983.943715]  [<ffffffff911b2b04>] print_circular_bug+0x1fb/0x20c
    [  983.949748]  [<ffffffff910def43>] __lock_acquire+0x1003/0x17b0
    [  983.955613]  [<ffffffff910dfd0c>] lock_acquire+0x1bc/0x1f0
    [  983.961123]  [<ffffffff9128ec51>] ? blkdev_put+0x31/0x150
    [  983.966550]  [<ffffffff91823125>] mutex_lock_nested+0x65/0x350
    [  983.972407]  [<ffffffff9128ec51>] ? blkdev_put+0x31/0x150
    [  983.977832]  [<ffffffff9128ec51>] blkdev_put+0x31/0x150
    [  983.983101]  [<ffffffffc033481f>] btrfs_close_bdev+0x4f/0x60 [btrfs]
    [  983.989500]  [<ffffffffc033d77b>] __btrfs_close_devices+0xcb/0x200 [btrfs]
    [  983.996415]  [<ffffffffc033d8db>] btrfs_close_devices+0x2b/0xa0 [btrfs]
    [  984.003068]  [<ffffffffc03081c5>] close_ctree+0x265/0x340 [btrfs]
    [  984.009189]  [<ffffffff9126cc5e>] ? evict_inodes+0x15e/0x170
    [  984.014881]  [<ffffffffc02d7959>] btrfs_put_super+0x19/0x20 [btrfs]
    [  984.021176]  [<ffffffff91250e2f>] generic_shutdown_super+0x6f/0x100
    [  984.027476]  [<ffffffff91250f56>] kill_anon_super+0x16/0x30
    [  984.033082]  [<ffffffffc02da97e>] btrfs_kill_super+0x1e/0x130 [btrfs]
    [  984.039548]  [<ffffffff91250fe9>] deactivate_locked_super+0x49/0x80
    [  984.045839]  [<ffffffff912515fd>] deactivate_super+0x5d/0x70
    [  984.051525]  [<ffffffff91270a1c>] cleanup_mnt+0x5c/0x80
    [  984.056774]  [<ffffffff91270a92>] __cleanup_mnt+0x12/0x20
    [  984.062201]  [<ffffffff910aa2fe>] task_work_run+0x7e/0xc0
    [  984.067625]  [<ffffffff91081b5a>] exit_to_usermode_loop+0x7e/0xb4
    [  984.073747]  [<ffffffff910039eb>] syscall_return_slowpath+0xbb/0xd0
    [  984.080038]  [<ffffffff9182605c>] entry_SYSCALL_64_fastpath+0xbf/0xc1
    
    Reported-by: Ilya Dryomov <[email protected]>
    Signed-off-by: Anand Jain <[email protected]>
    Reviewed-by: David Sterba <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    asj authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    0f2e022 View commit details
    Browse the repository at this point in the history
  35. Btrfs: don't BUG() during drop snapshot

    commit 4867268 upstream.
    
    Really there's lots of things that can go wrong here, kill all the
    BUG_ON()'s and replace the logic ones with ASSERT()'s and return EIO
    instead.
    
    Signed-off-by: Josef Bacik <[email protected]>
    [ switched to btrfs_err, errors go to common label ]
    Reviewed-by: Liu Bo <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Josef Bacik authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    02fffa1 View commit details
    Browse the repository at this point in the history
  36. Btrfs: fix incremental send failure caused by balance

    commit d5e84fd upstream.
    
    Commit 9515558 ("Btrfs: send, don't bug on inconsistent snapshots")
    removed some BUG_ON() statements (replacing them with returning errors
    to user space and logging error messages) when a snapshot is in an
    inconsistent state due to failures to update a delayed inode item (ENOMEM
    or ENOSPC) after adding/updating/deleting references, xattrs or file
    extent items.
    
    However there is a case, when no errors happen, where a file extent item
    can be modified without having the corresponding inode item updated. This
    case happens during balance under very specific timings, when relocation
    is in the stage where it updates data pointers and a leaf that contains
    file extent items is COWed. When that happens file extent items get their
    disk_bytenr field updated to a new value that reflects the post relocation
    logical address of the extent, without updating their respective inode
    items (as there is nothing that needs to be updated on them). This is
    performed at relocation.c:replace_file_extents() through
    relocation.c:btrfs_reloc_cow_block().
    
    So make an incremental send deal with this case and don't do any processing
    for a file extent item that got its disk_bytenr field updated by relocation,
    since the extent's data is the same as the one pointed by the file extent
    item in the parent snapshot.
    
    After the recent commit mentioned above this case resulted in EIO errors
    returned to user space (and an error message logged to dmesg/syslog) when
    doing an incremental send, while before it, it resulted in hitting a
    BUG_ON leading to the following trace:
    
    [  952.206705] ------------[ cut here ]------------
    [  952.206714] kernel BUG at ../fs/btrfs/send.c:5653!
    [  952.206719] Internal error: Oops - BUG: 0 [Freescale#1] SMP
    [  952.209854] Modules linked in: st dm_mod nls_utf8 isofs fuse nf_log_ipv6 xt_pkttype xt_physdev br_netfilter nf_log_ipv4 nf_log_common xt_LOG xt_limit ebtable_filter ebtables af_packet bridge stp llc ip6t_REJECT xt_tcpudp nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_raw ipt_REJECT iptable_raw xt_CT iptable_filter ip6table_mangle nf_conntrack_netbios_ns nf_conntrack_broadcast nf_conntrack_ipv4 nf_defrag_ipv4 ip_tables xt_conntrack nf_conntrack ip6table_filter ip6_tables x_tables xfs libcrc32c nls_iso8859_1 nls_cp437 vfat fat joydev aes_ce_blk ablk_helper cryptd snd_intel8x0 aes_ce_cipher snd_ac97_codec ac97_bus snd_pcm ghash_ce sha2_ce sha1_ce snd_timer snd virtio_net soundcore btrfs xor sr_mod cdrom hid_generic usbhid raid6_pq virtio_blk virtio_scsi bochs_drm drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops ttm virtio_mmio xhci_pci xhci_hcd usbcore usb_common virtio_pci virtio_ring virtio drm sg efivarfs
    [  952.228333] Supported: Yes
    [  952.228908] CPU: 0 PID: 12779 Comm: snapperd Not tainted 4.4.14-50-default Freescale#1
    [  952.230329] Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015
    [  952.231683] task: ffff800058e94100 ti: ffff8000d866c000 task.ti: ffff8000d866c000
    [  952.233279] PC is at changed_cb+0x9f4/0xa48 [btrfs]
    [  952.234375] LR is at changed_cb+0x58/0xa48 [btrfs]
    [  952.236552] pc : [<ffff7ffffc39de7c>] lr : [<ffff7ffffc39d4e0>] pstate: 80000145
    [  952.238049] sp : ffff8000d866fa20
    [  952.238732] x29: ffff8000d866fa20 x28: 0000000000000019
    [  952.239840] x27: 00000000000028d5 x26: 00000000000024a2
    [  952.241008] x25: 0000000000000002 x24: ffff8000e66e92f0
    [  952.242131] x23: ffff8000b8c76800 x22: ffff800092879140
    [  952.243238] x21: 0000000000000002 x20: ffff8000d866fb78
    [  952.244348] x19: ffff8000b8f8c200 x18: 0000000000002710
    [  952.245607] x17: 0000ffff90d42480 x16: ffff800000237dc0
    [  952.246719] x15: 0000ffff90de7510 x14: ab000c000a2faf08
    [  952.247835] x13: 0000000000577c2b x12: ab000c000b696665
    [  952.248981] x11: 2e65726f632f6966 x10: 652d34366d72612f
    [  952.250101] x9 : 32627572672f746f x8 : ab000c00092f1671
    [  952.251352] x7 : 8000000000577c2b x6 : ffff800053eadf45
    [  952.252468] x5 : 0000000000000000 x4 : ffff80005e169494
    [  952.253582] x3 : 0000000000000004 x2 : ffff8000d866fb78
    [  952.254695] x1 : 000000000003e2a3 x0 : 000000000003e2a4
    [  952.255803]
    [  952.256150] Process snapperd (pid: 12779, stack limit = 0xffff8000d866c020)
    [  952.257516] Stack: (0xffff8000d866fa20 to 0xffff8000d8670000)
    [  952.258654] fa20: ffff8000d866fae0 ffff7ffffc308fc0 ffff800092879140 ffff8000e66e92f0
    [  952.260219] fa40: 0000000000000035 ffff800055de6000 ffff8000b8c76800 ffff8000d866fb78
    [  952.261745] fa60: 0000000000000002 00000000000024a2 00000000000028d5 0000000000000019
    [  952.263269] fa80: ffff8000d866fae0 ffff7ffffc3090f0 ffff8000d866fae0 ffff7ffffc309128
    [  952.264797] faa0: ffff800092879140 ffff8000e66e92f0 0000000000000035 ffff800055de6000
    [  952.268261] fac0: ffff8000b8c76800 ffff8000d866fb78 0000000000000002 0000000000001000
    [  952.269822] fae0: ffff8000d866fbc0 ffff7ffffc39ecfc ffff8000b8f8c200 ffff8000b8f8c368
    [  952.271368] fb00: ffff8000b8f8c378 ffff800055de6000 0000000000000001 ffff8000ecb17500
    [  952.272893] fb20: ffff8000b8c76800 ffff800092879140 ffff800062b6d000 ffff80007a9e2470
    [  952.274420] fb40: ffff8000b8f8c208 0000000005784000 ffff8000580a8000 ffff8000b8f8c200
    [  952.276088] fb60: ffff7ffffc39d488 00000002b8f8c368 0000000000000000 000000000003e2a4
    [  952.280275] fb80: 000000000000006c ffff7ffffc39ec00 000000000003e2a4 000000000000006c
    [  952.283219] fba0: ffff8000b8f8c300 0000000000000100 0000000000000001 ffff8000ecb17500
    [  952.286166] fbc0: ffff8000d866fcd0 ffff7ffffc3643c0 ffff8000f8842700 0000ffff8ffe9278
    [  952.289136] fbe0: 0000000040489426 ffff800055de6000 0000ffff8ffe9278 0000000040489426
    [  952.292083] fc00: 000000000000011d 000000000000001d ffff80007a9e4598 ffff80007a9e43e8
    [  952.294959] fc20: ffff8000b8c7693f 0000000000003b24 0000000000000019 ffff8000b8f8c218
    [  952.301161] fc40: 00000001d866fc70 ffff8000b8c76800 0000000000000128 ffffffffffffff84
    [  952.305749] fc60: ffff800058e941ff 0000000000003a58 ffff8000d866fcb0 ffff8000000f7390
    [  952.308875] fc80: 000000000000012a 0000000000010290 ffff8000d866fc00 000000000000007b
    [  952.311915] fca0: 0000000000010290 ffff800046c1b100 74732d7366727462 000001006d616572
    [  952.314937] fcc0: ffff8000fffc4100 cb88537fdc8ba60e ffff8000d866fe10 ffff8000002499e8
    [  952.318008] fce0: 0000000040489426 ffff8000f8842700 0000ffff8ffe9278 ffff80007a9e4598
    [  952.321321] fd00: 0000ffff8ffe9278 0000000040489426 000000000000011d 000000000000001d
    [  952.324280] fd20: ffff80000072c000 ffff8000d866c000 ffff8000d866fda0 ffff8000000e997c
    [  952.327156] fd40: ffff8000fffc4180 00000000000031ed ffff8000fffc4180 ffff800046c1b7d4
    [  952.329895] fd60: 0000000000000140 0000ffff907ea170 000000000000011d 00000000000000dc
    [  952.334641] fd80: ffff80000072c000 ffff8000d866c000 0000000000000000 0000000000000002
    [  952.338002] fda0: ffff8000d866fdd0 ffff8000000ebacc ffff800046c1b080 ffff800046c1b7d4
    [  952.340724] fdc0: ffff8000d866fdf0 ffff8000000db67c 0000000000000040 ffff800000e69198
    [  952.343415] fde0: 0000ffff8ffea790 00000000000031ed ffff8000d866fe20 ffff800000254000
    [  952.346101] fe00: 000000000000001d 0000000000000004 ffff8000d866fe90 ffff800000249d3c
    [  952.348980] fe20: ffff8000f8842700 0000000000000000 ffff8000f8842701 0000000000000008
    [  952.351696] fe40: ffff8000d866fe70 0000000000000008 ffff8000d866fe90 ffff800000249cf8
    [  952.354387] fe60: ffff8000f8842700 0000ffff8ffe9170 ffff8000f8842701 0000000000000008
    [  952.357083] fe80: 0000ffff8ffe9278 ffff80008ff85500 0000ffff8ffe90c0 ffff800000085c84
    [  952.359800] fea0: 0000000000000000 0000ffff8ffe9170 ffffffffffffffff 0000ffff90d473bc
    [  952.365351] fec0: 0000000000000000 0000000000000015 0000000000000008 0000000040489426
    [  952.369550] fee0: 0000ffff8ffe9278 0000ffff907ea790 0000ffff907ea170 0000ffff907ea790
    [  952.372416] ff00: 0000ffff907ea170 0000000000000000 000000000000001d 0000000000000004
    [  952.375223] ff20: 0000ffff90a32220 00000000003d0f00 0000ffff907ea0a0 0000ffff8ffe8f30
    [  952.378099] ff40: 0000ffff9100f554 0000ffff91147000 0000ffff91117bc0 0000ffff90d473b0
    [  952.381115] ff60: 0000ffff9100f620 0000ffff880069b0 0000ffff8ffe9170 0000ffff8ffe91a0
    [  952.384003] ff80: 0000ffff8ffe9160 0000ffff8ffe9140 0000ffff88006990 0000ffff8ffe9278
    [  952.386860] ffa0: 0000ffff88008a60 0000ffff8ffe9480 0000ffff88014ca0 0000ffff8ffe90c0
    [  952.389654] ffc0: 0000ffff910be8e8 0000ffff8ffe90c0 0000ffff90d473bc 0000000000000000
    [  952.410986] ffe0: 0000000000000008 000000000000001d 6e2079747265706f 72616d223d656d61
    [  952.415497] Call trace:
    [  952.417403] [<ffff7ffffc39de7c>] changed_cb+0x9f4/0xa48 [btrfs]
    [  952.420023] [<ffff7ffffc308fc0>] btrfs_compare_trees+0x500/0x6b0 [btrfs]
    [  952.422759] [<ffff7ffffc39ecfc>] btrfs_ioctl_send+0xb4c/0xe10 [btrfs]
    [  952.425601] [<ffff7ffffc3643c0>] btrfs_ioctl+0x374/0x29a4 [btrfs]
    [  952.428031] [<ffff8000002499e8>] do_vfs_ioctl+0x33c/0x600
    [  952.430360] [<ffff800000249d3c>] SyS_ioctl+0x90/0xa4
    [  952.432552] [<ffff800000085c84>] el0_svc_naked+0x38/0x3c
    [  952.434803] Code: 2a1503e0 17fffdac b9404282 17ffff28 (d4210000)
    [  952.437457] ---[ end trace 9afd7090c466cf15 ]---
    
    Signed-off-by: Filipe Manana <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    fdmanana authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    8c59356 View commit details
    Browse the repository at this point in the history
  37. btrfs: make file clone aware of fatal signals

    commit 69ae5e4 upstream.
    
    Indeed this just make the behavior similar to xfs when process has
    fatal signals pending, and it'll make fstests/generic/298 happy.
    
    Signed-off-by: Wang Xiaoguang <[email protected]>
    Reviewed-by: David Sterba <[email protected]>
    Signed-off-by: David Sterba <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    wangxiaoguang authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    fc1d3e5 View commit details
    Browse the repository at this point in the history
  38. exec: Ensure mm->user_ns contains the execed files

    commit f84df2a upstream.
    
    When the user namespace support was merged the need to prevent
    ptrace from revealing the contents of an unreadable executable
    was overlooked.
    
    Correct this oversight by ensuring that the executed file
    or files are in mm->user_ns, by adjusting mm->user_ns.
    
    Use the new function privileged_wrt_inode_uidgid to see if
    the executable is a member of the user namespace, and as such
    if having CAP_SYS_PTRACE in the user namespace should allow
    tracing the executable.  If not update mm->user_ns to
    the parent user namespace until an appropriate parent is found.
    
    Reported-by: Jann Horn <[email protected]>
    Fixes: 9e4a36e ("userns: Fail exec for suid and sgid binaries with ids outside our user namespace.")
    Signed-off-by: "Eric W. Biederman" <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    ebiederm authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    781e976 View commit details
    Browse the repository at this point in the history
  39. fs: exec: apply CLOEXEC before changing dumpable task flags

    commit 613cc2b upstream.
    
    If you have a process that has set itself to be non-dumpable, and it
    then undergoes exec(2), any CLOEXEC file descriptors it has open are
    "exposed" during a race window between the dumpable flags of the process
    being reset for exec(2) and CLOEXEC being applied to the file
    descriptors. This can be exploited by a process by attempting to access
    /proc/<pid>/fd/... during this window, without requiring CAP_SYS_PTRACE.
    
    The race in question is after set_dumpable has been (for get_link,
    though the trace is basically the same for readlink):
    
    [vfs]
    -> proc_pid_link_inode_operations.get_link
       -> proc_pid_get_link
          -> proc_fd_access_allowed
             -> ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS);
    
    Which will return 0, during the race window and CLOEXEC file descriptors
    will still be open during this window because do_close_on_exec has not
    been called yet. As a result, the ordering of these calls should be
    reversed to avoid this race window.
    
    This is of particular concern to container runtimes, where joining a
    PID namespace with file descriptors referring to the host filesystem
    can result in security issues (since PRCTL_SET_DUMPABLE doesn't protect
    against access of CLOEXEC file descriptors -- file descriptors which may
    reference filesystem objects the container shouldn't have access to).
    
    Cc: [email protected]
    Reported-by: Michael Crosby <[email protected]>
    Signed-off-by: Aleksa Sarai <[email protected]>
    Signed-off-by: Al Viro <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    cyphar authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    52d6972 View commit details
    Browse the repository at this point in the history
  40. block_dev: don't test bdev->bd_contains when it is not stable

    commit bcc7f5b upstream.
    
    bdev->bd_contains is not stable before calling __blkdev_get().
    When __blkdev_get() is called on a parition with ->bd_openers == 0
    it sets
      bdev->bd_contains = bdev;
    which is not correct for a partition.
    After a call to __blkdev_get() succeeds, ->bd_openers will be > 0
    and then ->bd_contains is stable.
    
    When FMODE_EXCL is used, blkdev_get() calls
       bd_start_claiming() ->  bd_prepare_to_claim() -> bd_may_claim()
    
    This call happens before __blkdev_get() is called, so ->bd_contains
    is not stable.  So bd_may_claim() cannot safely use ->bd_contains.
    It currently tries to use it, and this can lead to a BUG_ON().
    
    This happens when a whole device is already open with a bd_holder (in
    use by dm in my particular example) and two threads race to open a
    partition of that device for the first time, one opening with O_EXCL and
    one without.
    
    The thread that doesn't use O_EXCL gets through blkdev_get() to
    __blkdev_get(), gains the ->bd_mutex, and sets bdev->bd_contains = bdev;
    
    Immediately thereafter the other thread, using FMODE_EXCL, calls
    bd_start_claiming() from blkdev_get().  This should fail because the
    whole device has a holder, but because bdev->bd_contains == bdev
    bd_may_claim() incorrectly reports success.
    This thread continues and blocks on bd_mutex.
    
    The first thread then sets bdev->bd_contains correctly and drops the mutex.
    The thread using FMODE_EXCL then continues and when it calls bd_may_claim()
    again in:
    			BUG_ON(!bd_may_claim(bdev, whole, holder));
    The BUG_ON fires.
    
    Fix this by removing the dependency on ->bd_contains in
    bd_may_claim().  As bd_may_claim() has direct access to the whole
    device, it can simply test if the target bdev is the whole device.
    
    Fixes: 6b4517a ("block: implement bd_claiming and claiming block")
    Signed-off-by: NeilBrown <[email protected]>
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    NeilBrown authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    04804d8 View commit details
    Browse the repository at this point in the history
  41. mm: Add a user_ns owner to mm_struct and fix ptrace permission checks

    commit bfedb58 upstream.
    
    During exec dumpable is cleared if the file that is being executed is
    not readable by the user executing the file.  A bug in
    ptrace_may_access allows reading the file if the executable happens to
    enter into a subordinate user namespace (aka clone(CLONE_NEWUSER),
    unshare(CLONE_NEWUSER), or setns(fd, CLONE_NEWUSER).
    
    This problem is fixed with only necessary userspace breakage by adding
    a user namespace owner to mm_struct, captured at the time of exec, so
    it is clear in which user namespace CAP_SYS_PTRACE must be present in
    to be able to safely give read permission to the executable.
    
    The function ptrace_may_access is modified to verify that the ptracer
    has CAP_SYS_ADMIN in task->mm->user_ns instead of task->cred->user_ns.
    This ensures that if the task changes it's cred into a subordinate
    user namespace it does not become ptraceable.
    
    The function ptrace_attach is modified to only set PT_PTRACE_CAP when
    CAP_SYS_PTRACE is held over task->mm->user_ns.  The intent of
    PT_PTRACE_CAP is to be a flag to note that whatever permission changes
    the task might go through the tracer has sufficient permissions for
    it not to be an issue.  task->cred->user_ns is always the same
    as or descendent of mm->user_ns.  Which guarantees that having
    CAP_SYS_PTRACE over mm->user_ns is the worst case for the tasks
    credentials.
    
    To prevent regressions mm->dumpable and mm->user_ns are not considered
    when a task has no mm.  As simply failing ptrace_may_attach causes
    regressions in privileged applications attempting to read things
    such as /proc/<pid>/stat
    
    Acked-by: Kees Cook <[email protected]>
    Tested-by: Cyrill Gorcunov <[email protected]>
    Fixes: 8409cca ("userns: allow ptrace from non-init user namespaces")
    Signed-off-by: "Eric W. Biederman" <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    ebiederm authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    e45692f View commit details
    Browse the repository at this point in the history
  42. vfs,mm: fix return value of read() at s_maxbytes

    commit d05c5f7 upstream.
    
    We truncated the possible read iterator to s_maxbytes in commit
    c2a9737 ("vfs,mm: fix a dead loop in truncate_inode_pages_range()"),
    but our end condition handling was wrong: it's not an error to try to
    read at the end of the file.
    
    Reading past the end should return EOF (0), not EINVAL.
    
    See for example
    
      https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1649342
      http://lists.gnu.org/archive/html/bug-coreutils/2016-12/msg00008.html
    
    where a md5sum of a maximally sized file fails because the final read is
    exactly at s_maxbytes.
    
    Fixes: c2a9737 ("vfs,mm: fix a dead loop in truncate_inode_pages_range()")
    Reported-by: Joseph Salisbury <[email protected]>
    Cc: Wei Fang <[email protected]>
    Cc: Christoph Hellwig <[email protected]>
    Cc: Dave Chinner <[email protected]>
    Cc: Al Viro <[email protected]>
    Cc: Andrew Morton <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    torvalds authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    23d179a View commit details
    Browse the repository at this point in the history
  43. ptrace: Capture the ptracer's creds not PT_PTRACE_CAP

    commit 64b875f upstream.
    
    When the flag PT_PTRACE_CAP was added the PTRACE_TRACEME path was
    overlooked.  This can result in incorrect behavior when an application
    like strace traces an exec of a setuid executable.
    
    Further PT_PTRACE_CAP does not have enough information for making good
    security decisions as it does not report which user namespace the
    capability is in.  This has already allowed one mistake through
    insufficient granulariy.
    
    I found this issue when I was testing another corner case of exec and
    discovered that I could not get strace to set PT_PTRACE_CAP even when
    running strace as root with a full set of caps.
    
    This change fixes the above issue with strace allowing stracing as
    root a setuid executable without disabling setuid.  More fundamentaly
    this change allows what is allowable at all times, by using the correct
    information in it's decision.
    
    Fixes: 4214e42f96d4 ("v2.4.9.11 -> v2.4.9.12")
    Signed-off-by: "Eric W. Biederman" <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    ebiederm authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    ade692b View commit details
    Browse the repository at this point in the history
  44. crypto: caam - fix AEAD givenc descriptors

    commit d128af1 upstream.
    
    The AEAD givenc descriptor relies on moving the IV through the
    output FIFO and then back to the CTX2 for authentication. The
    SEQ FIFO STORE could be scheduled before the data can be
    read from OFIFO, especially since the SEQ FIFO LOAD needs
    to wait for the SEQ FIFO LOAD SKIP to finish first. The
    SKIP takes more time when the input is SG than when it's
    a contiguous buffer. If the SEQ FIFO LOAD is not scheduled
    before the STORE, the DECO will hang waiting for data
    to be available in the OFIFO so it can be transferred to C2.
    In order to overcome this, first force transfer of IV to C2
    by starting the "cryptlen" transfer first and then starting to
    store data from OFIFO to the output buffer.
    
    Fixes: 1acebad ("crypto: caam - faster aead implementation")
    Signed-off-by: Alex Porosanu <[email protected]>
    Signed-off-by: Horia Geantă <[email protected]>
    Signed-off-by: Herbert Xu <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    alexandru-porosanu-nxp authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    8022387 View commit details
    Browse the repository at this point in the history
  45. ext4: fix mballoc breakage with 64k block size

    commit 69e43e8 upstream.
    
    'border' variable is set to a value of 2 times the block size of the
    underlying filesystem. With 64k block size, the resulting value won't
    fit into a 16-bit variable. Hence this commit changes the data type of
    'border' to 'unsigned int'.
    
    Fixes: c9de560
    Signed-off-by: Chandan Rajendra <[email protected]>
    Signed-off-by: Theodore Ts'o <[email protected]>
    Reviewed-by: Andreas Dilger <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Chandan Rajendra authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    86efd99 View commit details
    Browse the repository at this point in the history
  46. ext4: fix stack memory corruption with 64k block size

    commit 30a9d7a upstream.
    
    The number of 'counters' elements needed in 'struct sg' is
    super_block->s_blocksize_bits + 2. Presently we have 16 'counters'
    elements in the array. This is insufficient for block sizes >= 32k. In
    such cases the memcpy operation performed in ext4_mb_seq_groups_show()
    would cause stack memory corruption.
    
    Fixes: c9de560
    Signed-off-by: Chandan Rajendra <[email protected]>
    Signed-off-by: Theodore Ts'o <[email protected]>
    Reviewed-by: Jan Kara <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Chandan Rajendra authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    7505584 View commit details
    Browse the repository at this point in the history
  47. ext4: use more strict checks for inodes_per_block on mount

    commit cd6bb35 upstream.
    
    Centralize the checks for inodes_per_block and be more strict to make
    sure the inodes_per_block_group can't end up being zero.
    
    Signed-off-by: Theodore Ts'o <[email protected]>
    Reviewed-by: Andreas Dilger <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    tytso authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    52a9daa View commit details
    Browse the repository at this point in the history
  48. ext4: fix in-superblock mount options processing

    commit 5aee0f8 upstream.
    
    Fix a large number of problems with how we handle mount options in the
    superblock.  For one, if the string in the superblock is long enough
    that it is not null terminated, we could run off the end of the string
    and try to interpret superblocks fields as characters.  It's unlikely
    this will cause a security problem, but it could result in an invalid
    parse.  Also, parse_options is destructive to the string, so in some
    cases if there is a comma-separated string, it would be modified in
    the superblock.  (Fortunately it only happens on file systems with a
    1k block size.)
    
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    tytso authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    9689eb9 View commit details
    Browse the repository at this point in the history
  49. ext4: add sanity checking to count_overhead()

    commit c48ae41 upstream.
    
    The commit "ext4: sanity check the block and cluster size at mount
    time" should prevent any problems, but in case the superblock is
    modified while the file system is mounted, add an extra safety check
    to make sure we won't overrun the allocated buffer.
    
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    tytso authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    1bfcffb View commit details
    Browse the repository at this point in the history
  50. ext4: reject inodes with negative size

    commit 7e6e1ef upstream.
    
    Don't load an inode with a negative size; this causes integer overflow
    problems in the VFS.
    
    [ Added EXT4_ERROR_INODE() to mark file system as corrupted. -TYT]
    
    Fixes: a48380f (ext4: rename i_dir_acl to i_size_high)
    Signed-off-by: Darrick J. Wong <[email protected]>
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    djwong authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    3664877 View commit details
    Browse the repository at this point in the history
  51. ext4: return -ENOMEM instead of success

    commit 578620f upstream.
    
    We should set the error code if kzalloc() fails.
    
    Fixes: 67cf5b0 ("ext4: add the basic function for inline data support")
    Signed-off-by: Dan Carpenter <[email protected]>
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Dan Carpenter authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    e33673b View commit details
    Browse the repository at this point in the history
  52. ext4: do not perform data journaling when data is encrypted

    commit 73b92a2 upstream.
    
    Currently data journalling is incompatible with encryption: enabling both
    at the same time has never been supported by design, and would result in
    unpredictable behavior. However, users are not precluded from turning on
    both features simultaneously. This change programmatically replaces data
    journaling for encrypted regular files with ordered data journaling mode.
    
    Background:
    Journaling encrypted data has not been supported because it operates on
    buffer heads of the page in the page cache. Namely, when the commit
    happens, which could be up to five seconds after caching, the commit
    thread uses the buffer heads attached to the page to copy the contents of
    the page to the journal. With encryption, it would have been required to
    keep the bounce buffer with ciphertext for up to the aforementioned five
    seconds, since the page cache can only hold plaintext and could not be
    used for journaling. Alternatively, it would be required to setup the
    journal to initiate a callback at the commit time to perform deferred
    encryption - in this case, not only would the data have to be written
    twice, but it would also have to be encrypted twice. This level of
    complexity was not justified for a mode that in practice is very rarely
    used because of the overhead from the data journalling.
    
    Solution:
    If data=journaled has been set as a mount option for a filesystem, or if
    journaling is enabled on a regular file, do not perform journaling if the
    file is also encrypted, instead fall back to the data=ordered mode for the
    file.
    
    Rationale:
    The intent is to allow seamless and proper filesystem operation when
    journaling and encryption have both been enabled, and have these two
    conflicting features gracefully resolved by the filesystem.
    
    Fixes: 4461471
    Signed-off-by: Sergey Karamov <[email protected]>
    Signed-off-by: Theodore Ts'o <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    skaramov authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    d06eaf2 View commit details
    Browse the repository at this point in the history
  53. Revert "f2fs: use percpu_counter for # of dirty pages in inode"

    commit 204706c upstream.
    
    This reverts commit 1beba1b.
    
    The perpcu_counter doesn't provide atomicity in single core and consume more
    DRAM. That incurs fs_mark test failure due to ENOMEM.
    
    Signed-off-by: Jaegeuk Kim <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Jaegeuk Kim authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    67e5239 View commit details
    Browse the repository at this point in the history
  54. f2fs: set ->owner for debugfs status file's file_operations

    commit 05e6ea2 upstream.
    
    The struct file_operations instance serving the f2fs/status debugfs file
    lacks an initialization of its ->owner.
    
    This means that although that file might have been opened, the f2fs module
    can still get removed. Any further operation on that opened file, releasing
    included,  will cause accesses to unmapped memory.
    
    Indeed, Mike Marshall reported the following:
    
      BUG: unable to handle kernel paging request at ffffffffa0307430
      IP: [<ffffffff8132a224>] full_proxy_release+0x24/0x90
      <...>
      Call Trace:
       [] __fput+0xdf/0x1d0
       [] ____fput+0xe/0x10
       [] task_work_run+0x8e/0xc0
       [] do_exit+0x2ae/0xae0
       [] ? __audit_syscall_entry+0xae/0x100
       [] ? syscall_trace_enter+0x1ca/0x310
       [] do_group_exit+0x44/0xc0
       [] SyS_exit_group+0x14/0x20
       [] do_syscall_64+0x61/0x150
       [] entry_SYSCALL64_slow_path+0x25/0x25
      <...>
      ---[ end trace f22ae883fa3ea6b8 ]---
      Fixing recursive fault but reboot is needed!
    
    Fix this by initializing the f2fs/status file_operations' ->owner with
    THIS_MODULE.
    
    This will allow debugfs to grab a reference to the f2fs module upon any
    open on that file, thus preventing it from getting removed.
    
    Fixes: 902829a ("f2fs: move proc files to debugfs")
    Reported-by: Mike Marshall <[email protected]>
    Reported-by: Martin Brandenburg <[email protected]>
    Signed-off-by: Nicolai Stange <[email protected]>
    Signed-off-by: Jaegeuk Kim <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    nicstange authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    154d83a View commit details
    Browse the repository at this point in the history
  55. f2fs: fix overflow due to condition check order

    commit e87f732 upstream.
    
    In the last ilen case, i was already increased, resulting in accessing out-
    of-boundary entry of do_replace and blkaddr.
    Fix to check ilen first to exit the loop.
    
    Fixes: 2aa8fbb9693020 ("f2fs: refactor __exchange_data_block for speed up")
    Signed-off-by: Jaegeuk Kim <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Jaegeuk Kim authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    bf0f020 View commit details
    Browse the repository at this point in the history
  56. loop: return proper error from loop_queue_rq()

    commit b4a567e upstream.
    
    ->queue_rq() should return one of the BLK_MQ_RQ_QUEUE_* constants, not
    an errno.
    
    Fixes: f4aa4c7 ("block: loop: convert to per-device workqueue")
    Signed-off-by: Omar Sandoval <[email protected]>
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    osandov authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    6290a3b View commit details
    Browse the repository at this point in the history
  57. nvmet: Fix possible infinite loop triggered on hot namespace removal

    commit e4fcf07 upstream.
    
    When removing a namespace we delete it from the subsystem namespaces
    list with list_del_init which allows us to know if it is enabled or
    not.
    
    The problem is that list_del_init initialize the list next and does
    not respect the RCU list-traversal we do on the IO path for locating
    a namespace. Instead we need to use list_del_rcu which is allowed to
    run concurrently with the _rcu list-traversal primitives (keeps list
    next intact) and guarantees concurrent nvmet_find_naespace forward
    progress.
    
    By changing that, we cannot rely on ns->dev_link for knowing if the
    namspace is enabled, so add enabled indicator entry to nvmet_ns for
    that.
    
    Signed-off-by: Sagi Grimberg <[email protected]>
    Signed-off-by: Solganik Alexander <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    sashas-lb authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    3e0ef1b View commit details
    Browse the repository at this point in the history
  58. mm/vmscan.c: set correct defer count for shrinker

    commit 5f33a08 upstream.
    
    Our system uses significantly more slab memory with memcg enabled with
    the latest kernel.  With 3.10 kernel, slab uses 2G memory, while with
    4.6 kernel, 6G memory is used.  The shrinker has problem.  Let's see we
    have two memcg for one shrinker.  In do_shrink_slab:
    
    1. Check cg1.  nr_deferred = 0, assume total_scan = 700.  batch size
       is 1024, then no memory is freed.  nr_deferred = 700
    
    2. Check cg2.  nr_deferred = 700.  Assume freeable = 20, then
       total_scan = 10 or 40.  Let's assume it's 10.  No memory is freed.
       nr_deferred = 10.
    
    The deferred share of cg1 is lost in this case.  kswapd will free no
    memory even run above steps again and again.
    
    The fix makes sure one memcg's deferred share isn't lost.
    
    Link: http://lkml.kernel.org/r/2414be961b5d25892060315fbb56bb19d81d0c07.1476227351.git.shli@fb.com
    Signed-off-by: Shaohua Li <[email protected]>
    Cc: Johannes Weiner <[email protected]>
    Cc: Michal Hocko <[email protected]>
    Cc: Vladimir Davydov <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    shligit authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    0927d28 View commit details
    Browse the repository at this point in the history
  59. mm, page_alloc: keep pcp count and list contents in sync if struct pa…

    …ge is corrupted
    
    commit a6de734 upstream.
    
    Vlastimil Babka pointed out that commit 479f854 ("mm, page_alloc:
    defer debugging checks of pages allocated from the PCP") will allow the
    per-cpu list counter to be out of sync with the per-cpu list contents if
    a struct page is corrupted.
    
    The consequence is an infinite loop if the per-cpu lists get fully
    drained by free_pcppages_bulk because all the lists are empty but the
    count is positive.  The infinite loop occurs here
    
                    do {
                            batch_free++;
                            if (++migratetype == MIGRATE_PCPTYPES)
                                    migratetype = 0;
                            list = &pcp->lists[migratetype];
                    } while (list_empty(list));
    
    What the user sees is a bad page warning followed by a soft lockup with
    interrupts disabled in free_pcppages_bulk().
    
    This patch keeps the accounting in sync.
    
    Fixes: 479f854 ("mm, page_alloc: defer debugging checks of pages allocated from the PCP")
    Link: http://lkml.kernel.org/r/[email protected]
    Signed-off-by: Mel Gorman <[email protected]>
    Acked-by: Vlastimil Babka <[email protected]>
    Acked-by: Michal Hocko <[email protected]>
    Acked-by: Hillf Danton <[email protected]>
    Cc: Christoph Lameter <[email protected]>
    Cc: Johannes Weiner <[email protected]>
    Cc: Jesper Dangaard Brouer <[email protected]>
    Cc: Joonsoo Kim <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    gormanm authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    d4f4b2e View commit details
    Browse the repository at this point in the history
  60. usb: gadget: composite: always set ep->mult to a sensible value

    commit eaa496f upstream.
    
    ep->mult is supposed to be set to Isochronous and
    Interrupt Endapoint's multiplier value. This value
    is computed from different places depending on the
    link speed.
    
    If we're dealing with HighSpeed, then it's part of
    bits [12:11] of wMaxPacketSize. This case wasn't
    taken into consideration before.
    
    While at that, also make sure the ep->mult defaults
    to one so drivers can use it unconditionally and
    assume they'll never multiply ep->maxpacket to zero.
    
    Cc: <[email protected]>
    Signed-off-by: Felipe Balbi <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Felipe Balbi authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    8b63a92 View commit details
    Browse the repository at this point in the history
  61. PM / OPP: Pass opp_table to dev_pm_opp_put_regulator()

    commit 91291d9 upstream.
    
    Joonyoung Shim reported an interesting problem on his ARM octa-core
    Odoroid-XU3 platform. During system suspend, dev_pm_opp_put_regulator()
    was failing for a struct device for which dev_pm_opp_set_regulator() is
    called earlier.
    
    This happened because an earlier call to
    dev_pm_opp_of_cpumask_remove_table() function (from cpufreq-dt.c file)
    removed all the entries from opp_table->dev_list apart from the last CPU
    device in the cpumask of CPUs sharing the OPP.
    
    But both dev_pm_opp_set_regulator() and dev_pm_opp_put_regulator()
    routines get CPU device for the first CPU in the cpumask. And so the OPP
    core failed to find the OPP table for the struct device.
    
    This patch attempts to fix this problem by returning a pointer to the
    opp_table from dev_pm_opp_set_regulator() and using that as the
    parameter to dev_pm_opp_put_regulator(). This ensures that the
    dev_pm_opp_put_regulator() doesn't fail to find the opp table.
    
    Note that similar design problem also exists with other
    dev_pm_opp_put_*() APIs, but those aren't used currently by anyone and
    so we don't need to update them for now.
    
    Reported-by: Joonyoung Shim <[email protected]>
    Signed-off-by: Stephen Boyd <[email protected]>
    Signed-off-by: Viresh Kumar <[email protected]>
    [ Viresh: Wrote commit log and tested on exynos 5250 ]
    Signed-off-by: Rafael J. Wysocki <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    bebarino authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    e3742a1 View commit details
    Browse the repository at this point in the history
  62. blk-mq: Do not invoke .queue_rq() for a stopped queue

    commit bc27c01 upstream.
    
    The meaning of the BLK_MQ_S_STOPPED flag is "do not call
    .queue_rq()". Hence modify blk_mq_make_request() such that requests
    are queued instead of issued if a queue has been stopped.
    
    Reported-by: Ming Lei <[email protected]>
    Signed-off-by: Bart Van Assche <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Reviewed-by: Ming Lei <[email protected]>
    Reviewed-by: Hannes Reinecke <[email protected]>
    Reviewed-by: Johannes Thumshirn <[email protected]>
    Reviewed-by: Sagi Grimberg <[email protected]>
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Bart Van Assche authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    45f6311 View commit details
    Browse the repository at this point in the history
  63. dm table: fix 'all_blk_mq' inconsistency when an empty table is loaded

    commit 6936c12 upstream.
    
    An earlier DM multipath table could have been build ontop of underlying
    devices that were all using blk-mq.  In that case, if that active
    multipath table is replaced with an empty DM multipath table (that
    reflects all paths have failed) then it is important that the
    'all_blk_mq' state of the active table is transfered to the new empty DM
    table.  Otherwise dm-rq.c:dm_old_prep_tio() will incorrectly clone a
    request that isn't needed by the DM multipath target when it is to issue
    IO to an underlying blk-mq device.
    
    Fixes: e83068a ("dm mpath: add optional "queue_mode" feature")
    Reported-by: Bart Van Assche <[email protected]>
    Tested-by: Bart Van Assche <[email protected]>
    Signed-off-by: Mike Snitzer <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    snitm authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    d948d3b View commit details
    Browse the repository at this point in the history
  64. dm table: an 'all_blk_mq' table must be loaded for a blk-mq DM device

    commit 301fc3f upstream.
    
    When dm_table_set_type() is used by a target to establish a DM table's
    type (e.g. DM_TYPE_MQ_REQUEST_BASED in the case of DM multipath) the
    DM core must go on to verify that the devices in the table are
    compatible with the established type.
    
    Fixes: e83068a ("dm mpath: add optional "queue_mode" feature")
    Signed-off-by: Bart Van Assche <[email protected]>
    Signed-off-by: Mike Snitzer <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Bart Van Assche authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    1ca66d6 View commit details
    Browse the repository at this point in the history
  65. dm flakey: return -EINVAL on interval bounds error in flakey_ctr()

    commit bff7e06 upstream.
    
    Fix to return error code -EINVAL instead of 0, as is done elsewhere in
    this function.
    
    Fixes: e80d1c8 ("dm: do not override error code returned from dm_get_device()")
    Signed-off-by: Wei Yongjun <[email protected]>
    Signed-off-by: Mike Snitzer <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    weiyj authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    bd5fcd1 View commit details
    Browse the repository at this point in the history
  66. dm crypt: mark key as invalid until properly loaded

    commit 265e909 upstream.
    
    In crypt_set_key(), if a failure occurs while replacing the old key
    (e.g. tfm->setkey() fails) the key must not have DM_CRYPT_KEY_VALID flag
    set.  Otherwise, the crypto layer would have an invalid key that still
    has DM_CRYPT_KEY_VALID flag set.
    
    Signed-off-by: Ondrej Kozina <[email protected]>
    Reviewed-by: Mikulas Patocka <[email protected]>
    Signed-off-by: Mike Snitzer <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    oniko authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    26011e6 View commit details
    Browse the repository at this point in the history
  67. dm rq: fix a race condition in rq_completed()

    commit d15bb3a upstream.
    
    It is required to hold the queue lock when calling blk_run_queue_async()
    to avoid that a race between blk_run_queue_async() and
    blk_cleanup_queue() is triggered.
    
    Signed-off-by: Bart Van Assche <[email protected]>
    Signed-off-by: Mike Snitzer <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Bart Van Assche authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    454b98d View commit details
    Browse the repository at this point in the history
  68. dm raid: fix discard support regression

    commit 11e2968 upstream.
    
    Commit ecbfb9f ("dm raid: add raid level takeover support") moved the
    configure_discard_support() call from raid_ctr() to raid_preresume().
    
    Enabling/disabling discard _must_ happen during table load (through the
    .ctr hook).  Fix this regression by moving the
    configure_discard_support() call back to raid_ctr().
    
    Fixes: ecbfb9f ("dm raid: add raid level takeover support")
    Signed-off-by: Heinz Mauelshagen <[email protected]>
    Signed-off-by: Mike Snitzer <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    mauelsha authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    ab10ab0 View commit details
    Browse the repository at this point in the history
  69. dm space map metadata: fix 'struct sm_metadata' leak on failed create

    commit 314c25c upstream.
    
    In dm_sm_metadata_create() we temporarily change the dm_space_map
    operations from 'ops' (whose .destroy function deallocates the
    sm_metadata) to 'bootstrap_ops' (whose .destroy function doesn't).
    
    If dm_sm_metadata_create() fails in sm_ll_new_metadata() or
    sm_ll_extend(), it exits back to dm_tm_create_internal(), which calls
    dm_sm_destroy() with the intention of freeing the sm_metadata, but it
    doesn't (because the dm_space_map operations is still set to
    'bootstrap_ops').
    
    Fix this by setting the dm_space_map operations back to 'ops' if
    dm_sm_metadata_create() fails when it is set to 'bootstrap_ops'.
    
    Signed-off-by: Benjamin Marzinski <[email protected]>
    Acked-by: Joe Thornber <[email protected]>
    Signed-off-by: Mike Snitzer <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    bmarzins authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    769c092 View commit details
    Browse the repository at this point in the history
  70. ASoC: intel: Fix crash at suspend/resume without card registration

    commit 2fc995a upstream.
    
    When ASoC Intel SST Medfield driver is probed but without codec / card
    assigned, it causes an Oops and freezes the kernel at suspend/resume,
    
     PM: Suspending system (freeze)
     Suspending console(s) (use no_console_suspend to debug)
     BUG: unable to handle kernel NULL pointer dereference at 0000000000000018
     IP: [<ffffffffc09d9409>] sst_soc_prepare+0x19/0xa0 [snd_soc_sst_mfld_platform]
     Oops: 0000 [Freescale#1] PREEMPT SMP
     CPU: 0 PID: 1552 Comm: systemd-sleep Tainted: G W 4.9.0-rc6-1.g5f5c2ad-default Freescale#1
     Call Trace:
      [<ffffffffb45318f9>] dpm_prepare+0x209/0x460
      [<ffffffffb4531b61>] dpm_suspend_start+0x11/0x60
      [<ffffffffb40d3cc2>] suspend_devices_and_enter+0xb2/0x710
      [<ffffffffb40d462e>] pm_suspend+0x30e/0x390
      [<ffffffffb40d2eba>] state_store+0x8a/0x90
      [<ffffffffb43c670f>] kobj_attr_store+0xf/0x20
      [<ffffffffb42b0d97>] sysfs_kf_write+0x37/0x40
      [<ffffffffb42b02bc>] kernfs_fop_write+0x11c/0x1b0
      [<ffffffffb422be68>] __vfs_write+0x28/0x140
      [<ffffffffb43728a8>] ? apparmor_file_permission+0x18/0x20
      [<ffffffffb433b2ab>] ? security_file_permission+0x3b/0xc0
      [<ffffffffb422d095>] vfs_write+0xb5/0x1a0
      [<ffffffffb422e3d6>] SyS_write+0x46/0xa0
      [<ffffffffb4719fbb>] entry_SYSCALL_64_fastpath+0x1e/0xad
    
    Add proper NULL checks in the PM code of mdfld driver.
    
    Signed-off-by: Takashi Iwai <[email protected]>
    Acked-by: Vinod Koul <[email protected]>
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    tiwai authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    6cb589c View commit details
    Browse the repository at this point in the history
  71. CIFS: Fix a possible memory corruption during reconnect

    commit 53e0e11 upstream.
    
    We can not unlock/lock cifs_tcp_ses_lock while walking through ses
    and tcon lists because it can corrupt list iterator pointers and
    a tcon structure can be released if we don't hold an extra reference.
    Fix it by moving a reconnect process to a separate delayed work
    and acquiring a reference to every tcon that needs to be reconnected.
    Also do not send an echo request on newly established connections.
    
    Signed-off-by: Pavel Shilovsky <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    piastry authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    ff04da3 View commit details
    Browse the repository at this point in the history
  72. CIFS: Fix missing nls unload in smb2_reconnect()

    commit 4772c79 upstream.
    
    Acked-by: Sachin Prabhu <[email protected]>
    Signed-off-by: Pavel Shilovsky <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    piastry authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    9f1f507 View commit details
    Browse the repository at this point in the history
  73. CIFS: Fix a possible memory corruption in push locks

    commit e3d240e upstream.
    
    If maxBuf is not 0 but less than a size of SMB2 lock structure
    we can end up with a memory corruption.
    
    Signed-off-by: Pavel Shilovsky <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    piastry authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    bbf23f0 View commit details
    Browse the repository at this point in the history
  74. kernel/watchdog: use nmi registers snapshot in hardlockup handler

    commit 4d1f0fb upstream.
    
    NMI handler doesn't call set_irq_regs(), it's set only by normal IRQ.
    Thus get_irq_regs() returns NULL or stale registers snapshot with IP/SP
    pointing to the code interrupted by IRQ which was interrupted by NMI.
    NULL isn't a problem: in this case watchdog calls dump_stack() and
    prints full stack trace including NMI.  But if we're stuck in IRQ
    handler then NMI watchlog will print stack trace without IRQ part at
    all.
    
    This patch uses registers snapshot passed into NMI handler as arguments:
    these registers point exactly to the instruction interrupted by NMI.
    
    Fixes: 5553787 ("kernel/watchdog.c: perform all-CPU backtrace in case of hard lockup")
    Link: http://lkml.kernel.org/r/146771764784.86724.6006627197118544150.stgit@buzz
    Signed-off-by: Konstantin Khlebnikov <[email protected]>
    Cc: Jiri Kosina <[email protected]>
    Cc: Ulrich Obergfell <[email protected]>
    Cc: Aaron Tomlin <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    koct9i authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    2f826a7 View commit details
    Browse the repository at this point in the history
  75. watchdog: mei_wdt: request stop on reboot to prevent false positive e…

    …vent
    
    commit 9eff114 upstream.
    
    Systemd on reboot enables shutdown watchdog that leaves the watchdog
    device open to ensure that even if power down process get stuck the
    platform reboots nonetheless.
    The iamt_wdt is an alarm-only watchdog and can't reboot system, but the
    FW will generate an alarm event reboot was completed in time, as the
    watchdog is not automatically disabled during power cycle.
    So we should request stop watchdog on reboot to eliminate wrong alarm
    from the FW.
    
    Signed-off-by: Alexander Usyskin <[email protected]>
    Signed-off-by: Tomas Winkler <[email protected]>
    Reviewed-by: Guenter Roeck <[email protected]>
    Signed-off-by: Guenter Roeck <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    ausyskin authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    bf902ea View commit details
    Browse the repository at this point in the history
  76. watchdog: qcom: fix kernel panic due to external abort on non-linefetch

    commit f06f35c upstream.
    
    This patch fixes a off-by-one in the "watchdog: qcom: add option for
    standalone watchdog not in timer block" patch that causes the
    following panic on boot:
    
    > Unhandled fault: external abort on non-linefetch (0x1008) at 0xc8874002
    > pgd = c0204000
    > [c8874002] *pgd=87806811, *pte=0b017653, *ppte=0b017453
    > Internal error: : 1008 [Freescale#1] SMP ARM
    > CPU: 2 PID: 1 Comm: swapper/0 Not tainted 4.8.6 #0
    > Hardware name: Generic DT based system
    > PC is at 0xc02222f4
    > LR is at 0x1
    > pc : [<c02222f4>]    lr : [<00000001>]    psr: 00000113
    > sp : c782fc98  ip : 00000003  fp : 00000000
    > r10: 00000004  r9 : c782e000  r8 : c04ab98c
    > r7 : 00000001  r6 : c8874002  r5 : c782fe00  r4 : 00000002
    > r3 : 00000000  r2 : c782fe00  r1 : 00100000  r0 : c8874002
    > Flags: nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
    > Control: 10c5387d  Table: 8020406a  DAC: 00000051
    > Process swapper/0 (pid: 1, stack limit = 0xc782e210)
    > Stack: (0xc782fc98 to 0xc7830000)
    > [...]
    
    The WDT_STS (status) needs to be translated via wdt_addr as well.
    
    fixes: f0d9d0f ("watchdog: qcom: add option for standalone watchdog not in timer block")
    Signed-off-by: Christian Lamparter <[email protected]>
    Reviewed-by: Guenter Roeck <[email protected]>
    Signed-off-by: Guenter Roeck <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    chunkeey authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    63b33e0 View commit details
    Browse the repository at this point in the history
  77. kernel/debug/debug_core.c: more properly delay for secondary CPUs

    commit 2d13bb6 upstream.
    
    We've got a delay loop waiting for secondary CPUs.  That loop uses
    loops_per_jiffy.  However, loops_per_jiffy doesn't actually mean how
    many tight loops make up a jiffy on all architectures.  It is quite
    common to see things like this in the boot log:
    
      Calibrating delay loop (skipped), value calculated using timer
      frequency.. 48.00 BogoMIPS (lpj=24000)
    
    In my case I was seeing lots of cases where other CPUs timed out
    entering the debugger only to print their stack crawls shortly after the
    kdb> prompt was written.
    
    Elsewhere in kgdb we already use udelay(), so that should be safe enough
    to use to implement our timeout.  We'll delay 1 ms for 1000 times, which
    should give us a full second of delay (just like the old code wanted)
    but allow us to notice that we're done every 1 ms.
    
    [[email protected]: simplifications, per Daniel]
    Link: http://lkml.kernel.org/r/[email protected]
    Signed-off-by: Douglas Anderson <[email protected]>
    Reviewed-by: Daniel Thompson <[email protected]>
    Cc: Jason Wessel <[email protected]>
    Cc: Brian Norris <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    dianders authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    8419f52 View commit details
    Browse the repository at this point in the history
  78. tpm xen: Remove bogus tpm_chip_unregister

    commit 1f0f30e upstream.
    
    tpm_chip_unregister can only be called after tpm_chip_register.
    devm manages the allocation so no unwind is needed here.
    
    Fixes: afb5abc ("tpm: two-phase chip management functions")
    Reviewed-by: Jarkko Sakkinen <[email protected]>
    Signed-off-by: Jarkko Sakkinen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    jgunthorpe authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    883f12a View commit details
    Browse the repository at this point in the history
  79. xen/gntdev: Use VM_MIXEDMAP instead of VM_IO to avoid NUMA balancing

    commit 30faaaf upstream.
    
    Commit 9c17d96 ("xen/gntdev: Grant maps should not be subject to
    NUMA balancing") set VM_IO flag to prevent grant maps from being
    subjected to NUMA balancing.
    
    It was discovered recently that this flag causes get_user_pages() to
    always fail with -EFAULT.
    
    check_vma_flags
    __get_user_pages
    __get_user_pages_locked
    __get_user_pages_unlocked
    get_user_pages_fast
    iov_iter_get_pages
    dio_refill_pages
    do_direct_IO
    do_blockdev_direct_IO
    do_blockdev_direct_IO
    ext4_direct_IO_read
    generic_file_read_iter
    aio_run_iocb
    
    (which can happen if guest's vdisk has direct-io-safe option).
    
    To avoid this let's use VM_MIXEDMAP flag instead --- it prevents
    NUMA balancing just as VM_IO does and has no effect on
    check_vma_flags().
    
    
    Reported-by: Olaf Hering <[email protected]>
    Suggested-by: Hugh Dickins <[email protected]>
    Signed-off-by: Boris Ostrovsky <[email protected]>
    Acked-by: Hugh Dickins <[email protected]>
    Tested-by: Olaf Hering <[email protected]>
    Signed-off-by: Juergen Gross <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Boris Ostrovsky authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    6fbd3fb View commit details
    Browse the repository at this point in the history
  80. arm/xen: Use alloc_percpu rather than __alloc_percpu

    commit 24d5373 upstream.
    
    The function xen_guest_init is using __alloc_percpu with an alignment
    which are not power of two.
    
    However, the percpu allocator never supported alignments which are not power
    of two and has always behaved incorectly in thise case.
    
    Commit 3ca45a4 "percpu: ensure requested alignment is power of two"
    introduced a check which trigger a warning [1] when booting linux-next
    on Xen. But in reality this bug was always present.
    
    This can be fixed by replacing the call to __alloc_percpu with
    alloc_percpu. The latter will use an alignment which are a power of two.
    
    [1]
    
    [    0.023921] illegal size (48) or align (48) for percpu allocation
    [    0.024167] ------------[ cut here ]------------
    [    0.024344] WARNING: CPU: 0 PID: 1 at linux/mm/percpu.c:892 pcpu_alloc+0x88/0x6c0
    [    0.024584] Modules linked in:
    [    0.024708]
    [    0.024804] CPU: 0 PID: 1 Comm: swapper/0 Not tainted
    4.9.0-rc7-next-20161128 Freescale#473
    [    0.025012] Hardware name: Foundation-v8A (DT)
    [    0.025162] task: ffff80003d870000 task.stack: ffff80003d844000
    [    0.025351] PC is at pcpu_alloc+0x88/0x6c0
    [    0.025490] LR is at pcpu_alloc+0x88/0x6c0
    [    0.025624] pc : [<ffff00000818e678>] lr : [<ffff00000818e678>]
    pstate: 60000045
    [    0.025830] sp : ffff80003d847cd0
    [    0.025946] x29: ffff80003d847cd0 x28: 0000000000000000
    [    0.026147] x27: 0000000000000000 x26: 0000000000000000
    [    0.026348] x25: 0000000000000000 x24: 0000000000000000
    [    0.026549] x23: 0000000000000000 x22: 00000000024000c0
    [    0.026752] x21: ffff000008e97000 x20: 0000000000000000
    [    0.026953] x19: 0000000000000030 x18: 0000000000000010
    [    0.027155] x17: 0000000000000a3f x16: 00000000deadbeef
    [    0.027357] x15: 0000000000000006 x14: ffff000088f79c3f
    [    0.027573] x13: ffff000008f79c4d x12: 0000000000000041
    [    0.027782] x11: 0000000000000006 x10: 0000000000000042
    [    0.027995] x9 : ffff80003d847a40 x8 : 6f697461636f6c6c
    [    0.028208] x7 : 6120757063726570 x6 : ffff000008f79c84
    [    0.028419] x5 : 0000000000000005 x4 : 0000000000000000
    [    0.028628] x3 : 0000000000000000 x2 : 000000000000017f
    [    0.028840] x1 : ffff80003d870000 x0 : 0000000000000035
    [    0.029056]
    [    0.029152] ---[ end trace 0000000000000000 ]---
    [    0.029297] Call trace:
    [    0.029403] Exception stack(0xffff80003d847b00 to
                                   0xffff80003d847c30)
    [    0.029621] 7b00: 0000000000000030 0001000000000000
    ffff80003d847cd0 ffff00000818e678
    [    0.029901] 7b20: 0000000000000002 0000000000000004
    ffff000008f7c060 0000000000000035
    [    0.030153] 7b40: ffff000008f79000 ffff000008c4cd88
    ffff80003d847bf0 ffff000008101778
    [    0.030402] 7b60: 0000000000000030 0000000000000000
    ffff000008e97000 00000000024000c0
    [    0.030647] 7b80: 0000000000000000 0000000000000000
    0000000000000000 0000000000000000
    [    0.030895] 7ba0: 0000000000000035 ffff80003d870000
    000000000000017f 0000000000000000
    [    0.031144] 7bc0: 0000000000000000 0000000000000005
    ffff000008f79c84 6120757063726570
    [    0.031394] 7be0: 6f697461636f6c6c ffff80003d847a40
    0000000000000042 0000000000000006
    [    0.031643] 7c00: 0000000000000041 ffff000008f79c4d
    ffff000088f79c3f 0000000000000006
    [    0.031877] 7c20: 00000000deadbeef 0000000000000a3f
    [    0.032051] [<ffff00000818e678>] pcpu_alloc+0x88/0x6c0
    [    0.032229] [<ffff00000818ece8>] __alloc_percpu+0x18/0x20
    [    0.032409] [<ffff000008d9606c>] xen_guest_init+0x174/0x2f4
    [    0.032591] [<ffff0000080830f8>] do_one_initcall+0x38/0x130
    [    0.032783] [<ffff000008d90c34>] kernel_init_freeable+0xe0/0x248
    [    0.032995] [<ffff00000899a890>] kernel_init+0x10/0x100
    [    0.033172] [<ffff000008082ec0>] ret_from_fork+0x10/0x50
    
    Reported-by: Wei Chen <[email protected]>
    Link: https://lkml.org/lkml/2016/11/28/669
    Signed-off-by: Julien Grall <[email protected]>
    Signed-off-by: Stefano Stabellini <[email protected]>
    Reviewed-by: Stefano Stabellini <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Julien Grall authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    959e363 View commit details
    Browse the repository at this point in the history
  81. xfs: set AGI buffer type in xlog_recover_clear_agi_bucket

    commit 6b10b23 upstream.
    
    xlog_recover_clear_agi_bucket didn't set the
    type to XFS_BLFT_AGI_BUF, so we got a warning during log
    replay (or an ASSERT on a debug build).
    
        XFS (md0): Unknown buffer type 0!
        XFS (md0): _xfs_buf_ioapply: no ops on block 0xaea8802/0x1
    
    Fix this, as was done in f19b872 for 2 other locations
    with the same problem.
    
    Signed-off-by: Eric Sandeen <[email protected]>
    Reviewed-by: Brian Foster <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Signed-off-by: Dave Chinner <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    sandeen authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    587e89b View commit details
    Browse the repository at this point in the history
  82. arm64: mark reserved memblock regions explicitly in iomem

    commit e7cd190 upstream.
    
    Kdump(kexec-tools) parses /proc/iomem to identify all the memory regions
    on the system. Since the current kernel names "nomap" regions, like UEFI
    runtime services code/data, as "System RAM," kexec-tools sets up elf core
    header to include them in a crash dump file (/proc/vmcore).
    
    Then crash dump kernel parses UEFI memory map again, re-marks those regions
    as "nomap" and does not create a memory mapping for them unlike the other
    areas of System RAM. In this case, copying /proc/vmcore through
    copy_oldmem_page() on crash dump kernel will end up with a kernel abort,
    as reported in [1].
    
    This patch names all the "nomap" regions explicitly as "reserved" so that
    we can exclude them from a crash dump file. acpi_os_ioremap() must also
    be modified because those regions have WB attributes [2].
    
    Apart from kdump, this change also matches x86's use of acpi (and
    /proc/iomem).
    
    [1] http://lists.infradead.org/pipermail/linux-arm-kernel/2016-August/448186.html
    [2] http://lists.infradead.org/pipermail/linux-arm-kernel/2016-August/450089.html
    
    Reviewed-by: Catalin Marinas <[email protected]>
    Tested-by: James Morse <[email protected]>
    Reviewed-by: James Morse <[email protected]>
    Signed-off-by: AKASHI Takahiro <[email protected]>
    Signed-off-by: Will Deacon <[email protected]>
    Cc: Matthias Brugger <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    AKASHI Takahiro authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    7742256 View commit details
    Browse the repository at this point in the history
  83. Revert "netfilter: nat: convert nat bysrc hash to rhashtable"

    This reverts commit 870190a as it is
    not working properly.  Please move to 4.9 to get the full fix.
    
    Reported-by: Pablo Neira Ayuso <[email protected]>
    Cc: Florian Westphal <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    99d6d4e View commit details
    Browse the repository at this point in the history
  84. Revert "netfilter: move nat hlist_head to nf_conn"

    This reverts commit 7c96643 as it is
    not working properly.  Please move to 4.9 to get the full fix.
    
    Reported-by: Pablo Neira Ayuso <[email protected]>
    Cc: Florian Westphal <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    f199bdb View commit details
    Browse the repository at this point in the history
  85. driver core: fix race between creating/querying glue dir and its cleanup

    commit cebf8fd upstream.
    
    The global mutex of 'gdp_mutex' is used to serialize creating/querying
    glue dir and its cleanup. Turns out it isn't a perfect way because
    part(kobj_kset_leave()) of the actual cleanup action() is done inside
    the release handler of the glue dir kobject. That means gdp_mutex has
    to be held before releasing the last reference count of the glue dir
    kobject.
    
    This patch moves glue dir's cleanup after kobject_del() in device_del()
    for avoiding the race.
    
    Cc: Yijing Wang <[email protected]>
    Reported-by: Chandra Sekhar Lingutla <[email protected]>
    Signed-off-by: Ming Lei <[email protected]>
    Cc: Jiri Slaby <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Ming Lei authored and gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    6458972 View commit details
    Browse the repository at this point in the history
  86. Linux 4.8.16

    gregkh committed Jan 6, 2017
    Configuration menu
    Copy the full SHA
    c65ed08 View commit details
    Browse the repository at this point in the history

Commits on Jan 9, 2017

  1. ssb: Fix error routine when fallback SPROM fails

    commit 8052d72 upstream.
    
    When there is a CRC error in the SPROM read from the device, the code
    attempts to handle a fallback SPROM. When this also fails, the driver
    returns zero rather than an error code.
    
    Signed-off-by: Larry Finger <[email protected]>
    Signed-off-by: Kalle Valo <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    lwfinger authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    c9fce6b View commit details
    Browse the repository at this point in the history
  2. rtlwifi: Fix enter/exit power_save

    commit ba9f93f upstream.
    
    In commit a5ffbe0 ("rtlwifi: Fix scheduling while atomic bug") and
    commit a269913 ("rtlwifi: Rework rtl_lps_leave() and rtl_lps_enter()
    to use work queue"), an error was introduced in the power-save routines
    due to the fact that leaving PS was delayed by the use of a work queue.
    
    This problem is fixed by detecting if the enter or leave routines are
    in interrupt mode. If so, the workqueue is used to place the request.
    If in normal mode, the enter or leave routines are called directly.
    
    Fixes: a269913 ("rtlwifi: Rework rtl_lps_leave() and rtl_lps_enter() to use work queue")
    Reported-by: Ping-Ke Shih <[email protected]>
    Signed-off-by: Larry Finger <[email protected]>
    Signed-off-by: Kalle Valo <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    lwfinger authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    e24523a View commit details
    Browse the repository at this point in the history
  3. perf/x86: Fix exclusion of BTS and LBR for Goldmont

    commit b0c1ef5 upstream.
    
    An earlier patch allowed enabling PT and LBR at the same
    time on Goldmont. However it also allowed enabling BTS and LBR
    at the same time, which is still not supported. Fix this by
    bypassing the check only for PT.
    
    Signed-off-by: Andi Kleen <[email protected]>
    Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
    Cc: Linus Torvalds <[email protected]>
    Cc: Peter Zijlstra <[email protected]>
    Cc: Thomas Gleixner <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Fixes: ccbebba ("perf/x86/intel/pt: Bypass PT vs. LBR exclusivity if the core supports it")
    Link: http://lkml.kernel.org/r/[email protected]
    Signed-off-by: Ingo Molnar <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Andi Kleen authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    7b9e1a1 View commit details
    Browse the repository at this point in the history
  4. perf/x86/intel/cstate: Prevent hotplug callback leak

    commit 834fcd2 upstream.
    
    If the pmu registration fails the registered hotplug callbacks are not
    removed. Wrong in any case, but fatal in case of a modular driver.
    
    Replace the nonsensical state names with proper ones while at it.
    
    Fixes: 77c34ef ("perf/x86/intel/cstate: Convert Intel CSTATE to hotplug state machine")
    Signed-off-by: Thomas Gleixner <[email protected]>
    Cc: Sebastian Siewior <[email protected]>
    Cc: Peter Zijlstra <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    KAGA-KOKO authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    2abcc02 View commit details
    Browse the repository at this point in the history
  5. rtl8xxxu: Work around issue with 8192eu and 8723bu devices not reconn…

    …ecting
    
    commit c59f13b upstream.
    
    The H2C MEDIA_STATUS_RPT command for some reason causes 8192eu and
    8723bu devices not being able to reconnect.
    
    Reported-by: Barry Day <[email protected]>
    Signed-off-by: Jes Sorensen <[email protected]>
    Signed-off-by: Kalle Valo <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Jes Sorensen authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    d2546f6 View commit details
    Browse the repository at this point in the history
  6. cfg80211/mac80211: fix BSS leaks when abandoning assoc attempts

    commit e6f462d upstream.
    
    When mac80211 abandons an association attempt, it may free
    all the data structures, but inform cfg80211 and userspace
    about it only by sending the deauth frame it received, in
    which case cfg80211 has no link to the BSS struct that was
    used and will not cfg80211_unhold_bss() it.
    
    Fix this by providing a way to inform cfg80211 of this with
    the BSS entry passed, so that it can clean up properly, and
    use this ability in the appropriate places in mac80211.
    
    This isn't ideal: some code is more or less duplicated and
    tracing is missing. However, it's a fairly small change and
    it's thus easier to backport - cleanups can come later.
    
    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    jmberg-intel authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    42e76c5 View commit details
    Browse the repository at this point in the history
  7. ath9k: fix ath9k_hw_gpio_get() to return 0 or 1 on success

    commit 91851cc upstream.
    
    Commit b2d70d4 ("ath9k: make GPIO API to support both of WMAC and
    SOC") refactored ath9k_hw_gpio_get() to support both WMAC and SOC GPIOs,
    changing the return on success from 1 to BIT(gpio). This broke some callers
    like ath_is_rfkill_set(). This doesn't fix any known bug in mainline at the
    moment, but should be fixed anyway.
    
    Instead of fixing all callers, change ath9k_hw_gpio_get() back to only
    return 0 or 1.
    
    Fixes: b2d70d4 ("ath9k: make GPIO API to support both of WMAC and SOC")
    Signed-off-by: Matthias Schiffer <[email protected]>
    [[email protected]: mention that doesn't fix any known bug]
    Signed-off-by: Kalle Valo <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    neocturne authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    d80ff7c View commit details
    Browse the repository at this point in the history
  8. ath9k: Really fix LED polarity for some Mini PCI AR9220 MB92 cards.

    commit 79e57dd upstream.
    
    The active_high LED of my Wistron DNMA-92 is still being recognized as
    active_low on 4.7.6 mainline. When I was preparing my former commit
    0f9edcd ("ath9k: Fix LED polarity for some Mini PCI AR9220 MB92
    cards.") to fix that I must have somehow messed up with testing, because
    I tested the final version of that patch before sending it, and it was
    apparently working; but now it is not working on 4.7.6 mainline.
    
    I initially added the PCI_DEVICE_SUB section for 0x0029/0x2096 above the
    PCI_VDEVICE section for 0x0029; but then I moved the former below the
    latter after seeing how 0x002A sections were sorted in the file.
    
    This turned out to be wrong: if a generic PCI_VDEVICE entry (that has
    both subvendor and subdevice IDs set to PCI_ANY_ID) is put before a more
    specific one (PCI_DEVICE_SUB), then the generic PCI_VDEVICE entry will
    match first and will be used.
    
    With this patch, 0x0029/0x2096 has finally got active_high LED on 4.7.6.
    
    While I'm at it, let's fix 0x002A too by also moving its generic definition
    below its specific ones.
    
    Fixes: 0f9edcd ("ath9k: Fix LED polarity for some Mini PCI AR9220 MB92 cards.")
    Signed-off-by: Vittorio Gambaletta <[email protected]>
    [[email protected]: improve the commit log based on email discussions]
    Signed-off-by: Kalle Valo <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    VittGam authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    0ed0b25 View commit details
    Browse the repository at this point in the history
  9. mmc: sdhci: Fix recovery from tuning timeout

    commit 61e53bd upstream.
    
    Clearing the tuning bits should reset the tuning circuit. However there is
    more to do. Reset the command and data lines for good measure, and then
    for eMMC ensure the card is not still trying to process a tuning command by
    sending a stop command.
    
    Note the JEDEC eMMC specification says the stop command (CMD12) can be used
    to stop a tuning command (CMD21) whereas the SD specification is silent on
    the subject with respect to the SD tuning command (CMD19). Considering that
    CMD12 is not a valid SDIO command, the stop command is sent only when the
    tuning command is CMD21 i.e. for eMMC. That addresses cases seen so far
    which have been on eMMC.
    
    Note that this replaces the commit fe5fb2e ("mmc: sdhci: Reset cmd and
    data circuits after tuning failure") which is being reverted for v4.9+.
    
    Signed-off-by: Adrian Hunter <[email protected]>
    Tested-by: Dan O'Donovan <[email protected]>
    Signed-off-by: Ulf Hansson <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    ahunter6 authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    52980ce View commit details
    Browse the repository at this point in the history
  10. regulator: stw481x-vmmc: fix ages old enable error

    commit 295070e upstream.
    
    The regulator has never been properly enabled, it has been
    dormant all the time. It's strange that MMC was working
    at all, but it likely worked by the signals going through
    the levelshifter and reaching the card anyways.
    
    Fixes: 3615a34 ("regulator: add STw481x VMMC driver")
    Signed-off-by: Linus Walleij <[email protected]>
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    linusw authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    95d2a43 View commit details
    Browse the repository at this point in the history
  11. timekeeping_Force_unsigned_clocksource_to_nanoseconds_conversion

    commit 9c16457 upstream.
    
    The clocksource delta to nanoseconds conversion is using signed math, but
    the delta is unsigned. This makes the conversion space smaller than
    necessary and in case of a multiplication overflow the conversion can
    become negative. The conversion is done with scaled math:
    
        s64 nsec_delta = ((s64)clkdelta * clk->mult) >> clk->shift;
    
    Shifting a signed integer right obvioulsy preserves the sign, which has
    interesting consequences:
    
     - Time jumps backwards
    
     - __iter_div_u64_rem() which is used in one of the calling code pathes
       will take forever to piecewise calculate the seconds/nanoseconds part.
    
    This has been reported by several people with different scenarios:
    
    David observed that when stopping a VM with a debugger:
    
     "It was essentially the stopped by debugger case.  I forget exactly why,
      but the guest was being explicitly stopped from outside, it wasn't just
      scheduling lag.  I think it was something in the vicinity of 10 minutes
      stopped."
    
     When lifting the stop the machine went dead.
    
    The stopped by debugger case is not really interesting, but nevertheless it
    would be a good thing not to die completely.
    
    But this was also observed on a live system by Liav:
    
     "When the OS is too overloaded, delta will get a high enough value for the
      msb of the sum delta * tkr->mult + tkr->xtime_nsec to be set, and so
      after the shift the nsec variable will gain a value similar to
      0xffffffffff000000."
    
    Unfortunately this has been reintroduced recently with commit 6bd58f0
    ("time: Add cycles to nanoseconds translation"). It had been fixed a year
    ago already in commit 35a4933 ("time: Avoid signed overflow in
    timekeeping_get_ns()").
    
    Though it's not surprising that the issue has been reintroduced because the
    function itself and the whole call chain uses s64 for the result and the
    propagation of it. The change in this recent commit is subtle:
    
       s64 nsec;
    
    -  nsec = (d * m + n) >> s:
    +  nsec = d * m + n;
    +  nsec >>= s;
    
    d being type of cycle_t adds another level of obfuscation.
    
    This wouldn't have happened if the previous change to unsigned computation
    would have made the 'nsec' variable u64 right away and a follow up patch
    had cleaned up the whole call chain.
    
    There have been patches submitted which basically did a revert of the above
    patch leaving everything else unchanged as signed. Back to square one. This
    spawned a admittedly pointless discussion about potential users which rely
    on the unsigned behaviour until someone pointed out that it had been fixed
    before. The changelogs of said patches added further confusion as they made
    finally false claims about the consequences for eventual users which expect
    signed results.
    
    Despite delta being cycle_t, aka. u64, it's very well possible to hand in
    a signed negative value and the signed computation will happily return the
    correct result. But nobody actually sat down and analyzed the code which
    was added as user after the propably unintended signed conversion.
    
    Though in sensitive code like this it's better to analyze it proper and
    make sure that nothing relies on this than hunting the subtle wreckage half
    a year later. After analyzing all call chains it stands that no caller can
    hand in a negative value (which actually would work due to the s64 cast)
    and rely on the signed math to do the right thing.
    
    Change the conversion function to unsigned math. The conversion of all call
    chains is done in a follow up patch.
    
    This solves the starvation issue, which was caused by the negative result,
    but it does not solve the underlying problem. It merily procrastinates
    it. When the timekeeper update is deferred long enough that the unsigned
    multiplication overflows, then time going backwards is observable again.
    
    It does neither solve the issue of clocksources with a small counter width
    which will wrap around possibly several times and cause random time stamps
    to be generated. But those are usually not found on systems used for
    virtualization, so this is likely a non issue.
    
    I took the liberty to claim authorship for this simply because
    analyzing all callsites and writing the changelog took substantially
    more time than just making the simple s/s64/u64/ change and ignore the
    rest.
    
    Fixes: 6bd58f0 ("time: Add cycles to nanoseconds translation")
    Reported-by: David Gibson <[email protected]>
    Reported-by: Liav Rehana <[email protected]>
    Signed-off-by: Thomas Gleixner <[email protected]>
    Reviewed-by: David Gibson <[email protected]>
    Acked-by: Peter Zijlstra (Intel) <[email protected]>
    Cc: Parit Bhargava <[email protected]>
    Cc: Laurent Vivier <[email protected]>
    Cc: "Christopher S. Hall" <[email protected]>
    Cc: Chris Metcalf <[email protected]>
    Cc: Richard Cochran <[email protected]>
    Cc: John Stultz <[email protected]>
    Link: http://lkml.kernel.org/r/[email protected]
    Signed-off-by: Thomas Gleixner <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    KAGA-KOKO authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    61d0b71 View commit details
    Browse the repository at this point in the history
  12. gpio: chardev: Return error for seek operations

    commit f4e81c5 upstream.
    
    The GPIO chardev is used for management tasks (allocating line and event
    handles) and does neither support read() nor write() operations. Hence it
    does not make much sense to allow seek operations.
    
    Currently the chardev uses noop_llseek() for its seek implementation. This
    function does not move the pointer and simply returns the current position
    (always 0 for the GPIO chardev). noop_llseek() is primarily meant for
    devices that can not support seek, but where there might be a user that
    depends on the seek() operation succeeding. For newly added devices that
    can not support seek operations it is recommended to use no_llseek(), which
    will return an error. For more information see commit 6038f37
    ("llseek: automatically add .llseek fop").
    
    Unfortunately this was overlooked when the GPIO chardev ABI was introduced.
    But it is highly unlikely that since then userspace applications have
    appeared that rely on being able to perform non-failing seek operations on
    a GPIO chardev file descriptor. So it should be safe to change from
    noop_llseel() to no_seek(). Also use nonseekable_open() in the chardev
    open() callback to clear the FMODE_SEEK, FMODE_PREAD and FMODE_PWRITE flags
    from the file. Neither of these should be set on a file that does not
    support seek operations.
    
    Fixes: 3c702e9 ("gpio: add a userspace chardev ABI for GPIOs")
    Signed-off-by: Lars-Peter Clausen <[email protected]>
    Signed-off-by: Linus Walleij <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    larsclausen authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    bd12562 View commit details
    Browse the repository at this point in the history
  13. arm64: tegra: Add VDD_GPU regulator to Jetson TX1

    commit 5e6b9a8 upstream.
    
    Add the VDD_GPU regulator (a GPIO-enabled PWM regulator) to the Jetson
    TX1 board. This addition allows the GPU to be used provided the
    bootloader properly enabled the GPU node.
    
    Signed-off-by: Alexandre Courbot <[email protected]>
    Signed-off-by: Thierry Reding <[email protected]>
    [as pointed out by Thierry on IRC, nobody has reported a bug
     in the field, but using a new bootloader with a .dtb that
     has the incorrect data, it will crash on boot]
    Fixes: 336f79c ("arm64: tegra: Add NVIDIA Jetson TX1 Developer Kit support")
    Signed-off-by: Arnd Bergmann <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Gnurou authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    2f885da View commit details
    Browse the repository at this point in the history
  14. clk: bcm2835: Avoid overwriting the div info when disabling a pll_div…

    … clk
    
    commit 68af4fa upstream.
    
    bcm2835_pll_divider_off() is resetting the divider field in the A2W reg
    to zero when disabling the clock.
    
    Make sure we preserve this value by reading the previous a2w_reg value
    first and ORing the result with A2W_PLL_CHANNEL_DISABLE.
    
    Signed-off-by: Boris Brezillon <[email protected]>
    Fixes: 41691b8 ("clk: bcm2835: Add support for programming the audio domain clocks")
    Reviewed-by: Eric Anholt <[email protected]>
    Signed-off-by: Stephen Boyd <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Boris Brezillon authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    def2c87 View commit details
    Browse the repository at this point in the history
  15. thermal: hwmon: Properly report critical temperature in sysfs

    commit f37fabb upstream.
    
    In the critical sysfs entry the thermal hwmon was returning wrong
    temperature to the user-space.  It was reporting the temperature of the
    first trip point instead of the temperature of critical trip point.
    
    For example:
    	/sys/class/hwmon/hwmon0/temp1_crit:50000
    	/sys/class/thermal/thermal_zone0/trip_point_0_temp:50000
    	/sys/class/thermal/thermal_zone0/trip_point_0_type:active
    	/sys/class/thermal/thermal_zone0/trip_point_3_temp:120000
    	/sys/class/thermal/thermal_zone0/trip_point_3_type:critical
    
    Since commit e68b16a ("thermal: add hwmon sysfs I/F") the driver
    have been registering a sysfs entry if get_crit_temp() callback was
    provided.  However when accessed, it was calling get_trip_temp() instead
    of the get_crit_temp().
    
    Fixes: e68b16a ("thermal: add hwmon sysfs I/F")
    Signed-off-by: Krzysztof Kozlowski <[email protected]>
    Signed-off-by: Zhang Rui <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    krzk authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    a26a016 View commit details
    Browse the repository at this point in the history
  16. docs: sphinx-extensions: make rstFlatTable work with docutils 0.13

    commit 217e2bf upstream.
    
    In docutils 0.13, the return type of get_column_widths method of the
    Table directive has changed [1], which breaks our flat-table directive
    and leads to a TypeError when trying to build the docs [2].
    
    This patch adds support for the new return type, while keeping support
    for older docutils versions too.
    
    [1] https://sourceforge.net/p/docutils/patches/120/
    [2] https://sourceforge.net/p/docutils/bugs/303/
    
    Signed-off-by: Dmitry Shachnev <[email protected]>
    Signed-off-by: Jonathan Corbet <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    mitya57 authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    235394e View commit details
    Browse the repository at this point in the history
  17. hv: acquire vmbus_connection.channel_mutex in vmbus_free_channels()

    commit abd1026 upstream.
    
    "kernel BUG at drivers/hv/channel_mgmt.c:350!" is observed when hv_vmbus
    module is unloaded. BUG_ON() was introduced in commit 85d9aa7
    ("Drivers: hv: vmbus: add an API vmbus_hvsock_device_unregister()") as
    vmbus_free_channels() codepath was apparently forgotten.
    
    Fixes: 85d9aa7 ("Drivers: hv: vmbus: add an API vmbus_hvsock_device_unregister()")
    
    Signed-off-by: Vitaly Kuznetsov <[email protected]>
    Signed-off-by: K. Y. Srinivasan <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    vittyvk authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    823c5c9 View commit details
    Browse the repository at this point in the history
  18. staging: comedi: ni_mio_common: fix M Series ni_ai_insn_read() data mask

    commit 655c4d4 upstream.
    
    For NI M Series cards, the Comedi `insn_read` handler for the AI
    subdevice is broken due to ANDing the value read from the AI FIFO data
    register with an incorrect mask.  The incorrect mask clears all but the
    most significant bit of the sample data.  It should preserve all the
    sample data bits.  Correct it.
    
    Fixes: 817144a ("staging: comedi: ni_mio_common: remove unnecessary use of 'board->adbits'")
    Signed-off-by: Ian Abbott <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    ian-abbott authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    689d592 View commit details
    Browse the repository at this point in the history
  19. staging: comedi: ni_mio_common: fix E series ni_ai_insn_read() data

    commit 857a661 upstream.
    
    Commit 0557344 ("staging: comedi: ni_mio_common: fix local var for
    32-bit read") changed the type of local variable `d` from `unsigned
    short` to `unsigned int` to fix a bug introduced in
    commit 9c340ac ("staging: comedi: ni_stc.h: add read/write
    callbacks to struct ni_private") when reading AI data for NI PCI-6110
    and PCI-6111 cards.  Unfortunately, other parts of the function rely on
    the variable being `unsigned short` when an offset value in local
    variable `signbits` is added to `d` before writing the value to the
    `data` array:
    
    			d += signbits;
    		  	data[n] = d;
    
    The `signbits` variable will be non-zero in bipolar mode, and is used to
    convert the hardware's 2's complement, 16-bit numbers to Comedi's
    straight binary sample format (with 0 representing the most negative
    voltage).  This breaks because `d` is now 32 bits wide instead of 16
    bits wide, so after the addition of `signbits`, `data[n]` ends up being
    set to values above 65536 for negative voltages.  This affects all
    supported "E series" cards except PCI-6143 (and PXI-6143). Fix it by
    ANDing the value written to the `data[n]` with the mask 0xffff.
    
    Fixes: 0557344 ("staging: comedi: ni_mio_common: fix local var for 32-bit read")
    Signed-off-by: Ian Abbott <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    ian-abbott authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    ce81006 View commit details
    Browse the repository at this point in the history
  20. ACPI / video: Add force_native quirk for Dell XPS 17 L702X

    commit 350fa03 upstream.
    
    The Dell XPS 17 L702X has a non-working acpi_video0 backlight interface
    and an intel_backlight interface which works fine. Add a force_native
    quirk for it so that the non-working acpi_video0 interface does not get
    registered.
    
    Note that there also is an issue with the brightnesskeys on this laptop,
    they do not generate key-press events in anyway. That is not solved by
    this patch.
    
    Link: https://bugzilla.redhat.com/show_bug.cgi?id=1123661
    Signed-off-by: Hans de Goede <[email protected]>
    Signed-off-by: Rafael J. Wysocki <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    jwrdegoede authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    b7eea51 View commit details
    Browse the repository at this point in the history
  21. ACPI / video: Add force_native quirk for HP Pavilion dv6

    commit 6276e53 upstream.
    
    The HP Pavilion dv6 has a non-working acpi_video0 backlight interface
    and an intel_backlight interface which works fine. Add a force_native
    quirk for it so that the non-working acpi_video0 interface does not get
    registered.
    
    Note that there are quite a few HP Pavilion dv6 variants, some
    woth ATI and some with NVIDIA hybrid gfx, both seem to need this
    quirk to have working backlight control. There are also some versions
    with only Intel integrated gfx, these may not need this quirk, but it
    should not hurt there.
    
    Link: https://bugzilla.redhat.com/show_bug.cgi?id=1204476
    Link: https://bugs.launchpad.net/ubuntu/+source/linux-lts-trusty/+bug/1416940
    Signed-off-by: Hans de Goede <[email protected]>
    Signed-off-by: Rafael J. Wysocki <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    jwrdegoede authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    bab5208 View commit details
    Browse the repository at this point in the history
  22. drm/amd/amdgpu: enable GUI idle INT after enabling CGCG

    commit dd31ae9 upstream.
    
    GUI idle interrupts should be enabled only after we
    have enabled coarse grain clock gating (CGCG). This
    prevents GFX engine generating idle interrupt even
    though CGCG is not completely enabled.
    
    Most of the time this goes un-noticed, but on some
    Stoney ASICs this results in GFX engine hang after
    system resumes from suspend. The issue is not
    particular to Stoney though and could have occured
    on any ASIC. The patch fixes this issue.
    
    Reviewed-by: Alex Deucher <[email protected]>
    Reported-by: Sunil Uttarwar <[email protected]>
    Signed-off-by: Arindam Nath <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    amd-anath authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    fef5427 View commit details
    Browse the repository at this point in the history
  23. drm/nouveau/gr: fallback to legacy paths during firmware lookup

    commit e137040 upstream.
    
    Look for firmware files using the legacy ("nouveau/nvxx_fucxxxx") path
    if they cannot be found in the new, "official" path. User setups were
    broken by the switch, which is bad.
    
    There are only 4 firmware files we may want to look up that way, so
    hardcode them into the lookup function. All new firmware files should
    use the standard "nvidia/<chip>/gr/" path.
    
    Fixes: 8539b37 ("drm/nouveau/gr: use NVIDIA-provided external firmwares")
    Signed-off-by: Alexandre Courbot <[email protected]>
    Signed-off-by: Ben Skeggs <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Gnurou authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    00e1fb1 View commit details
    Browse the repository at this point in the history
  24. drm/nouveau/kms: lvds panel strap moved again on maxwell

    commit 768e847 upstream.
    
    Signed-off-by: Ben Skeggs <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Ben Skeggs authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    764e8e8 View commit details
    Browse the repository at this point in the history
  25. drm/nouveau/bios: require checksum to match for fast acpi shadow method

    commit 5dc7f4a upstream.
    
    Signed-off-by: Ben Skeggs <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Ben Skeggs authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    ce71868 View commit details
    Browse the repository at this point in the history
  26. drm/nouveau/ltc: protect clearing of comptags with mutex

    commit f4e65ef upstream.
    
    Signed-off-by: Ben Skeggs <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Ben Skeggs authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    82d9824 View commit details
    Browse the repository at this point in the history
  27. drm/nouveau/ttm: wait for bo fence to signal before unmapping vmas

    commit 10dcab3 upstream.
    
    TTM was changed a while back to allow for pipelining of buffer moves, and
    part of this was the removal of waiting for a BO to idle before calling
    move(), placing the responsibility on the driver to do this if required.
    
    That's all well and good, except, we make use of move_notify() to handle
    mapping/unmapping from the GPU VMM as move() isn't called on all paths.
    
    This commit adds a wait before unmapping from a VMM in move_notify(), to
    prevent GPU page faults where a buffer is still being accessed.
    
    Signed-off-by: Ben Skeggs <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Ben Skeggs authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    28d1864 View commit details
    Browse the repository at this point in the history
  28. drm/nouveau/i2c/gk110b,gm10x: use the correct implementation

    commit 5b3800a upstream.
    
    DPAUX registers moved on Kepler, these chipsets were still using the
    Fermi implementation for some reason.
    
    This fixes detection of hotplug/sink IRQs on DP connectors.
    
    Signed-off-by: Ben Skeggs <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Ben Skeggs authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    2a7a437 View commit details
    Browse the repository at this point in the history
  29. drm/nouveau/fifo/gf100-: protect channel preempt with subdev mutex

    commit b27add1 upstream.
    
    This avoids an issue that occurs when we're attempting to preempt multiple
    channels simultaneously.  HW seems to ignore preempt requests while it's
    still processing a previous one, which, well, makes sense.
    
    Fixes random "fifo: SCHED_ERROR 0d []" + GPCCS page faults during parallel
    piglit runs on (at least) GM107.
    
    Signed-off-by: Ben Skeggs <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Ben Skeggs authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    9c6fb7b View commit details
    Browse the repository at this point in the history
  30. drm/radeon: Also call cursor_move_locked when the cursor size changes

    commit dcab0fa upstream.
    
    The cursor size also affects the register programming.
    
    Signed-off-by: Michel Dänzer <[email protected]>
    Reviewed-by: Alex Deucher <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Michel Dänzer authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    6fb9422 View commit details
    Browse the repository at this point in the history
  31. drm/radeon: Hide the HW cursor while it's out of bounds

    commit 6b16cf7 upstream.
    
    Fixes hangs in that case under some circumstances.
    
    v2:
    * Only use non-0 x/yorigin if the cursor is (partially) outside of the
      top/left edge of the total surface with AVIVO/DCE
    
    Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1000433
    Signed-off-by: Michel Dänzer <[email protected]>
    Reviewed-by: Alex Deucher <[email protected]> (v1)
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Michel Dänzer authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    1f884ec View commit details
    Browse the repository at this point in the history
  32. drm/radeon: add additional pci revision to dpm workaround

    commit 8729675 upstream.
    
    New variant.
    
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    alexdeucher authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    cdb7aaa View commit details
    Browse the repository at this point in the history
  33. drm/radeon/si: load the proper firmware on 0x87 oland boards

    commit abb2e3c upstream.
    
    New variant.
    
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    alexdeucher authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    10b598d View commit details
    Browse the repository at this point in the history
  34. drm/gma500: Add compat ioctl

    commit 0a97c81 upstream.
    
    Hook up drm_compat_ioctl to support 32-bit userspace on 64-bit kernels.
    It turns out that N2600 and N2800 comes with 64-bit enabled. We
    previously assumed there where no such systems out there.
    
    Signed-off-by: Patrik Jakobsson <[email protected]>
    Signed-off-by: Sean Paul <[email protected]>
    Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    patjak authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    8bfa4f5 View commit details
    Browse the repository at this point in the history
  35. drm/amdgpu: fix init save/restore list in gfx_v8.0

    commit 202e0b2 upstream.
    
    set valid data to mmRLC_SRM_INDEX_CNTL_ADDRx/DATAx.
    
    Signed-off-by: Rex Zhu <[email protected]>
    Reviewed-by: Alex Deucher <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Rex Zhu authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    0f95e4a View commit details
    Browse the repository at this point in the history
  36. drivers/gpu/drm/ast: Fix infinite loop if read fails

    commit 298360a upstream.
    
    ast_get_dram_info() configures a window in order to access BMC memory.
    A BMC register can be configured to disallow this, and if so, causes
    an infinite loop in the ast driver which renders the system unusable.
    
    Fix this by erroring out if an error is detected.  On powerpc systems with
    EEH, this leads to the device being fenced and the system continuing to
    operate.
    
    Signed-off-by: Russell Currey <[email protected]>
    Reviewed-by: Joel Stanley <[email protected]>
    Signed-off-by: Daniel Vetter <[email protected]>
    Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    ruscur authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    dfc3c8a View commit details
    Browse the repository at this point in the history
  37. mei: request async autosuspend at the end of enumeration

    commit d5f8e16 upstream.
    
    pm_runtime_autosuspend can take synchronous or asynchronous
    paths, Because we are calling pm_runtime_mark_last_busy just before
    this most of the cases it takes the asynchronous way. However,
    when the FW or driver resets during already running runtime suspend,
    the call will result in calling to the driver's rpm callback and results
    in a deadlock on device_lock.
    The simplest fix is to replace pm_runtime_autosuspend with
    asynchronous pm_request_autosuspend.
    
    Signed-off-by: Alexander Usyskin <[email protected]>
    Signed-off-by: Tomas Winkler <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    ausyskin authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    7be0a5f View commit details
    Browse the repository at this point in the history
  38. mei: me: add lewisburg device ids

    commit 9ff2007 upstream.
    
    Add MEI Lewisburg PCH IDs for Purley based workstations.
    
    Signed-off-by: Alexander Usyskin <[email protected]>
    Signed-off-by: Tomas Winkler <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    tomasbw authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    2695afd View commit details
    Browse the repository at this point in the history
  39. block: protect iterate_bdevs() against concurrent close

    commit af30922 upstream.
    
    If a block device is closed while iterate_bdevs() is handling it, the
    following NULL pointer dereference occurs because bdev->b_disk is NULL
    in bdev_get_queue(), which is called from blk_get_backing_dev_info() (in
    turn called by the mapping_cap_writeback_dirty() call in
    __filemap_fdatawrite_range()):
    
     BUG: unable to handle kernel NULL pointer dereference at 0000000000000508
     IP: [<ffffffff81314790>] blk_get_backing_dev_info+0x10/0x20
     PGD 9e62067 PUD 9ee8067 PMD 0
     Oops: 0000 [Freescale#1] PREEMPT SMP DEBUG_PAGEALLOC
     Modules linked in:
     CPU: 1 PID: 2422 Comm: sync Not tainted 4.5.0-rc7+ Freescale#400
     Hardware name: QEMU Standard PC (i440FX + PIIX, 1996)
     task: ffff880009f4d700 ti: ffff880009f5c000 task.ti: ffff880009f5c000
     RIP: 0010:[<ffffffff81314790>]  [<ffffffff81314790>] blk_get_backing_dev_info+0x10/0x20
     RSP: 0018:ffff880009f5fe68  EFLAGS: 00010246
     RAX: 0000000000000000 RBX: ffff88000ec17a38 RCX: ffffffff81a4e940
     RDX: 7fffffffffffffff RSI: 0000000000000000 RDI: ffff88000ec176c0
     RBP: ffff880009f5fe68 R08: 0000000000000000 R09: 0000000000000000
     R10: 0000000000000001 R11: 0000000000000000 R12: ffff88000ec17860
     R13: ffffffff811b25c0 R14: ffff88000ec178e0 R15: ffff88000ec17a38
     FS:  00007faee505d700(0000) GS:ffff88000fb00000(0000) knlGS:0000000000000000
     CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
     CR2: 0000000000000508 CR3: 0000000009e8a000 CR4: 00000000000006e0
     Stack:
      ffff880009f5feb8 ffffffff8112e7f5 0000000000000000 7fffffffffffffff
      0000000000000000 0000000000000000 7fffffffffffffff 0000000000000001
      ffff88000ec178e0 ffff88000ec17860 ffff880009f5fec8 ffffffff8112e81f
     Call Trace:
      [<ffffffff8112e7f5>] __filemap_fdatawrite_range+0x85/0x90
      [<ffffffff8112e81f>] filemap_fdatawrite+0x1f/0x30
      [<ffffffff811b25d6>] fdatawrite_one_bdev+0x16/0x20
      [<ffffffff811bc402>] iterate_bdevs+0xf2/0x130
      [<ffffffff811b2763>] sys_sync+0x63/0x90
      [<ffffffff815d4272>] entry_SYSCALL_64_fastpath+0x12/0x76
     Code: 0f 1f 44 00 00 48 8b 87 f0 00 00 00 55 48 89 e5 <48> 8b 80 08 05 00 00 5d
     RIP  [<ffffffff81314790>] blk_get_backing_dev_info+0x10/0x20
      RSP <ffff880009f5fe68>
     CR2: 0000000000000508
     ---[ end trace 2487336ceb3de62d ]---
    
    The crash is easily reproducible by running the following command, if an
    msleep(100) is inserted before the call to func() in iterate_devs():
    
     while :; do head -c1 /dev/nullb0; done > /dev/null & while :; do sync; done
    
    Fix it by holding the bd_mutex across the func() call and only calling
    func() if the bdev is opened.
    
    Fixes: 5c0d6b6 ("vfs: Create function for iterating over block devices")
    Reported-and-tested-by: Wei Fang <[email protected]>
    Signed-off-by: Rabin Vincent <[email protected]>
    Signed-off-by: Jan Kara <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Signed-off-by: Jens Axboe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    vwax authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    6d8bb56 View commit details
    Browse the repository at this point in the history
  40. vt: fix Scroll Lock LED trigger name

    commit 31b5929 upstream.
    
    There is a disagreement between drivers/tty/vt/keyboard.c and
    drivers/input/input-leds.c with regard to what is a Scroll Lock LED
    trigger name: input calls it "kbd-scrolllock", but vt calls it
    "kbd-scrollock" (two l's).
    This prevents Scroll Lock LED trigger from binding to this LED by default.
    
    Since it is a scroLL Lock LED, this interface was introduced only about a
    year ago and in an Internet search people seem to reference this trigger
    only to set it to this LED let's simply rename it to "kbd-scrolllock".
    
    Also, it looks like this was supposed to be changed before this code was
    merged: https://lkml.org/lkml/2015/6/9/697 but it was done only on
    the input side.
    
    Signed-off-by: Maciej S. Szmigiero <[email protected]>
    Acked-by: Samuel Thibault <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    maciejsszmigiero authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    698ac69 View commit details
    Browse the repository at this point in the history
  41. stm class: Fix device leak in open error path

    commit a0ebf51 upstream.
    
    Make sure to drop the reference taken by class_find_device() also on
    allocation errors in open().
    
    Signed-off-by: Johan Hovold <[email protected]>
    Fixes: 7bd1d40 ("stm class: Introduce an abstraction for...")
    Signed-off-by: Alexander Shishkin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    jhovold authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    3863ab6 View commit details
    Browse the repository at this point in the history
  42. scsi: megaraid_sas: For SRIOV enabled firmware, ensure VF driver wait…

    …s for 30secs before reset
    
    commit 18e1c7f upstream.
    
    For SRIOV enabled firmware, if there is a OCR(online controller reset)
    possibility driver set the convert flag to 1, which is not happening if
    there are outstanding commands even after 180 seconds.  As driver does
    not set convert flag to 1 and still making the OCR to run, VF(Virtual
    function) driver is directly writing on to the register instead of
    waiting for 30 seconds. Setting convert flag to 1 will cause VF driver
    will wait for 30 secs before going for reset.
    
    Signed-off-by: Kiran Kumar Kasturi <[email protected]>
    Signed-off-by: Sumit Saxena <[email protected]>
    Reviewed-by: Hannes Reinecke <[email protected]>
    Reviewed-by: Tomas Henzl <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    kadesai16 authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    dbd4e6c View commit details
    Browse the repository at this point in the history
  43. scsi: megaraid_sas: Do not set MPI2_TYPE_CUDA for JBOD FP path for FW…

    … which does not support JBOD sequence map
    
    commit d557358 upstream.
    
    Signed-off-by: Sumit Saxena <[email protected]>
    Reviewed-by: Hannes Reinecke <[email protected]>
    Reviewed-by: Tomas Henzl <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    kadesai16 authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    9c3928b View commit details
    Browse the repository at this point in the history
  44. iscsi-target: Return error if unable to add network portal

    commit 83337e5 upstream.
    
    If iscsit_tpg_add_network_portal() fails then
    return error code instead of 0 to user space.
    
    If iscsi-target returns 0 then user space keeps
    on retrying same command infinitely, targetcli or
    echo hangs till command completes with non zero
    return value. In some cases it is possible that
    add network portal command never completes with
    success even after retrying multiple times,
    for example - cxgbit_setup_np() always returns
    -EINVAL if portal IP does not belong to Chelsio
    adapter interface.
    
    Signed-off-by: Varun Prakash <[email protected]>
    Signed-off-by: Bart Van Assche <[email protected]>
    [ bvanassche: Added "Fixes:" and "Cc: stable" tags ]
    Fixes: commit d4b3fa4 ("iscsi-target: Make iscsi_tpg_np driver show/store use generic code")
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Varun Prakash authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    de8a06c View commit details
    Browse the repository at this point in the history
  45. scsi: zfcp: fix use-after-"free" in FC ingress path after TMF

    commit dac37e1 upstream.
    
    When SCSI EH invokes zFCP's callbacks for eh_device_reset_handler() and
    eh_target_reset_handler(), it expects us to relent the ownership over
    the given scsi_cmnd and all other scsi_cmnds within the same scope - LUN
    or target - when returning with SUCCESS from the callback ('release'
    them).  SCSI EH can then reuse those commands.
    
    We did not follow this rule to release commands upon SUCCESS; and if
    later a reply arrived for one of those supposed to be released commands,
    we would still make use of the scsi_cmnd in our ingress tasklet. This
    will at least result in undefined behavior or a kernel panic because of
    a wrong kernel pointer dereference.
    
    To fix this, we NULLify all pointers to scsi_cmnds (struct zfcp_fsf_req
    *)->data in the matching scope if a TMF was successful. This is done
    under the locks (struct zfcp_adapter *)->abort_lock and (struct
    zfcp_reqlist *)->lock to prevent the requests from being removed from
    the request-hashtable, and the ingress tasklet from making use of the
    scsi_cmnd-pointer in zfcp_fsf_fcp_cmnd_handler().
    
    For cases where a reply arrives during SCSI EH, but before we get a
    chance to NULLify the pointer - but before we return from the callback
    -, we assume that the code is protected from races via the CAS operation
    in blk_complete_request() that is called in scsi_done().
    
    The following stacktrace shows an example for a crash resulting from the
    previous behavior:
    
    Unable to handle kernel pointer dereference at virtual kernel address fffffee17a672000
    Oops: 0038 [Freescale#1] SMP
    CPU: 2 PID: 0 Comm: swapper/2 Not tainted
    task: 00000003f7ff5be0 ti: 00000003f3d38000 task.ti: 00000003f3d38000
    Krnl PSW : 0404d00180000000 00000000001156b0 (smp_vcpu_scheduled+0x18/0x40)
               R:0 T:1 IO:0 EX:0 Key:0 M:1 W:0 P:0 AS:3 CC:1 PM:0 EA:3
    Krnl GPRS: 000000200000007e 0000000000000000 fffffee17a671fd8 0000000300000015
               ffffffff80000000 00000000005dfde8 07000003f7f80e00 000000004fa4e800
               000000036ce8d8f8 000000036ce8d9c0 00000003ece8fe00 ffffffff969c9e93
               00000003fffffffd 000000036ce8da10 00000000003bf134 00000003f3b07918
    Krnl Code: 00000000001156a2: a7190000        lghi    %r1,0
               00000000001156a6: a7380015        lhi    %r3,21
              #00000000001156aa: e32050000008    ag    %r2,0(%r5)
              >00000000001156b0: 482022b0        lh    %r2,688(%r2)
               00000000001156b4: ae123000        sigp    %r1,%r2,0(%r3)
               00000000001156b8: b2220020        ipm    %r2
               00000000001156bc: 8820001c        srl    %r2,28
               00000000001156c0: c02700000001    xilf    %r2,1
    Call Trace:
    ([<0000000000000000>] 0x0)
     [<000003ff807bdb8e>] zfcp_fsf_fcp_cmnd_handler+0x3de/0x490 [zfcp]
     [<000003ff807be30a>] zfcp_fsf_req_complete+0x252/0x800 [zfcp]
     [<000003ff807c0a48>] zfcp_fsf_reqid_check+0xe8/0x190 [zfcp]
     [<000003ff807c194e>] zfcp_qdio_int_resp+0x66/0x188 [zfcp]
     [<000003ff80440c64>] qdio_kick_handler+0xdc/0x310 [qdio]
     [<000003ff804463d0>] __tiqdio_inbound_processing+0xf8/0xcd8 [qdio]
     [<0000000000141fd4>] tasklet_action+0x9c/0x170
     [<0000000000141550>] __do_softirq+0xe8/0x258
     [<000000000010ce0a>] do_softirq+0xba/0xc0
     [<000000000014187c>] irq_exit+0xc4/0xe8
     [<000000000046b526>] do_IRQ+0x146/0x1d8
     [<00000000005d6a3c>] io_return+0x0/0x8
     [<00000000005d6422>] vtime_stop_cpu+0x4a/0xa0
    ([<0000000000000000>] 0x0)
     [<0000000000103d8a>] arch_cpu_idle+0xa2/0xb0
     [<0000000000197f94>] cpu_startup_entry+0x13c/0x1f8
     [<0000000000114782>] smp_start_secondary+0xda/0xe8
     [<00000000005d6efe>] restart_int_handler+0x56/0x6c
     [<0000000000000000>] 0x0
    Last Breaking-Event-Address:
     [<00000000003bf12e>] arch_spin_lock_wait+0x56/0xb0
    
    Suggested-by: Steffen Maier <[email protected]>
    Signed-off-by: Benjamin Block <[email protected]>
    Fixes: ea127f9 ("[PATCH] s390 (7/7): zfcp host adapter.") (tglx/history.git)
    Signed-off-by: Steffen Maier <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Benjamin-Block authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    5cebfea View commit details
    Browse the repository at this point in the history
  46. scsi: zfcp: do not trace pure benign residual HBA responses at defaul…

    …t level
    
    commit 56d23ed upstream.
    
    Since quite a while, Linux issues enough SCSI commands per scsi_device
    which successfully return with FCP_RESID_UNDER, FSF_FCP_RSP_AVAILABLE,
    and SAM_STAT_GOOD.  This floods the HBA trace area and we cannot see
    other and important HBA trace records long enough.
    
    Therefore, do not trace HBA response errors for pure benign residual
    under counts at the default trace level.
    
    This excludes benign residual under count combined with other validity
    bits set in FCP_RSP_IU, such as FCP_SNS_LEN_VAL.  For all those other
    cases, we still do want to see both the HBA record and the corresponding
    SCSI record by default.
    
    Signed-off-by: Steffen Maier <[email protected]>
    Fixes: a54ca0f ("[SCSI] zfcp: Redesign of the debug tracing for HBA records.")
    Reviewed-by: Benjamin Block <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    steffen-maier authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    057fe03 View commit details
    Browse the repository at this point in the history
  47. scsi: zfcp: fix rport unblock race with LUN recovery

    commit 6f2ce1c upstream.
    
    It is unavoidable that zfcp_scsi_queuecommand() has to finish requests
    with DID_IMM_RETRY (like fc_remote_port_chkready()) during the time
    window when zfcp detected an unavailable rport but
    fc_remote_port_delete(), which is asynchronous via
    zfcp_scsi_schedule_rport_block(), has not yet blocked the rport.
    
    However, for the case when the rport becomes available again, we should
    prevent unblocking the rport too early.  In contrast to other FCP LLDDs,
    zfcp has to open each LUN with the FCP channel hardware before it can
    send I/O to a LUN.  So if a port already has LUNs attached and we
    unblock the rport just after port recovery, recoveries of LUNs behind
    this port can still be pending which in turn force
    zfcp_scsi_queuecommand() to unnecessarily finish requests with
    DID_IMM_RETRY.
    
    This also opens a time window with unblocked rport (until the followup
    LUN reopen recovery has finished).  If a scsi_cmnd timeout occurs during
    this time window fc_timed_out() cannot work as desired and such command
    would indeed time out and trigger scsi_eh. This prevents a clean and
    timely path failover.  This should not happen if the path issue can be
    recovered on FC transport layer such as path issues involving RSCNs.
    
    Fix this by only calling zfcp_scsi_schedule_rport_register(), to
    asynchronously trigger fc_remote_port_add(), after all LUN recoveries as
    children of the rport have finished and no new recoveries of equal or
    higher order were triggered meanwhile.  Finished intentionally includes
    any recovery result no matter if successful or failed (still unblock
    rport so other successful LUNs work).  For simplicity, we check after
    each finished LUN recovery if there is another LUN recovery pending on
    the same port and then do nothing.  We handle the special case of a
    successful recovery of a port without LUN children the same way without
    changing this case's semantics.
    
    For debugging we introduce 2 new trace records written if the rport
    unblock attempt was aborted due to still unfinished or freshly triggered
    recovery. The records are only written above the default trace level.
    
    Benjamin noticed the important special case of new recovery that can be
    triggered between having given up the erp_lock and before calling
    zfcp_erp_action_cleanup() within zfcp_erp_strategy().  We must avoid the
    following sequence:
    
    ERP thread                 rport_work      other context
    -------------------------  --------------  --------------------------------
    port is unblocked, rport still blocked,
     due to pending/running ERP action,
     so ((port->status & ...UNBLOCK) != 0)
     and (port->rport == NULL)
    unlock ERP
    zfcp_erp_action_cleanup()
    case ZFCP_ERP_ACTION_REOPEN_LUN:
    zfcp_erp_try_rport_unblock()
    ((status & ...UNBLOCK) != 0) [OLD!]
                                               zfcp_erp_port_reopen()
                                               lock ERP
                                               zfcp_erp_port_block()
                                               port->status clear ...UNBLOCK
                                               unlock ERP
                                               zfcp_scsi_schedule_rport_block()
                                               port->rport_task = RPORT_DEL
                                               queue_work(rport_work)
                               zfcp_scsi_rport_work()
                               (port->rport_task != RPORT_ADD)
                               port->rport_task = RPORT_NONE
                               zfcp_scsi_rport_block()
                               if (!port->rport) return
    zfcp_scsi_schedule_rport_register()
    port->rport_task = RPORT_ADD
    queue_work(rport_work)
                               zfcp_scsi_rport_work()
                               (port->rport_task == RPORT_ADD)
                               port->rport_task = RPORT_NONE
                               zfcp_scsi_rport_register()
                               (port->rport == NULL)
                               rport = fc_remote_port_add()
                               port->rport = rport;
    
    Now the rport was erroneously unblocked while the zfcp_port is blocked.
    This is another situation we want to avoid due to scsi_eh
    potential. This state would at least remain until the new recovery from
    the other context finished successfully, or potentially forever if it
    failed.  In order to close this race, we take the erp_lock inside
    zfcp_erp_try_rport_unblock() when checking the status of zfcp_port or
    LUN.  With that, the possible corresponding rport state sequences would
    be: (unblock[ERP thread],block[other context]) if the ERP thread gets
    erp_lock first and still sees ((port->status & ...UNBLOCK) != 0),
    (block[other context],NOP[ERP thread]) if the ERP thread gets erp_lock
    after the other context has already cleard ...UNBLOCK from port->status.
    
    Since checking fields of struct erp_action is unsafe because they could
    have been overwritten (re-used for new recovery) meanwhile, we only
    check status of zfcp_port and LUN since these are only changed under
    erp_lock elsewhere. Regarding the check of the proper status flags (port
    or port_forced are similar to the shown adapter recovery):
    
    [zfcp_erp_adapter_shutdown()]
    zfcp_erp_adapter_reopen()
     zfcp_erp_adapter_block()
      * clear UNBLOCK ---------------------------------------+
     zfcp_scsi_schedule_rports_block()                       |
     write_lock_irqsave(&adapter->erp_lock, flags);-------+  |
     zfcp_erp_action_enqueue()                            |  |
      zfcp_erp_setup_act()                                |  |
       * set ERP_INUSE -----------------------------------|--|--+
     write_unlock_irqrestore(&adapter->erp_lock, flags);--+  |  |
    .context-switch.                                         |  |
    zfcp_erp_thread()                                        |  |
     zfcp_erp_strategy()                                     |  |
      write_lock_irqsave(&adapter->erp_lock, flags);------+  |  |
      ...                                                 |  |  |
      zfcp_erp_strategy_check_target()                    |  |  |
       zfcp_erp_strategy_check_adapter()                  |  |  |
        zfcp_erp_adapter_unblock()                        |  |  |
         * set UNBLOCK -----------------------------------|--+  |
      zfcp_erp_action_dequeue()                           |     |
       * clear ERP_INUSE ---------------------------------|-----+
      ...                                                 |
      write_unlock_irqrestore(&adapter->erp_lock, flags);-+
    
    Hence, we should check for both UNBLOCK and ERP_INUSE because they are
    interleaved.  Also we need to explicitly check ERP_FAILED for the link
    down case which currently does not clear the UNBLOCK flag in
    zfcp_fsf_link_down_info_eval().
    
    Signed-off-by: Steffen Maier <[email protected]>
    Fixes: 8830271 ("[SCSI] zfcp: Dont fail SCSI commands when transitioning to blocked fc_rport")
    Fixes: a2fa0ae ("[SCSI] zfcp: Block FC transport rports early on errors")
    Fixes: 5f852be ("[SCSI] zfcp: Fix deadlock between zfcp ERP and SCSI")
    Fixes: 338151e ("[SCSI] zfcp: make use of fc_remote_port_delete when target port is unavailable")
    Fixes: 3859f6a ("[PATCH] zfcp: add rports to enable scsi_add_device to work again")
    Reviewed-by: Benjamin Block <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    steffen-maier authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    6d675df View commit details
    Browse the repository at this point in the history
  48. scsi: avoid a permanent stop of the scsi device's request queue

    commit d2a1452 upstream.
    
    A race between scanning and fc_remote_port_delete() may result in a
    permanent stop if the device gets blocked before scsi_sysfs_add_sdev()
    and unblocked after.  The reason is that blocking a device sets both the
    SDEV_BLOCKED state and the QUEUE_FLAG_STOPPED.  However,
    scsi_sysfs_add_sdev() unconditionally sets SDEV_RUNNING which causes the
    device to be ignored by scsi_target_unblock() and thus never have its
    QUEUE_FLAG_STOPPED cleared leading to a device which is apparently
    running but has a stopped queue.
    
    We actually have two places where SDEV_RUNNING is set: once in
    scsi_add_lun() which respects the blocked flag and once in
    scsi_sysfs_add_sdev() which doesn't.  Since the second set is entirely
    spurious, simply remove it to fix the problem.
    
    Reported-by: Zengxi Chen <[email protected]>
    Signed-off-by: Wei Fang <[email protected]>
    Reviewed-by: Ewan D. Milne <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    FWei-HW authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    cc328ce View commit details
    Browse the repository at this point in the history
  49. ARC: mm: arc700: Don't assume 2 colours for aliasing VIPT dcache

    commit 08fe007 upstream.
    
    An ARC700 customer reported linux boot crashes when upgrading to bigger
    L1 dcache (64K from 32K). Turns out they had an aliasing VIPT config and
    current code only assumed 2 colours, while theirs had 4. So default to 4
    colours and complain if there are fewer. Ideally this needs to be a
    Kconfig option, but heck that's too much of hassle for a single user.
    
    Signed-off-by: Vineet Gupta <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    vineetgarc authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    5c98bf8 View commit details
    Browse the repository at this point in the history
  50. firmware: fix usermode helper fallback loading

    commit 2e700f8 upstream.
    
    When you use the firmware usermode helper fallback with a timeout value set to a
    value greater than INT_MAX (2147483647) a cast overflow issue causes the
    timeout value to go negative and breaks all usermode helper loading. This
    regression was introduced through commit 68ff2a0 ("firmware_loader:
    handle timeout via wait_for_completion_interruptible_timeout()") on kernel
    v4.0.
    
    The firmware_class drivers relies on the firmware usermode helper
    fallback as a mechanism to look for firmware if the direct filesystem
    search failed only if:
    
      a) You've enabled CONFIG_FW_LOADER_USER_HELPER_FALLBACK (not many distros):
    
      Then all of these callers will rely on the fallback mechanism in case
      the firmware is not found through an initial direct filesystem lookup:
    
      o request_firmware()
      o request_firmware_into_buf()
      o request_firmware_nowait()
    
      b) If you've only enabled CONFIG_FW_LOADER_USER_HELPER (most distros):
    
      Then only callers using request_firmware_nowait() with the second
      argument set to false, this explicitly is requesting the UMH firmware
      fallback to be relied on in case the first filesystem lookup fails.
    
      Using Coccinelle SmPL grammar we have identified only two drivers
      explicitly requesting the UMH firmware fallback mechanism:
    
      - drivers/firmware/dell_rbu.c
      - drivers/leds/leds-lp55xx-common.c
    
    Since most distributions only enable CONFIG_FW_LOADER_USER_HELPER the
    biggest impact of this regression are users of the dell_rbu and
    leds-lp55xx-common device driver which required the UMH to find their
    respective needed firmwares.
    
    The default timeout for the UMH is set to 60 seconds always, as of
    commit 68ff2a0 ("firmware_loader: handle timeout via
    wait_for_completion_interruptible_timeout()") the timeout was bumped
    to MAX_JIFFY_OFFSET ((LONG_MAX >> 1)-1). Additionally the MAX_JIFFY_OFFSET
    value was also used if the timeout was configured by a user to 0.
    
    The following works:
    
    echo 2147483647 > /sys/class/firmware/timeout
    
    But both of the following set the timeout to MAX_JIFFY_OFFSET even if
    we display 0 back to userspace:
    
    echo 2147483648 > /sys/class/firmware/timeout
    cat /sys/class/firmware/timeout
    0
    
    echo 0> /sys/class/firmware/timeout
    cat /sys/class/firmware/timeout
    0
    
    A max value of INT_MAX (2147483647) seconds is therefore implicit due to the
    another cast with simple_strtol().
    
    This fixes the secondary cast (the first one is simple_strtol() but its an
    issue only by forcing an implicit limit) by re-using the timeout variable and
    only setting retval in appropriate cases.
    
    Lastly worth noting systemd had ripped out the UMH firmware fallback
    mechanism from udev since udev 2014 via commit be2ea723b1d023b3d
    ("udev: remove userspace firmware loading support"), so as of systemd v217.
    
    Signed-off-by: Yves-Alexis Perez <[email protected]>
    Fixes: 68ff2a0 "firmware_loader: handle timeout via wait_for_completion_interruptible_timeout()"
    Cc: Luis R. Rodriguez <[email protected]>
    Cc: Ming Lei <[email protected]>
    Cc: Bjorn Andersson <[email protected]>
    Cc: Greg Kroah-Hartman <[email protected]>
    Acked-by: Luis R. Rodriguez <[email protected]>
    Reviewed-by: Bjorn Andersson <[email protected]>
    [[email protected]: gave commit log a whole lot of love]
    Signed-off-by: Luis R. Rodriguez <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    corsac-s authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    f356ab0 View commit details
    Browse the repository at this point in the history
  51. s390/vmlogrdr: fix IUCV buffer allocation

    commit 5457e03 upstream.
    
    The buffer for iucv_message_receive() needs to be below 2 GB. In
    __iucv_message_receive(), the buffer address is casted to an u32, which
    would result in either memory corruption or an addressing exception when
    using addresses >= 2 GB.
    
    Fix this by using GFP_DMA for the buffer allocation.
    
    Signed-off-by: Gerald Schaefer <[email protected]>
    Signed-off-by: Martin Schwidefsky <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    gerald-schaefer authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    9652b62 View commit details
    Browse the repository at this point in the history
  52. s390/kexec: use node 0 when re-adding crash kernel memory

    commit 9f88eb4 upstream.
    
    When re-adding crash kernel memory within setup_resources() the
    function memblock_add() is used. That function will add memory by
    default to node "MAX_NUMNODES" instead of node 0, like the memory
    detection code does. In case of !NUMA this will trigger this warning
    when the kernel generates the vmemmap:
    
    Usage of MAX_NUMNODES is deprecated. Use NUMA_NO_NODE instead
    WARNING: CPU: 0 PID: 0 at mm/memblock.c:1261 memblock_virt_alloc_internal+0x76/0x220
    CPU: 0 PID: 0 Comm: swapper Not tainted 4.9.0-rc6 Freescale#16
    Call Trace:
     [<0000000000d0b2e8>] memblock_virt_alloc_try_nid+0x88/0xc8
     [<000000000083c8ea>] __earlyonly_bootmem_alloc.constprop.1+0x42/0x50
     [<000000000083e7f4>] vmemmap_populate+0x1ac/0x1e0
     [<0000000000840136>] sparse_mem_map_populate+0x46/0x68
     [<0000000000d0c59c>] sparse_init+0x184/0x238
     [<0000000000cf45f6>] paging_init+0xbe/0xf8
     [<0000000000cf1d4a>] setup_arch+0xa02/0xae0
     [<0000000000ced75a>] start_kernel+0x72/0x450
     [<0000000000100020>] _stext+0x20/0x80
    
    If NUMA is selected numa_setup_memory() will fix the node assignments
    before the vmemmap will be populated; so this warning will only appear
    if NUMA is not selected.
    
    To fix this simply use memblock_add_node() and re-add crash kernel
    memory explicitly to node 0.
    
    Reported-and-tested-by: Christian Borntraeger <[email protected]>
    Fixes: 4e042af ("s390/kexec: fix crash on resize of reserved memory")
    Signed-off-by: Heiko Carstens <[email protected]>
    Signed-off-by: Martin Schwidefsky <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    heicarst authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    d3d61bb View commit details
    Browse the repository at this point in the history
  53. arm64: KVM: pmu: Reset PMSELR_EL0.SEL to a sane value before entering…

    … the guest
    
    commit 21cbe3c upstream.
    
    The ARMv8 architecture allows the cycle counter to be configured
    by setting PMSELR_EL0.SEL==0x1f and then accessing PMXEVTYPER_EL0,
    hence accessing PMCCFILTR_EL0. But it disallows the use of
    PMSELR_EL0.SEL==0x1f to access the cycle counter itself through
    PMXEVCNTR_EL0.
    
    Linux itself doesn't violate this rule, but we may end up with
    PMSELR_EL0.SEL being set to 0x1f when we enter a guest. If that
    guest accesses PMXEVCNTR_EL0, the access may UNDEF at EL1,
    despite the guest not having done anything wrong.
    
    In order to avoid this unfortunate course of events (haha!), let's
    sanitize PMSELR_EL0 on guest entry. This ensures that the guest
    won't explode unexpectedly.
    
    Acked-by: Will Deacon <[email protected]>
    Signed-off-by: Marc Zyngier <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Marc Zyngier authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    c33e1ab View commit details
    Browse the repository at this point in the history
  54. sc16is7xx: Drop bogus use of IRQF_ONESHOT

    commit 04da738 upstream.
    
    The use of IRQF_ONESHOT when registering an interrupt handler with
    request_irq() is non-sensical.
    
    Not only that, it also prevents the handler from being threaded when it
    otherwise should be w/ IRQ_FORCED_THREADING is enabled.  This causes the
    following deadlock observed by Sean Nyekjaer on -rt:
    
    Internal error: Oops - BUG: 0 [Freescale#1] PREEMPT SMP ARM
    [..]
       rt_spin_lock_slowlock from queue_kthread_work
       queue_kthread_work from sc16is7xx_irq
       sc16is7xx_irq [sc16is7xx] from handle_irq_event_percpu
       handle_irq_event_percpu from handle_irq_event
       handle_irq_event from handle_level_irq
       handle_level_irq from generic_handle_irq
       generic_handle_irq from mxc_gpio_irq_handler
       mxc_gpio_irq_handler from mx3_gpio_irq_handler
       mx3_gpio_irq_handler from generic_handle_irq
       generic_handle_irq from __handle_domain_irq
       __handle_domain_irq from gic_handle_irq
       gic_handle_irq from __irq_svc
       __irq_svc from rt_spin_unlock
       rt_spin_unlock from kthread_worker_fn
       kthread_worker_fn from kthread
       kthread from ret_from_fork
    
    Fixes: 9e6f4ca ("sc16is7xx: use kthread_worker for tx_work and irq")
    Reported-by: Sean Nyekjaer <[email protected]>
    Signed-off-by: Josh Cartwright <[email protected]>
    Cc: [email protected]
    Cc: Jakub Kicinski <[email protected]>
    Cc: [email protected]
    Cc: Sebastian Andrzej Siewior <[email protected]>
    Signed-off-by: Julia Cartwright <[email protected]>
    Acked-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Josh Cartwright authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    4709034 View commit details
    Browse the repository at this point in the history
  55. md/raid5: limit request size according to implementation limits

    commit e8d7c33 upstream.
    
    Current implementation employ 16bit counter of active stripes in lower
    bits of bio->bi_phys_segments. If request is big enough to overflow
    this counter bio will be completed and freed too early.
    
    Fortunately this not happens in default configuration because several
    other limits prevent that: stripe_cache_size * nr_disks effectively
    limits count of active stripes. And small max_sectors_kb at lower
    disks prevent that during normal read/write operations.
    
    Overflow easily happens in discard if it's enabled by module parameter
    "devices_handle_discard_safely" and stripe_cache_size is set big enough.
    
    This patch limits requests size with 256Mb - 8Kb to prevent overflows.
    
    Signed-off-by: Konstantin Khlebnikov <[email protected]>
    Cc: Shaohua Li <[email protected]>
    Cc: Neil Brown <[email protected]>
    Signed-off-by: Shaohua Li <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    koct9i authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    b202064 View commit details
    Browse the repository at this point in the history
  56. scsi: aacraid: remove wildcard for series 9 controllers

    commit ae2aae2 upstream.
    
    Controllers with this PCI ID never shipped outside of
    PMCS/Microsemi. Remove the ID from the aacraid driver. smartpqi is the
    correct driver for these controllers.
    
    [mkp: patch description]
    
    Reviewed-by: Scott Teel <[email protected]>
    Signed-off-by: Kevin Barnett <[email protected]>
    Signed-off-by: Don Brace <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Kevin Barnett authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    0773e92 View commit details
    Browse the repository at this point in the history
  57. KVM: PPC: Book3S HV: Save/restore XER in checkpointed register state

    commit 0d808df upstream.
    
    When switching from/to a guest that has a transaction in progress,
    we need to save/restore the checkpointed register state.  Although
    XER is part of the CPU state that gets checkpointed, the code that
    does this saving and restoring doesn't save/restore XER.
    
    This fixes it by saving and restoring the XER.  To allow userspace
    to read/write the checkpointed XER value, we also add a new ONE_REG
    specifier.
    
    The visible effect of this bug is that the guest may see its XER
    value being corrupted when it uses transactions.
    
    Fixes: e4e3812 ("KVM: PPC: Book3S HV: Add transactional memory support")
    Fixes: 0a8ecce ("KVM: PPC: Book3S HV: Add missing code for transaction reclaim on guest exit")
    Signed-off-by: Paul Mackerras <[email protected]>
    Reviewed-by: Thomas Huth <[email protected]>
    Signed-off-by: Paul Mackerras <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    paulusmack authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    b751eb6 View commit details
    Browse the repository at this point in the history
  58. KVM: PPC: Book3S HV: Don't lose hardware R/C bit updates in H_PROTECT

    commit f064a0d upstream.
    
    The hashed page table MMU in POWER processors can update the R
    (reference) and C (change) bits in a HPTE at any time until the
    HPTE has been invalidated and the TLB invalidation sequence has
    completed.  In kvmppc_h_protect, which implements the H_PROTECT
    hypercall, we read the HPTE, modify the second doubleword,
    invalidate the HPTE in memory, do the TLB invalidation sequence,
    and then write the modified value of the second doubleword back
    to memory.  In doing so we could overwrite an R/C bit update done
    by hardware between when we read the HPTE and when the TLB
    invalidation completed.  To fix this we re-read the second
    doubleword after the TLB invalidation and OR in the (possibly)
    new values of R and C.  We can use an OR since hardware only ever
    sets R and C, never clears them.
    
    This race was found by code inspection.  In principle this bug could
    cause occasional guest memory corruption under host memory pressure.
    
    Fixes: a8606e2 ("KVM: PPC: Handle some PAPR hcalls in the kernel", 2011-06-29)
    Signed-off-by: Paul Mackerras <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    paulusmack authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    9a5cf8c View commit details
    Browse the repository at this point in the history
  59. kvm: nVMX: Allow L1 to intercept software exceptions (#BP and #OF)

    commit ef85b67 upstream.
    
    When L2 exits to L0 due to "exception or NMI", software exceptions
    (#BP and #OF) for which L1 has requested an intercept should be
    handled by L1 rather than L0. Previously, only hardware exceptions
    were forwarded to L1.
    
    Signed-off-by: Jim Mattson <[email protected]>
    Signed-off-by: Paolo Bonzini <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    jsmattsonjr authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    43983ce View commit details
    Browse the repository at this point in the history
  60. fsnotify: Fix possible use-after-free in inode iteration on umount

    commit 5716863 upstream.
    
    fsnotify_unmount_inodes() plays complex tricks to pin next inode in the
    sb->s_inodes list when iterating over all inodes. Furthermore the code has a
    bug that if the current inode is the last on i_sb_list that does not have e.g.
    I_FREEING set, then we leave next_i pointing to inode which may get removed
    from the i_sb_list once we drop s_inode_list_lock thus resulting in
    use-after-free issues (usually manifesting as infinite looping in
    fsnotify_unmount_inodes()).
    
    Fix the problem by keeping current inode pinned somewhat longer. Then we can
    make the code much simpler and standard.
    
    Signed-off-by: Jan Kara <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    jankara authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    576ea9e View commit details
    Browse the repository at this point in the history
  61. vsock/virtio: fix src/dst cid format

    commit f83f12d upstream.
    
    These fields are 64 bit, using le32_to_cpu and friends
    on these will not do the right thing.
    Fix this up.
    
    Signed-off-by: Michael S. Tsirkin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    mstsirkin authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    8569aad View commit details
    Browse the repository at this point in the history
  62. ftrace/x86_32: Set ftrace_stub to weak to prevent gcc from using shor…

    …t jumps to it
    
    commit 847fa1a upstream.
    
    With new binutils, gcc may get smart with its optimization and change a jmp
    from a 5 byte jump to a 2 byte one even though it was jumping to a global
    function. But that global function existed within a 2 byte radius, and gcc
    was able to optimize it. Unfortunately, that jump was also being modified
    when function graph tracing begins. Since ftrace expected that jump to be 5
    bytes, but it was only two, it overwrote code after the jump, causing a
    crash.
    
    This was fixed for x86_64 with commit 8329e81, with the same subject as
    this commit, but nothing was done for x86_32.
    
    Fixes: d61f82d ("ftrace: use dynamic patching for updating mcount calls")
    Reported-by: Colin Ian King <[email protected]>
    Tested-by: Colin Ian King <[email protected]>
    Signed-off-by: Steven Rostedt <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    rostedt authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    f61152e View commit details
    Browse the repository at this point in the history
  63. platform/x86: asus-nb-wmi.c: Add X45U quirk

    commit e74e259 upstream.
    
    Without this patch, the Asus X45U wireless card can't be turned
    on (hard-blocked), but after a suspend/resume it just starts working.
    
    Following this bug report[1], there are other cases like this one, but
    this Asus is the only model that I can test.
    
    [1] https://ubuntuforums.org/showthread.php?t=2181558
    
    Signed-off-by: Marcos Paulo de Souza <[email protected]>
    Signed-off-by: Andy Shevchenko <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    marcosps authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    b2758da View commit details
    Browse the repository at this point in the history
  64. fgraph: Handle a case where a tracer ignores set_graph_notrace

    commit 794de08 upstream.
    
    Both the wakeup and irqsoff tracers can use the function graph tracer when
    the display-graph option is set. The problem is that they ignore the notrace
    file, and record the entry of functions that would be ignored by the
    function_graph tracer. This causes the trace->depth to be recorded into the
    ring buffer. The set_graph_notrace uses a trick by adding a large negative
    number to the trace->depth when a graph function is to be ignored.
    
    On trace output, the graph function uses the depth to record a stack of
    functions. But since the depth is negative, it accesses the array with a
    negative number and causes an out of bounds access that can cause a kernel
    oops or corrupt data.
    
    Have the print functions handle cases where a tracer still records functions
    even when they are in set_graph_notrace.
    
    Also add warnings if the depth is below zero before accessing the array.
    
    Note, the function graph logic will still prevent the return of these
    functions from being recorded, which means that they will be left hanging
    without a return. For example:
    
       # echo '*spin*' > set_graph_notrace
       # echo 1 > options/display-graph
       # echo wakeup > current_tracer
       # cat trace
       [...]
          _raw_spin_lock() {
            preempt_count_add() {
            do_raw_spin_lock() {
          update_rq_clock();
    
    Where it should look like:
    
          _raw_spin_lock() {
            preempt_count_add();
            do_raw_spin_lock();
          }
          update_rq_clock();
    
    Cc: Namhyung Kim <[email protected]>
    Fixes: 29ad23b ("ftrace: Add set_graph_notrace filter")
    Signed-off-by: Steven Rostedt <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    rostedt authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    e661b5d View commit details
    Browse the repository at this point in the history
  65. IB/mad: Fix an array index check

    commit 2fe2f37 upstream.
    
    The array ib_mad_mgmt_class_table.method_table has MAX_MGMT_CLASS
    (80) elements. Hence compare the array index with that value instead
    of with IB_MGMT_MAX_METHODS (128). This patch avoids that Coverity
    reports the following:
    
    Overrunning array class->method_table of 80 8-byte elements at element index 127 (byte offset 1016) using index convert_mgmt_class(mad_hdr->mgmt_class) (which evaluates to 127).
    
    Fixes: commit b7ab0b1 ("IB/mad: Verify mgmt class in received MADs")
    Signed-off-by: Bart Van Assche <[email protected]>
    Cc: Sean Hefty <[email protected]>
    Reviewed-by: Hal Rosenstock <[email protected]>
    Signed-off-by: Doug Ledford <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Bart Van Assche authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    f079fc1 View commit details
    Browse the repository at this point in the history
  66. IPoIB: Avoid reading an uninitialized member variable

    commit 11b642b upstream.
    
    This patch avoids that Coverity reports the following:
    
        Using uninitialized value port_attr.state when calling printk
    
    Fixes: commit 94232d9 ("IPoIB: Start multicast join process only on active ports")
    Signed-off-by: Bart Van Assche <[email protected]>
    Cc: Erez Shitrit <[email protected]>
    Reviewed-by: Leon Romanovsky <[email protected]>
    Signed-off-by: Doug Ledford <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Bart Van Assche authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    37d4adb View commit details
    Browse the repository at this point in the history
  67. IB/multicast: Check ib_find_pkey() return value

    commit d3a2418 upstream.
    
    This patch avoids that Coverity complains about not checking the
    ib_find_pkey() return value.
    
    Fixes: commit 547af76 ("IB/multicast: Report errors on multicast groups if P_key changes")
    Signed-off-by: Bart Van Assche <[email protected]>
    Cc: Sean Hefty <[email protected]>
    Signed-off-by: Doug Ledford <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Bart Van Assche authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    2a0aa77 View commit details
    Browse the repository at this point in the history
  68. IB/rxe: Fix a memory leak in rxe_qp_cleanup()

    commit e259934 upstream.
    
    A socket is associated with every QP by the rxe driver but sock_release()
    is never called. Add a call to sock_release() in rxe_qp_cleanup().
    
    Fixes: commit 8700e3e7c48A5 ("Add Soft RoCE driver")
    Signed-off-by: Bart Van Assche <[email protected]>
    Cc: Moni Shoua <[email protected]>
    Cc: Kamal Heib <[email protected]>
    Cc: Amir Vadai <[email protected]>
    Cc: Haggai Eran <[email protected]>
    Reviewed-by: Moni Shoua <[email protected]>
    Signed-off-by: Doug Ledford <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Bart Van Assche authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    7b3721a View commit details
    Browse the repository at this point in the history
  69. IB/cma: Fix a race condition in iboe_addr_get_sgid()

    commit fba332b upstream.
    
    Code that dereferences the struct net_device ip_ptr member must be
    protected with an in_dev_get() / in_dev_put() pair. Hence insert
    calls to these functions.
    
    Fixes: commit 7b85627 ("IB/cma: IBoE (RoCE) IP-based GID addressing")
    Signed-off-by: Bart Van Assche <[email protected]>
    Reviewed-by: Moni Shoua <[email protected]>
    Cc: Or Gerlitz <[email protected]>
    Cc: Roland Dreier <[email protected]>
    Signed-off-by: Doug Ledford <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Bart Van Assche authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    15d1d22 View commit details
    Browse the repository at this point in the history
  70. mn88472: fix chip id check on probe

    commit 365fe4e upstream.
    
    A register used to identify chip during probe was overwritten during
    firmware download and due to that later probe's for warm chip were
    failing. Detect chip from the another register, which is located on
    different register bank 2.
    
    Fixes: 94d0eaa ("[media] mn88472: move out of staging to media")
    
    Signed-off-by: Antti Palosaari <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    palosaari authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    84b2f66 View commit details
    Browse the repository at this point in the history
  71. mn88473: fix chip id check on probe

    commit d930b5b upstream.
    
    A register used to identify chip during probe was overwritten during
    firmware download and due to that later probe's for warm chip were
    failing. Detect chip from the another register, which is located on
    different register bank 2.
    
    Fixes: 7908fad ("[media] mn88473: finalize driver")
    
    Signed-off-by: Antti Palosaari <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    palosaari authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    c3fe33d View commit details
    Browse the repository at this point in the history
  72. s5p-mfc: fix failure path of s5p_mfc_alloc_memdev()

    commit 3467c9a upstream.
    
    s5p_mfc_alloc_memdev() function lacks proper releasing
    of allocated device in case of reserved memory initialization
    failure. This results in NULL pointer dereference:
    
    [    2.828457] Unable to handle kernel NULL pointer dereference at virtual address 00000001
    [    2.835089] pgd = c0004000
    [    2.837752] [00000001] *pgd=00000000
    [    2.844696] Internal error: Oops: 5 [Freescale#1] PREEMPT SMP ARM
    [    2.848680] Modules linked in:
    [    2.851722] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.8.0-rc6-00002-gafa1b97 torvalds#878
    [    2.859357] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
    [    2.865433] task: ef080000 task.stack: ef06c000
    [    2.869952] PC is at strcmp+0x0/0x30
    [    2.873508] LR is at platform_match+0x84/0xac
    [    2.877847] pc : [<c032621c>]    lr : [<c03f65e8>]    psr: 20000013
    [    2.877847] sp : ef06dea0  ip : 00000000  fp : 00000000
    [    2.889303] r10: 00000000  r9 : c0b34848  r8 : c0b1e968
    [    2.894511] r7 : 00000000  r6 : 00000001  r5 : c086e7fc  r4 : eeb8e010
    [    2.901021] r3 : 0000006d  r2 : 00000000  r1 : c086e7fc  r0 : 00000001
    [    2.907533] Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
    [    2.914649] Control: 10c5387d  Table: 4000404a  DAC: 00000051
    [    2.920378] Process swapper/0 (pid: 1, stack limit = 0xef06c210)
    [    2.926367] Stack: (0xef06dea0 to 0xef06e000)
    [    2.930711] dea0: eeb8e010 c0c2d91c c03f4a6c c03f4a8c 00000000 c0c2d91c c03f4a6c c03f2fc8
    [    2.938870] dec0: ef003274 ef10c4c0 c0c2d91c ef10cc80 c0c21270 c03f3fa4 c09c1be8 c0c2d91c
    [    2.947028] dee0: 00000006 c0c2d91c 00000006 c0b3483c c0c47000 c03f5314 c0c2d908 c0b5fed8
    [    2.955188] df00: 00000006 c010178c 60000013 c0a4ef14 00000000 c06feaa0 ef080000 60000013
    [    2.963347] df20: 00000000 c0c095c8 efffca76 c0816b8c 000000d5 c0134098 c0b34848 c09d6cdc
    [    2.971506] df40: c0a4de70 00000000 00000006 00000006 c0c09568 efffca40 c0b5fed8 00000006
    [    2.979665] df60: c0b3483c c0c47000 000000d5 c0b34848 c0b005a4 c0b00d84 00000006 00000006
    [    2.987824] df80: 00000000 c0b005a4 00000000 c06fb4d8 00000000 00000000 00000000 00000000
    [    2.995983] dfa0: 00000000 c06fb4e0 00000000 c01079b8 00000000 00000000 00000000 00000000
    [    3.004142] dfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    [    3.012302] dfe0: 00000000 00000000 00000000 00000000 00000013 00000000 ffffffff ffffffff
    [    3.020469] [<c032621c>] (strcmp) from [<c03f65e8>] (platform_match+0x84/0xac)
    [    3.027672] [<c03f65e8>] (platform_match) from [<c03f4a8c>] (__driver_attach+0x20/0xb0)
    [    3.035654] [<c03f4a8c>] (__driver_attach) from [<c03f2fc8>] (bus_for_each_dev+0x54/0x88)
    [    3.043812] [<c03f2fc8>] (bus_for_each_dev) from [<c03f3fa4>] (bus_add_driver+0xe8/0x1f4)
    [    3.051971] [<c03f3fa4>] (bus_add_driver) from [<c03f5314>] (driver_register+0x78/0xf4)
    [    3.059958] [<c03f5314>] (driver_register) from [<c010178c>] (do_one_initcall+0x3c/0x16c)
    [    3.068123] [<c010178c>] (do_one_initcall) from [<c0b00d84>] (kernel_init_freeable+0x120/0x1ec)
    [    3.076802] [<c0b00d84>] (kernel_init_freeable) from [<c06fb4e0>] (kernel_init+0x8/0x118)
    [    3.084958] [<c06fb4e0>] (kernel_init) from [<c01079b8>] (ret_from_fork+0x14/0x3c)
    [    3.092506] Code: 1afffffb e12fff1e e1a03000 eafffff7 (e4d03001)
    [    3.098618] ---[ end trace 511bf9d750810709 ]---
    [    3.103207] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
    
    This patch fixes this issue.
    
    Fixes: c79667d ("media: s5p-mfc: replace custom
    	reserved memory handling code with generic one")
    
    Signed-off-by: Marek Szyprowski <[email protected]>
    Signed-off-by: Sylwester Nawrocki <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    mszyprow authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    88bfde2 View commit details
    Browse the repository at this point in the history
  73. media: solo6x10: fix lockup by avoiding delayed register write

    commit 5fc4b06 upstream.
    
    This fixes a lockup at device probing which happens on some solo6010
    hardware samples. This is a regression introduced by commit e1ceb25
    ("[media] SOLO6x10: remove unneeded register locking and barriers")
    
    The observed lockup happens in solo_set_motion_threshold() called from
    solo_motion_config().
    
    This extra "flushing" is not fundamentally needed for every write, but
    apparently the code in driver assumes such behaviour at last in some
    places.
    
    Actual fix was proposed by Hans Verkuil.
    
    Fixes: e1ceb25 ("[media] SOLO6x10: remove unneeded register locking and barriers")
    
    Signed-off-by: Andrey Utkin <[email protected]>
    Signed-off-by: Hans Verkuil <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Andrey Utkin authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    4963b19 View commit details
    Browse the repository at this point in the history
  74. v4l: tvp5150: Add missing break in set control handler

    commit d183e4e upstream.
    
    A break is missing resulting in the hue control enabling or disabling
    the decode completely. Fix it.
    
    Fixes: c43875f ("[media] tvp5150: replace MEDIA_ENT_F_CONN_TEST by a control")
    
    Signed-off-by: Laurent Pinchart <[email protected]>
    Signed-off-by: Mauro Carvalho Chehab <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    pinchartl authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    b784371 View commit details
    Browse the repository at this point in the history
  75. Input: drv260x - fix input device's parent assignment

    commit 5a8a6b8 upstream.
    
    We were assigning I2C bus controller instead of client as parent device.
    Besides being logically wrong, it messed up with devm handling of input
    device. As a result we were leaving input device and event node behind
    after rmmod-ing the driver, which lead to a kernel oops if one were to
    access the event node later.
    
    Let's remove the assignment and rely on devm_input_allocate_device() to
    set it up properly for us.
    
    Signed-off-by: Jingkui Wang <[email protected]>
    Fixes: 7132fe4 ("Input: drv260x - add TI drv260x haptics driver")
    Signed-off-by: Dmitry Torokhov <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Catramen authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    7d0a6cf View commit details
    Browse the repository at this point in the history
  76. i40iw: Use correct src address in memcpy to rdma stats counters

    commit 91c42b7 upstream.
    
    hw_stats is a pointer to i40_iw_dev_stats struct in i40iw_get_hw_stats().
    Use hw_stats and not &hw_stats in the memcpy to copy the i40iw device stats
    data into rdma_hw_stats counters.
    
    Fixes: b40f475 ("IB/core: Make device counter infrastructure dynamic")
    
    Signed-off-by: Shiraz Saleem <[email protected]>
    Signed-off-by: Faisal Latif <[email protected]>
    Signed-off-by: Doug Ledford <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    shirazsaleem authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    c75bc2b View commit details
    Browse the repository at this point in the history
  77. PCI: Check for PME in targeted sleep state

    commit 6496ebd upstream.
    
    One some systems, the firmware does not allow certain PCI devices to be put
    in deep D-states.  This can cause problems for wakeup signalling, if the
    device does not support PME# in the deepest allowed suspend state.  For
    example, Pierre reports that on his system, ACPI does not permit his xHCI
    host controller to go into D3 during runtime suspend -- but D3 is the only
    state in which the controller can generate PME# signals.  As a result, the
    controller goes into runtime suspend but never wakes up, so it doesn't work
    properly.  USB devices plugged into the controller are never detected.
    
    If the device relies on PME# for wakeup signals but is not capable of
    generating PME# in the target state, the PCI core should accurately report
    that it cannot do wakeup from runtime suspend.  This patch modifies the
    pci_dev_run_wake() routine to add this check.
    
    Reported-by: Pierre de Villemereuil <[email protected]>
    Tested-by: Pierre de Villemereuil <[email protected]>
    Signed-off-by: Alan Stern <[email protected]>
    Signed-off-by: Bjorn Helgaas <[email protected]>
    Acked-by: Rafael J. Wysocki <[email protected]>
    CC: Lukas Wunner <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    AlanStern authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    1f93d1a View commit details
    Browse the repository at this point in the history
  78. libceph: verify authorize reply on connect

    commit 5c056fd upstream.
    
    After sending an authorizer (ceph_x_authorize_a + ceph_x_authorize_b),
    the client gets back a ceph_x_authorize_reply, which it is supposed to
    verify to ensure the authenticity and protect against replay attacks.
    The code for doing this is there (ceph_x_verify_authorizer_reply(),
    ceph_auth_verify_authorizer_reply() + plumbing), but it is never
    invoked by the the messenger.
    
    AFAICT this goes back to 2009, when ceph authentication protocols
    support was added to the kernel client in 4e7a5dc ("ceph:
    negotiate authentication protocol; implement AUTH_NONE protocol").
    
    The second param of ceph_connection_operations::verify_authorizer_reply
    is unused all the way down.  Pass 0 to facilitate backporting, and kill
    it in the next commit.
    
    Signed-off-by: Ilya Dryomov <[email protected]>
    Reviewed-by: Sage Weil <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    idryomov authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    1678ada View commit details
    Browse the repository at this point in the history
  79. nfs_write_end(): fix handling of short copies

    commit c0cf3ef upstream.
    
    What matters when deciding if we should make a page uptodate is
    not how much we _wanted_ to copy, but how much we actually have
    copied.  As it is, on architectures that do not zero tail on
    short copy we can leave uninitialized data in page marked uptodate.
    
    Signed-off-by: Al Viro <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Al Viro authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    8f5ff87 View commit details
    Browse the repository at this point in the history
  80. pNFS: On error, do not send LAYOUTGET until the LAYOUTRETURN has comp…

    …leted
    
    commit 6604b20 upstream.
    
    If there is an I/O error, we should not call LAYOUTGET until the
    LAYOUTRETURN that reports the error is complete.
    
    Signed-off-by: Trond Myklebust <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    trondmypd authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    7de1b81 View commit details
    Browse the repository at this point in the history
  81. pNFS: Don't clear the layout stateid if a layout return is outstanding

    commit 7b65099 upstream.
    
    If we no longer hold any layout segments, we're normally expected to
    consider the layout stateid to be invalid. However we cannot assume this
    if we're about to, or in the process of sending a layoutreturn.
    
    Fixes: 334a8f3 ("pNFS: Don't forget the layout stateid if...")
    Signed-off-by: Trond Myklebust <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    trondmypd authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    f061c76 View commit details
    Browse the repository at this point in the history
  82. pNFS: Clear NFS_LAYOUT_RETURN_REQUESTED when invalidating the layout …

    …stateid
    
    commit ae5a459 upstream.
    
    We must ensure that we don't schedule a layoutreturn if the layout stateid
    has been marked as invalid.
    
    Fixes: 2a59a04 ("pNFS: Fix pnfs_set_layout_stateid() to clear...")
    Signed-off-by: Trond Myklebust <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    trondmypd authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    abb2903 View commit details
    Browse the repository at this point in the history
  83. pNFS: Fix a deadlock between read resends and layoutreturn

    commit 54e4a0d upstream.
    
    We must not call nfs_pageio_init_read() on a new nfs_pageio_descriptor
    while holding a reference to a layout segment, as that can deadlock
    pnfs_update_layout().
    
    Fixes: d67ae82 ("pnfs/flexfiles: Add the FlexFile Layout Driver")
    Signed-off-by: Trond Myklebust <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    trondmypd authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    c513ade View commit details
    Browse the repository at this point in the history
  84. SUNRPC: fix refcounting problems with auth_gss messages.

    commit 1cded9d upstream.
    
    There are two problems with refcounting of auth_gss messages.
    
    First, the reference on the pipe->pipe list (taken by a call
    to rpc_queue_upcall()) is not counted.  It seems to be
    assumed that a message in pipe->pipe will always also be in
    pipe->in_downcall, where it is correctly reference counted.
    
    However there is no guaranty of this.  I have a report of a
    NULL dereferences in rpc_pipe_read() which suggests a msg
    that has been freed is still on the pipe->pipe list.
    
    One way I imagine this might happen is:
    - message is queued for uid=U and auth->service=S1
    - rpc.gssd reads this message and starts processing.
      This removes the message from pipe->pipe
    - message is queued for uid=U and auth->service=S2
    - rpc.gssd replies to the first message. gss_pipe_downcall()
      calls __gss_find_upcall(pipe, U, NULL) and it finds the
      *second* message, as new messages are placed at the head
      of ->in_downcall, and the service type is not checked.
    - This second message is removed from ->in_downcall and freed
      by gss_release_msg() (even though it is still on pipe->pipe)
    - rpc.gssd tries to read another message, and dereferences a pointer
      to this message that has just been freed.
    
    I fix this by incrementing the reference count before calling
    rpc_queue_upcall(), and decrementing it if that fails, or normally in
    gss_pipe_destroy_msg().
    
    It seems strange that the reply doesn't target the message more
    precisely, but I don't know all the details.  In any case, I think the
    reference counting irregularity became a measureable bug when the
    extra arg was added to __gss_find_upcall(), hence the Fixes: line
    below.
    
    The second problem is that if rpc_queue_upcall() fails, the new
    message is not freed. gss_alloc_msg() set the ->count to 1,
    gss_add_msg() increments this to 2, gss_unhash_msg() decrements to 1,
    then the pointer is discarded so the memory never gets freed.
    
    Fixes: 9130b8d ("SUNRPC: allow for upcalls for same uid but different gss service")
    Link: https://bugzilla.opensuse.org/show_bug.cgi?id=1011250
    Signed-off-by: NeilBrown <[email protected]>
    Signed-off-by: Trond Myklebust <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    NeilBrown authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    0349fbe View commit details
    Browse the repository at this point in the history
  85. powerpc/64e: Convert cmpi to cmpwi in head_64.S

    commit f87f253 upstream.
    
    From 80f2393 ("powerpc: Convert cmp to cmpd in idle enter sequence"):
    
      PowerPC's "cmp" instruction has four operands. Normally people write
      "cmpw" or "cmpd" for the second cmp operand 0 or 1. But, frequently
      people forget, and write "cmp" with just three operands.
    
      With older binutils this is silently accepted as if this was "cmpw",
      while often "cmpd" is wanted. With newer binutils GAS will complain
      about this for 64-bit code. For 32-bit code it still silently assumes
      "cmpw" is what is meant.
    
    In this case, cmpwi is called for, so this is just a build fix for
    new toolchains.
    
    Signed-off-by: Nicholas Piggin <[email protected]>
    Signed-off-by: Michael Ellerman <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    npiggin authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    e451d67 View commit details
    Browse the repository at this point in the history
  86. powerpc/ps3: Fix system hang with GCC 5 builds

    commit 6dff5b6 upstream.
    
    GCC 5 generates different code for this bootwrapper null check that
    causes the PS3 to hang very early in its bootup. This check is of
    limited value, so just get rid of it.
    
    Signed-off-by: Geoff Levand <[email protected]>
    Signed-off-by: Michael Ellerman <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    glevand authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    3a4e428 View commit details
    Browse the repository at this point in the history
  87. libnvdimm, pfn: fix align attribute

    commit af7d9f0 upstream.
    
    Fix the format specifier so that the attribute can be parsed correctly.
    Currently it returns decimal 1000 for a 4096-byte alignment.
    
    Reported-by: Dave Jiang <[email protected]>
    Fixes: 315c562 ("libnvdimm, pfn: add 'align' attribute, default to HPAGE_SIZE")
    Signed-off-by: Dan Williams <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    djbw authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    29f3d11 View commit details
    Browse the repository at this point in the history
  88. target/user: Fix use-after-free of tcmu_cmds if they are expired

    commit d0905ca upstream.
    
    Don't free the cmd in tcmu_check_expired_cmd, it's still referenced by
    an entry in our cmd_id->cmd idr. If userspace ever resumes processing,
    tcmu_handle_completions() will use the now-invalid cmd pointer.
    
    Instead, don't free cmd. It will be freed by tcmu_handle_completion() if
    userspace ever recovers, or tcmu_free_device if not.
    
    Reported-by: Bryant G Ly <[email protected]>
    Tested-by: Bryant G Ly <[email protected]>
    Signed-off-by: Andy Grover <[email protected]>
    Signed-off-by: Bart Van Assche <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Andy Grover authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    e141d1a View commit details
    Browse the repository at this point in the history
  89. kconfig/nconf: Fix hang when editing symbol with a long prompt

    commit 79e51b5 upstream.
    
    Currently it is impossible to edit the value of a config symbol with a
    prompt longer than (terminal width - 2) characters.  dialog_inputbox()
    calculates a negative x-offset for the input window and newwin() fails
    as this is invalid.  It also doesn't check for this failure, so it
    busy-loops calling wgetch(NULL) which immediately returns -1.
    
    The additions in the offset calculations also don't match the intended
    size of the window.
    
    Limit the window size and calculate the offset similarly to
    show_scroll_win().
    
    Fixes: 692d97c ("kconfig: new configuration interface (nconfig)")
    Signed-off-by: Ben Hutchings <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    bwh-ct authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    d787c6b View commit details
    Browse the repository at this point in the history
  90. sg_write()/bsg_write() is not fit to be called under KERNEL_DS

    commit 128394e upstream.
    
    Both damn things interpret userland pointers embedded into the payload;
    worse, they are actually traversing those.  Leaving aside the bad
    API design, this is very much _not_ safe to call with KERNEL_DS.
    Bail out early if that happens.
    
    Signed-off-by: Al Viro <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Al Viro authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    48f26ed View commit details
    Browse the repository at this point in the history
  91. net: mvpp2: fix dma unmapping of TX buffers for fragments

    commit 8354491 upstream.
    
    Since commit 71ce391 ("net: mvpp2: enable proper per-CPU TX
    buffers unmapping"), we are not correctly DMA unmapping TX buffers for
    fragments.
    
    Indeed, the mvpp2_txq_inc_put() function only stores in the
    txq_cpu->tx_buffs[] array the physical address of the buffer to be
    DMA-unmapped when skb != NULL. In addition, when DMA-unmapping, we use
    skb_headlen(skb) to get the size to be unmapped. Both of this works fine
    for TX descriptors that are associated directly to a SKB, but not the
    ones that are used for fragments, with a NULL pointer as skb:
    
     - We have a NULL physical address when calling DMA unmap
     - skb_headlen(skb) crashes because skb is NULL
    
    This causes random crashes when fragments are used.
    
    To solve this problem, we need to:
    
     - Store the physical address of the buffer to be unmapped
       unconditionally, regardless of whether it is tied to a SKB or not.
    
     - Store the length of the buffer to be unmapped, which requires a new
       field.
    
    Instead of adding a third array to store the length of the buffer to be
    unmapped, and as suggested by David Miller, this commit refactors the
    tx_buffs[] and tx_skb[] arrays of 'struct mvpp2_txq_pcpu' into a
    separate structure 'mvpp2_txq_pcpu_buf', to which a 'size' field is
    added. Therefore, instead of having three arrays to allocate/free, we
    have a single one, which also improve data locality, reducing the
    impact on the CPU cache.
    
    Fixes: 71ce391 ("net: mvpp2: enable proper per-CPU TX buffers unmapping")
    Reported-by: Raphael G <[email protected]>
    Cc: Raphael G <[email protected]>
    Signed-off-by: Thomas Petazzoni <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    tpetazzoni authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    4803ec2 View commit details
    Browse the repository at this point in the history
  92. drm/i915/dsi: Fix chv_exec_gpio disabling the GPIOs it is setting

    commit 22ca0d4 upstream.
    
    Set the CHV_GPIO_GPIOEN bit when updating GPIOs from chv_exec_gpio.
    
    Fixes: a0a6d4f ("drm/i915/dsi: add support for gpio elements on CHV")
    Cc: Jani Nikula <[email protected]>
    Cc: Ville Syrjälä <[email protected]>
    Signed-off-by: Hans de Goede <[email protected]>
    Reviewed-by: Ville Syrjälä <[email protected]>
    Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
    Signed-off-by: Ville Syrjälä <[email protected]>
    (cherry picked from commit b2b45fc)
    Signed-off-by: Jani Nikula <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    jwrdegoede authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    6a412ff View commit details
    Browse the repository at this point in the history
  93. drm/i915/dsi: Do not clear DPOUNIT_CLOCK_GATE_DISABLE from vlv_init_d…

    …isplay_clock_gating
    
    commit bb98e72 upstream.
    
    On my Cherrytrail CUBE iwork8 Air tablet PIPE-A would get stuck on loading
    i915 at boot 1 out of every 3 boots, resulting in a non functional LCD.
    Once the i915 driver has successfully loaded, the panel can be disabled /
    enabled without hitting this issue.
    
    The getting stuck is caused by vlv_init_display_clock_gating() clearing
    the DPOUNIT_CLOCK_GATE_DISABLE bit in DSPCLK_GATE_D when called from
    chv_pipe_power_well_ops.enable() on driver load, while a pipe is enabled
    driving the DSI LCD by the BIOS.
    
    Clearing this bit while DSI is in use is a known issue and
    intel_dsi_pre_enable() / intel_dsi_post_disable() already set / clear it
    as appropriate.
    
    This commit modifies vlv_init_display_clock_gating() to leave the
    DPOUNIT_CLOCK_GATE_DISABLE bit alone fixing the pipe getting stuck.
    
    Changes in v2:
    -Replace PIPE-A with "a pipe" or "the pipe" in the commit msg and
    comment
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97330
    Signed-off-by: Hans de Goede <[email protected]>
    Reviewed-by: Ville Syrjälä <[email protected]>
    Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
    Signed-off-by: Ville Syrjälä <[email protected]>
    (cherry picked from commit 721d484)
    Signed-off-by: Jani Nikula <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    jwrdegoede authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    294bb34 View commit details
    Browse the repository at this point in the history
  94. drm/i915: Fix cdclk vs. dev_cdclk mess when not recomputing things

    commit 14676ec upstream.
    
    When we end up not recomputing the cdclk, we need to populate
    intel_state->cdclk with the "atomic_cdclk_freq" instead of the
    current cdclk_freq. When no pipes are active, the actual cdclk_freq
    may be lower than what the configuration of the planes and
    pipes would require from the point of view of the software state.
    
    This fixes bogus WARNS from skl_max_scale() which is trying to check
    the plane software state against the cdclk frequency. So any time
    it got called during DPMS off for instance, we might have tripped
    the warn if the current mode would have required a higher than
    minimum cdclk.
    
    v2: Drop the dev_cdclk stuff (Maarten)
    
    Cc: Maarten Lankhorst <[email protected]>
    Cc: Mika Kahola <[email protected]>
    Cc: [email protected]
    Cc: Daniel J Blueman <[email protected]>
    Cc: Paul Bolle <[email protected]>
    Cc: Joseph Yasi <[email protected]>
    Tested-by: Paul Bolle <[email protected]>
    Tested-by: Joseph Yasi <[email protected]> (v1)
    Fixes: 1a617b7 ("drm/i915: Keep track of the cdclk as if all crtc's were active.")
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98214
    Signed-off-by: Ville Syrjälä <[email protected]>
    Reviewed-by: Maarten Lankhorst <[email protected]>
    Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
    (cherry picked from commit e0ca7a6)
    Signed-off-by: Jani Nikula <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    vsyrjala authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    22aba47 View commit details
    Browse the repository at this point in the history
  95. drm/i915: Initialize dev_priv->atomic_cdclk_freq at init time

    commit 1f3dc3e upstream.
    
    Looks like we're only initializing dev_priv->atomic_cdclk_freq
    at resume and commit times, not at init time. Let's do that as
    well.
    
    We're now hitting the 'WARN_ON(intel_state->cdclk == 0)' in
    hsw_compute_linetime_wm() on account of populating
    intel_state->cdclk from dev_priv->atomic_cdclk_freq.
    Previously we were mispopulating intel_state->cdclk with
    dev_priv->cdclk_freq which always had a proper value at init
    time and hence the WARN_ON() didn't trigger.
    
    Cc: Matthew Auld <[email protected]>
    Reported-by: Matthew Auld <[email protected]>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98902
    Fixes: 14676ec ("drm/i915: Fix cdclk vs. dev_cdclk mess when not recomputing things")
    Signed-off-by: Ville Syrjälä <[email protected]>
    Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
    Tested-by: Matthew Auld <[email protected]>
    Reviewed-by: Matthew Auld <[email protected]>
    (cherry picked from commit 6a259b1)
    Signed-off-by: Jani Nikula <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    vsyrjala authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    000e612 View commit details
    Browse the repository at this point in the history
  96. drm/i915: skip the first 4k of stolen memory on everything >= gen8

    commit 6ba0566 upstream.
    
    BSpec got updated and this workaround is now listed as standard
    required programming for all subsequent projects. This is confirmed to
    fix Skylake screen flickering issues (probably caused by the fact that
    we initialized a ring in the first page of stolen, but I didn't 100%
    confirm this theory).
    
    v2: this is the patch that fixes the screen flickering, document it.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94605
    Tested-by: Dominik Klementowski <[email protected]>
    Signed-off-by: Paulo Zanoni <[email protected]>
    Acked-by: Chris Wilson <[email protected]>
    Reviewed-by: Daniel Vetter <[email protected]>
    Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
    (cherry picked from commit d435376)
    Signed-off-by: Jani Nikula <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    pzanoni-intel authored and gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    adf363f View commit details
    Browse the repository at this point in the history
  97. Linux 4.8.17

    gregkh committed Jan 9, 2017
    Configuration menu
    Copy the full SHA
    3d8f8d0 View commit details
    Browse the repository at this point in the history

Commits on Jan 23, 2017

  1. Merge tag 'v4.8.17' into 4.8.x+fslc

    This is the 4.8.17 stable release
    redbrain17 committed Jan 23, 2017
    Configuration menu
    Copy the full SHA
    35ef795 View commit details
    Browse the repository at this point in the history