4.1.4-stable review
Subsystems (4)
Greg Kroah-Hartman
maintainerPATCH 189/267 md: unlock mddev_lock on an error path.
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit 9a8c0fa861e4db60409b4dda254cef5e17e4d43c upstream.
This error path retuns while still holding the lock - bad.
--- drivers/md/md.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/md/md.c +3 -1
@@ -4005,8 +4005,10 @@ new_dev_store(struct mddev *mddev, constelse rdev =md_import_device (dev,-1 ,-1 ); -if (IS_ERR (rdev)) +if (IS_ERR (rdev)) { +mddev_unlock (mddev);return PTR_ERR (rdev); + } err =bind_rdev_to_array (rdev, mddev); out:if (err)
Greg Kroah-Hartman
maintainerPATCH 190/267 md: Skip cluster setup for dm-raid
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Goldwyn Rodrigues <[email protected]>
commit d3b178adb3a3adf54ecf77758138b654c3ee7f09 upstream.
There is a bug that the bitmap superblock isn't initialised properly for dm-raid, so a new field can have garbage in new fields. (dm-raid does initialisation in the kernel - md initialised the
superblock in mdadm).
This means that for dm-raid we cannot currently trust the new ->nodes field. So:
- use __GFP_ZERO to initialise the superblock properly for all new arrays
- initialise all fields in bitmap_info in bitmap_new_disk_sb
- ignore ->nodes for dm arrays (yes, this is a hack)
This bug exposes dm-raid to bug in the (still experimental) md-cluster code, so it is suitable for -stable. It does cause crashes.
References: https://bugzilla.kernel.org/show_bug.cgi?id=100491
--- drivers/md/bitmap.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/md/bitmap.c +12 -3
@@ -494,7 +494,7 @@ static int bitmap_new_disk_sb(struct bitbitmap_super_t *sb;unsigned long chunksize, daemon_sleep, write_behind; - bitmap->storage.sb_page =alloc_page (GFP_KERNEL ); + bitmap->storage.sb_page =alloc_page (GFP_KERNEL | __GFP_ZERO);if (bitmap->storage.sb_page ==NULL )return -ENOMEM ; bitmap->storage.sb_page->index =0 ;
@@ -541,6 +541,7 @@ static int bitmap_new_disk_sb(struct bit sb->state =cpu_to_le32 (bitmap->flags); bitmap->events_cleared = bitmap->mddev->events; sb->events_cleared =cpu_to_le64 (bitmap->mddev->events); + bitmap->mddev->bitmap_info.nodes =0 ;kunmap_atomic (sb);
@@ -611,8 +612,16 @@ re_read: daemon_sleep =le32_to_cpu (sb->daemon_sleep) *HZ ; write_behind =le32_to_cpu (sb->write_behind); sectors_reserved =le32_to_cpu (sb->sectors_reserved); - nodes =le32_to_cpu (sb->nodes); -strlcpy (bitmap->mddev->bitmap_info.cluster_name, sb->cluster_name,64 ); +/* XXX: This is a hack to ensure that we don't use clustering +* in case: +* - dm-raid is in use and +* - the nodes written in bitmap_sb is erroneous. +*/ +if (!bitmap->mddev->sync_super) { + nodes =le32_to_cpu (sb->nodes); +strlcpy (bitmap->mddev->bitmap_info.cluster_name, + sb->cluster_name,64 ); + }/* verify that the bitmap-specific fields are valid */ if (sb->magic !=cpu_to_le32 (BITMAP_MAGIC ))
Greg Kroah-Hartman
maintainerPATCH 144/267 drm/i915: Snapshot seqno of most recently submitted request.
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomas Elf <[email protected]>
commit 94f7bbe1509731bdef651d7fb235b2c31fb23be8 upstream.
The hang checker needs to inspect whether or not the ring request list is empty as well as if the given engine has reached or passed the most recently submitted request. The problem with this is that the hang checker cannot grab the struct_mutex, which is required in order to safely inspect requests since requests might be deallocated during inspection. In the past we've had kernel panics due to this very unsynchronized access in the hang checker.
One solution to this problem is to not inspect the requests directly since we're only interested in the seqno of the most recently submitted request - not the request itself. Instead the seqno of the most recently submitted request is stored separately, which the hang checker then inspects, circumventing the issue of synchronization from the hang checker entirely.
This fixes a regression introduced in
commit 44cdd6d219bc64f6810b8ed0023a4d4db9e0fe68
Author: John Harrison <[email protected]> Date: Mon Nov 24 18:49:40 2014 +0000
drm/i915: Convert 'ring_idle()' to use requests not seqnos
v2 (Chris Wilson):
- Pass current engine seqno to ring_idle() from i915_hangcheck_elapsed() rather than compute it over again.
- Remove extra whitespace.
Issue: VIZ-5998
--- drivers/gpu/drm/i915/i915_gem.c | 1 + drivers/gpu/drm/i915/i915_irq.c | 13 +++---------- drivers/gpu/drm/i915/intel_ringbuffer.h | 7 +++++++ 3 files changed, 11 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +1 -0
@@ -2401,6 +2401,7 @@ int __i915_add_request(struct intel_engi } request->emitted_jiffies = jiffies; + ring->last_submitted_seqno = request->seqno;list_add_tail (&request->list, &ring->request_list); request->file_priv =NULL ;
drivers/gpu/drm/i915/i915_irq.c +3 -10
@@ -2650,18 +2650,11 @@ static void gen8_disable_vblank(struct dspin_unlock_irqrestore (&dev_priv->irq_lock, irqflags); } -static struct drm_i915_gem_request * -ring_last_request (struct intel_engine_cs *ring) -{ -return list_entry (ring->request_list.prev, - struct drm_i915_gem_request, list); -} -static bool -ring_idle (struct intel_engine_cs *ring) +ring_idle (struct intel_engine_cs *ring,u32 seqno) {return (list_empty (&ring->request_list) || -i915_gem_request_completed (ring_last_request (ring), false)); +i915_seqno_passed (seqno, ring->last_submitted_seqno)); } static bool
@@ -2883,7 +2876,7 @@ static void i915_hangcheck_elapsed(struc acthd =intel_ring_get_active_head (ring);if (ring->hangcheck.seqno == seqno) { -if (ring_idle (ring)) { +if (ring_idle (ring, seqno)) { ring->hangcheck.action =HANGCHECK_IDLE ;if (waitqueue_active (&ring->irq_queue)) {
drivers/gpu/drm/i915/intel_ringbuffer.h +7 -0
@@ -266,6 +266,13 @@ struct intel_engine_cs {* Do we have some not yet emitted requests outstanding? */ struct drm_i915_gem_request *outstanding_lazy_request; +/** +* Seqno of request most recently submitted to request_list. +* Used exclusively by hang checker to avoid grabbing lock while +* inspecting request list. +*/ +u32 last_submitted_seqno; +bool gpu_caches_dirty;wait_queue_head_t irq_queue;
Greg Kroah-Hartman
maintainerPATCH 192/267 hwmon: (nct7802) fix visibility of temp3
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Constantine Shulyupin <[email protected]>
commit 56172d81a9bc37a69b95dd627b8d48135c9c7b31 upstream.
Excerpt from datasheet:
7.2.32 Mode Selection RegisterRTD3_MD : 00=Closed , 01=Reserved , 10=Thermistor mode , 11=Voltage sense
Show temp3 only in Thermistor mode
--- drivers/hwmon/nct7802.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/nct7802.c +1 -1
@@ -547,7 +547,7 @@ static umode_t nct7802_temp_is_visible(sif (index >=9 && index <18 && (reg &0x0c ) !=0x04 && (reg &0x0c ) !=0x08 )/* RD2 */ return 0 ; -if (index >=18 && index <27 && (reg &0x30 ) !=0x10 )/* RD3 */ +if (index >=18 && index <27 && (reg &0x30 ) !=0x20 )/* RD3 */ return 0 ;if (index >=27 && index <35 )/* local */ return attr->mode;
Greg Kroah-Hartman
maintainerPATCH 201/267 Btrfs: fix file corruption after cloning inline extents
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit ed958762644b404654a6f5d23e869f496fe127c6 upstream.
Using the clone ioctl (or extent_same ioctl, which calls the same extent cloning function as well) we end up allowing copy an inline extent from the source file into a non-zero offset of the destination file. This is something not expected and that the btrfs code is not prepared to deal with - all inline extents must be at a file offset equals to 0.
For example, the following excerpt of a test case for fstests triggers a crash/BUG_ON() on a write operation after an inline extent is cloned into a non-zero offset:
_scratch_mkfs >>$seqres.full 2>&1
_scratch_mount
# Create our test files. File foo has the same 2K of data at offset 4K
# as file bar has at its offset 0.
$XFS_IO_PROG -f -s -c "pwrite -S 0xaa 0 4K" \
-c "pwrite -S 0xbb 4k 2K" \
-c "pwrite -S 0xcc 8K 4K" \
$SCRATCH_MNT/foo | _filter_xfs_io
# File bar consists of a single inline extent (2K size).
$XFS_IO_PROG -f -s -c "pwrite -S 0xbb 0 2K" \
$SCRATCH_MNT/bar | _filter_xfs_io
# Now call the clone ioctl to clone the extent of file bar into file
# foo at its offset 4K. This made file foo have an inline extent at
# offset 4K, something which the btrfs code can not deal with in future
# IO operations because all inline extents are supposed to start at an
# offset of 0, resulting in all sorts of chaos.
# So here we validate that clone ioctl returns an EOPNOTSUPP, which is
# what it returns for other cases dealing with inlined extents.
$CLONER_PROG -s 0 -d $((4 * 1024)) -l $((2 * 1024)) \
$SCRATCH_MNT/bar $SCRATCH_MNT/foo# Because of the inline extent at offset 4K, the following write made
# the kernel crash with a BUG_ON(). $XFS_IO_PROG -c "pwrite -S 0xdd 6K 2K" $SCRATCH_MNT/foo | _filter_xfs_io
status=0
exit
The stack trace of the BUG_ON() triggered by the last write is:
[152154.035903] ------------[ cut here ]------------ [152154.036424] kernel BUG at mm/page-writeback.c:2286! [152154.036424] invalid opcode: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC [152154.036424] Modules linked in: btrfs dm_flakey dm_mod crc32c_generic xor raid6_pq nfsd auth_rpcgss oid_registry nfs_acl nfs lockd grace fscache sunrpc loop fuse parport_pc acpi_cpu$ [152154.036424] CPU: 2 PID: 17873 Comm: xfs_io Tainted: G W 4.1.0-rc6-btrfs-next-11+ #2 [152154.036424] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.8.1-0-g4adadbd-20150316_085822-nilsson.home.kraxel.org 04/01/2014 [152154.036424] task: ffff880429f70990 ti: ffff880429efc000 task.ti: ffff880429efc000 [152154.036424] RIP: 0010:[<ffffffff8111a9d5>] [<ffffffff8111a9d5>] clear_page_dirty_for_io+0x1e/0x90 [152154.036424] RSP: 0018:ffff880429effc68 EFLAGS: 00010246 [152154.036424] RAX: 0200000000000806 RBX: ffffea0006a6d8f0 RCX: 0000000000000001 [152154.036424] RDX: 0000000000000000 RSI: ffffffff81155d1b RDI: ffffea0006a6d8f0 [152154.036424] RBP: ffff880429effc78 R08: ffff8801ce389fe0 R09: 0000000000000001 [152154.036424] R10: 0000000000002000 R11: ffffffffffffffff R12: ffff8800200dce68 [152154.036424] R13: 0000000000000000 R14: ffff8800200dcc88 R15: ffff8803d5736d80 [152154.036424] FS: 00007fbf119f6700(0000) GS:ffff88043d280000(0000) knlGS:0000000000000000 [152154.036424] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [152154.036424] CR2: 0000000001bdc000 CR3: 00000003aa555000 CR4: 00000000000006e0 [152154.036424] Stack: [152154.036424] ffff8803d5736d80 0000000000000001 ffff880429effcd8 ffffffffa04e97c1 [152154.036424] ffff880429effd68 ffff880429effd60 0000000000000001 ffff8800200dc9c8 [152154.036424] 0000000000000001 ffff8800200dcc88 0000000000000000 0000000000001000 [152154.036424] Call Trace: [152154.036424] [<ffffffffa04e97c1>] lock_and_cleanup_extent_if_need+0x147/0x18d [btrfs] [152154.036424] [<ffffffffa04ea82c>] __btrfs_buffered_write+0x245/0x4c8 [btrfs] [152154.036424] [<ffffffffa04ed14b>] ? btrfs_file_write_iter+0x150/0x3e0 [btrfs] [152154.036424] [<ffffffffa04ed15a>] ? btrfs_file_write_iter+0x15f/0x3e0 [btrfs] [152154.036424] [<ffffffffa04ed2c7>] btrfs_file_write_iter+0x2cc/0x3e0 [btrfs] [152154.036424] [<ffffffff81165a4a>] __vfs_write+0x7c/0xa5 [152154.036424] [<ffffffff81165f89>] vfs_write+0xa0/0xe4 [152154.036424] [<ffffffff81166855>] SyS_pwrite64+0x64/0x82 [152154.036424] [<ffffffff81465197>] system_call_fastpath+0x12/0x6f [152154.036424] Code: 48 89 c7 e8 0f ff ff ff 5b 41 5c 5d c3 0f 1f 44 00 00 55 48 89 e5 41 54 53 48 89 fb e8 ae ef 00 00 49 89 c4 48 8b 03 a8 01 75 02 <0f> 0b 4d 85 e4 74 59 49 8b 3c 2$ [152154.036424] RIP [<ffffffff8111a9d5>] clear_page_dirty_for_io+0x1e/0x90 [152154.036424] RSP <ffff880429effc68> [152154.242621] ---[ end trace e3d3376b23a57041 ]---
Fix this by returning the error EOPNOTSUPP if an attempt to copy an inline extent into a non-zero offset happens, just like what is done for other scenarios that would require copying/splitting inline extents, which were introduced by the following commits:
00fdf13a2e9f ("Btrfs: fix a crash of clone with inline extents's split") 3f9e3df8da3c ("btrfs: replace error code from btrfs_drop_extents")
--- fs/btrfs/ioctl.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
fs/btrfs/ioctl.c +14 -0
@@ -3434,6 +3434,20 @@ process_slot:u64 trim =0 ;u64 aligned_end =0 ; +/* +* Don't copy an inline extent into an offset +* greater than zero. Having an inline extent +* at such an offset results in chaos as btrfs +* isn't prepared for such cases. Just skip +* this case for the same reasons as commented +* at btrfs_ioctl_clone(). +*/ +if (last_dest_end >0 ) { + ret = -EOPNOTSUPP ; +btrfs_end_transaction (trans, root); + goto out; + } +if (off > key.offset) { skip = off - key.offset; new_key.offset += skip;
Greg Kroah-Hartman
maintainerPATCH 202/267 selinux: dont waste ebitmap space when importing NetLabel categories
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Moore <[email protected]>
commit 3324603524925c7727207027d1c15e597412d15e upstream.
At present we don't create efficient ebitmaps when importing NetLabel category bitmaps. This can present a problem when comparing ebitmaps since ebitmap_cmp() is very strict about these things and considers these wasteful ebitmaps not equal when compared to their more efficient counterparts, even if their values are the same. This isn't likely to cause problems on 64-bit systems due to a bit of luck on how NetLabel/CIPSO works and the default ebitmap size, but it can be a problem on 32-bit systems.
This patch fixes this problem by being a bit more intelligent when importing NetLabel category bitmaps by skipping over empty sections which should result in a nice, efficient ebitmap.
--- security/selinux/ss/ebitmap.c | 6 ++++++ 1 file changed, 6 insertions(+)
security/selinux/ss/ebitmap.c +6 -0
@@ -153,6 +153,12 @@ int ebitmap_netlbl_import(struct ebitmapif (offset == (u32)-1 )return 0 ; +/* don't waste ebitmap space if the netlabel bitmap is empty */ +if (bitmap ==0 ) { + offset +=EBITMAP_UNIT_SIZE ; +continue ; + } +if (e_iter ==NULL || offset >= e_iter->startbit +EBITMAP_SIZE ) { e_prev = e_iter;
Greg Kroah-Hartman
maintainerPATCH 203/267 selinux: fix mprotect PROT_EXEC regression caused by mm change
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Smalley <[email protected]>
commit 892e8cac99a71f6254f84fc662068d912e1943bf upstream.
commit 66fc13039422ba7df2d01a8ee0873e4ef965b50b ("mm: shmem_zero_setup skip security check and lockdep conflict with XFS") caused a regression for SELinux by disabling any SELinux checking of mprotect PROT_EXEC on shared anonymous mappings. However, even before that regression, the checking on such mprotect PROT_EXEC calls was inconsistent with the checking on a mmap PROT_EXEC call for a shared anonymous mapping. On a mmap, the security hook is passed a NULL file and knows it is dealing with an anonymous mapping and therefore applies an execmem check and no file checks. On a mprotect, the security hook is passed a vma with a non-NULL vm_file (as this was set from the internally-created shmem file during mmap) and therefore applies the file-based execute check and no execmem check. Since the aforementioned commit now marks the shmem zero inode with the S_PRIVATE flag, the file checks are disabled and we have no checking at all on mprotect PROT_EXEC. Add a test to the mprotect hook logic for such private inodes, and apply an execmem check in that case. This makes the mmap and mprotect checking consistent for shared anonymous mappings, as well as for /dev/zero and ashmem.
--- security/selinux/hooks.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
security/selinux/hooks.c +2 -1
@@ -3288,7 +3288,8 @@ static int file_map_prot_check(struct fiint rc =0 ;if (default_noexec && - (prot &PROT_EXEC ) && (!file || (!shared && (prot &PROT_WRITE )))) { + (prot &PROT_EXEC ) && (!file ||IS_PRIVATE (file_inode (file)) || + (!shared && (prot &PROT_WRITE )))) {/* * We are making executable an anonymous mapping or a * private file mapping that will also be writable.
Greg Kroah-Hartman
maintainerPATCH 204/267 fuse: initialize fc->release before calling it
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miklos Szeredi <[email protected]>
commit 0ad0b3255a08020eaf50e34ef0d6df5bdf5e09ed upstream.
fc->release is called from fuse_conn_put() which was used in the error cleanup before fc->release was initialized.
[Jeremiah Mahler <[email protected]>: assign fc->release after calling fuse_conn_init(fc) instead of before.]
--- fs/fuse/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/fuse/inode.c +1 -1
@@ -1026,6 +1026,7 @@ static int fuse_fill_super(struct super_ goto err_fput;fuse_conn_init (fc); + fc->release = fuse_free_conn; fc->dev = sb->s_dev; fc->sb = sb;
@@ -1040,7 +1041,6 @@ static int fuse_fill_super(struct super_ fc->dont_mask =1 ; sb->s_flags |=MS_POSIXACL ; - fc->release = fuse_free_conn; fc->flags = d.flags; fc->user_id = d.user_id; fc->group_id = d.group_id;
Greg Kroah-Hartman
maintainerPATCH 205/267 crush: fix a bug in tree bucket decode
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilya Dryomov <[email protected]>
commit 82cd003a77173c91b9acad8033fb7931dac8d751 upstream.
struct crush_bucket_tree::num_nodes is u8, so ceph_decode_8_safe() should be used. -Wconversion catches this, but I guess it went unnoticed in all the noise it spews. The actual problem (at least for common crushmaps) isn't the u32 -> u8 truncation though - it's the advancement by 4 bytes instead of 1 in the crushmap buffer.
--- net/ceph/osdmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ceph/osdmap.c +1 -1
@@ -89,7 +89,7 @@ static int crush_decode_tree_bucket(void {int j;dout ("crush_decode_tree_bucket %p to %p\n" , *p, end); -ceph_decode_32_safe (p, end, b->num_nodes, bad); +ceph_decode_8_safe (p, end, b->num_nodes, bad); b->node_weights =kcalloc (b->num_nodes,sizeof (u32),GFP_NOFS );if (b->node_weights ==NULL )return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 207/267 ACPI / PNP: Reserve ACPI resources at the fs_initcall_sync stage
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Rafael J. Wysocki" <[email protected]>
commit 0294112ee3135fbd15eaa70015af8283642dd970 upstream.
This effectively reverts the following three commits:
7bc10388ccdd ACPI / resources: free memory on error in add_region_before() 0f1b414d1907 ACPI / PNP: Avoid conflicting resource reservations b9a5e5e18fbf ACPI / init: Fix the ordering of acpi_reserve_resources()
(commit b9a5e5e18fbf introduced regressions some of which, but not all, were addressed by commit 0f1b414d1907 and commit 7bc10388ccdd was a fixup on top of the latter) and causes ACPI fixed hardware resources to be reserved at the fs_initcall_sync stage of system initialization.
The story is as follows. First, a boot regression was reported due to an apparent resource reservation ordering change after a commit that shouldn't lead to such changes. Investigation led to the conclusion that the problem happened because acpi_reserve_resources() was executed at the device_initcall() stage of system initialization which wasn't strictly ordered with respect to driver initialization (and with respect to the initialization of the pcieport driver in particular), so a random change causing the device initcalls to be run in a different order might break things.
The response to that was to attempt to run acpi_reserve_resources() as soon as we knew that ACPI would be in use (commit b9a5e5e18fbf). However, that turned out to be too early, because it caused resource reservations made by the PNP system driver to fail on at least one system and that failure was addressed by commit 0f1b414d1907.
That fix still turned out to be insufficient, though, because calling acpi_reserve_resources() before the fs_initcall stage of system initialization caused a boot regression to happen on the eCAFE EC-800-H20G/S netbook. That meant that we only could call acpi_reserve_resources() at the fs_initcall initialization stage or later, but then we might just as well call it after the PNP initalization in which case commit 0f1b414d1907 wouldn't be necessary any more.
For this reason, the changes made by commit 0f1b414d1907 are reverted (along with a memory leak fixup on top of that commit), the changes made by commit b9a5e5e18fbf that went too far are reverted too and acpi_reserve_resources() is changed into fs_initcall_sync, which will cause it to be executed after the PNP subsystem initialization (which is an fs_initcall) and before device initcalls (including the pcieport driver initialization) which should avoid the initial issue.
--- drivers/acpi/osl.c | 12 ++- drivers/acpi/resource.c | 162 ------------------------------------------------ drivers/pnp/system.c | 35 ++-------- include/linux/acpi.h | 10 -- 4 files changed, 18 insertions(+), 201 deletions(-)
drivers/acpi/osl.c +9 -3
@@ -175,10 +175,14 @@ static void __init acpi_request_region (if (!addr || !length)return ; -acpi_reserve_region (addr, length, gas->space_id,0 , desc); +/* Resources are never freed */ +if (gas->space_id ==ACPI_ADR_SPACE_SYSTEM_IO ) +request_region (addr, length, desc); +else if (gas->space_id ==ACPI_ADR_SPACE_SYSTEM_MEMORY ) +request_mem_region (addr, length, desc); } -static void __init acpi_reserve_resources (void ) +static int __init acpi_reserve_resources (void ) {acpi_request_region (&acpi_gbl_FADT.xpm1a_event_block, acpi_gbl_FADT.pm1_event_length,"ACPI PM1a_EVT_BLK" );
@@ -207,7 +211,10 @@ static void __init acpi_reserve_resourceif (!(acpi_gbl_FADT.gpe1_block_length &0x1 ))acpi_request_region (&acpi_gbl_FADT.xgpe1_block, acpi_gbl_FADT.gpe1_block_length,"ACPI GPE1_BLK" ); + +return 0 ; } +fs_initcall_sync (acpi_reserve_resources);void acpi_os_printf (const char *fmt, ...) {
@@ -1838,7 +1845,6 @@ acpi_status __init acpi_os_initialize(voacpi_status __init acpi_os_initialize1 (void ) { -acpi_reserve_resources (); kacpid_wq =alloc_workqueue ("kacpid" ,0 ,1 ); kacpi_notify_wq =alloc_workqueue ("kacpi_notify" ,0 ,1 ); kacpi_hotplug_wq =alloc_ordered_workqueue ("kacpi_hotplug" ,0 );
drivers/acpi/resource.c +0 -162
171 lines not on this page · raw message
drivers/pnp/system.c +9 -26
@@ -7,7 +7,6 @@* Bjorn Helgaas <[email protected]> */ -#include <linux/acpi.h> #include <linux/pnp.h> #include <linux/device.h> #include <linux/init.h>
@@ -23,41 +22,25 @@ static const struct pnp_device_id pnp_de {"", 0} }; -#ifdef CONFIG_ACPI -static bool __reserve_range (u64 start,unsigned int length,bool io,char *desc) -{ -u8 space_id = io ?ACPI_ADR_SPACE_SYSTEM_IO :ACPI_ADR_SPACE_SYSTEM_MEMORY ; -return !acpi_reserve_region (start, length, space_id,IORESOURCE_BUSY , desc); -} -#else -static bool __reserve_range (u64 start,unsigned int length,bool io,char *desc) -{ -struct resource *res; - - res = io ?request_region (start, length, desc) : -request_mem_region (start, length, desc); -if (res) { - res->flags &= ~IORESOURCE_BUSY ; -return true; - } -return false; -} -#endif -static void reserve_range (struct pnp_dev *dev,struct resource *r,int port) {char *regionid;const char *pnpid =dev_name (&dev->dev);resource_size_t start = r->start, end = r->end; -bool reserved; +struct resource *res; regionid =kmalloc (16 ,GFP_KERNEL );if (!regionid)return ;snprintf (regionid,16 ,"pnp %s" , pnpid); - reserved =__reserve_range (start, end - start +1 , !!port, regionid); -if (!reserved) +if (port) + res =request_region (start, end - start +1 , regionid); +else + res =request_mem_region (start, end - start +1 , regionid); +if (res) + res->flags &= ~IORESOURCE_BUSY ; +else kfree (regionid);/*
@@ -66,7 +49,7 @@ static void reserve_range(struct pnp_dev* have double reservations. */ dev_info (&dev->dev,"%pR %s reserved\n" , r, - reserved ?"has been" :"could not be" ); + res ?"has been" :"could not be" ); }static void reserve_resources_of_dev (struct pnp_dev *dev)
include/linux/acpi.h +0 -10
@@ -332,9 +332,6 @@ int acpi_check_region(resource_size_t stint acpi_resources_are_enforced (void ); -int acpi_reserve_region (u64 start,unsigned int length,u8 space_id, -unsigned long flags,char *desc); -#ifdef CONFIG_HIBERNATION void __init acpi_no_s4_hw_signature (void );#endif
@@ -530,13 +527,6 @@ static inline int acpi_check_region(resoreturn 0 ; } -static inline int acpi_reserve_region (u64 start,unsigned int length, -u8 space_id,unsigned long flags, -char *desc) -{ -return -ENXIO ; -} -struct acpi_table_header ;static inline int acpi_table_parse (char *id,int (*handler)(struct acpi_table_header *))
Greg Kroah-Hartman
maintainerPATCH 208/267 ACPI / LPSS: Fix up acpi_lpss_create_device()
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Rafael J. Wysocki" <[email protected]>
commit d3e13ff3c1aa2403d9a5f371baac088daeb8f56d upstream.
Fix a return value (which should be a negative error code) and a memory leak (the list allocated by acpi_dev_get_resources() needs to be freed on ioremap() errors too) in acpi_lpss_create_device() introduced by commit 4483d59e29fe 'ACPI / LPSS: check the result of ioremap()'.
--- drivers/acpi/acpi_lpss.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/acpi/acpi_lpss.c +5 -2
@@ -352,13 +352,16 @@ static int acpi_lpss_create_device(struc pdata->mmio_size =resource_size (rentry->res); pdata->mmio_base =ioremap (rentry->res->start, pdata->mmio_size); -if (!pdata->mmio_base) - goto err_out;break ; }acpi_dev_free_resource_list (&resource_list); +if (!pdata->mmio_base) { + ret = -ENOMEM ; + goto err_out; + } + pdata->dev_desc = dev_desc;if (dev_desc->setup)
Greg Kroah-Hartman
maintainerPATCH 209/267 ACPICA: Tables: Enable both 32-bit and 64-bit FACS
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lv Zheng <[email protected]>
commit c04e1fb4396d27f18296db0f914760fa7fe8223a upstream.
ACPICA commit f7b86f35416e3d1f71c3d816ff5075ddd33ed486
The following commit is reported to have broken s2ram on some platforms:
Commit: 0249ed2444d65d65fc3f3f64f398f1ad0b7e54cd
ACPICA: Add option to favor 32-bit FADT addresses.
The platform reports 2 FACS tables (which is not allowed by ACPI specification) and the new 32-bit address favor rule forces OSPMs to use the FACS table reported via FADT's X_FIRMWARE_CTRL field.
The root cause of the reported bug might be one of the followings:
1. BIOS may favor the 64-bit firmware waking vector address when the version of the FACS is greater than 0 and Linux currently only supports resuming from the real mode, so the 64-bit firmware waking vector has never been set and might be invalid to BIOS while the commit enables higher version FACS.
2. BIOS may favor the FACS reported via the "FIRMWARE_CTRL" field in the FADT while the commit doesn't set the firmware waking vector address of the FACS reported by "FIRMWARE_CTRL", it only sets the firware waking vector address of the FACS reported by "X_FIRMWARE_CTRL".
This patch excludes the cases that can trigger the bugs caused by the root cause 2.
There is no handshaking mechanism can be used by OSPM to tell BIOS which FACS is currently used. Thus the FACS reported by "FIRMWARE_CTRL" may still be used by BIOS and the 0 value of the 32-bit firmware waking vector might trigger such failure.
This patch tries to favor 32bit FACS address in another way where both the FACS reported by "FIRMWARE_CTRL" and the FACS reported by "X_FIRMWARE_CTRL" are loaded so that further commit can set firmware waking vector in the both tables to ensure we can exclude the cases that trigger the bugs caused by the root cause 2. The exclusion is split into 2 commits as this commit is also useful for dumping more ACPI tables, it won't get reverted when such exclusion is no longer necessary. Lv Zheng.
--- drivers/acpi/acpica/aclocal.h | 1 + drivers/acpi/acpica/tbfadt.c | 21 +++++++++++++-------- drivers/acpi/acpica/tbutils.c | 34 +++++++++++++++++++++++----------- drivers/acpi/acpica/tbxfload.c | 3 ++- include/acpi/acpixf.h | 9 +++++++++ 5 files changed, 48 insertions(+), 20 deletions(-)
drivers/acpi/acpica/aclocal.h +1 -0
@@ -213,6 +213,7 @@ struct acpi_table_list {#define ACPI_TABLE_INDEX_DSDT (0)#define ACPI_TABLE_INDEX_FACS (1) +#define ACPI_TABLE_INDEX_X_FACS (2)struct acpi_find_context {char *search_for;
drivers/acpi/acpica/tbfadt.c +13 -8
@@ -350,9 +350,18 @@ void acpi_tb_parse_fadt(u32 table_index)/* If Hardware Reduced flag is set, there is no FACS */ if (!acpi_gbl_reduced_hardware) { -acpi_tb_install_fixed_table ((acpi_physical_address ) - acpi_gbl_FADT.Xfacs,ACPI_SIG_FACS , -ACPI_TABLE_INDEX_FACS ); +if (acpi_gbl_FADT.facs) { +acpi_tb_install_fixed_table ((acpi_physical_address ) + acpi_gbl_FADT.facs, +ACPI_SIG_FACS , +ACPI_TABLE_INDEX_FACS ); + } +if (acpi_gbl_FADT.Xfacs) { +acpi_tb_install_fixed_table ((acpi_physical_address ) + acpi_gbl_FADT.Xfacs, +ACPI_SIG_FACS , +ACPI_TABLE_INDEX_X_FACS ); + } } }
@@ -491,13 +500,9 @@ static void acpi_tb_convert_fadt(void) acpi_gbl_FADT.header.length =sizeof (struct acpi_table_fadt );/* -* Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary. +* Expand the 32-bit DSDT addresses to 64-bit as necessary. * Later ACPICA code will always use the X 64-bit field. */ - acpi_gbl_FADT.Xfacs =acpi_tb_select_address ("FACS" , - acpi_gbl_FADT.facs, - acpi_gbl_FADT.Xfacs); - acpi_gbl_FADT.Xdsdt =acpi_tb_select_address ("DSDT" , acpi_gbl_FADT.dsdt, acpi_gbl_FADT.Xdsdt);
drivers/acpi/acpica/tbutils.c +23 -11
@@ -68,7 +68,8 @@ acpi_tb_get_root_table_entry(u8 *table_eacpi_status acpi_tb_initialize_facs (void ) { -acpi_status status; +struct acpi_table_facs *facs32; +struct acpi_table_facs *facs64;/* If Hardware Reduced flag is set, there is no FACS */
@@ -77,11 +78,22 @@ acpi_status acpi_tb_initialize_facs(voidreturn (AE_OK ); } - status =acpi_get_table_by_index (ACPI_TABLE_INDEX_FACS , - ACPI_CAST_INDIRECT_PTR(struct - acpi_table_header, - &acpi_gbl_FACS)); -return (status); + (void )acpi_get_table_by_index (ACPI_TABLE_INDEX_FACS , + ACPI_CAST_INDIRECT_PTR(struct + acpi_table_header, + &facs32)); + (void )acpi_get_table_by_index (ACPI_TABLE_INDEX_X_FACS , + ACPI_CAST_INDIRECT_PTR(struct + acpi_table_header, + &facs64)); + +if (acpi_gbl_use32_bit_facs_addresses) { + acpi_gbl_FACS = facs32 ? facs32 : facs64; + }else { + acpi_gbl_FACS = facs64 ? facs64 : facs32; + } + +return (AE_OK ); }#endif /* !ACPI_REDUCED_HARDWARE */
@@ -101,7 +113,7 @@ acpi_status acpi_tb_initialize_facs(voidu8 acpi_tb_tables_loaded (void ) { -if (acpi_gbl_root_table_list.current_table_count >=3 ) { +if (acpi_gbl_root_table_list.current_table_count >=4 ) {return (TRUE); }
@@ -357,11 +369,11 @@ acpi_status __init acpi_tb_parse_root_ta table_entry =ACPI_ADD_PTR (u8, table,sizeof (struct acpi_table_header ));/* -* First two entries in the table array are reserved for the DSDT -* and FACS, which are not actually present in the RSDT/XSDT - they -* come from the FADT +* First three entries in the table array are reserved for the DSDT +* and 32bit/64bit FACS, which are not actually present in the +* RSDT/XSDT - they come from the FADT */ - acpi_gbl_root_table_list.current_table_count =2 ; + acpi_gbl_root_table_list.current_table_count =3 ;/* Initialize the root table array from the RSDT/XSDT */
drivers/acpi/acpica/tbxfload.c +2 -1
@@ -166,7 +166,8 @@ static acpi_status acpi_tb_load_namespac (void )acpi_ut_acquire_mutex (ACPI_MTX_TABLES );for (i =0 ; i < acpi_gbl_root_table_list.current_table_count; ++i) { - if ((!ACPI_COMPARE_NAME + if (!acpi_gbl_root_table_list.tables[i].address || + (!ACPI_COMPARE_NAME (&(acpi_gbl_root_table_list.tables[i].signature), ACPI_SIG_SSDT) &&
include/acpi/acpixf.h +9 -0
@@ -200,6 +200,15 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_do_not_useACPI_INIT_GLOBAL (u8, acpi_gbl_use32_bit_fadt_addresses, TRUE);/* +* Optionally use 32-bit FACS table addresses. +* It is reported that some platforms fail to resume from system suspending +* if 64-bit FACS table address is selected: +* https://bugzilla.kernel.org/show_bug.cgi?id=74021 +* Default is TRUE, favor the 32-bit addresses. +*/ +ACPI_INIT_GLOBAL (u8, acpi_gbl_use32_bit_facs_addresses, TRUE); + +/* * Optionally truncate I/O addresses to 16 bits. Provides compatibility * with other ACPI implementations. NOTE: During ACPICA initialization, * this value is set to TRUE if any Windows OSI strings have been
Greg Kroah-Hartman
maintainerPATCH 193/267 ARM: dts: mx23: fix iio-hwmon support
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Wahren <[email protected]>
commit e8e94ed6285428ab780cd7b0df4622f71eceb39e upstream.
In order to get iio-hwmon support, the lradc must be declared as an iio provider. So fix this issue by adding the #io-channel-cells property.
--- arch/arm/boot/dts/imx23.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm/boot/dts/imx23.dtsi +1 -0
@@ -435,6 +435,7 @@ interrupts = <36 37 38 39 40 41 42 43 44>; status = "disabled"; clocks = <&clks 26>; + #io-channel-cells = <1>; }; spdif@80054000 {
Greg Kroah-Hartman
maintainerPATCH 211/267 ACPICA: Tables: Enable default 64-bit FADT addresses favor
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lv Zheng <[email protected]>
commit 0ea61381788a37d864f9841b0fe97d40f7058f3b upstream.
ACPICA commit 4da56eeae0749dfe8491285c1e1fad48f6efafd8
The following commit temporarily disables correct 64-bit FADT addresses favor during the period the root cause of the bug is not fixed:
Commit: 85dbd5801f62b66e2aa7826aaefcaebead44c8a6
ACPICA: Tables: Restore old behavor to favor 32-bit FADT addresses.
With enough protections, this patch re-enables 64-bit FADT addresses by default. If regressions are reported against such change, this patch should be bisected and reverted.
Note that 64-bit FACS favor and 64-bit firmware waking vector favor are excluded by this commit in order not to break OSPMs. Lv Zheng.
--- include/acpi/acpixf.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/acpi/acpixf.h +2 -2
@@ -195,9 +195,9 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_do_not_use* address. Although ACPICA adheres to the ACPI specification which * requires the use of the corresponding 64-bit address if it is non-zero, * some machines have been found to have a corrupted non-zero 64-bit -* address. Default is TRUE, favor the 32-bit addresses. +* address. Default is FALSE, do not favor the 32-bit addresses. */ -ACPI_INIT_GLOBAL (u8, acpi_gbl_use32_bit_fadt_addresses, TRUE); +ACPI_INIT_GLOBAL (u8, acpi_gbl_use32_bit_fadt_addresses, FALSE);/* * Optionally use 32-bit FACS table addresses.
Greg Kroah-Hartman
maintainerPATCH 212/267 ACPI / PCI: Fix regressions caused by resource_size_t overflow with 32-bit kernel
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiang Liu <[email protected]>
commit 1fb01ca93a1348a1469b8777326cd7632483de77 upstream.
Zoltan Boszormenyi reported this regression:
"There's a Realtek RTL8111/8168/8411 (PCI ID 10ec:8168, Subsystem ID
1565:230e) network chip on the mainboard. After the r8169 driver loaded the IRQs in the machine went berserk. Keyboard keypressed arrived with considerable latency and duplicated, so no real work was possible. The machine responded to the power button but didn't actually power down. It just stuck at the powering down message. I had to press the power button for 4 seconds to power it down.
The computer is a POS machine with a big battery inside. Because of this, either ACPI or the Realtek chip kept the bad state and after rebooting, the network chip didn't even show up in lspci. Not even the PXE ROM announced itself during boot. I had to disconnect the battery to beat some sense back to the computer.
The regression happens with 4.0.5, 4.1.0-rc8 and 4.1.0-final. 3.18.16 was good."
The regression is caused by commit 593669c2ac0f (x86/PCI/ACPI: Use common ACPI resource interfaces to simplify implementation). Since commit 593669c2ac0f, x86 PCI ACPI host bridge driver validates ACPI resources by first converting an ACPI resource to a 'struct resource' structure and then applying checks against the converted resource structure. The 'start' and 'end' fields in 'struct resource' are defined to be type of resource_size_t, which may be 32 bits or 64 bits depending on CONFIG_PHYS_ADDR_T_64BIT.
This may cause incorrect resource validation results with 32-bit kernels because 64-bit ACPI resource descriptors may get truncated when converting to 32-bit 'start' and 'end' fields in 'struct resource'. It eventually affects PCI resource allocation subsystem and makes some PCI devices and the system behave abnormally due to incorrect resource assignment.
So enhance the ACPI resource parsing interfaces to ignore ACPI resource descriptors with address/offset above 4G when running in 32-bit mode.
With the fix applied, the behavior of the machine was restored to how 3.18.16 worked, i.e. the memory range that is over 4GB is ignored again, and lspci -vvxxx shows that everything is at the same memory window as they were with 3.18.16.
--- drivers/acpi/resource.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-)
drivers/acpi/resource.c +15 -9
@@ -193,6 +193,7 @@ static bool acpi_decode_space(struct resu8 iodec = attr->granularity ==0xfff ?ACPI_DECODE_10 :ACPI_DECODE_16 ;bool wp = addr->info.mem.write_protect;u64 len = attr->address_length; +u64 start, end, offset =0 ;struct resource *res = &win->res;/*
@@ -204,9 +205,6 @@ static bool acpi_decode_space(struct respr_debug ("ACPI: Invalid address space min_addr_fix %d, max_addr_fix %d, len %llx\n" , addr->min_address_fixed, addr->max_address_fixed, len); - res->start = attr->minimum; - res->end = attr->maximum; -/* * For bridges that translate addresses across the bridge, * translation_offset is the offset that must be added to the
@@ -214,12 +212,22 @@ static bool acpi_decode_space(struct res* primary side. Non-bridge devices must list 0 for all Address * Translation offset bits. */ -if (addr->producer_consumer ==ACPI_PRODUCER ) { - res->start += attr->translation_offset; - res->end += attr->translation_offset; - }else if (attr->translation_offset) { +if (addr->producer_consumer ==ACPI_PRODUCER ) + offset = attr->translation_offset; +else if (attr->translation_offset)pr_debug ("ACPI: translation_offset(%lld) is invalid for non-bridge device.\n" , attr->translation_offset); + start = attr->minimum + offset; + end = attr->maximum + offset; + + win->offset = offset; + res->start = start; + res->end = end; +if (sizeof (resource_size_t) <sizeof (u64) && + (offset != win->offset || start != res->start || end != res->end)) { +pr_warn ("acpi resource window ([%#llx-%#llx] ignored, not CPU addressable)\n" , + attr->minimum, attr->maximum); +return false; }switch (addr->resource_type) {
@@ -236,8 +244,6 @@ static bool acpi_decode_space(struct resreturn false; } - win->offset = attr->translation_offset; -if (addr->producer_consumer ==ACPI_PRODUCER ) res->flags |=IORESOURCE_WINDOW ;
Greg Kroah-Hartman
maintainerPATCH 213/267 serial: samsung: only use earlycon for console
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 357d56151976a78d90dc3dfac01777de0ef05212 upstream.
A configuration that enables earlycon but not the core console code causes a link error:
drivers/built-in.o: In function `setup_earlycon':
drivers/tty/serial/earlycon.c:70: undefined reference to `uart_parse_earlycon'
That error can be triggered by the newly added samsung earlycon support, which is missing a 'select' statement.
As suggested by Peter Hurley, solves the problem by moving the 'select SERIAL_EARLYCON' statement to the samsung console driver option, as it is done by all other console drivers.
--- drivers/tty/serial/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/Kconfig +1 -1
@@ -241,7 +241,6 @@ config SERIAL_SAMSUNG tristate "Samsung SoC serial support" depends on PLAT_SAMSUNG || ARCH_EXYNOS select SERIAL_CORE - select SERIAL_EARLYCON help Support for the on-chip UARTs on the Samsung S3C24XX series CPUs, providing /dev/ttySAC0, 1 and 2 (note, some machines may not
@@ -277,6 +276,7 @@ config SERIAL_SAMSUNG_CONSOLE bool "Support for console on Samsung SoC serial port" depends on SERIAL_SAMSUNG=y select SERIAL_CORE_CONSOLE + select SERIAL_EARLYCON help Allow selection of the S3C24XX on-board serial ports for use as an virtual console.
Greg Kroah-Hartman
maintainerPATCH 216/267 PM / clk: Fix clock error check in __pm_clk_add()
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
commit 3fc3a0be0dab352e065d1dad7d3f81953ed0d4bc upstream.
In the final iteration of commit 245bd6f6af8a62a2 ("PM / clock_ops: Add pm_clk_add_clk()"), a refcount increment was added by Grygorii Strashko. However, the accompanying IS_ERR() check operates on the wrong clock pointer, which is always zero at this point, i.e. not an error. This may lead to a NULL pointer dereference later, when __clk_get() tries to dereference an error pointer.
Check the passed clock pointer instead to fix this.
--- drivers/base/power/clock_ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/power/clock_ops.c +1 -1
@@ -93,7 +93,7 @@ static int __pm_clk_add(struct device *dreturn -ENOMEM ; } }else { -if (IS_ERR (ce->clk) || !__clk_get (clk)) { +if (IS_ERR (clk) || !__clk_get (clk)) {kfree (ce);return -ENOENT ; }
Greg Kroah-Hartman
maintainerPATCH 218/267 tty: remove platform_sysrq_reset_seq
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit ffb6e0c9a0572f8e5f8e9337a1b40ac2ec1493a1 upstream.
The platform_sysrq_reset_seq code was intended as a way for an embedded platform to provide its own sysrq sequence at compile time. After over two years, nobody has started using it in an upstream kernel, and the platforms that were interested in it have moved on to devicetree, which can be used to configure the sequence without requiring kernel changes. The method is also incompatible with the way that most architectures build support for multiple platforms into a single kernel.
Now the code is producing warnings when built with gcc-5.1:
drivers/tty/sysrq.c: In function 'sysrq_init':drivers/tty/sysrq.c:959:33: warning: array subscript is above array bounds [-Warray-bounds]
key = platform_sysrq_reset_seq[i];
We could fix this, but it seems unlikely that it will ever be used, so let's just remove the code instead. We still have the option to pass the sequence either in DT, using the kernel command line, or using the /sys/module/sysrq/parameters/reset_seq file.
--- drivers/tty/sysrq.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-)
drivers/tty/sysrq.c +1 -18
@@ -55,9 +55,6 @@static int __read_mostly sysrq_enabled =CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE ;static bool __read_mostly sysrq_always_enabled; -unsigned short platform_sysrq_reset_seq[]__weak = {KEY_RESERVED }; -int sysrq_reset_downtime_ms__weak ; -static bool sysrq_on (void ) {return sysrq_enabled || sysrq_always_enabled;
@@ -569,6 +566,7 @@ void handle_sysrq(int key)EXPORT_SYMBOL (handle_sysrq);#ifdef CONFIG_INPUT +static int sysrq_reset_downtime_ms;/* Simple translation table for the SysRq keys */ static const unsigned char sysrq_xlate[KEY_CNT] =
@@ -949,23 +947,8 @@ static bool sysrq_handler_registered;static inline void sysrq_register_handler (void ) { -unsigned short key;int error; -int i; - -/* First check if a __weak interface was instantiated. */ -for (i =0 ; i <ARRAY_SIZE (sysrq_reset_seq); i++) { - key = platform_sysrq_reset_seq[i]; -if (key ==KEY_RESERVED || key >KEY_MAX ) -break ; - - sysrq_reset_seq[sysrq_reset_seq_len++] = key; - } -/* -* DT configuration takes precedence over anything that would -* have been defined via the __weak interface. -*/ sysrq_of_get_keyreset_config (); error =input_register_handler (&sysrq_handler);
Greg Kroah-Hartman
maintainerPATCH 220/267 PM / sleep: Increase default DPM watchdog timeout to 60
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit fff3b16d2754a061a3549c4307a186423a0128fd upstream.
Many harddisks (mostly WD ones) have firmware problems and take too long, more than 10 seconds, to resume from suspend. And this often exceeds the default DPM watchdog timeout (12 seconds), resulting in a kernel panic out of sudden.
Since most distros just take the default as is, we should give a bit more safer value. This patch increases the default value from 12 seconds to one minute, which has been confirmed to be long enough for such problematic disks.
--- kernel/power/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/power/Kconfig +1 -1
@@ -187,7 +187,7 @@ config DPM_WATCHDOG config DPM_WATCHDOG_TIMEOUT int "Watchdog timeout in seconds" range 1 120 - default 12 + default 60 depends on DPM_WATCHDOG config PM_TRACE
Greg Kroah-Hartman
maintainerPATCH 221/267 firmware: dmi_scan: Only honor end-of-table for 64-bit tables
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean Delvare <[email protected]>
commit 17cd5bd5391e6e7b363d66335e1bc6760ae969b9 upstream.
A 32-bit entry point to a DMI table says how many structures the table contains. The SMBIOS specification explicitly says that end-of-table markers should be ignored if they are not actually at the end of the DMI table. So only honor the end-of-table marker for tables accessed through 64-bit entry points, as they do not specify a structure count.
--- drivers/firmware/dmi_scan.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/firmware/dmi_scan.c +9 -4
@@ -89,9 +89,9 @@ static void dmi_table(u8 *buf,/* * Stop when we have seen all the items the table claimed to have -* (SMBIOS < 3.0 only) OR we reach an end-of-table marker OR we run -* off the end of the table (should never happen but sometimes does -* on bogus implementations.) +* (SMBIOS < 3.0 only) OR we reach an end-of-table marker (SMBIOS +* >= 3.0 only) OR we run off the end of the table (should never +* happen but sometimes does on bogus implementations.) */ while ((!dmi_num || i < dmi_num) && (data - buf +sizeof (struct dmi_header )) <= dmi_len) {
@@ -110,8 +110,13 @@ static void dmi_table(u8 *buf,/* * 7.45 End-of-Table (Type 127) [SMBIOS reference spec v3.0.0] +* For tables behind a 64-bit entry point, we have no item +* count and no exact table length, so stop on end-of-table +* marker. For tables behind a 32-bit entry point, we have +* seen OEM structures behind the end-of-table marker on +* some systems, so don't trust it. */ -if (dm->type ==DMI_ENTRY_END_OF_TABLE ) +if (!dmi_num && dm->type ==DMI_ENTRY_END_OF_TABLE )break ; data +=2 ;
Greg Kroah-Hartman
maintainerPATCH 222/267 compiler-intel: fix wrong compiler barrier() macro
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
commit b86a50c3b5414eafdbee7f34af4a201a4a7817c2 upstream.
Cleanup commit 73679e508201 ("compiler-intel.h: Remove duplicate definition") removed the double definition of __memory_barrier() intrinsics.
However, in doing so, it also removed the preceding #undef barrier by accident, meaning, the actual barrier() macro from compiler-gcc.h with inline asm is still in place as __GNUC__ is provided.
Subsequently, barrier() can never be defined as __memory_barrier() from compiler.h since it already has a definition in place and if we trust the comment in compiler-intel.h, ecc doesn't support gcc specific asm statements.
I don't have an ecc at hand (unsure if that's still used in the field?) and only found this by accident during code review, a revert of that cleanup would be simplest option.
--- include/linux/compiler-intel.h | 2 ++ 1 file changed, 2 insertions(+)
include/linux/compiler-intel.h +2 -0
@@ -13,10 +13,12 @@/* Intel ECC compiler doesn't support gcc specific asm stmts. * It uses intrinsics to do the equivalent things. */ +#undef barrier#undef barrier_data#undef RELOC_HIDE#undef OPTIMIZER_HIDE_VAR +#define barrier () __memory_barrier()#define barrier_data (ptr) barrier()#define RELOC_HIDE (ptr, off) \
Greg Kroah-Hartman
maintainerPATCH 223/267 __bitmap_parselist: fix bug in empty string handling
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Metcalf <[email protected]>
commit 2528a8b8f457d7432552d0e2b6f0f4046bb702f4 upstream.
bitmap_parselist("", &mask, nmaskbits) will erroneously set bit zero in the mask. The same bug is visible in cpumask_parselist() since it is layered on top of the bitmask code, e.g. if you boot with "isolcpus=", you will actually end up with cpu zero isolated.
The bug was introduced in commit 4b060420a596 ("bitmap, irq: add smp_affinity_list interface to /proc/irq") when bitmap_parselist() was generalized to support userspace as well as kernelspace.
--- lib/bitmap.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
lib/bitmap.c +9 -8
@@ -506,12 +506,12 @@ static int __bitmap_parselist(const charunsigned a, b;int c, old_c, totaldigits;const char __user __force *ubuf = (const char __user __force *)buf; -int exp_digit, in_range; +int at_start, in_range; totaldigits = c =0 ;bitmap_zero (maskp, nmaskbits); do { - exp_digit = 1; + at_start = 1; in_range = 0; a = b = 0;
@@ -540,11 +540,10 @@ static int __bitmap_parselist(const charbreak ;if (c =='-' ) { -if (exp_digit || in_range) +if (at_start || in_range)return -EINVAL ; b =0 ; in_range =1 ; - exp_digit =1 ;continue ; }
@@ -554,16 +553,18 @@ static int __bitmap_parselist(const char b = b *10 + (c -'0' );if (!in_range) a = b; - exp_digit =0 ; + at_start =0 ; totaldigits++; }if (!(a <= b))return -EINVAL ;if (b >= nmaskbits)return -ERANGE ; -while (a <= b) { -set_bit (a, maskp); - a++; +if (!at_start) { +while (a <= b) { +set_bit (a, maskp); + a++; + } } }while (buflen && c ==',' );return 0 ;
Greg Kroah-Hartman
maintainerPATCH 224/267 security_syslog() should be called once only
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vasily Averin <[email protected]>
commit d194e5d666225b04c7754471df0948f645b6ab3a upstream.
The final version of commit 637241a900cb ("kmsg: honor dmesg_restrict sysctl on /dev/kmsg") lost few hooks, as result security_syslog() are processed incorrectly:
- open of /dev/kmsg checks syslog access permissions by using check_syslog_permissions() where security_syslog() is not called if dmesg_restrict is set.
- syslog syscall and /proc/kmsg calls do_syslog() where security_syslog can be executed twice (inside check_syslog_permissions() and then directly in do_syslog())
With this patch security_syslog() is called once only in all syslog-related operations regardless of dmesg_restrict value.
--- kernel/printk/printk.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
kernel/printk/printk.c +4 -7
@@ -484,11 +484,11 @@ int check_syslog_permissions(int type, b* already done the capabilities checks at open time. */ if (from_file && type !=SYSLOG_ACTION_OPEN ) -return 0 ; + goto ok;if (syslog_action_restricted (type)) {if (capable (CAP_SYSLOG )) -return 0 ; + goto ok;/* * For historical reasons, accept CAP_SYS_ADMIN too, with * a warning.
@@ -498,10 +498,11 @@ int check_syslog_permissions(int type, b"CAP_SYS_ADMIN but no CAP_SYSLOG " "(deprecated).\n" , current->comm, task_pid_nr(current)); -return 0 ; + goto ok; }return -EPERM ; } +ok:return security_syslog (type); }
@@ -1263,10 +1264,6 @@ int do_syslog(int type, char __user *bufif (error) goto out; - error =security_syslog (type); -if (error) -return error; -switch (type) {case SYSLOG_ACTION_CLOSE :/* Close log */ break ;
Greg Kroah-Hartman
maintainerPATCH 225/267 mac80211: fix the beacon csa counter for mesh and ibss
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chun-Yeow Yeoh <[email protected]>
commit 8df734e865b74d9f273216482a45a38269dc767a upstream.
The csa counter has moved from sdata to beacon/presp but it is not updated accordingly for mesh and ibss. Fix this.
--- net/mac80211/cfg.c | 1 + net/mac80211/ibss.c | 1 + net/mac80211/mesh.c | 1 + 3 files changed, 3 insertions(+)
net/mac80211/cfg.c +1 -0
@@ -3356,6 +3356,7 @@ static int ieee80211_mgmt_tx(struct wiph/* Update CSA counters */ if (sdata->vif.csa_active && (sdata->vif.type ==NL80211_IFTYPE_AP || + sdata->vif.type ==NL80211_IFTYPE_MESH_POINT || sdata->vif.type ==NL80211_IFTYPE_ADHOC ) && params->n_csa_offsets) {int i;
net/mac80211/ibss.c +1 -0
@@ -146,6 +146,7 @@ ieee80211_ibss_build_presp(struct ieee80 csa_settings->chandef.chan->center_freq); presp->csa_counter_offsets[0 ] = (pos - presp->head); *pos++ = csa_settings->count; + presp->csa_current_counter = csa_settings->count; }/* put the remaining rates in WLAN_EID_EXT_SUPP_RATES */
net/mac80211/mesh.c +1 -0
@@ -680,6 +680,7 @@ ieee80211_mesh_build_beacon(struct ieee8 *pos++ =0x0 ; *pos++ =ieee80211_frequency_to_channel ( csa->settings.chandef.chan->center_freq); + bcn->csa_current_counter = csa->settings.count; bcn->csa_counter_offsets[0 ] = hdr_len +6 ; *pos++ = csa->settings.count; *pos++ =WLAN_EID_CHAN_SWITCH_PARAM ;
Greg Kroah-Hartman
maintainerPATCH 226/267 iwlwifi: mvm: fix ROC reference accounting
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eliad Peller <[email protected]>
commit c779273b37bec14c33feeab11c4d457a24bc64e0 upstream.
commit b112889c5af8124 ("iwlwifi: mvm: add Aux ROC request/response flow") added aux ROC flow in addition to the existing ROC flow. While doing it, it moved the ROC reference release to a common work item, which is being called for both the ROC and aux ROC flows.
This resulted in invalid reference accounting, as no reference was taken in case of aux ROC, while a reference was released on completion.
Fix it by adding a reference for the aux ROC as well, and release only the relevant references on completion (according to the set bits).
While at it, convert cancel_work_sync() to flush_work(), in order to make sure the references are being cleaned properly.
--- drivers/net/wireless/iwlwifi/mvm/debugfs.c | 5 +++-- drivers/net/wireless/iwlwifi/mvm/mac80211.c | 2 +- drivers/net/wireless/iwlwifi/mvm/mvm.h | 1 + drivers/net/wireless/iwlwifi/mvm/time-event.c | 15 +++++++++------ 4 files changed, 14 insertions(+), 9 deletions(-)
drivers/net/wireless/iwlwifi/mvm/debugfs.c +3 -2
@@ -6,7 +6,7 @@* GPL LICENSE SUMMARY * * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. -* Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH +* Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * * This program is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as
@@ -32,7 +32,7 @@* BSD LICENSE * * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. -* Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH +* Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * All rights reserved. * * Redistribution and use in source and binary forms, with or without
@@ -1356,6 +1356,7 @@ static ssize_t iwl_dbgfs_d0i3_refs_read(PRINT_MVM_REF (IWL_MVM_REF_UCODE_DOWN );PRINT_MVM_REF (IWL_MVM_REF_SCAN );PRINT_MVM_REF (IWL_MVM_REF_ROC ); +PRINT_MVM_REF (IWL_MVM_REF_ROC_AUX );PRINT_MVM_REF (IWL_MVM_REF_P2P_CLIENT );PRINT_MVM_REF (IWL_MVM_REF_AP_IBSS );PRINT_MVM_REF (IWL_MVM_REF_USER );
drivers/net/wireless/iwlwifi/mvm/mac80211.c +1 -1
@@ -1404,7 +1404,7 @@ void __iwl_mvm_mac_stop(struct iwl_mvm ** The work item could be running or queued if the * ROC time event stops just as we get here. */ -cancel_work_sync (&mvm->roc_done_wk); +flush_work (&mvm->roc_done_wk);iwl_trans_stop_device (mvm->trans);
drivers/net/wireless/iwlwifi/mvm/mvm.h +1 -0
@@ -275,6 +275,7 @@ enum iwl_mvm_ref_type {IWL_MVM_REF_UCODE_DOWN ,IWL_MVM_REF_SCAN ,IWL_MVM_REF_ROC , +IWL_MVM_REF_ROC_AUX ,IWL_MVM_REF_P2P_CLIENT ,IWL_MVM_REF_AP_IBSS , IWL_MVM_REF_USER,
drivers/net/wireless/iwlwifi/mvm/time-event.c +9 -6
@@ -6,7 +6,7 @@* GPL LICENSE SUMMARY * * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. -* Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH +* Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * * This program is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as
@@ -32,7 +32,7 @@* BSD LICENSE * * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. -* Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH +* Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * All rights reserved. * * Redistribution and use in source and binary forms, with or without
@@ -108,12 +108,14 @@ void iwl_mvm_roc_done_wk(struct work_str* in the case that the time event actually completed in the firmware * (which is handled in iwl_mvm_te_handle_notif). */ -if (test_and_clear_bit (IWL_MVM_STATUS_ROC_RUNNING , &mvm->status)) +if (test_and_clear_bit (IWL_MVM_STATUS_ROC_RUNNING , &mvm->status)) { queues |=BIT (IWL_MVM_OFFCHANNEL_QUEUE ); -if (test_and_clear_bit (IWL_MVM_STATUS_ROC_AUX_RUNNING , &mvm->status)) +iwl_mvm_unref (mvm,IWL_MVM_REF_ROC ); + } +if (test_and_clear_bit (IWL_MVM_STATUS_ROC_AUX_RUNNING , &mvm->status)) { queues |=BIT (mvm->aux_queue); - -iwl_mvm_unref (mvm,IWL_MVM_REF_ROC ); +iwl_mvm_unref (mvm,IWL_MVM_REF_ROC_AUX ); + }synchronize_net ();
@@ -393,6 +395,7 @@ static int iwl_mvm_aux_roc_te_handle_not }else if (le32_to_cpu (notif->action) ==TE_V2_NOTIF_HOST_EVENT_START ) {set_bit (IWL_MVM_STATUS_ROC_AUX_RUNNING , &mvm->status); te_data->running = true; +iwl_mvm_ref (mvm,IWL_MVM_REF_ROC_AUX );ieee80211_ready_on_channel (mvm->hw);/* Start TE */ }else { IWL_DEBUG_TE(mvm,
Greg Kroah-Hartman
maintainerPATCH 228/267 mac80211: prevent possible crypto tx tailroom corruption
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Kazior <[email protected]>
commit ab499db80fcf07c18e4053f91a619500f663e90e upstream.
There was a possible race between ieee80211_reconfig() and ieee80211_delayed_tailroom_dec(). This could result in inability to transmit data if driver crashed during roaming or rekeying and subsequent skbs with insufficient tailroom appeared.
This race was probably never seen in the wild because a device driver would have to crash AND recover within 0.5s which is very unlikely.
I was able to prove this race exists after changing the delay to 10s locally and crashing ath10k via debugfs immediately after GTK rekeying. In case of ath10k the counter went below
0. This was harmless but other drivers which actually require tailroom (e.g. for WEP ICV or MMIC) could end up with the counter at 0 instead of >0 and introduce insufficient skb tailroom failures because mac80211 would not resize skbs appropriately anymore.
--- net/mac80211/main.c | 3 +++ 1 file changed, 3 insertions(+)
net/mac80211/main.c +3 -0
@@ -249,6 +249,7 @@ static void ieee80211_restart_work(struc {struct ieee80211_local *local = container_of(work, struct ieee80211_local, restart_work); +struct ieee80211_sub_if_data *sdata;/* wait for scan work complete */ flush_workqueue (local->workqueue);
@@ -257,6 +258,8 @@ static void ieee80211_restart_work(struc "%s called with hardware scan in progress\n", __func__);rtnl_lock (); +list_for_each_entry (sdata, &local->interfaces, list) +flush_delayed_work (&sdata->dec_tailroom_needed_wk);ieee80211_scan_cancel (local);ieee80211_reconfig (local);rtnl_unlock ();
Greg Kroah-Hartman
maintainerPATCH 229/267 e1000e: Cleanup handling of VLAN_HLEN as a part of max frame size
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Duyck <[email protected]>
commit 8084b86dcfbc4b4822868c1dbdb429b5c08154e2 upstream.
When the VLAN_HLEN was added to the calculation for the maximum frame size there seems to have been a number of issues added to the driver.
The first issue is that in some cases the maximum frame size for a device never really reached the actual maximum frame size as the VLAN header length was not included the calculation for that value. As a result some parts only supported a maximum frame size of either 1496 in the case of parts that didn't support jumbo frames, and 8996 in the case of the parts that do.
The second issue is the fact that there were several checks that weren't updated so as a result setting an MTU of 1500 was treated as enabling jumbo frames as the calculated value was 1522 instead of 1518. I have addressed those by replacing ETH_FRAME_LEN with VLAN_ETH_FRAME_LEN where appropriate.
The final issue was the fact that lowering the MTU below 1500 would cause the driver to allocate 2K buffers for the rings. This is an old issue that was fixed several years ago in igb/ixgbe and I am addressing now by just replacing == with a <= so that we always just round up to 1522 for anything that isn't a jumbo frame.
--- drivers/net/ethernet/intel/e1000e/82571.c | 2 +- drivers/net/ethernet/intel/e1000e/ich8lan.c | 10 +++++----- drivers/net/ethernet/intel/e1000e/netdev.c | 18 ++++++++---------- 3 files changed, 14 insertions(+), 16 deletions(-)
drivers/net/ethernet/intel/e1000e/82571.c +1 -1
@@ -2010,7 +2010,7 @@ const struct e1000_info e1000_82573_info .flags2 = FLAG2_DISABLE_ASPM_L1 | FLAG2_DISABLE_ASPM_L0S, .pba = 20, - .max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN, + .max_hw_frame_size = VLAN_ETH_FRAME_LEN + ETH_FCS_LEN, .get_variants = e1000_get_variants_82571, .mac_ops = &e82571_mac_ops, .phy_ops = &e82_phy_ops_m88,
drivers/net/ethernet/intel/e1000e/ich8lan.c +5 -5
@@ -1563,7 +1563,7 @@ static s32 e1000_get_variants_ich8lan(st ((adapter->hw.mac.type >= e1000_pch2lan) && (!(er32(CTRL_EXT) & E1000_CTRL_EXT_LSECCK)))) { adapter->flags &= ~FLAG_HAS_JUMBO_FRAMES ; - adapter->max_hw_frame_size =ETH_FRAME_LEN +ETH_FCS_LEN ; + adapter->max_hw_frame_size =VLAN_ETH_FRAME_LEN +ETH_FCS_LEN ; hw->mac.ops.blink_led =NULL ; }
@@ -5681,7 +5681,7 @@ const struct e1000_info e1000_ich8_info | FLAG_HAS_FLASH | FLAG_APME_IN_WUC, .pba = 8, - .max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN, + .max_hw_frame_size = VLAN_ETH_FRAME_LEN + ETH_FCS_LEN, .get_variants = e1000_get_variants_ich8lan, .mac_ops = &ich8_mac_ops, .phy_ops = &ich8_phy_ops,
@@ -5754,7 +5754,7 @@ const struct e1000_info e1000_pch2_info .flags2 = FLAG2_HAS_PHY_STATS | FLAG2_HAS_EEE, .pba = 26, - .max_hw_frame_size = 9018, + .max_hw_frame_size = 9022, .get_variants = e1000_get_variants_ich8lan, .mac_ops = &ich8_mac_ops, .phy_ops = &ich8_phy_ops,
@@ -5774,7 +5774,7 @@ const struct e1000_info e1000_pch_lpt_in .flags2 = FLAG2_HAS_PHY_STATS | FLAG2_HAS_EEE, .pba = 26, - .max_hw_frame_size = 9018, + .max_hw_frame_size = 9022, .get_variants = e1000_get_variants_ich8lan, .mac_ops = &ich8_mac_ops, .phy_ops = &ich8_phy_ops,
@@ -5794,7 +5794,7 @@ const struct e1000_info e1000_pch_spt_in .flags2 = FLAG2_HAS_PHY_STATS | FLAG2_HAS_EEE, .pba = 26, - .max_hw_frame_size = 9018, + .max_hw_frame_size = 9022, .get_variants = e1000_get_variants_ich8lan, .mac_ops = &ich8_mac_ops, .phy_ops = &ich8_phy_ops,
drivers/net/ethernet/intel/e1000e/netdev.c +8 -10
@@ -3807,7 +3807,7 @@ void e1000e_reset(struct e1000_adapter */* reset Packet Buffer Allocation to default */ ew32 (PBA , pba); -if (adapter->max_frame_size >ETH_FRAME_LEN +ETH_FCS_LEN ) { +if (adapter->max_frame_size > (VLAN_ETH_FRAME_LEN +ETH_FCS_LEN )) {/* To maintain wire speed transmits, the Tx FIFO should be * large enough to accommodate two full transmit packets, * rounded up to the next 1KB and expressed in KB. Likewise,
@@ -4196,9 +4196,9 @@ static int e1000_sw_init(struct e1000_ad {struct net_device *netdev = adapter->netdev; - adapter->rx_buffer_len =ETH_FRAME_LEN +VLAN_HLEN +ETH_FCS_LEN ; + adapter->rx_buffer_len =VLAN_ETH_FRAME_LEN +ETH_FCS_LEN ; adapter->rx_ps_bsize0 =128 ; - adapter->max_frame_size = netdev->mtu +ETH_HLEN +ETH_FCS_LEN ; + adapter->max_frame_size = netdev->mtu +VLAN_ETH_HLEN +ETH_FCS_LEN ; adapter->min_frame_size =ETH_ZLEN +ETH_FCS_LEN ; adapter->tx_ring_count =E1000_DEFAULT_TXD ; adapter->rx_ring_count =E1000_DEFAULT_RXD ;
@@ -5781,17 +5781,17 @@ struct rtnl_link_stats64 *e1000e_get_stastatic int e1000_change_mtu (struct net_device *netdev,int new_mtu) {struct e1000_adapter *adapter =netdev_priv (netdev); -int max_frame = new_mtu +VLAN_HLEN +ETH_HLEN +ETH_FCS_LEN ; +int max_frame = new_mtu +VLAN_ETH_HLEN +ETH_FCS_LEN ;/* Jumbo frame support */ -if ((max_frame >ETH_FRAME_LEN +ETH_FCS_LEN ) && +if ((max_frame > (VLAN_ETH_FRAME_LEN +ETH_FCS_LEN )) && !(adapter->flags &FLAG_HAS_JUMBO_FRAMES )) {e_err ("Jumbo Frames not supported.\n" );return -EINVAL ; }/* Supported frame sizes */ -if ((new_mtu <ETH_ZLEN +ETH_FCS_LEN +VLAN_HLEN ) || +if ((new_mtu < (VLAN_ETH_ZLEN +ETH_FCS_LEN )) || (max_frame > adapter->max_hw_frame_size)) {e_err ("Unsupported MTU setting\n" );return -EINVAL ;
@@ -5831,10 +5831,8 @@ static int e1000_change_mtu(struct net_d adapter->rx_buffer_len =4096 ;/* adjust allocation if LPE protects us, and we aren't using SBP */ -if ((max_frame ==ETH_FRAME_LEN +ETH_FCS_LEN ) || - (max_frame ==ETH_FRAME_LEN +VLAN_HLEN +ETH_FCS_LEN )) - adapter->rx_buffer_len =ETH_FRAME_LEN +VLAN_HLEN - +ETH_FCS_LEN ; +if (max_frame <= (VLAN_ETH_FRAME_LEN +ETH_FCS_LEN )) + adapter->rx_buffer_len =VLAN_ETH_FRAME_LEN +ETH_FCS_LEN ;if (netif_running (netdev))e1000e_up (adapter);
Greg Kroah-Hartman
maintainerPATCH 231/267 ideapad_laptop: Lenovo G50-30 fix rfkill reports wireless blocked
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Tunin <[email protected]>
commit 4fa9dabcffc8e16601307d3d56b58c68d9716ba4 upstream.
Lenovo G30-50 does not have a hardware wireless switch and wireless is always blocked.
--- drivers/platform/x86/ideapad-laptop.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/platform/x86/ideapad-laptop.c +7 -0
@@ -837,6 +837,13 @@ static const struct dmi_system_id no_hw_ }, }, { + .ident = "Lenovo G50-30", + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo G50-30"), + }, + }, + { .ident ="Lenovo Yoga 2 11 / 13 / Pro" , .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
Greg Kroah-Hartman
maintainerPATCH 233/267 of/address: use atomic allocation in pci_register_io_range()
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jingoo Han <[email protected]>
commit 294240ffe784e951dc2ef070da04fa31ef6db3a0 upstream.
When kzalloc() is called under spin_lock(), GFP_ATOMIC should be used to avoid sleeping allocation.
The call tree is:
of_pci_range_to_resource()
--> pci_register_io_range() <-- takes spin_lock(&io_range_lock);
--> kzalloc()--- drivers/of/address.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/of/address.c +1 -1
@@ -712,7 +712,7 @@ int __weak pci_register_io_range(phys_ad }/* add the range to the list */ - range =kzalloc (sizeof (*range),GFP_KERNEL ); + range =kzalloc (sizeof (*range),GFP_ATOMIC );if (!range) { err = -ENOMEM ; goto end_register;
Greg Kroah-Hartman
maintainerPATCH 236/267 of: return NUMA_NO_NODE from fallback of_node_to_nid()
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Khlebnikov <[email protected]>
commit c8fff7bc5bba6bd59cad40441c189c4efe7190f6 upstream.
Node 0 might be offline as well as any other numa node, in this case kernel cannot handle memory allocation and crashes.
--- drivers/of/base.c | 2 +- include/linux/of.h | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/of/base.c +1 -1
@@ -89,7 +89,7 @@ EXPORT_SYMBOL(of_n_size_cells);#ifdef CONFIG_NUMA int __weak of_node_to_nid (struct device_node *np) { -return numa_node_id (); +return NUMA_NO_NODE ; }#endif
include/linux/of.h +4 -1
@@ -673,7 +673,10 @@ static inline void of_property_clear_fla#if defined(CONFIG_OF ) && defined(CONFIG_NUMA )extern int of_node_to_nid (struct device_node *np);#else -static inline int of_node_to_nid (struct device_node *device) {return 0 ; } +static inline int of_node_to_nid (struct device_node *device) +{ +return NUMA_NO_NODE ; +}#endif static inline struct device_node *of_find_matching_node(
Greg Kroah-Hartman
maintainerPATCH 197/267 Btrfs: fix race between caching kthread and returning inode to inode cache
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit ae9d8f17118551bedd797406a6768b87c2146234 upstream.
While the inode cache caching kthread is calling btrfs_unpin_free_ino(), we could have a concurrent call to btrfs_return_ino() that adds a new entry to the root's free space cache of pinned inodes. This concurrent call does not acquire the fs_info->commit_root_sem before adding a new entry if the caching state is BTRFS_CACHE_FINISHED, which is a problem because the caching kthread calls btrfs_unpin_free_ino() after setting the caching state to BTRFS_CACHE_FINISHED and therefore races with the task calling btrfs_return_ino(), which is adding a new entry, while the former (caching kthread) is navigating the cache's rbtree, removing and freeing nodes from the cache's rbtree without acquiring the spinlock that protects the rbtree.
This race resulted in memory corruption due to double free of struct btrfs_free_space objects because both tasks can end up doing freeing the same objects. Note that adding a new entry can result in merging it with other entries in the cache, in which case those entries are freed. This is particularly important as btrfs_free_space structures are also used for the block group free space caches.
This memory corruption can be detected by a debugging kernel, which reports it with the following trace:
[132408.501148] slab error in verify_redzone_free(): cache `btrfs_free_space': double free detected [132408.505075] CPU: 15 PID: 12248 Comm: btrfs-ino-cache Tainted: G W 4.1.0-rc5-btrfs-next-10+ #1 [132408.505075] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.8.1-0-g4adadbd-20150316_085822-nilsson.home.kraxel.org 04/01/2014 [132408.505075] ffff880023e7d320 ffff880163d73cd8 ffffffff8145eec7 ffffffff81095dce [132408.505075] ffff880009735d40 ffff880163d73ce8 ffffffff81154e1e ffff880163d73d68 [132408.505075] ffffffff81155733 ffffffffa054a95a ffff8801b6099f00 ffffffffa0505b5f [132408.505075] Call Trace: [132408.505075] [<ffffffff8145eec7>] dump_stack+0x4f/0x7b [132408.505075] [<ffffffff81095dce>] ? console_unlock+0x356/0x3a2 [132408.505075] [<ffffffff81154e1e>] __slab_error.isra.28+0x25/0x36 [132408.505075] [<ffffffff81155733>] __cache_free+0xe2/0x4b6 [132408.505075] [<ffffffffa054a95a>] ? __btrfs_add_free_space+0x2f0/0x343 [btrfs] [132408.505075] [<ffffffffa0505b5f>] ? btrfs_unpin_free_ino+0x8e/0x99 [btrfs] [132408.505075] [<ffffffff810f3b30>] ? time_hardirqs_off+0x15/0x28 [132408.505075] [<ffffffff81084d42>] ? trace_hardirqs_off+0xd/0xf [132408.505075] [<ffffffff811563a1>] ? kfree+0xb6/0x14e [132408.505075] [<ffffffff811563d0>] kfree+0xe5/0x14e [132408.505075] [<ffffffffa0505b5f>] btrfs_unpin_free_ino+0x8e/0x99 [btrfs] [132408.505075] [<ffffffffa0505e08>] caching_kthread+0x29e/0x2d9 [btrfs] [132408.505075] [<ffffffffa0505b6a>] ? btrfs_unpin_free_ino+0x99/0x99 [btrfs] [132408.505075] [<ffffffff8106698f>] kthread+0xef/0xf7 [132408.505075] [<ffffffff810f3b08>] ? time_hardirqs_on+0x15/0x28 [132408.505075] [<ffffffff810668a0>] ? __kthread_parkme+0xad/0xad [132408.505075] [<ffffffff814653d2>] ret_from_fork+0x42/0x70 [132408.505075] [<ffffffff810668a0>] ? __kthread_parkme+0xad/0xad [132408.505075] ffff880023e7d320: redzone 1:0x9f911029d74e35b, redzone 2:0x9f911029d74e35b. [132409.501654] slab: double free detected in cache 'btrfs_free_space', objp ffff880023e7d320 [132409.503355] ------------[ cut here ]------------ [132409.504241] kernel BUG at mm/slab.c:2571!
Therefore fix this by having btrfs_unpin_free_ino() acquire the lock that protects the rbtree while doing the searches and removing entries.
--- fs/btrfs/inode-map.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
fs/btrfs/inode-map.c +11 -4
@@ -246,6 +246,7 @@ void btrfs_unpin_free_ino(struct btrfs_r {struct btrfs_free_space_ctl *ctl = root->free_ino_ctl;struct rb_root *rbroot = &root->free_ino_pinned->free_space_offset; +spinlock_t *rbroot_lock = &root->free_ino_pinned->tree_lock;struct btrfs_free_space *info;struct rb_node *n;u64 count;
@@ -254,23 +255,29 @@ void btrfs_unpin_free_ino(struct btrfs_rreturn ;while (1 ) { +bool add_to_ctl = true; + +spin_lock (rbroot_lock); n =rb_first (rbroot); -if (!n) +if (!n) { +spin_unlock (rbroot_lock);break ; + } info = rb_entry(n, struct btrfs_free_space, offset_index);BUG_ON (info->bitmap);/* Logic error */ if (info->offset > root->ino_cache_progress) - goto free; + add_to_ctl = false;else if (info->offset + info->bytes > root->ino_cache_progress) count = root->ino_cache_progress - info->offset +1 ;else count = info->bytes; -__btrfs_add_free_space (ctl, info->offset, count); -free:rb_erase (&info->offset_index, rbroot); +spin_unlock (rbroot_lock); +if (add_to_ctl) +__btrfs_add_free_space (ctl, info->offset, count);kmem_cache_free (btrfs_free_space_cachep, info); } }
Greg Kroah-Hartman
maintainerPATCH 198/267 Btrfs: fix fsync data loss after append write
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit e4545de5b035c7debb73d260c78377dbb69cbfb5 upstream.
If we do an append write to a file (which increases its inode's i_size) that does not have the flag BTRFS_INODE_NEEDS_FULL_SYNC set in its inode, and the previous transaction added a new hard link to the file, which sets the flag BTRFS_INODE_COPY_EVERYTHING in the file's inode, and then fsync the file, the inode's new i_size isn't logged. This has the consequence that after the fsync log is replayed, the file size remains what it was before the append write operation, which means users/applications will not be able to read the data that was successsfully fsync'ed before.
This happens because neither the inode item nor the delayed inode get their i_size updated when the append write is made - doing so would require starting a transaction in the buffered write path, something that we do not do intentionally for performance reasons.
Fix this by making sure that when the flag BTRFS_INODE_COPY_EVERYTHING is set the inode is logged with its current i_size (log the in-memory inode into the log tree).
This issue is not a recent regression and is easy to reproduce with the following test case for fstests:
seq=basename $0
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"
here=pwd
tmp=/tmp/$$
status=1 # failure is the default!
_cleanup()
{
_cleanup_flakey
rm -f $tmp.*
}
trap "_cleanup; exit \$status" 0 1 2 3 15# get standard environment, filters and checks . ./common/rc . ./common/filter . ./common/dmflakey
# real QA test starts here _supported_fs generic _supported_os Linux _need_to_be_root _require_scratch _require_dm_flakey _require_metadata_journaling $SCRATCH_DEV
_crash_and_mount()
{
# Simulate a crash/power loss.
_load_flakey_table $FLAKEY_DROP_WRITES
_unmount_flakey
# Allow writes again and mount. This makes the fs replay its fsync log.
_load_flakey_table $FLAKEY_ALLOW_WRITES
_mount_flakey
}rm -f $seqres.full
_scratch_mkfs >> $seqres.full 2>&1
_init_flakey
_mount_flakey
# Create the test file with some initial data and then fsync it.
# The fsync here is only needed to trigger the issue in btrfs, as it causes the
# the flag BTRFS_INODE_NEEDS_FULL_SYNC to be removed from the btrfs inode.
$XFS_IO_PROG -f -c "pwrite -S 0xaa 0 32k" \
-c "fsync" \
$SCRATCH_MNT/foo | _filter_xfs_io
sync # Add a hard link to our file.
# On btrfs this sets the flag BTRFS_INODE_COPY_EVERYTHING on the btrfs inode,
# which is a necessary condition to trigger the issue. ln $SCRATCH_MNT/foo $SCRATCH_MNT/bar
# Sync the filesystem to force a commit of the current btrfs transaction, this
# is a necessary condition to trigger the bug on btrfs. sync
# Now append more data to our file, increasing its size, and fsync the file.
# In btrfs because the inode flag BTRFS_INODE_COPY_EVERYTHING was set and the
# write path did not update the inode item in the btree nor the delayed inode
# item (in memory struture) in the current transaction (created by the fsync
# handler), the fsync did not record the inode's new i_size in the fsync
# log/journal. This made the data unavailable after the fsync log/journal is
# replayed.
$XFS_IO_PROG -c "pwrite -S 0xbb 32K 32K" \
-c "fsync" \
$SCRATCH_MNT/foo | _filter_xfs_ioecho "File content after fsync and before crash:" od -t x1 $SCRATCH_MNT/foo
_crash_and_mount
echo "File content after crash and log replay:"
od -t x1 $SCRATCH_MNT/foo
status=0
exit
The expected file output before and after the crash/power failure expects the appended data to be available, which is:
0000000 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa *
0100000 bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb *
0200000
--- fs/btrfs/tree-log.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
fs/btrfs/tree-log.c +9 -5
@@ -4161,6 +4161,7 @@ static int btrfs_log_inode(struct btrfs_u64 ino =btrfs_ino (inode);struct extent_map_tree *em_tree = &BTRFS_I (inode)->extent_tree;u64 logged_isize =0 ; +bool need_log_inode_item = true; path =btrfs_alloc_path ();if (!path)
@@ -4269,11 +4270,6 @@ static int btrfs_log_inode(struct btrfs_ }else {if (inode_only ==LOG_INODE_ALL ) fast_search = true; - ret =log_inode_item (trans, log, dst_path, inode); -if (ret) { - err = ret; - goto out_unlock; - } goto log_extents; }
@@ -4296,6 +4292,9 @@ again:if (min_key.type > max_key.type)break ; +if (min_key.type ==BTRFS_INODE_ITEM_KEY ) + need_log_inode_item = false; + src = path->nodes[0 ];if (ins_nr && ins_start_slot + ins_nr == path->slots[0 ]) { ins_nr++;
@@ -4366,6 +4365,11 @@ next_slot: log_extents:btrfs_release_path (path);btrfs_release_path (dst_path); +if (need_log_inode_item) { + err =log_inode_item (trans, log, dst_path, inode); +if (err) + goto out_unlock; + }if (fast_search) {/* * Some ordered extents started by fsync might have completed
Greg Kroah-Hartman
maintainerPATCH 191/267 hwmon: (mcp3021) Fix broken output scaling
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Stevens, Nick" <[email protected]>
commit 347d7e45bd09ce09cbc30d5cea9de377eb22f55c upstream.
The mcp3021 scaling code is dividing the VDD (full-scale) value in millivolts by the A2D resolution to obtain the scaling factor. When VDD is 3300mV (the standard value) and the resolution is 12-bit (4096 divisions), the result is a scale factor of 3300/4096, which is always one. Effectively, the raw A2D reading is always being returned because no scaling is applied.
This patch fixes the issue and simplifies the register-to-volts calculation, removing the unneeded "output_scale" struct member.
--- drivers/hwmon/mcp3021.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/hwmon/mcp3021.c +1 -13
@@ -31,14 +31,11 @@/* output format */ #define MCP3021_SAR_SHIFT 2#define MCP3021_SAR_MASK 0x3ff -#define MCP3021_OUTPUT_RES 10/* 10-bit resolution */ -#define MCP3021_OUTPUT_SCALE 4#define MCP3221_SAR_SHIFT 0#define MCP3221_SAR_MASK 0xfff#define MCP3221_OUTPUT_RES 12/* 12-bit resolution */ -#define MCP3221_OUTPUT_SCALE 1enum chips { mcp3021,
@@ -54,7 +51,6 @@ struct mcp3021_data {u16 sar_shift;u16 sar_mask;u8 output_res; -u8 output_scale; };static int mcp3021_read16 (struct i2c_client *client)
@@ -84,13 +80,7 @@ static int mcp3021_read16(struct i2c_clistatic inline u16 volts_from_reg (struct mcp3021_data *data,u16 val) { -if (val ==0 ) -return 0 ; - - val = val * data->output_scale - data->output_scale /2 ; - -return val *DIV_ROUND_CLOSEST (data->vdd, - (1 << data->output_res) * data->output_scale); +return DIV_ROUND_CLOSEST (data->vdd * val,1 << data->output_res); } static ssize_t show_in_input(struct device *dev, struct device_attribute *attr,
@@ -132,14 +122,12 @@ static int mcp3021_probe(struct i2c_clie data->sar_shift =MCP3021_SAR_SHIFT ; data->sar_mask =MCP3021_SAR_MASK ; data->output_res =MCP3021_OUTPUT_RES ; - data->output_scale =MCP3021_OUTPUT_SCALE ;break ;case mcp3221: data->sar_shift =MCP3221_SAR_SHIFT ; data->sar_mask =MCP3221_SAR_MASK ; data->output_res =MCP3221_OUTPUT_RES ; - data->output_scale =MCP3221_OUTPUT_SCALE ;break ; }
Greg Kroah-Hartman
maintainerPATCH 199/267 Btrfs: fix memory leak in the extent_same ioctl
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit 497b4050e0eacd4c746dd396d14916b1e669849d upstream.
We were allocating memory with memdup_user() but we were never releasing that memory. This affected pretty much every call to the ioctl, whether it deduplicated extents or not.
This issue was reported on IRC by Julian Taylor and on the mailing list by Marcel Ritter, credit goes to them for finding the issue.
--- fs/btrfs/ioctl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/btrfs/ioctl.c +3 -1
@@ -2938,7 +2938,7 @@ out_unlock:static long btrfs_ioctl_file_extent_same (struct file *file,struct btrfs_ioctl_same_args __user *argp) { -struct btrfs_ioctl_same_args *same; +struct btrfs_ioctl_same_args *same =NULL ;struct btrfs_ioctl_same_extent_info *info;struct inode *src =file_inode (file);u64 off;
@@ -2968,6 +2968,7 @@ static long btrfs_ioctl_file_extent_sameif (IS_ERR (same)) { ret =PTR_ERR (same); + same =NULL ; goto out; }
@@ -3038,6 +3039,7 @@ static long btrfs_ioctl_file_extent_same out:mnt_drop_write_file (file); +kfree (same);return ret; }
Greg Kroah-Hartman
maintainerPATCH 200/267 Btrfs: fix list transaction->pending_ordered corruption
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit d3efe08400317888f559bbedf0e42cd31575d0ef upstream.
When we call btrfs_commit_transaction(), we splice the list "ordered" of our transaction handle into the transaction's "pending_ordered" list, but we don't re-initialize the "ordered" list of our transaction handle, this means it still points to the same elements it used to before the splice. Then we check if the current transaction's state is
Quoted 1 line
=
TRANS_STATE_COMMIT_STARTand if it is we end up calling
btrfs_end_transaction() which simply splices again the "ordered" list of our handle into the transaction's "pending_ordered" list, leaving multiple pointers to the same ordered extents which results in list corruption when we are iterating, removing and freeing ordered extents at btrfs_wait_pending_ordered(), resulting in access to dangling pointers / use-after-free issues.
Similarly, btrfs_end_transaction() can end up in some cases calling btrfs_commit_transaction(), and both did a list splice of the transaction handle's "ordered" list into the transaction's "pending_ordered" without re-initializing the handle's "ordered" list, resulting in exactly the same problem.
This produces the following warning on a kernel with linked list debugging enabled:
[109749.265416] ------------[ cut here ]------------ [109749.266410] WARNING: CPU: 7 PID: 324 at lib/list_debug.c:59 __list_del_entry+0x5a/0x98() [109749.267969] list_del corruption. prev->next should be ffff8800ba087e20, but was fffffff8c1f7c35d (...) [109749.287505] Call Trace: [109749.288135] [<ffffffff8145f077>] dump_stack+0x4f/0x7b [109749.298080] [<ffffffff81095de5>] ? console_unlock+0x356/0x3a2 [109749.331605] [<ffffffff8104b3b0>] warn_slowpath_common+0xa1/0xbb [109749.334849] [<ffffffff81260642>] ? __list_del_entry+0x5a/0x98 [109749.337093] [<ffffffff8104b410>] warn_slowpath_fmt+0x46/0x48 [109749.337847] [<ffffffff81260642>] __list_del_entry+0x5a/0x98 [109749.338678] [<ffffffffa053e8bf>] btrfs_wait_pending_ordered+0x46/0xdb [btrfs] [109749.340145] [<ffffffffa058a65f>] ? __btrfs_run_delayed_items+0x149/0x163 [btrfs] [109749.348313] [<ffffffffa054077d>] btrfs_commit_transaction+0x36b/0xa10 [btrfs] [109749.349745] [<ffffffff81087310>] ? trace_hardirqs_on+0xd/0xf [109749.350819] [<ffffffffa055370d>] btrfs_sync_file+0x36f/0x3fc [btrfs] [109749.351976] [<ffffffff8118ec98>] vfs_fsync_range+0x8f/0x9e [109749.360341] [<ffffffff8118ecc3>] vfs_fsync+0x1c/0x1e [109749.368828] [<ffffffff8118ee1d>] do_fsync+0x34/0x4e [109749.369790] [<ffffffff8118f045>] SyS_fsync+0x10/0x14 [109749.370925] [<ffffffff81465197>] system_call_fastpath+0x12/0x6f [109749.382274] ---[ end trace 48e0d07f7c03d95a ]---
On a non-debug kernel this leads to invalid memory accesses, causing a crash. Fix this by using list_splice_init() instead of list_splice() in btrfs_commit_transaction() and btrfs_end_transaction().
--- fs/btrfs/transaction.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/transaction.c +2 -2
@@ -758,7 +758,7 @@ static int __btrfs_end_transaction(strucif (!list_empty (&trans->ordered)) {spin_lock (&info->trans_lock); -list_splice (&trans->ordered, &cur_trans->pending_ordered); +list_splice_init (&trans->ordered, &cur_trans->pending_ordered);spin_unlock (&info->trans_lock); }
@@ -1848,7 +1848,7 @@ int btrfs_commit_transaction(struct btrf }spin_lock (&root->fs_info->trans_lock); -list_splice (&trans->ordered, &cur_trans->pending_ordered); +list_splice_init (&trans->ordered, &cur_trans->pending_ordered);if (cur_trans->state >=TRANS_STATE_COMMIT_START ) {spin_unlock (&root->fs_info->trans_lock);atomic_inc (&cur_trans->use_count);
Greg Kroah-Hartman
maintainerPATCH 239/267 clk: Fix JSON output in debugfs
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Wahren <[email protected]>
commit 7cb81136d2efe0f5ed9d965857f4756a15e6c338 upstream.
key/value pairs in a JSON object must be separated by a comma. After adding the properties "accuracy" and "phase" the JSON output of /sys/kernel/debug/clk/clk_dump is invalid.
So add the missing commas to fix it.
--- drivers/clk/clk.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/clk/clk.c +3 -2
@@ -230,11 +230,12 @@ static void clk_dump_one(struct seq_fileif (!c)return ; +/* This should be JSON format, i.e. elements separated with a comma */ seq_printf (s,"\"%s\": { " , c->name);seq_printf (s,"\"enable_count\": %d," , c->enable_count);seq_printf (s,"\"prepare_count\": %d," , c->prepare_count); -seq_printf (s,"\"rate\": %lu" ,clk_core_get_rate (c)); -seq_printf (s,"\"accuracy\": %lu" ,clk_core_get_accuracy (c)); +seq_printf (s,"\"rate\": %lu," ,clk_core_get_rate (c)); +seq_printf (s,"\"accuracy\": %lu," ,clk_core_get_accuracy (c));seq_printf (s,"\"phase\": %d" ,clk_core_get_phase (c)); }
Greg Kroah-Hartman
maintainerPATCH 248/267 nfs: fix potential credential leak in ff_layout_update_mirror_cred
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
commit a24221dca1868101c9b4b5adde4a6a5b1a3a64a7 upstream.
If we have two tasks racing to update a mirror's credentials, then they can end up leaking one (or more) sets of credentials. The first task will set mirror->cred and then the second task will just overwrite it.
Use a cmpxchg to ensure that the creds are only set once. If we get to the point where we would set mirror->cred and find that they're already set, then we just release the creds that were just found.
--- fs/nfs/flexfilelayout/flexfilelayoutdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/nfs/flexfilelayout/flexfilelayoutdev.c +2 -1
@@ -324,7 +324,8 @@ static int ff_layout_update_mirror_cred( __func__, PTR_ERR(cred));return PTR_ERR (cred); }else { - mirror->cred = cred; +if (cmpxchg (&mirror->cred,NULL , cred)) +put_rpccred (cred); } }return 0 ;
Greg Kroah-Hartman
maintainerPATCH 249/267 nfs: always update creds in mirror, even when we have an already connected ds
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
commit 0c8315dd56577445dd1afe6b9cfa06b7efdf2f82 upstream.
A ds can be associated with more than one mirror, but we currently skip setting a mirror's credentials if we find that it's already set up with a connected client.
The upshot is that we can end up sending DS writes with MDS credentials instead of properly setting them up. Fix nfs4_ff_layout_prepare_ds to always verify that the mirror's credentials are set up, even when we have a DS that's already connected.
--- fs/nfs/flexfilelayout/flexfilelayoutdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfs/flexfilelayout/flexfilelayoutdev.c +2 -2
@@ -387,7 +387,7 @@ nfs4_ff_layout_prepare_ds(struct pnfs_la/* matching smp_wmb() in _nfs4_pnfs_v3/4_ds_connect */ smp_rmb ();if (ds->ds_clp) - goto out; + goto out_update_creds; flavor =nfs4_ff_layout_choose_authflavor (mirror);
@@ -431,7 +431,7 @@ nfs4_ff_layout_prepare_ds(struct pnfs_la } } } - +out_update_creds:if (ff_layout_update_mirror_cred (mirror, ds)) ds =NULL ; out:
Greg Kroah-Hartman
maintainerPATCH 250/267 SUNRPC: Fix a memory leak in the backchannel code
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit 88de6af24f2b48b06c514d3c3d0a8f22fafe30bd upstream.
req->rq_private_buf isn't initialised when xprt_setup_backchannel calls xprt_free_allocation.
--- net/sunrpc/backchannel_rqst.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/backchannel_rqst.c +1 -1
@@ -60,7 +60,7 @@ static void xprt_free_allocation(structdprintk ("RPC: free allocations for req= %p\n" , req);WARN_ON_ONCE (test_bit (RPC_BC_PA_IN_USE , &req->rq_bc_pa_state)); - xbufp = &req->rq_private_buf; + xbufp = &req->rq_rcv_buf;free_page ((unsigned long )xbufp->head[0 ].iov_base); xbufp = &req->rq_snd_buf;free_page ((unsigned long )xbufp->head[0 ].iov_base);
Greg Kroah-Hartman
maintainerPATCH 251/267 9p: forgetting to cancel request on interrupted zero-copy RPC
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit a84b69cb6e0a41e86bc593904faa6def3b957343 upstream.
If we'd already sent a request and decide to abort it, we *must* issue TFLUSH properly and not just blindly reuse the tag, or we'll get seriously screwed when response eventually arrives and we confuse it for response to later request that had reused the same tag.
--- net/9p/client.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/9p/client.c +2 -1
@@ -843,7 +843,8 @@ static struct p9_req_t *p9_client_zc_rpcif (err <0 ) {if (err == -EIO ) c->status = Disconnected; - goto reterr; +if (err != -ERESTARTSYS ) + goto reterr; }if (req->status ==REQ_STATUS_ERROR ) {p9_debug (P9_DEBUG_ERROR ,"req_status error %d\n" , req->t_err);
Greg Kroah-Hartman
maintainerPATCH 252/267 9p: dont leave a half-initialized inode sitting around
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit 0a73d0a204a4a04a1e110539c5a524ae51f91d6d upstream.
--- fs/9p/vfs_inode.c | 3 +-- fs/9p/vfs_inode_dotl.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)
fs/9p/vfs_inode.c +1 -2
@@ -540,8 +540,7 @@ static struct inode *v9fs_qid_iget(strucunlock_new_inode (inode);return inode; error: -unlock_new_inode (inode); -iput (inode); +iget_failed (inode);return ERR_PTR (retval); }
fs/9p/vfs_inode_dotl.c +1 -2
@@ -149,8 +149,7 @@ static struct inode *v9fs_qid_iget_dotl(unlock_new_inode (inode);return inode; error: -unlock_new_inode (inode); -iput (inode); +iget_failed (inode);return ERR_PTR (retval); }
Greg Kroah-Hartman
maintainerPATCH 254/267 agp/intel: Fix typo in needs_ilk_vtd_wa()
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Wilson <[email protected]>
commit 8b572a4200828b4e75cc22ed2f494b58d5372d65 upstream.
In needs_ilk_vtd_wa(), we pass in the GPU device but compared it against the ids for the mobile GPU and the mobile host bridge. That latter is impossible and so likely was just a typo for the desktop GPU device id (which is also buggy).
Fixes commit da88a5f7f7d434e2cde1b3e19d952e6d84533662
Author: Chris Wilson <[email protected]> Date: Wed Feb 13 09:31:53 2013 +0000
drm/i915: Disable WC PTE updates to w/a buggy IOMMU on ILK
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91127
References: https://bugzilla.freedesktop.org/show_bug.cgi?id=60391
--- drivers/char/agp/intel-gtt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/agp/intel-gtt.c +1 -1
@@ -581,7 +581,7 @@ static inline int needs_ilk_vtd_wa(void)/* Query intel_iommu to see if we need the workaround. Presumably that * was loaded first. */ -if ((gpu_devid ==PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB || +if ((gpu_devid ==PCI_DEVICE_ID_INTEL_IRONLAKE_D_IG || gpu_devid ==PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG ) && intel_iommu_gfx_mapped)return 1 ;
Greg Kroah-Hartman
maintainerPATCH 255/267 ARM: dove: fix legacy dove IRQ numbers
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell King <[email protected]>
commit 5d6bed2a9c8bc161bff4cc7cede00f2e0e27a7e7 upstream.
v3.18 changed handle_IRQ() to call __handle_domain_irq(), which now rejects attempts to deliver IRQ0. Since IRQ 0 is used as the timer interrupt (just like the PIT on x86), this causes boot to fail as the bogomips calibration never completes.
Fix this by shuffling all interrupts up by one.
--- arch/arm/mach-dove/include/mach/irqs.h | 118 ++++++++++++++++----------------- arch/arm/mach-dove/irq.c | 8 +- 2 files changed, 63 insertions(+), 63 deletions(-)
arch/arm/mach-dove/include/mach/irqs.h +59 -59
@@ -14,73 +14,73 @@/* * Dove Low Interrupt Controller */ -#define IRQ_DOVE_BRIDGE 0 -#define IRQ_DOVE_H2C 1 -#define IRQ_DOVE_C2H 2 -#define IRQ_DOVE_NAND 3 -#define IRQ_DOVE_PDMA 4 -#define IRQ_DOVE_SPI1 5 -#define IRQ_DOVE_SPI0 6 -#define IRQ_DOVE_UART_0 7 -#define IRQ_DOVE_UART_1 8 -#define IRQ_DOVE_UART_2 9 -#define IRQ_DOVE_UART_3 10 -#define IRQ_DOVE_I2C 11 -#define IRQ_DOVE_GPIO_0_7 12 -#define IRQ_DOVE_GPIO_8_15 13 -#define IRQ_DOVE_GPIO_16_23 14 -#define IRQ_DOVE_PCIE0_ERR 15 -#define IRQ_DOVE_PCIE0 16 -#define IRQ_DOVE_PCIE1_ERR 17 -#define IRQ_DOVE_PCIE1 18 -#define IRQ_DOVE_I2S0 19 -#define IRQ_DOVE_I2S0_ERR 20 -#define IRQ_DOVE_I2S1 21 -#define IRQ_DOVE_I2S1_ERR 22 -#define IRQ_DOVE_USB_ERR 23 -#define IRQ_DOVE_USB0 24 -#define IRQ_DOVE_USB1 25 -#define IRQ_DOVE_GE00_RX 26 -#define IRQ_DOVE_GE00_TX 27 -#define IRQ_DOVE_GE00_MISC 28 -#define IRQ_DOVE_GE00_SUM 29 -#define IRQ_DOVE_GE00_ERR 30 -#define IRQ_DOVE_CRYPTO 31 +#define IRQ_DOVE_BRIDGE (1 + 0) +#define IRQ_DOVE_H2C (1 + 1) +#define IRQ_DOVE_C2H (1 + 2) +#define IRQ_DOVE_NAND (1 + 3) +#define IRQ_DOVE_PDMA (1 + 4) +#define IRQ_DOVE_SPI1 (1 + 5) +#define IRQ_DOVE_SPI0 (1 + 6) +#define IRQ_DOVE_UART_0 (1 + 7) +#define IRQ_DOVE_UART_1 (1 + 8) +#define IRQ_DOVE_UART_2 (1 + 9) +#define IRQ_DOVE_UART_3 (1 + 10) +#define IRQ_DOVE_I2C (1 + 11) +#define IRQ_DOVE_GPIO_0_7 (1 + 12) +#define IRQ_DOVE_GPIO_8_15 (1 + 13) +#define IRQ_DOVE_GPIO_16_23 (1 + 14) +#define IRQ_DOVE_PCIE0_ERR (1 + 15) +#define IRQ_DOVE_PCIE0 (1 + 16) +#define IRQ_DOVE_PCIE1_ERR (1 + 17) +#define IRQ_DOVE_PCIE1 (1 + 18) +#define IRQ_DOVE_I2S0 (1 + 19) +#define IRQ_DOVE_I2S0_ERR (1 + 20) +#define IRQ_DOVE_I2S1 (1 + 21) +#define IRQ_DOVE_I2S1_ERR (1 + 22) +#define IRQ_DOVE_USB_ERR (1 + 23) +#define IRQ_DOVE_USB0 (1 + 24) +#define IRQ_DOVE_USB1 (1 + 25) +#define IRQ_DOVE_GE00_RX (1 + 26) +#define IRQ_DOVE_GE00_TX (1 + 27) +#define IRQ_DOVE_GE00_MISC (1 + 28) +#define IRQ_DOVE_GE00_SUM (1 + 29) +#define IRQ_DOVE_GE00_ERR (1 + 30) +#define IRQ_DOVE_CRYPTO (1 + 31)/* * Dove High Interrupt Controller */ -#define IRQ_DOVE_AC97 32 -#define IRQ_DOVE_PMU 33 -#define IRQ_DOVE_CAM 34 -#define IRQ_DOVE_SDIO0 35 -#define IRQ_DOVE_SDIO1 36 -#define IRQ_DOVE_SDIO0_WAKEUP 37 -#define IRQ_DOVE_SDIO1_WAKEUP 38 -#define IRQ_DOVE_XOR_00 39 -#define IRQ_DOVE_XOR_01 40 -#define IRQ_DOVE_XOR0_ERR 41 -#define IRQ_DOVE_XOR_10 42 -#define IRQ_DOVE_XOR_11 43 -#define IRQ_DOVE_XOR1_ERR 44 -#define IRQ_DOVE_LCD_DCON 45 -#define IRQ_DOVE_LCD1 46 -#define IRQ_DOVE_LCD0 47 -#define IRQ_DOVE_GPU 48 -#define IRQ_DOVE_PERFORM_MNTR 49 -#define IRQ_DOVE_VPRO_DMA1 51 -#define IRQ_DOVE_SSP_TIMER 54 -#define IRQ_DOVE_SSP 55 -#define IRQ_DOVE_MC_L2_ERR 56 -#define IRQ_DOVE_CRYPTO_ERR 59 -#define IRQ_DOVE_GPIO_24_31 60 -#define IRQ_DOVE_HIGH_GPIO 61 -#define IRQ_DOVE_SATA 62 +#define IRQ_DOVE_AC97 (1 + 32) +#define IRQ_DOVE_PMU (1 + 33) +#define IRQ_DOVE_CAM (1 + 34) +#define IRQ_DOVE_SDIO0 (1 + 35) +#define IRQ_DOVE_SDIO1 (1 + 36) +#define IRQ_DOVE_SDIO0_WAKEUP (1 + 37) +#define IRQ_DOVE_SDIO1_WAKEUP (1 + 38) +#define IRQ_DOVE_XOR_00 (1 + 39) +#define IRQ_DOVE_XOR_01 (1 + 40) +#define IRQ_DOVE_XOR0_ERR (1 + 41) +#define IRQ_DOVE_XOR_10 (1 + 42) +#define IRQ_DOVE_XOR_11 (1 + 43) +#define IRQ_DOVE_XOR1_ERR (1 + 44) +#define IRQ_DOVE_LCD_DCON (1 + 45) +#define IRQ_DOVE_LCD1 (1 + 46) +#define IRQ_DOVE_LCD0 (1 + 47) +#define IRQ_DOVE_GPU (1 + 48) +#define IRQ_DOVE_PERFORM_MNTR (1 + 49) +#define IRQ_DOVE_VPRO_DMA1 (1 + 51) +#define IRQ_DOVE_SSP_TIMER (1 + 54) +#define IRQ_DOVE_SSP (1 + 55) +#define IRQ_DOVE_MC_L2_ERR (1 + 56) +#define IRQ_DOVE_CRYPTO_ERR (1 + 59) +#define IRQ_DOVE_GPIO_24_31 (1 + 60) +#define IRQ_DOVE_HIGH_GPIO (1 + 61) +#define IRQ_DOVE_SATA (1 + 62)/* * DOVE General Purpose Pins */ -#define IRQ_DOVE_GPIO_START 64 +#define IRQ_DOVE_GPIO_START 65#define NR_GPIO_IRQS 64/*
arch/arm/mach-dove/irq.c +4 -4
@@ -126,14 +126,14 @@ __exception_irq_entry dove_legacy_handle stat =readl_relaxed (dove_irq_base +IRQ_CAUSE_LOW_OFF ); stat &=readl_relaxed (dove_irq_base +IRQ_MASK_LOW_OFF );if (stat) { -unsigned int hwirq =__fls (stat); +unsigned int hwirq =1 +__fls (stat);handle_IRQ (hwirq, regs);return ; } stat =readl_relaxed (dove_irq_base +IRQ_CAUSE_HIGH_OFF ); stat &=readl_relaxed (dove_irq_base +IRQ_MASK_HIGH_OFF );if (stat) { -unsigned int hwirq =32 +__fls (stat); +unsigned int hwirq =33 +__fls (stat);handle_IRQ (hwirq, regs);return ; }
@@ -144,8 +144,8 @@ void __init dove_init_irq(void) {int i; -orion_irq_init (0 ,IRQ_VIRT_BASE +IRQ_MASK_LOW_OFF ); -orion_irq_init (32 ,IRQ_VIRT_BASE +IRQ_MASK_HIGH_OFF ); +orion_irq_init (1 ,IRQ_VIRT_BASE +IRQ_MASK_LOW_OFF ); +orion_irq_init (33 ,IRQ_VIRT_BASE +IRQ_MASK_HIGH_OFF );#ifdef CONFIG_MULTI_IRQ_HANDLER set_handle_irq (dove_legacy_handle_irq);
Greg Kroah-Hartman
maintainerPATCH 256/267 EDAC, octeon: Fix broken build due to model helper renames
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaro Koskinen <[email protected]>
commit 75a15a7864c9e281c74a1670b10b69d1d7ff1c82 upstream.
Commit
debe6a623d3c ("MIPS: OCTEON: Update octeon-model.h code for new SoCs.")
renamed some SoC model helper functions, but forgot to update the EDAC drivers resulting in build failures. Fix that.
--- drivers/edac/octeon_edac-l2c.c | 2 +- drivers/edac/octeon_edac-lmc.c | 2 +- drivers/edac/octeon_edac-pc.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/edac/octeon_edac-l2c.c +1 -1
@@ -151,7 +151,7 @@ static int octeon_l2c_probe(struct platf l2c->ctl_name ="octeon_l2c_err" ; -if (OCTEON_IS_MODEL (OCTEON_FAM_1_PLUS )) { +if (OCTEON_IS_OCTEON1PLUS ()) {union cvmx_l2t_err l2t_err;union cvmx_l2d_err l2d_err;
drivers/edac/octeon_edac-lmc.c +1 -1
@@ -234,7 +234,7 @@ static int octeon_lmc_edac_probe(struct layers[0 ].size =1 ; layers[0 ].is_virt_csrow = false; -if (OCTEON_IS_MODEL (OCTEON_FAM_1_PLUS )) { +if (OCTEON_IS_OCTEON1PLUS ()) {union cvmx_lmcx_mem_cfg0 cfg0; cfg0.u64 =cvmx_read_csr (CVMX_LMCX_MEM_CFG0 (0 ));
drivers/edac/octeon_edac-pc.c +1 -1
@@ -73,7 +73,7 @@ static int co_cache_error_event(structedac_device_handle_ce (p->ed, cpu,0 ,"dcache" );/* Clear the error indication */ -if (OCTEON_IS_MODEL (OCTEON_FAM_2 )) +if (OCTEON_IS_OCTEON2 ())write_octeon_c0_dcacheerr (1 );else write_octeon_c0_dcacheerr (0 );
Greg Kroah-Hartman
maintainerPATCH 240/267 clk: ti: dra7-atl-clock: Fix possible ERR_PTR dereference
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit e0cdcda508f110b7ec190dc7c5eb2869ba73a535 upstream.
of_clk_get_from_provider() returns ERR_PTR on failure. The dra7-atl-clock driver was not checking its return value and immediately used it in __clk_get_hw(). __clk_get_hw() dereferences supplied clock, if it is not NULL, so in that case it would dereference an ERR_PTR.
--- drivers/clk/ti/clk-dra7-atl.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/clk/ti/clk-dra7-atl.c +5 -0
@@ -252,6 +252,11 @@ static int of_dra7_atl_clk_probe(struct } clk =of_clk_get_from_provider (&clkspec); +if (IS_ERR (clk)) { +pr_err ("%s: failed to get atl clock %d from provider\n" , + __func__, i); +return PTR_ERR (clk); + } cdesc =to_atl_desc (__clk_get_hw (clk)); cdesc->cinfo = cinfo;
Greg Kroah-Hartman
maintainerPATCH 257/267 p9_client_write(): avoid double p9_free_req()
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit 67e808fbb0404a12d9b9830a44bbb48d447d8bc9 upstream.
Braino in "9p: switch p9_client_write() to passing it struct iov_iter *"; if response is impossible to parse and we discard the request, get the out of the loop right there.
--- net/9p/client.c | 1 + 1 file changed, 1 insertion(+)
net/9p/client.c +1 -0
@@ -1648,6 +1648,7 @@ p9_client_write(struct p9_fid *fid, u64if (*err) {trace_9p_protocol_dump (clnt, req->rc);p9_free_req (clnt, req); +break ; }p9_debug (P9_DEBUG_9P ,"<<< RWRITE count %d\n" , count);
Greg Kroah-Hartman
maintainerPATCH 258/267 ARM64: smp: Fix suspicious RCU usage with ipi tracepoints
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Boyd <[email protected]>
commit be081d9bf3e163a9ed1ca2f0f14f08424c7f9016 upstream.
John Stultz reported an RCU splat on ARM with ipi trace events enabled. It looks like the same problem exists on ARM64.
At this point in the IPI handling path we haven't called irq_enter() yet, so RCU doesn't know that we're about to exit idle and properly warns that we're using RCU from an idle CPU. Use trace_ipi_entry_rcuidle() instead of trace_ipi_entry() so that RCU is informed about our exit from idle.
--- arch/arm64/kernel/smp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/kernel/smp.c +2 -2
@@ -569,7 +569,7 @@ void handle_IPI(int ipinr, struct pt_regstruct pt_regs *old_regs =set_irq_regs (regs);if ((unsigned )ipinr <NR_IPI ) { -trace_ipi_entry (ipi_types[ipinr]); +trace_ipi_entry_rcuidle (ipi_types[ipinr]);__inc_irq_stat (cpu, ipi_irqs[ipinr]); }
@@ -612,7 +612,7 @@ void handle_IPI(int ipinr, struct pt_reg }if ((unsigned )ipinr <NR_IPI ) -trace_ipi_exit (ipi_types[ipinr]); +trace_ipi_exit_rcuidle (ipi_types[ipinr]);set_irq_regs (old_regs); }
Greg Kroah-Hartman
maintainerPATCH 259/267 arm64: bpf: fix out-of-bounds read in bpf2a64_offset()
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xi Wang <[email protected]>
commit 8eee539ddea09bccae2426f09b0ba6a18b72b691 upstream.
Problems occur when bpf_to or bpf_from has value prog->len - 1 (e.g., "Very long jump backwards" in test_bpf where the last instruction is a jump): since ctx->offset has length prog->len, ctx->offset[bpf_to + 1] or ctx->offset[bpf_from + 1] will cause an out-of-bounds read, leading to a bogus jump offset and kernel panic.
This patch moves updating ctx->offset to after calling build_insn(), and changes indexing to use bpf_to and bpf_from without + 1.
--- arch/arm64/net/bpf_jit_comp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
arch/arm64/net/bpf_jit_comp.c +4 -3
@@ -113,9 +113,9 @@ static inline void emit_a64_mov_i(conststatic inline int bpf2a64_offset (int bpf_to,int bpf_from,const struct jit_ctx *ctx) { -int to = ctx->offset[bpf_to +1 ]; +int to = ctx->offset[bpf_to];/* -1 to account for the Branch instruction */ -int from = ctx->offset[bpf_from +1 ] -1 ; +int from = ctx->offset[bpf_from] -1 ;return to - from; }
@@ -640,10 +640,11 @@ static int build_body(struct jit_ctx *ctconst struct bpf_insn *insn = &prog->insnsi[i];int ret; + ret =build_insn (insn, ctx); +if (ctx->image ==NULL ) ctx->offset[i] = ctx->idx; - ret =build_insn (insn, ctx);if (ret >0 ) { i++;continue ;
Greg Kroah-Hartman
maintainerPATCH 260/267 arm64: bpf: fix endianness conversion bugs
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xi Wang <[email protected]>
commit d63903bbc30c7ccad040851dfdb4da12d9a17bcf upstream.
Upper bits should be zeroed in endianness conversion:
- even when there's no need to change endianness (i.e., BPF_FROM_BE on big endian or BPF_FROM_LE on little endian);
- after rev16.
This patch fixes such bugs by emitting extra instructions to clear upper bits.
--- arch/arm64/net/bpf_jit.h | 4 ++++ arch/arm64/net/bpf_jit_comp.c | 22 ++++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-)
arch/arm64/net/bpf_jit.h +4 -0
@@ -110,6 +110,10 @@/* Rd = Rn >> shift; signed */ #define A64_ASR (sf, Rd, Rn, shift) A64_SBFM(sf, Rd, Rn, shift, (sf) ? 63 : 31) +/* Zero extend */ +#define A64_UXTH (sf, Rd, Rn) A64_UBFM(sf, Rd, Rn, 0, 15) +#define A64_UXTW (sf, Rd, Rn) A64_UBFM(sf, Rd, Rn, 0, 31) +/* Move wide (immediate) */ #define A64_MOVEW (sf, Rd, imm16, shift, type) \ aarch64_insn_gen_movewide(Rd, imm16, shift, \
arch/arm64/net/bpf_jit_comp.c +20 -2
@@ -289,23 +289,41 @@ static int build_insn(const struct bpf_icase BPF_ALU |BPF_END |BPF_FROM_BE :#ifdef CONFIG_CPU_BIG_ENDIAN if (BPF_SRC (code) ==BPF_FROM_BE ) -break ; + goto emit_bswap_uxt;#else /* !CONFIG_CPU_BIG_ENDIAN */ if (BPF_SRC (code) ==BPF_FROM_LE ) -break ; + goto emit_bswap_uxt;#endif switch (imm) {case 16 :emit (A64_REV16 (is64, dst, dst), ctx); +/* zero-extend 16 bits into 64 bits */ +emit (A64_UXTH (is64, dst, dst), ctx);break ;case 32 :emit (A64_REV32 (is64, dst, dst), ctx); +/* upper 32 bits already cleared */ break ;case 64 :emit (A64_REV64 (dst, dst), ctx);break ; }break ; +emit_bswap_uxt: +switch (imm) { +case 16 : +/* zero-extend 16 bits into 64 bits */ +emit (A64_UXTH (is64, dst, dst), ctx); +break ; +case 32 : +/* zero-extend 32 bits into 64 bits */ +emit (A64_UXTW (is64, dst, dst), ctx); +break ; +case 64 : +/* nop */ +break ; + } +break ;/* dst = imm */ case BPF_ALU |BPF_MOV |BPF_K :case BPF_ALU64 |BPF_MOV |BPF_K :
Greg Kroah-Hartman
maintainerPATCH 261/267 arm64: Dont report clear pmds and puds as huge
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoffer Dall <[email protected]>
commit fd28f5d439fca77348c129d5b73043a56f8a0296 upstream.
The current pmd_huge() and pud_huge() functions simply check if the table bit is not set and reports the entries as huge in that case. This is counter-intuitive as a clear pmd/pud cannot also be a huge pmd/pud, and it is inconsistent with at least arm and x86.
To prevent others from making the same mistake as me in looking at code that calls these functions and to fix an issue with KVM on arm64 that causes memory corruption due to incorrect page reference counting resulting from this mistake, let's change the behavior.
--- arch/arm64/mm/hugetlbpage.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/mm/hugetlbpage.c +2 -2
@@ -40,13 +40,13 @@ int huge_pmd_unshare(struct mm_struct *mint pmd_huge (pmd_t pmd) { -return !(pmd_val (pmd) &PMD_TABLE_BIT ); +return pmd_val (pmd) && !(pmd_val (pmd) &PMD_TABLE_BIT ); }int pud_huge (pud_t pud) {#ifndef __PAGETABLE_PMD_FOLDED -return !(pud_val (pud) &PUD_TABLE_BIT ); +return pud_val (pud) && !(pud_val (pud) &PUD_TABLE_BIT );#else return 0 ;#endif
Greg Kroah-Hartman
maintainerPATCH 263/267 ARM: 8393/1: smp: Fix suspicious RCU usage with ipi tracepoints
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Boyd <[email protected]>
commit 398f74569cebbf06bc6b069442bcd0e9616ca465 upstream.
John Stultz reports an RCU splat on boot with ARM ipi trace events enabled.
===============================
[ INFO: suspicious RCU usage. ]
4.1.0-rc7-00033-gb5bed2f #153 Not tainted
-------------------------------include/trace/events/ipi.h:68 suspicious rcu_dereference_check() usage!
other info that might help us debug this:
RCU used illegally from idle CPU!rcu_scheduler_active = 1, debug_locks = 0
RCU used illegally from extended quiescent state!
no locks held by swapper/0/0.
stack backtrace: CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.1.0-rc7-00033-gb5bed2f #153 Hardware name: Qualcomm (Flattened Device Tree) [<c0216b08>] (unwind_backtrace) from [<c02136e8>] (show_stack+0x10/0x14) [<c02136e8>] (show_stack) from [<c075e678>] (dump_stack+0x70/0xbc) [<c075e678>] (dump_stack) from [<c0215a80>] (handle_IPI+0x428/0x604) [<c0215a80>] (handle_IPI) from [<c020942c>] (gic_handle_irq+0x54/0x5c) [<c020942c>] (gic_handle_irq) from [<c0766604>] (__irq_svc+0x44/0x7c) Exception stack(0xc09f3f48 to 0xc09f3f90)
3f40: 00000001 00000001 00000000 c09f73b8 c09f4528 c0a5de9c
3f60: c076b4f0 00000000 00000000 c09ef108 c0a5cec1 00000001 00000000 c09f3f90 3f80: c026bf60 c0210ab8 20000113 ffffffff
[<c0766604>] (__irq_svc) from [<c0210ab8>] (arch_cpu_idle+0x20/0x3c) [<c0210ab8>] (arch_cpu_idle) from [<c02647f0>] (cpu_startup_entry+0x2c0/0x5dc) [<c02647f0>] (cpu_startup_entry) from [<c099bc1c>] (start_kernel+0x358/0x3c4) [<c099bc1c>] (start_kernel) from [<8020807c>] (0x8020807c)
At this point in the IPI handling path we haven't called irq_enter() yet, so RCU doesn't know that we're about to exit idle and properly warns that we're using RCU from an idle CPU. Use trace_ipi_entry_rcuidle() instead of trace_ipi_entry() so that RCU is informed about our exit from idle.
--- arch/arm/kernel/smp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/kernel/smp.c +2 -2
@@ -576,7 +576,7 @@ void handle_IPI(int ipinr, struct pt_regstruct pt_regs *old_regs =set_irq_regs (regs);if ((unsigned )ipinr <NR_IPI ) { -trace_ipi_entry (ipi_types[ipinr]); +trace_ipi_entry_rcuidle (ipi_types[ipinr]);__inc_irq_stat (cpu, ipi_irqs[ipinr]); }
@@ -635,7 +635,7 @@ void handle_IPI(int ipinr, struct pt_reg }if ((unsigned )ipinr <NR_IPI ) -trace_ipi_exit (ipi_types[ipinr]); +trace_ipi_exit_rcuidle (ipi_types[ipinr]);set_irq_regs (old_regs); }
Greg Kroah-Hartman
maintainerPATCH 264/267 ARM: 8397/1: fix vdsomunge not to depend on glibc specific error.h
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Szabolcs Nagy <[email protected]>
commit 13ee9fdba96577eb1583dcd7b15767ef623fae12 upstream.
If the host toolchain is not glibc based then the arm kernel build fails with
arch/arm/vdso/vdsomunge.c:53:19: fatal error: error.h: No such file or directory
error.h is a glibc only header (ie not available in musl, newlib and bsd libcs). Changed the error reporting to standard conforming code to avoid depending on specific C implementations.
--- arch/arm/vdso/vdsomunge.c | 56 +++++++++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 23 deletions(-)
arch/arm/vdso/vdsomunge.c +33 -23
@@ -45,13 +45,11 @@* it does. */ -#define _GNU_SOURCE -#include <byteswap.h> #include <elf.h> #include <errno.h> -#include <error.h> #include <fcntl.h> +#include <stdarg.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h>
@@ -82,11 +80,25 @@#define EF_ARM_ABI_FLOAT_HARD 0x400#endif +static int failed; +static const char *argv0;static const char *outfile; +static void fail (const char *fmt, ...) +{ +va_list ap; + + failed =1 ; +fprintf (stderr,"%s: " , argv0); +va_start (ap, fmt); +vfprintf (stderr, fmt, ap); +va_end (ap); +exit (EXIT_FAILURE ); +} +static void cleanup (void ) { -if (error_message_count >0 && outfile !=NULL ) +if (failed && outfile !=NULL )unlink (outfile); }
@@ -119,68 +131,66 @@ int main(int argc, char **argv)int infd;atexit (cleanup); + argv0 = argv[0 ];if (argc !=3 ) -error (EXIT_FAILURE ,0 ,"Usage: %s [infile] [outfile]" , argv[0 ]); +fail ("Usage: %s [infile] [outfile]\n" , argv[0 ]); infile = argv[1 ]; outfile = argv[2 ]; infd =open (infile,O_RDONLY );if (infd <0 ) -error (EXIT_FAILURE , errno,"Cannot open %s" , infile); +fail ("Cannot open %s: %s\n" , infile,strerror (errno));if (fstat (infd, &stat) !=0 ) -error (EXIT_FAILURE , errno,"Failed stat for %s" , infile); +fail ("Failed stat for %s: %s\n" , infile,strerror (errno)); inbuf =mmap (NULL , stat.st_size,PROT_READ ,MAP_PRIVATE , infd,0 );if (inbuf ==MAP_FAILED ) -error (EXIT_FAILURE , errno,"Failed to map %s" , infile); +fail ("Failed to map %s: %s\n" , infile,strerror (errno));close (infd); inhdr = inbuf;if (memcmp (&inhdr->e_ident,ELFMAG ,SELFMAG ) !=0 ) -error (EXIT_FAILURE ,0 ,"Not an ELF file" ); +fail ("Not an ELF file\n" );if (inhdr->e_ident[EI_CLASS ] !=ELFCLASS32 ) -error (EXIT_FAILURE ,0 ,"Unsupported ELF class" ); +fail ("Unsupported ELF class\n" ); swap = inhdr->e_ident[EI_DATA ] !=HOST_ORDER ;if (read_elf_half (inhdr->e_type, swap) !=ET_DYN ) -error (EXIT_FAILURE ,0 ,"Not a shared object" ); +fail ("Not a shared object\n" ); -if (read_elf_half (inhdr->e_machine, swap) !=EM_ARM ) { -error (EXIT_FAILURE ,0 ,"Unsupported architecture %#x" , - inhdr->e_machine); - } +if (read_elf_half (inhdr->e_machine, swap) !=EM_ARM ) +fail ("Unsupported architecture %#x\n" , inhdr->e_machine); e_flags =read_elf_word (inhdr->e_flags, swap);if (EF_ARM_EABI_VERSION (e_flags) !=EF_ARM_EABI_VER5 ) { -error (EXIT_FAILURE ,0 ,"Unsupported EABI version %#x" , -EF_ARM_EABI_VERSION (e_flags)); +fail ("Unsupported EABI version %#x\n" , +EF_ARM_EABI_VERSION (e_flags)); }if (e_flags &EF_ARM_ABI_FLOAT_HARD ) -error (EXIT_FAILURE ,0 , -"Unexpected hard-float flag set in e_flags" ); +fail ("Unexpected hard-float flag set in e_flags\n" ); clear_soft_float = !!(e_flags &EF_ARM_ABI_FLOAT_SOFT ); outfd =open (outfile,O_RDWR |O_CREAT |O_TRUNC ,S_IRUSR |S_IWUSR );if (outfd <0 ) -error (EXIT_FAILURE , errno,"Cannot open %s" , outfile); +fail ("Cannot open %s: %s\n" , outfile,strerror (errno));if (ftruncate (outfd, stat.st_size) !=0 ) -error (EXIT_FAILURE , errno,"Cannot truncate %s" , outfile); +fail ("Cannot truncate %s: %s\n" , outfile,strerror (errno)); outbuf =mmap (NULL , stat.st_size,PROT_READ |PROT_WRITE ,MAP_SHARED , outfd,0 );if (outbuf ==MAP_FAILED ) -error (EXIT_FAILURE , errno,"Failed to map %s" , outfile); +fail ("Failed to map %s: %s\n" , outfile,strerror (errno));close (outfd);
@@ -195,7 +205,7 @@ int main(int argc, char **argv) }if (msync (outbuf, stat.st_size,MS_SYNC ) !=0 ) -error (EXIT_FAILURE , errno,"Failed to sync %s" , outfile); +fail ("Failed to sync %s: %s\n" , outfile,strerror (errno));return EXIT_SUCCESS ; }
Greg Kroah-Hartman
maintainerPATCH 265/267 hpfs: kstrdup() out of memory handling
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sanidhya Kashyap <[email protected]>
commit ce657611baf902f14ae559ce4e0787ead6712067 upstream.
There is a possibility of nothing being allocated to the new_opts in case of memory pressure, therefore return ENOMEM for such case.
--- fs/hpfs/super.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/hpfs/super.c +5 -2
@@ -424,11 +424,14 @@ static int hpfs_remount_fs(struct super_int o;struct hpfs_sb_info *sbi =hpfs_sb (s);char *new_opts =kstrdup (data,GFP_KERNEL ); - + +if (!new_opts) +return -ENOMEM ; +sync_filesystem (s); *flags |=MS_NOATIME ; - +hpfs_lock (s); uid = sbi->sb_uid; gid = sbi->sb_gid; umask =0777 & ~sbi->sb_mode;
Greg Kroah-Hartman
maintainerPATCH 241/267 clk: qcom: Use parent rate when set rate to pixel RCG clock
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hai Li <[email protected]>
commit 6d451367bfa16fc103604bacd258f534c65d1540 upstream.
Since the parent rate has been recalculated, pixel RCG clock should rely on it to find the correct M/N values during set_rate, instead of calling __clk_round_rate() to its parent again.
--- drivers/clk/qcom/clk-rcg2.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/clk/qcom/clk-rcg2.c +3 -6
@@ -530,19 +530,16 @@ static int clk_pixel_set_rate(struct clkstruct clk_rcg2 *rcg =to_clk_rcg2 (hw);struct freq_tbl f = *rcg->freq_tbl;const struct frac_entry *frac = frac_table_pixel; -unsigned long request, src_rate; +unsigned long request;int delta =100000 ;u32 mask =BIT (rcg->hid_width) -1 ;u32 hid_div; -int index =qcom_find_src_index (hw, rcg->parent_map, f.src); -struct clk *parent =clk_get_parent_by_index (hw->clk, index);for (; frac->num; frac++) { request = (rate * frac->den) / frac->num; - src_rate =__clk_round_rate (parent, request); -if ((src_rate < (request - delta)) || - (src_rate > (request + delta))) +if ((parent_rate < (request - delta)) || + (parent_rate > (request + delta)))continue ; regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + CFG_REG,
Greg Kroah-Hartman
maintainerPATCH 266/267 hpfs: hpfs_error: Remove static buffer, use vsprintf extension %pV instead
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Perches <[email protected]>
commit a28e4b2b18ccb90df402da3f21e1a83c9d4f8ec1 upstream.
Removing unnecessary static buffers is good.
Use the vsprintf %pV extension instead.
--- fs/hpfs/super.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
fs/hpfs/super.c +7 -4
@@ -52,17 +52,20 @@ static void unmark_dirty(struct super_bl }/* Filesystem error... */ -static char err_buf[1024 ]; -void hpfs_error (struct super_block *s,const char *fmt, ...) { +struct va_format vaf;va_list args;va_start (args, fmt); -vsnprintf (err_buf,sizeof (err_buf), fmt, args); + + vaf.fmt = fmt; + vaf.va = &args; + +pr_err ("filesystem error: %pV" , &vaf); +va_end (args); -pr_err ("filesystem error: %s" , err_buf);if (!hpfs_sb (s)->sb_was_error) {if (hpfs_sb (s)->sb_err ==2 ) {pr_cont ("; crashing the system because you wanted it\n" );
Greg Kroah-Hartman
maintainerPATCH 267/267 Fix firmware loader uevent buffer NULL pointer dereference
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit 6f957724b94cb19f5c1c97efd01dd4df8ced323c upstream.
The firmware class uevent function accessed the "fw_priv->buf" buffer without the proper locking and testing for NULL. This is an old bug (looks like it goes back to 2012 and commit 1244691c73b2: "firmware
loader: introduce firmware_buf"), but for some reason it's triggering only now in 4.2-rc1.
Shuah Khan is trying to bisect what it is that causes this to trigger more easily, but in the meantime let's just fix the bug since others are hitting it too (at least Ingo reports having seen it as well).
--- drivers/base/firmware_class.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/base/firmware_class.c +13 -3
@@ -544,10 +544,8 @@ static void fw_dev_release(struct devicekfree (fw_priv); } -static int firmware_uevent (struct device *dev,struct kobj_uevent_env *env) +static int do_firmware_uevent (struct firmware_priv *fw_priv,struct kobj_uevent_env *env) { -struct firmware_priv *fw_priv =to_firmware_priv (dev); -if (add_uevent_var (env,"FIRMWARE=%s" , fw_priv->buf->fw_id))return -ENOMEM ;if (add_uevent_var (env,"TIMEOUT=%i" , loading_timeout))
@@ -558,6 +556,18 @@ static int firmware_uevent(struct devicereturn 0 ; } +static int firmware_uevent (struct device *dev,struct kobj_uevent_env *env) +{ +struct firmware_priv *fw_priv =to_firmware_priv (dev); +int err =0 ; + +mutex_lock (&fw_lock); +if (fw_priv->buf) + err =do_firmware_uevent (fw_priv, env); +mutex_unlock (&fw_lock); +return err; +} +static struct class firmware_class = { .name ="firmware" , .class_attrs = firmware_class_attrs,
Greg Kroah-Hartman
maintainerPATCH 242/267 pNFS: Fix a memory leak when attempted pnfs fails
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit 1ca018d28d96d07788474abf66a5f3e9594841f5 upstream.
pnfs_do_write() expects the call to pnfs_write_through_mds() to free the pgio header and to release the layout segment before exiting. The problem is that nfs_pgio_data_destroy() doesn't actually do this; it only frees the memory allocated by nfs_generic_pgio().
Ditto for pnfs_do_read()...
Fix in both cases is to add a call to hdr->release(hdr).
--- fs/nfs/pnfs.c | 2 ++ 1 file changed, 2 insertions(+)
fs/nfs/pnfs.c +2 -0
@@ -1865,6 +1865,7 @@ pnfs_write_through_mds(struct nfs_pageio mirror->pg_recoalesce =1 ; }nfs_pgio_data_destroy (hdr); + hdr->release (hdr); } static enum pnfs_try_status
@@ -1979,6 +1980,7 @@ pnfs_read_through_mds(struct nfs_pageio_ mirror->pg_recoalesce =1 ; }nfs_pgio_data_destroy (hdr); + hdr->release (hdr); }/*
Greg Kroah-Hartman
maintainerPATCH 243/267 pNFS/flexfiles: Fix the reset of struct pgio_header when resending
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit d620876990f02788d5a663075df007ffb91bdfad upstream.
hdr->good_bytes needs to be set to the length of the request, not zero.
--- fs/nfs/flexfilelayout/flexfilelayout.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/flexfilelayout/flexfilelayout.c +1 -1
@@ -631,7 +631,7 @@ static void ff_layout_reset_write(structnfs_direct_set_resched_writes (hdr->dreq);/* fake unstable write to let common nfs resend pages */ hdr->verf.committed =NFS_UNSTABLE ; - hdr->good_bytes =0 ; + hdr->good_bytes = hdr->args.count; }return ; }
Greg Kroah-Hartman
maintainerPATCH 244/267 NFS: Fix size of NFSACL SETACL operations
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
commit d683cc49daf7c5afca8cd9654aaa1bf63cdf2ad9 upstream.
When encoding the NFSACL SETACL operation, reserve just the estimated size of the ACL rather than a fixed maximum. This eliminates needless zero padding on the wire that the server ignores.
--- fs/nfs/nfs3xdr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/nfs3xdr.c +1 -1
@@ -1342,7 +1342,7 @@ static void nfs3_xdr_enc_setacl3args(strif (args->npages !=0 )xdr_write_pages (xdr, args->pages,0 , args->len);else -xdr_reserve_space (xdr,NFS_ACL_INLINE_BUFSIZE ); +xdr_reserve_space (xdr, args->len); error = nfsacl_encode(xdr->buf, base, args->inode, (args->mask & NFS_ACL) ?
Greg Kroah-Hartman
maintainerPATCH 247/267 NFS: Ensure we set NFS_CONTEXT_RESEND_WRITES when requeuing writes
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit c70701131f7a8edea91fc49d11796d342cff7c62 upstream.
If a write attempt fails, and the write is queued up for resending to the server, as opposed to being dropped, then we need to set the appropriate flag so that nfs_file_fsync() does the right thing.
--- fs/nfs/pnfs.c | 1 + fs/nfs/write.c | 1 + 2 files changed, 2 insertions(+)
fs/nfs/pnfs.c +1 -0
@@ -1821,6 +1821,7 @@ int pnfs_write_done_resend_to_mds(struct/* Resend all requests through the MDS */ nfs_pageio_init_write (&pgio, hdr->inode,FLUSH_STABLE , true, hdr->completion_ops); +set_bit (NFS_CONTEXT_RESEND_WRITES , &hdr->args.context->flags);return nfs_pageio_resend (&pgio, hdr); }EXPORT_SYMBOL_GPL (pnfs_write_done_resend_to_mds);
fs/nfs/write.c +1 -0
@@ -1289,6 +1289,7 @@ static void nfs_initiate_write(struct nfstatic void nfs_redirty_request (struct nfs_page *req) {nfs_mark_request_dirty (req); +set_bit (NFS_CONTEXT_RESEND_WRITES , &req->wb_context->flags);nfs_unlock_request (req);nfs_end_page_writeback (req);nfs_release_request (req);
Greg Kroah-Hartman
maintainerPATCH 111/267 usb: core: lpm: set lpm_capable for root hub device
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lu Baolu <[email protected]>
commit 2d2a316765d956bc5cb6bb367b2ec52ca59ab8e9 upstream.
Commit 25cd2882e2fc ("usb/xhci: Change how we indicate a host supports Link PM.") removed the code to set lpm_capable for USB 3.0 super-speed root hub. The intention of that change was to avoid touching usb core internal field, a.k.a. lpm_capable, and let usb core to set it by checking U1 and U2 exit latency values in the descriptor.
Usb core checks and sets lpm_capable in hub_port_init(). Unfortunately, root hub is a special usb device as it has no parent. Hub_port_init() will never be called for a root hub device. That means lpm_capable will by no means be set for the root hub. As the result, lpm isn't functional at all in Linux kernel.
This patch add the code to check and set lpm_capable when registering a root hub device. It could be back-ported to kernels as old as v3.15, that contains the Commit 25cd2882e2fc ("usb/xhci: Change how we indicate a host supports Link PM.").
--- drivers/usb/core/hcd.c | 7 +++++-- drivers/usb/core/hub.c | 2 +- drivers/usb/core/usb.h | 1 + 3 files changed, 7 insertions(+), 3 deletions(-)
drivers/usb/core/hcd.c +5 -2
@@ -1022,9 +1022,12 @@ static int register_root_hub(struct usb_ dev_name(&usb_dev->dev), retval);return (retval <0 ) ? retval : -EMSGSIZE ; } -if (usb_dev->speed ==USB_SPEED_SUPER ) { + +if (le16_to_cpu (usb_dev->descriptor.bcdUSB) >=0x0201 ) { retval =usb_get_bos_descriptor (usb_dev); -if (retval <0 ) { +if (!retval) { + usb_dev->lpm_capable =usb_device_supports_lpm (usb_dev); + }else if (usb_dev->speed ==USB_SPEED_SUPER ) {mutex_unlock (&usb_bus_list_lock);dev_dbg (parent_dev,"can't read %s bos descriptor %d\n" ,dev_name (&usb_dev->dev), retval);
drivers/usb/core/hub.c +1 -1
@@ -122,7 +122,7 @@ struct usb_hub *usb_hub_to_struct_hub(streturn usb_get_intfdata (hdev->actconfig->interface[0 ]); } -static int usb_device_supports_lpm (struct usb_device *udev) +int usb_device_supports_lpm (struct usb_device *udev) {/* USB 2.1 (and greater) devices indicate LPM support through * their USB 2.0 Extended Capabilities BOS descriptor.
drivers/usb/core/usb.h +1 -0
@@ -65,6 +65,7 @@ extern int usb_hub_init(void);extern void usb_hub_cleanup (void );extern int usb_major_init (void );extern void usb_major_cleanup (void ); +extern int usb_device_supports_lpm (struct usb_device *udev);#ifdef CONFIG_PM
Greg Kroah-Hartman
maintainerPATCH 167/267 w1_therm reference count family data
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Fries <[email protected]>
commit f7134eea05b2fb4a2c0935f8a540539fff01f3eb upstream.
A temperature conversion can take 750 ms and when possible the w1_therm slave driver drops the bus_mutex to allow other bus operations, but that includes operations such as a periodic slave search, which can remove this slave when it is no longer detected. If that happens the sl->family_data will be freed and set to NULL causing w1_slave_show to crash when it wakes up.
--- drivers/w1/slaves/w1_therm.c | 62 ++++++++++++++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 15 deletions(-)
drivers/w1/slaves/w1_therm.c +47 -15
@@ -59,16 +59,32 @@ MODULE_ALIAS("w1-family-" __stringify(W1static int w1_strong_pullup =1 ;module_param_named (strong_pullup, w1_strong_pullup, int,0 ); +struct w1_therm_family_data { +uint8_t rom[9 ]; +atomic_t refcnt; +}; + +/* return the address of the refcnt in the family data */ +#define THERM_REFCNT (family_data) \ + (&((struct w1_therm_family_data*)family_data)->refcnt) +static int w1_therm_add_slave (struct w1_slave *sl) { - sl->family_data =kzalloc (9 ,GFP_KERNEL ); + sl->family_data =kzalloc (sizeof (struct w1_therm_family_data ), +GFP_KERNEL );if (!sl->family_data)return -ENOMEM ; +atomic_set (THERM_REFCNT (sl->family_data),1 );return 0 ; }static void w1_therm_remove_slave (struct w1_slave *sl) { +int refcnt =atomic_sub_return (1 ,THERM_REFCNT (sl->family_data)); +while (refcnt) { +msleep (1000 ); + refcnt =atomic_read (THERM_REFCNT (sl->family_data)); + }kfree (sl->family_data); sl->family_data =NULL ; }
@@ -194,13 +210,22 @@ static ssize_t w1_slave_show(struct devistruct w1_slave *sl =dev_to_w1_slave (device);struct w1_master *dev = sl->master;u8 rom[9 ], crc, verdict, external_power; -int i, max_trying =10 ; +int i, ret, max_trying =10 ;ssize_t c =PAGE_SIZE ; +u8 *family_data = sl->family_data; + + ret =mutex_lock_interruptible (&dev->bus_mutex); +if (ret !=0 ) + goto post_unlock; - i =mutex_lock_interruptible (&dev->bus_mutex); -if (i !=0 ) -return i; +if (!sl->family_data) + { + ret = -ENODEV ; + goto pre_unlock; + } +/* prevent the slave from going away in sleep */ +atomic_inc (THERM_REFCNT (family_data));memset (rom,0 ,sizeof (rom));while (max_trying--) {
@@ -230,17 +255,19 @@ static ssize_t w1_slave_show(struct devimutex_unlock (&dev->bus_mutex); sleep_rem =msleep_interruptible (tm); -if (sleep_rem !=0 ) -return -EINTR ; +if (sleep_rem !=0 ) { + ret = -EINTR ; + goto post_unlock; + } - i =mutex_lock_interruptible (&dev->bus_mutex); -if (i !=0 ) -return i; + ret =mutex_lock_interruptible (&dev->bus_mutex); +if (ret !=0 ) + goto post_unlock; }else if (!w1_strong_pullup) { sleep_rem =msleep_interruptible (tm);if (sleep_rem !=0 ) { -mutex_unlock (&dev->bus_mutex); -return -EINTR ; + ret = -EINTR ; + goto pre_unlock; } }
@@ -269,19 +296,24 @@ static ssize_t w1_slave_show(struct devi c -=snprintf (buf +PAGE_SIZE - c, c,": crc=%02x %s\n" , crc, (verdict) ?"YES" :"NO" );if (verdict) -memcpy (sl->family_data, rom,sizeof (rom)); +memcpy (family_data, rom,sizeof (rom));else dev_warn (device,"Read failed CRC check\n" );for (i =0 ; i <9 ; ++i) c -=snprintf (buf +PAGE_SIZE - c, c,"%02x " , - ((u8 *)sl->family_data)[i]); + ((u8 *)family_data)[i]); c -=snprintf (buf +PAGE_SIZE - c, c,"t=%d\n" ,w1_convert_temp (rom, sl->family->fid)); + ret =PAGE_SIZE - c; + +pre_unlock:mutex_unlock (&dev->bus_mutex); -return PAGE_SIZE - c; +post_unlock: +atomic_dec (THERM_REFCNT (family_data)); +return ret; }static int __init w1_therm_init (void )
Greg Kroah-Hartman
maintainerPATCH 168/267 tpm, tpm_crb: fix le64_to_cpu conversions in crb_acpi_add()
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jarkko Sakkinen <[email protected]>
commit 49afd7289bd937401c5f7faa193054bc3c41dad6 upstream.
le64_to_cpu() was applied twice to the physical addresses read from the control area. This hasn't shown any visible regressions because CRB driver has been tested only on the little endian platofrms so far.
--- drivers/char/tpm/tpm_crb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/tpm/tpm_crb.c +2 -2
@@ -267,7 +267,7 @@ static int crb_acpi_add(struct acpi_devimemcpy_fromio (&pa, &priv->cca->cmd_pa,8 ); pa =le64_to_cpu (pa); - priv->cmd =devm_ioremap_nocache (dev,le64_to_cpu (pa), + priv->cmd =devm_ioremap_nocache (dev, pa,ioread32 (&priv->cca->cmd_size));if (!priv->cmd) {dev_err (dev,"ioremap of the command buffer failed\n" );
@@ -276,7 +276,7 @@ static int crb_acpi_add(struct acpi_devimemcpy_fromio (&pa, &priv->cca->rsp_pa,8 ); pa =le64_to_cpu (pa); - priv->rsp =devm_ioremap_nocache (dev,le64_to_cpu (pa), + priv->rsp =devm_ioremap_nocache (dev, pa,ioread32 (&priv->cca->rsp_size));if (!priv->rsp) {dev_err (dev,"ioremap of the response buffer failed\n" );
Greg Kroah-Hartman
maintainerPATCH 214/267 mmc: card: Fixup request missing in mmc_blk_issue_rw_rq
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ding Wang <[email protected]>
commit 29535f7b797df35cc9b6b3bca635591cdd3dd2a8 upstream.
The current handler of MMC_BLK_CMD_ERR in mmc_blk_issue_rw_rq function may cause new coming request permanent missing when the ongoing request (previoulsy started) complete end.
The problem scenario is as follows:
(1) Request A is ongoing;
(2) Request B arrived, and finally mmc_blk_issue_rw_rq() is called;
(3) Request A encounters the MMC_BLK_CMD_ERR error;
(4) In the error handling of MMC_BLK_CMD_ERR, suppose mmc_blk_cmd_err() end request A completed and return zero. Continue the error handling, suppose mmc_blk_reset() reset device success;
(5) Continue the execution, while loop completed because variable ret
is zero now;
(6) Finally, mmc_blk_issue_rw_rq() return without processing request B.
The process related to the missing request may wait that IO request complete forever, possibly crashing the application or hanging the system.
Fix this issue by starting new request when reset success.
--- drivers/mmc/card/block.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/mmc/card/block.c +5 -3
@@ -1912,9 +1912,11 @@ static int mmc_blk_issue_rw_rq(struct mmbreak ;case MMC_BLK_CMD_ERR : ret =mmc_blk_cmd_err (md, card, brq, req, ret); -if (!mmc_blk_reset (md, card->host, type)) -break ; - goto cmd_abort; +if (mmc_blk_reset (md, card->host, type)) + goto cmd_abort; +if (!ret) + goto start_new_req; +break ;case MMC_BLK_RETRY :if (retry++ <5 )break ;
Greg Kroah-Hartman
maintainerPATCH 215/267 mmc: sdhci: Restore behavior while creating OCR mask
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ulf Hansson <[email protected]>
commit 5fd26c7ecb32082745b0bd33c8e35badd1cb5a91 upstream.
Commit 3a48edc4bd68 ("mmc: sdhci: Use mmc core regulator infrastucture") changed the behavior for how to assign the ocr_avail mask for the mmc host. More precisely it started to mask the bits instead of assigning them.
Restore the behavior, but also make it clear that an OCR mask created from an external regulator overrides the other ones. The OCR mask is determined by one of the following with this priority:
1. Supported ranges of external regulator if one supplies VDD
2. Host OCR mask if set by the driver (based on DT properties)
3. The capabilities reported by the controller itself
--- drivers/mmc/host/sdhci.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/mmc/host/sdhci.c +5 -4
@@ -3315,13 +3315,14 @@ int sdhci_add_host(struct sdhci_host *hoSDHCI_MAX_CURRENT_MULTIPLIER ; } -/* If OCR set by external regulators, use it instead */ +/* If OCR set by host, use it instead. */ +if (host->ocr_mask) + ocr_avail = host->ocr_mask; + +/* If OCR set by external regulators, give it highest prio. */ if (mmc->ocr_avail) ocr_avail = mmc->ocr_avail; -if (host->ocr_mask) - ocr_avail &= host->ocr_mask; - mmc->ocr_avail = ocr_avail; mmc->ocr_avail_sdio = ocr_avail;if (host->ocr_avail_sdio)
Greg Kroah-Hartman
maintainerPATCH 245/267 fixing infinite OPEN loop in 4.0 stateid recovery
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Olga Kornievskaia <[email protected]>
commit e8d975e73e5fa05f983fbf2723120edcf68e0b38 upstream.
Problem: When an operation like WRITE receives a BAD_STATEID, even though recovery code clears the RECLAIM_NOGRACE recovery flag before recovering the open state, because of clearing delegation state for the associated inode, nfs_inode_find_state_and_recover() gets called and it makes the same state with RECLAIM_NOGRACE flag again. As a results, when we restart looking over the open states, we end up in the infinite loop instead of breaking out in the next test of state flags.
Solution: unset the RECLAIM_NOGRACE set because of
calling of nfs_inode_find_state_and_recover() after returning from calling recover_open() function.
--- fs/nfs/nfs4state.c | 2 ++ 1 file changed, 2 insertions(+)
fs/nfs/nfs4state.c +2 -0
@@ -1482,6 +1482,8 @@ restart:spin_unlock (&state->state_lock); }nfs4_put_open_state (state); +clear_bit (NFS4CLNT_RECLAIM_NOGRACE , + &state->flags);spin_lock (&sp->so_lock); goto restart; }
RE: [PATCH 4.1 209/267] ACPICA: Tables: Enable both 32-bit and 64-bit FACS
In reply to Greg Kroah-HartmanThis particular patch is not stable. Lv has fixed it and a new patch is forthcoming, at least a patch on top of this.
Quoted 217 lines
-----Original Message-----
From: Greg Kroah-Hartman [mailto:[email protected]]
Sent: Friday, July 31, 2015 12:41 PM
To: [email protected]
Cc: Greg Kroah-Hartman; [email protected]; Zheng, Lv; Moore, Robert; Wysocki, Rafael J
Subject: [PATCH 4.1 209/267] ACPICA: Tables: Enable both 32-bit and 64-bit FACS4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lv Zheng <[email protected]>
commit
c04e1fb4396d27f18296db0f914760fa7fe8223aupstream.ACPICA commit
f7b86f35416e3d1f71c3d816ff5075ddd33ed486The following commit is reported to have broken s2ram on some platforms:
Commit:0249ed2444d65d65fc3f3f64f398f1ad0b7e54cd
ACPICA: Add option to favor 32-bit FADT addresses.
The platform reports 2 FACS tables (which is not allowed by ACPI specification) and the new 32-bit address favor rule forces OSPMs to use the FACS table reported via FADT'sX_FIRMWARE_CTRLfield.The root cause of the reported bug might be one of the followings:
1. BIOS may favor the 64-bit firmware waking vector address when the version of the FACS is greater than 0 and Linux currently only supports resuming from the real mode, so the 64-bit firmware waking vector has never been set and might be invalid to BIOS while the commit enables higher version FACS.
2. BIOS may favor the FACS reported via the "FIRMWARE_CTRL" field in the FADT while the commit doesn't set the firmware waking vector address of the FACS reported by "FIRMWARE_CTRL", it only sets the firware waking vector address of the FACS reported by "X_FIRMWARE_CTRL".This patch excludes the cases that can trigger the bugs caused by the root cause 2.
There is no handshaking mechanism can be used by OSPM to tell BIOS which FACS is currently used. Thus the FACS reported by "
FIRMWARE_CTRL" may still be used by BIOS and the 0 value of the 32-bit firmware waking vector might trigger such failure.This patch tries to favor 32bit FACS address in another way where both the FACS reported by "
FIRMWARE_CTRL" and the FACS reported by "X_FIRMWARE_CTRL"
are loaded so that further commit can set firmware waking vector in the both tables to ensure we can exclude the cases that trigger the bugs caused by the root cause 2. The exclusion is split into 2 commits as this commit is also useful for dumping more ACPI tables, it won't get reverted when such exclusion is no longer necessary. Lv Zheng.Reported-and-tested-by Oswald Buddenhagen <[email protected]>Signed-off-by Lv Zheng <[email protected]>Signed-off-by Bob Moore <[email protected]>Signed-off-by Rafael J. Wysocki <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/acpi/acpica/aclocal.h | 1 + drivers/acpi/acpica/tbfadt.c | 21 +++++++++++++-------- drivers/acpi/acpica/tbutils.c | 34 +++++++++++++++++++++++----------- drivers/acpi/acpica/tbxfload.c | 3 ++- include/acpi/acpixf.h | 9 +++++++++ 5 files changed, 48 insertions(+), 20 deletions(-)drivers/acpi/acpica/aclocal.h +1
-0@@ -213,6 +213,7 @@ struct acpi_table_list {#define ACPI_TABLE_INDEX_DSDT (0)#define ACPI_TABLE_INDEX_FACS (1) +#define ACPI_TABLE_INDEX_X_FACS (2)struct acpi_find_context {char *search_for;drivers/acpi/acpica/tbfadt.c +13
-8@@ -350,9 +350,18 @@ void acpi_tb_parse_fadt(u32 table_index)/* If Hardware Reduced flag is set, there is no FACS */ if (!acpi_gbl_reduced_hardware) { -acpi_tb_install_fixed_table ((acpi_physical_address ) - acpi_gbl_FADT.Xfacs,ACPI_SIG_FACS , -ACPI_TABLE_INDEX_FACS ); +if (acpi_gbl_FADT.facs) { +acpi_tb_install_fixed_table ((acpi_physical_address ) + acpi_gbl_FADT.facs, +ACPI_SIG_FACS , +ACPI_TABLE_INDEX_FACS ); + } +if (acpi_gbl_FADT.Xfacs) { +acpi_tb_install_fixed_table ((acpi_physical_address ) + acpi_gbl_FADT.Xfacs, +ACPI_SIG_FACS , +ACPI_TABLE_INDEX_X_FACS ); + } } }@@ -491,13 +500,9 @@ static void acpi_tb_convert_fadt(void) acpi_gbl_FADT.header.length =sizeof (struct acpi_table_fadt );/* -* Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary. +* Expand the 32-bit DSDT addresses to 64-bit as necessary. * Later ACPICA code will always use the X 64-bit field. */ - acpi_gbl_FADT.Xfacs =acpi_tb_select_address ("FACS" , - acpi_gbl_FADT.facs, - acpi_gbl_FADT.Xfacs); - acpi_gbl_FADT.Xdsdt =acpi_tb_select_address ("DSDT" , acpi_gbl_FADT.dsdt, acpi_gbl_FADT.Xdsdt);drivers/acpi/acpica/tbutils.c +23
-11@@ -68,7 +68,8 @@ acpi_tb_get_root_table_entry(u8 *table_eacpi_status acpi_tb_initialize_facs (void ) { -acpi_status status; +struct acpi_table_facs *facs32; +struct acpi_table_facs *facs64;/* If Hardware Reduced flag is set, there is no FACS */ @@ -77,11 +78,22 @@ acpi_status acpi_tb_initialize_facs(voidreturn (AE_OK ); } - status =acpi_get_table_by_index (ACPI_TABLE_INDEX_FACS , - ACPI_CAST_INDIRECT_PTR(struct - acpi_table_header, - &acpi_gbl_FACS)); -return (status); + (void )acpi_get_table_by_index (ACPI_TABLE_INDEX_FACS , + ACPI_CAST_INDIRECT_PTR(struct + acpi_table_header, + &facs32)); + (void )acpi_get_table_by_index (ACPI_TABLE_INDEX_X_FACS , + ACPI_CAST_INDIRECT_PTR(struct + acpi_table_header, + &facs64)); + +if (acpi_gbl_use32_bit_facs_addresses) { + acpi_gbl_FACS = facs32 ? facs32 : facs64; + }else { + acpi_gbl_FACS = facs64 ? facs64 : facs32; + } + +return (AE_OK ); }#endif /* !ACPI_REDUCED_HARDWARE */ @@ -101,7 +113,7 @@ acpi_status acpi_tb_initialize_facs(voidu8 acpi_tb_tables_loaded (void ) { -if (acpi_gbl_root_table_list.current_table_count >=3 ) { +if (acpi_gbl_root_table_list.current_table_count >=4 ) {return (TRUE); }@@ -357,11 +369,11 @@ acpi_status __init acpi_tb_parse_root_ta table_entry =ACPI_ADD_PTR (u8, table,sizeof (struct acpi_table_header ));/* -* First two entries in the table array are reserved for the DSDT -* and FACS, which are not actually present in the RSDT/XSDT - they -* come from the FADT +* First three entries in the table array are reserved for the DSDT +* and 32bit/64bit FACS, which are not actually present in the +* RSDT/XSDT - they come from the FADT */ - acpi_gbl_root_table_list.current_table_count =2 ; + acpi_gbl_root_table_list.current_table_count =3 ;/* Initialize the root table array from the RSDT/XSDT */ drivers/acpi/acpica/tbxfload.c +2
-1@@ -166,7 +166,8 @@ static acpi_status acpi_tb_load_namespac (void )acpi_ut_acquire_mutex (ACPI_MTX_TABLES );for (i =0 ; i < acpi_gbl_root_table_list.current_table_count; ++i) { - if ((!ACPI_COMPARE_NAME + if (!acpi_gbl_root_table_list.tables[i].address || + (!ACPI_COMPARE_NAME (&(acpi_gbl_root_table_list.tables[i].signature), ACPI_SIG_SSDT) &&include/acpi/acpixf.h +10
-0@@ -200,6 +200,15 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_do_not_useACPI_INIT_GLOBAL (u8, acpi_gbl_use32_bit_fadt_addresses, TRUE);/* +* Optionally use 32-bit FACS table addresses. +* It is reported that some platforms fail to resume from system +suspending +* if 64-bit FACS table address is selected: +* https://bugzilla.kernel.org/show_bug.cgi?id=74021 +* Default is TRUE, favor the 32-bit addresses. +*/ +ACPI_INIT_GLOBAL (u8, acpi_gbl_use32_bit_facs_addresses, TRUE); + +/* * Optionally truncate I/O addresses to 16 bits. Provides compatibility * with other ACPI implementations. NOTE: During ACPICA initialization, * this value is set to TRUE if any Windows OSI strings have been
Greg Kroah-Hartman
maintainerPATCH 64/267 media: Fix regression in some more dib0700 based devices
In reply to Greg Kroah-Hartman4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Reitmayr <[email protected]>
commit e989a73ebd09d22c22ead51fa363a2f56f70f28a upstream.
Fix an oops during device initialization by correctly setting size_of_priv instead of leaving it 0.
The regression was introduced by 8abe4a0a3f6d4217b16a ("[media] dib7000:
export just one symbol") and only fixed for one type of dib0700 based devices in 9e334c75642b6e5bfb95 ("[media] Fix regression in some dib0700 based devices").
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=92301
--- drivers/media/usb/dvb-usb/dib0700_devices.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/media/usb/dvb-usb/dib0700_devices.c +6 -0
@@ -3944,6 +3944,8 @@ struct dvb_usb_device_properties dib0700 DIB0700_DEFAULT_STREAMING_CONFIG(0x02), }}, + .size_of_priv =sizeof (struct + dib0700_adapter_state), }, { .num_frontends = 1, .fe = {{
@@ -3956,6 +3958,8 @@ struct dvb_usb_device_properties dib0700 DIB0700_DEFAULT_STREAMING_CONFIG(0x03), }}, + .size_of_priv =sizeof (struct + dib0700_adapter_state), } },
@@ -4009,6 +4013,8 @@ struct dvb_usb_device_properties dib0700 DIB0700_DEFAULT_STREAMING_CONFIG(0x02), }}, + .size_of_priv =sizeof (struct + dib0700_adapter_state), }, },
Greg Kroah-Hartman
maintainerRe: [PATCH 4.1 209/267] ACPICA: Tables: Enable both 32-bit and 64-bit FACS
In reply to Moore, RobertQuoted 2 lines · Robert
This particular patch is not stable. Lv has fixed it and a new patch is forthcoming, at least a patch on top of this.
If it's not in Linus's tree yet, nothing I can do about it. Please provide the git commit id for that patch when it happens.
thanks,
greg k-h
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.1.4 release. There are 267 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun Aug 2 19:39:27 UTC 2015. Anything received after that time might be too late.
Build results:
total: 141 pass: 141 fail: 0 Qemu test results: total: 33 pass: 33 fail: 0
Details are available at http://server.roeck-us.net:8010/builders.
Guenter
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.1.4 release. There are 267 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun Aug 2 19:39:27 UTC 2015. Anything received after that time might be too late.
Compiled and booted on x86_32. No errors in dmesg.
regards
sudip
Greg Kroah-Hartman
maintainerQuoted 10 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.1.4 release. There are 267 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun Aug 2 19:39:27 UTC 2015. Anything received after that time might be too late.
Quoted 6 lines
Build results:
total: 141 pass: 141 fail: 0 Qemu test results: total: 33 pass: 33 fail: 0Details are available at http://server.roeck-us.net:8010/builders.
Thanks for testing all of these and letting me know.
greg k-h
Greg Kroah-Hartman
maintainerQuoted 10 lines · Sudip Mukherjee
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.1.4 release. There are 267 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun Aug 2 19:39:27 UTC 2015. Anything received after that time might be too late.
Compiled and booted on
x86_32. No errors in dmesg.
Thanks for testing all 3 of these and letting me know.
greg k-h
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.1.4 release. There are 267 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 7 lines
Responses should be made by Sun Aug 2 19:39:27 UTC 2015. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.1.4-rc1.gzand the diffstat can be found below.
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Signature · 5 lines
Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) [email protected] | (970) 217-8978
Greg Kroah-Hartman
maintainerQuoted 9 lines · Shuah Khan
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.1.4 release. There are 267 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun Aug 2 19:39:27 UTC 2015. Anything received after that time might be too late.
Quoted 6 lines
Quoted 4 lines
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.1.4-rc1.gzand the diffstat can be found below.
Compiled and booted on my test system. No dmesg regressions.
Thanks for testing all of these and letting me know.
greg k-h
Re: [PATCH 4.1 099/267] phy: twl4030-usb: remove incorrect pm_runtime_get_sync() in probe function.
In reply to Greg Kroah-HartmanHello,
this patch killed the musb-host functionality on my classic Beagleboard (rev c4). Symptom was that it there was a message I don't remember and the attached device didn't enumerate anymore (likely because of missing power, but I'm not sure).
A simple revert has fixed it, I haven't looked further into the problem.
Regards,
Alexander Holler
Am 31.07.2015 um 21:39 schrieb Greg Kroah-Hartman:
Quoted 42 lines
4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit
4724e27114c4a7eceeee07db227a17fcab6f165cupstream.The USB phy should initialize with power-off, and will be powered on by the USB system when a cable connection is detected.
Having this
pm_runtime_get_sync()during probe causes the phy to *always* be powered on.
Removing it returns to sensible power management.Fixes 96be39ab34b77c6f6f5cd6ae03aac6c6449ee5c4Signed-off-by NeilBrown <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/phy/phy-twl4030-usb.c | 1 - 1 file changed, 1 deletion(-)drivers/phy/phy-twl4030-usb.c +0
-2@@ -711,7 +711,6 @@ static int twl4030_usb_probe(struct platpm_runtime_use_autosuspend (&pdev->dev);pm_runtime_set_autosuspend_delay (&pdev->dev,2000 );pm_runtime_enable (&pdev->dev); -pm_runtime_get_sync (&pdev->dev);/* Our job is to use irqs and status from the power module * to keep the transceiver disabled when nothing's connected. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4.1 099/267] phy: twl4030-usb: remove incorrect pm_runtime_get_sync() in probe function.
Quoted 8 lines · Alexander Holler
Hello,
this patch killed the musb-host functionality on my classic Beagleboard (rev c4). Symptom was that it there was a message I don't remember and the attached device didn't enumerate anymore (likely because of missing power, but I'm not sure).
A simple revert has fixed it, I haven't looked further into the problem.
Neil Brown, how was this tested?
-Kishon
Quoted 49 lines
Regards,
Alexander Holler
Am 31.07.2015 um 21:39 schrieb Greg Kroah-Hartman:
Quoted 42 lines
4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit
4724e27114c4a7eceeee07db227a17fcab6f165cupstream.The USB phy should initialize with power-off, and will be powered on by the USB system when a cable connection is detected.
Having this
pm_runtime_get_sync()during probe causes the phy to *always* be powered on.
Removing it returns to sensible power management.Fixes 96be39ab34b77c6f6f5cd6ae03aac6c6449ee5c4Signed-off-by NeilBrown <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/phy/phy-twl4030-usb.c | 1 - 1 file changed, 1 deletion(-)drivers/phy/phy-twl4030-usb.c +0
-1@@ -711,7 +711,6 @@ static int twl4030_usb_probe(struct platpm_runtime_use_autosuspend (&pdev->dev);pm_runtime_set_autosuspend_delay (&pdev->dev,2000 );pm_runtime_enable (&pdev->dev); -pm_runtime_get_sync (&pdev->dev);/* Our job is to use irqs and status from the power module * to keep the transceiver disabled when nothing's connected. Signature · 5 lines
-- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4.1 099/267] phy: twl4030-usb: remove incorrect pm_runtime_get_sync() in probe function.
Quoted 5 lines · On Sat, 8 Aug 2015 12:18:55 +0530 Kishon Vijay Abraham I <[email protected]> wrote:
Quoted 2 lines · Alexander Holler
Hello,
Quoted 8 lines
Quoted 6 lines
this patch killed the musb-host functionality on my classic Beagleboard (rev c4). Symptom was that it there was a message I don't remember and the attached device didn't enumerate anymore (likely because of missing power, but I'm not sure).
A simple revert has fixed it, I haven't looked further into the problem.
Neil Brown, how was this tested?
Well, I have a board with an OMAP3 connected to a twl4030 for USB and I noted that it wasn't power-managed properly and when I made that change, it was. I don't recall the exact details
This is probably related to
Commit: 56301df6bcaa ("phy: twl4030-usb: make runtime pm more reliable.")
I certainly only tested with that patch in place.
Looking at the code again, I cannot see why I thought I needed the 4724e277 patch.
Devices are initialised as RPM_SUSPENDED with a usage count of zero (in pm_runtime_init) so when twl4030_usb_probe() calls pm_runtime_get_sync(), that will increase the usage_count to 1 and resume the device. Then it calls pm_runtime_put_autosuspend() which will (ultimately) drop the usage_count back to zero and suspend the device.
So it looks like I messed up, but I'm sure I must have had a reason for that patch. I'll try to do some testing later in the week and will report what I find.
NeilBrown
Quoted 52 lines
-Kishon
Quoted 49 lines
Regards,
Alexander Holler
Am 31.07.2015 um 21:39 schrieb Greg Kroah-Hartman:
Quoted 42 lines
4.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit
4724e27114c4a7eceeee07db227a17fcab6f165cupstream.The USB phy should initialize with power-off, and will be powered on by the USB system when a cable connection is detected.
Having this
pm_runtime_get_sync()during probe causes the phy to *always* be powered on.
Removing it returns to sensible power management.Fixes 96be39ab34b77c6f6f5cd6ae03aac6c6449ee5c4Signed-off-by NeilBrown <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/phy/phy-twl4030-usb.c | 1 - 1 file changed, 1 deletion(-)drivers/phy/phy-twl4030-usb.c +0
-1@@ -711,7 +711,6 @@ static int twl4030_usb_probe(struct platpm_runtime_use_autosuspend (&pdev->dev);pm_runtime_set_autosuspend_delay (&pdev->dev,2000 );pm_runtime_enable (&pdev->dev); -pm_runtime_get_sync (&pdev->dev);/* Our job is to use irqs and status from the power module * to keep the transceiver disabled when nothing's connected. Signature · 5 lines
-- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4.1 099/267] phy: twl4030-usb: remove incorrect pm_runtime_get_sync() in probe function.
Am 09.08.2015 um 11:00 schrieb NeilBrown:
Quoted 22 lines
Quoted 5 lines · On Sat, 8 Aug 2015 12:18:55 +0530 Kishon Vijay Abraham I <[email protected]> wrote:
Quoted 2 lines · Alexander Holler
Hello,
Quoted 8 lines
Quoted 6 lines
this patch killed the musb-host functionality on my classic Beagleboard (rev c4). Symptom was that it there was a message I don't remember and the attached device didn't enumerate anymore (likely because of missing power, but I'm not sure).
A simple revert has fixed it, I haven't looked further into the problem.
Neil Brown, how was this tested?
Well, I have a board with an OMAP3 connected to a twl4030 for USB and I noted that it wasn't power-managed properly and when I made that change, it was. I don't recall the exact details
Quoted 5 lines
This is probably related to
Commit:
56301df6bcaa("phy: twl4030-usb: make runtime pm more reliable.")I certainly only tested with that patch in place.
Cherry-Picking 56301df6bcaa instead of reverting d1221a608bd did the trick too. So it looks like 56301df6bcaa is indeed a prerequisit for d1221a608bd.
Therefor I suggest to feed 56301df6bcaa to the stable series (e.g. 4.1.6) too.
Regards,
Alexander Holler
Re: [PATCH 4.1 099/267] phy: twl4030-usb: remove incorrect pm_runtime_get_sync() in probe function.
Quoted 27 lines · On Sun, 9 Aug 2015 12:45:20 +0200 Alexander Holler <[email protected]> wrote:
Am 09.08.2015 um 11:00 schrieb NeilBrown:
Quoted 26 lines
Quoted 5 lines · On Sat, 8 Aug 2015 12:18:55 +0530 Kishon Vijay Abraham I <[email protected]> wrote:
Quoted 2 lines · Alexander Holler
Hello,
Quoted 8 lines
Quoted 6 lines
this patch killed the musb-host functionality on my classic Beagleboard (rev c4). Symptom was that it there was a message I don't remember and the attached device didn't enumerate anymore (likely because of missing power, but I'm not sure).
A simple revert has fixed it, I haven't looked further into the problem.
Neil Brown, how was this tested?
Well, I have a board with an OMAP3 connected to a twl4030 for USB and I noted that it wasn't power-managed properly and when I made that change, it was. I don't recall the exact details
This is probably related to
Commit:
56301df6bcaa("phy: twl4030-usb: make runtime pm more reliable.")
Quoted 9 lines
Quoted 1 line
I certainly only tested with that patch in place.
Cherry-Picking
56301df6bcaainstead of revertingd1221a608bddid the trick too. So it looks like56301df6bcaais indeed a prerequisit ford1221a608bd.Therefor I suggest to feed
56301df6bcaato the stable series (e.g. 4.1.6) too.
The reality is ... more complicated.
I had a close look at how refcounts are inc/dec for the twl4030 phy.
With the current mainline code (plus my twl4030 charger enhancements, which are not deeply relevant), the refcount does go to zero when nothing is plugged in, and goes to 2 when a regular USB cable is plugged in.
The two counts come from twl4030_usb_irq and twl4030_charger_enable_usb, which is what I would expect.
However at the end of twl4030_usb_probe, the count goes to -1 !!! because of the pm_runtime_put_autosuspend, which no longer has a balancing pm_runtime_get() - which I really shouldn't have removed.
The extra refcount that I saw before and blamed on that pm_runtime_get() actually comes from a phy_power_on() call in omap2430_musb_init.
omap2430_musb_init() calls phy_power_on(), and doesn't call phy_power_off() until omap2430_musb_exit().
So it tries to keep the phy on the entire time that the module is loaded.
Do we want to just remove the phy_power_on() call from omap2430_musb_init()?
That seems to work for me, but may well break on other boards.
I think the best thing to do for -stable it to leave 56301df6bcaa out and revert the backport of d1221a608bd.
That will return to a state which, while not perfect, at least is not a regression.
With that (older) code, the extra phy_power_on() call still increases the usage_count, but the irq_handler in the twl4030 phy driver will drop it down to zero without first increasing. So things work for the wrong reasons.
Felipe: you added the phy_power_on() call in
Commit: 3063a12be2b0 ("usb: musb: fix PHY power on/off")
Do we really want the phy to be on the whole time the modules is loaded? If not, how/when should the phy be powered down?
Thanks,
NeilBrown
Re: [PATCH 4.1 099/267] phy: twl4030-usb: remove incorrect pm_runtime_get_sync() in probe function.
Am 11.08.2015 um 10:29 schrieb NeilBrown:
Quoted 4 lines
With the current mainline code (plus my twl4030 charger enhancements, which are not deeply relevant), the refcount does go to zero when nothing is plugged in, and goes to 2 when a regular USB cable is plugged in.
Also I think it's just a little miswording (or extended typo), I'm not using a regular USB cable, but an OTG cable when using the host mode of the musb on the Beagleboard. Just to avoid confusion. Or do you talk about the client mode when it goes to 2?
Besides that, I'm sorry to not be of further help. My deeper knowledge about the musb sources in the kernel and u-boot (and the HW in question), has gone lost and I've currently no real reason to refresh that. ;)
Regards,
Alexander Holler
Re: [PATCH 4.1 099/267] phy: twl4030-usb: remove incorrect pm_runtime_get_sync() in probe function.
Quoted 11 lines · On Tue, 11 Aug 2015 23:34:17 +0200 Alexander Holler <[email protected]>…
Am 11.08.2015 um 10:29 schrieb NeilBrown:
Quoted 4 lines
With the current mainline code (plus my twl4030 charger enhancements, which are not deeply relevant), the refcount does go to zero when nothing is plugged in, and goes to 2 when a regular USB cable is plugged in.
Also I think it's just a little miswording (or extended typo), I'm not using a regular USB cable, but an OTG cable when using the host mode of the musb on the Beagleboard. Just to avoid confusion. Or do you talk about the client mode when it goes to 2?
With an OTG cable, the usage_count would probably got to '1' because the charger wouldn't be interested.
However the important point is that the usage_count goes to zero when no cable is plugged in.
Quoted 5 lines
Besides that, I'm sorry to not be of further help. My deeper knowledge about the musb sources in the kernel and u-boot (and the HW in question), has gone lost and I've currently no real reason to refresh that. ;)
Just reporting the problem is sometimes 90% for the bug fixed. I'm confident I know what is happening. What isn't clear is how best to fix it without breaking something else... I suspect Felipe can help with that.
Thanks,
NeilBrown
Re: [PATCH 4.1 099/267] phy: twl4030-usb: remove incorrect pm_runtime_get_sync() in probe function.
Hi,
Quoted 27 lines · NeilBrown
Quoted 11 lines · On Tue, 11 Aug 2015 23:34:17 +0200 Alexander Holler <[email protected]>…
Am 11.08.2015 um 10:29 schrieb NeilBrown:
Quoted 4 lines
With the current mainline code (plus my twl4030 charger enhancements, which are not deeply relevant), the refcount does go to zero when nothing is plugged in, and goes to 2 when a regular USB cable is plugged in.
Also I think it's just a little miswording (or extended typo), I'm not using a regular USB cable, but an OTG cable when using the host mode of the musb on the Beagleboard. Just to avoid confusion. Or do you talk about the client mode when it goes to 2?
With an OTG cable, the
usage_countwould probably got to '1' because the charger wouldn't be interested.However the important point is that the
usage_countgoes to zero when no cable is plugged in.Quoted 5 lines
Besides that, I'm sorry to not be of further help. My deeper knowledge about the musb sources in the kernel and u-boot (and the HW in question), has gone lost and I've currently no real reason to refresh that. ;)
Quoted 4 lines
Just reporting the problem is sometimes 90% for the bug fixed. I'm confident I know what is happening. What isn't clear is how best to fix it without breaking something else... I suspect Felipe can help with that.
It'll take me a while to be able to look at this. I don't have any platform with TWL4030 (IIRC, AM335x uses tps65218 instead). Besides, I have a slightly bigger problem to look at (MUSB + some hubs + CP2108 fails sometimes).
If I get some time, I'll try to have a look, but it might take a few weeks.
cheers
Signature · 1 line
balbi