3.14.6-stable review
Subsystems (11)
Greg Kroah-Hartman
maintainerPATCH 170/228 metag: Reduce maximum stack size to 256MB
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Hogan <[email protected]>
commit d71f290b4e98a39f49f2595a13be3b4d5ce8e1f1 upstream.
Specify the maximum stack size for arches where the stack grows upward (parisc and metag) in asm/processor.h rather than hard coding in fs/exec.c so that metag can specify a smaller value of 256MB rather than 1GB.
This fixes a BUG on metag if the RLIMIT_STACK hard limit is increased beyond a safe value by root. E.g. when starting a process after running "ulimit -H -s unlimited" it will then attempt to use a stack size of the maximum 1GB which is far too big for metag's limited user virtual address space (stack_top is usually 0x3ffff000):
BUG: failure at fs/exec.c:589/shift_arg_pages()!
--- arch/metag/include/asm/processor.h | 2 ++ arch/parisc/include/asm/processor.h | 2 ++ fs/exec.c | 6 +++--- 3 files changed, 7 insertions(+), 3 deletions(-)
arch/metag/include/asm/processor.h +2 -0
@@ -22,6 +22,8 @@/* Add an extra page of padding at the top of the stack for the guard page. */ #define STACK_TOP (TASK_SIZE - PAGE_SIZE)#define STACK_TOP_MAX STACK_TOP +/* Maximum virtual space for stack */ +#define STACK_SIZE_MAX (1 << 28)/* 256 MB */ /* This decides where the kernel will search for a free chunk of vm * space during mmap's.
arch/parisc/include/asm/processor.h +2 -0
@@ -55,6 +55,8 @@#define STACK_TOP TASK_SIZE#define STACK_TOP_MAX DEFAULT_TASK_SIZE +#define STACK_SIZE_MAX (1 << 30)/* 1 GB */ +#endif #ifndef __ASSEMBLY__
fs/exec.c +3 -3
@@ -654,10 +654,10 @@ int setup_arg_pages(struct linux_binprmunsigned long rlim_stack;#ifdef CONFIG_STACK_GROWSUP -/* Limit stack size to 1GB */ +/* Limit stack size */ stack_base =rlimit_max (RLIMIT_STACK ); -if (stack_base > (1 <<30 )) - stack_base =1 <<30 ; +if (stack_base >STACK_SIZE_MAX ) + stack_base =STACK_SIZE_MAX ;/* Make sure we didn't let the argument array grow too large. */ if (vma->vm_end - vma->vm_start > stack_base)
Greg Kroah-Hartman
maintainerPATCH 171/228 x86-64, modify_ldt: Make support for 16-bit segments a runtime option
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit fa81511bb0bbb2b1aace3695ce869da9762624ff upstream.
Checkin:
b3b42ac2cbae x86-64, modify_ldt: Ban 16-bit segments on 64-bit kernels
disabled 16-bit segments on 64-bit kernels due to an information leak. However, it does seem that people are genuinely using Wine to run old 16-bit Windows programs on Linux.
A proper fix for this ("espfix64") is coming in the upcoming merge window, but as a temporary fix, create a sysctl to allow the administrator to re-enable support for 16-bit segments.
It adds a "/proc/sys/abi/ldt16" sysctl that defaults to zero (off). If you hit this issue and care about your old Windows program more than you care about a kernel stack address information leak, you can do
echo 1 > /proc/sys/abi/ldt16
as root (add it to your startup scripts), and you should be ok.
The sysctl table is only added if you have COMPAT support enabled on x86-64, but I assume anybody who runs old windows binaries very much does that ;)
--- arch/x86/kernel/ldt.c | 4 +++- arch/x86/vdso/vdso32-setup.c | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-)
arch/x86/kernel/ldt.c +3 -1
@@ -20,6 +20,8 @@#include <asm/mmu_context.h> #include <asm/syscalls.h> +int sysctl_ldt16 =0 ; +#ifdef CONFIG_SMP static void flush_ldt (void *current_mm) {
@@ -234,7 +236,7 @@ static int write_ldt(void __user *ptr, u* IRET leaking the high bits of the kernel stack address. */ #ifdef CONFIG_X86_64 -if (!ldt_info.seg_32bit) { +if (!ldt_info.seg_32bit && !sysctl_ldt16) { error = -EINVAL ; goto out_unlock; }
arch/x86/vdso/vdso32-setup.c +8 -0
@@ -41,6 +41,7 @@ enum {#ifdef CONFIG_X86_64 #define vdso_enabled sysctl_vsyscall32#define arch_setup_additional_pages syscall32_setup_pages +extern int sysctl_ldt16;#endif /*
@@ -379,6 +380,13 @@ static struct ctl_table abi_table2[] = { .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec + }, + { + .procname = "ldt16", + .data = &sysctl_ldt16, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec }, {} };
Greg Kroah-Hartman
maintainerPATCH 172/228 genirq: Provide irq_force_affinity fallback for non-SMP
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 4c88d7f9b0d5fb0588c3386be62115cc2eaa8f9f upstream.
Patch 01f8fa4f01d "genirq: Allow forcing cpu affinity of interrupts" added an irq_force_affinity() function, and 30ccf03b4a6 "clocksource: Exynos_mct:
Use irq_force_affinity() in cpu bringup" subsequently uses it. However, the driver can be used with CONFIG_SMP disabled, but the function declaration is only available for CONFIG_SMP, leading to this build error:
drivers/clocksource/exynos_mct.c:431:3: error: implicit declaration of function 'irq_force_affinity' [-Werror=implicit-function-declaration]
irq_force_affinity(mct_irqs[MCT_L0_IRQ + cpu], cpumask_of(cpu));
This patch introduces a dummy helper function for the non-SMP case that always returns success, to get rid of the build error. Since the patches causing the problem are marked for stable backports, this one should be as well.
--- include/linux/interrupt.h | 5 +++++ 1 file changed, 5 insertions(+)
include/linux/interrupt.h +5 -0
@@ -271,6 +271,11 @@ static inline int irq_set_affinity(unsigreturn -EINVAL ; } +static inline int irq_force_affinity (unsigned int irq,const struct cpumask *cpumask) +{ +return 0 ; +} +static inline int irq_can_set_affinity (unsigned int irq) {return 0 ;
Greg Kroah-Hartman
maintainerPATCH 173/228 sysfs: make sure read buffer is zeroed
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit f5c16f29bf5e57ba4051fc7785ba7f035f798c71 upstream.
13c589d5b0ac ("sysfs: use seq_file when reading regular files") switched sysfs from custom read implementation to seq_file to enable later transition to kernfs. After the change, the buffer passed to ->show() is acquired through seq_get_buf(); unfortunately, this introduces a subtle behavior change. Before the commit, the buffer passed to ->show() was always zero as it was allocated using get_zeroed_page(). Because seq_file doesn't clear buffers on allocation and neither does seq_get_buf(), after the commit, depending on the behavior of ->show(), we may end up exposing uninitialized data to userland thus possibly altering userland visible behavior and leaking information.
Fix it by explicitly clearing the buffer.
--- fs/sysfs/file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/sysfs/file.c +2 -1
@@ -47,12 +47,13 @@ static int sysfs_kf_seq_show(struct seq_ssize_t count;char *buf; -/* acquire buffer and ensure that it's >= PAGE_SIZE */ +/* acquire buffer and ensure that it's >= PAGE_SIZE and clear */ count =seq_get_buf (sf, &buf);if (count <PAGE_SIZE ) {seq_commit (sf,-1 );return 0 ; } +memset (buf,0 ,PAGE_SIZE );/* * Invoke show(). Control may reach here via seq file lseek even
Greg Kroah-Hartman
maintainerPATCH 174/228 PCI: shpchp: Check bridges secondary (not primary) bus speed
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcel Apfelbaum <[email protected]>
commit 93fa9d32670f5592c8e56abc9928fc194e1e72fc upstream.
When a new device is added below a hotplug bridge, the bridge's secondary bus speed and the device's bus speed must match. The shpchp driver previously checked the bridge's *primary* bus speed, not the secondary bus speed.
This caused hot-add errors like:
shpchp 0000:00:03.0: Speed of bus ff and adapter 0 mismatch
Check the secondary bus speed instead.
--- drivers/pci/hotplug/shpchp_ctrl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/hotplug/shpchp_ctrl.c +2 -2
@@ -282,8 +282,8 @@ static int board_added(struct slot *p_slreturn WRONG_BUS_FREQUENCY ; } - bsp = ctrl->pci_dev->bus->cur_bus_speed; - msp = ctrl->pci_dev->bus->max_bus_speed; + bsp = ctrl->pci_dev->subordinate->cur_bus_speed; + msp = ctrl->pci_dev->subordinate->max_bus_speed;/* Check if there are other slots or devices on the same bus */ if (!list_empty (&ctrl->pci_dev->subordinate->devices))
Greg Kroah-Hartman
maintainerPATCH 175/228 target: Allow non-supporting backends to set pi_prot_type to 0
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Grover <[email protected]>
commit 448ba904160f9d8f69217c28a1692cee5afbff88 upstream.
Userspace tools assume if a value is read from configfs, it is valid and will not cause an error if the same value is written back. The only valid value for pi_prot_type for backends not supporting DIF is 0, so allow this particular value to be set without returning an error.
--- drivers/target/target_core_device.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/target/target_core_device.c +4 -0
@@ -936,6 +936,10 @@ int se_dev_set_pi_prot_type(struct se_dereturn 0 ; }if (!dev->transport->init_prot || !dev->transport->free_prot) { +/* 0 is only allowed value for non-supporting backends */ +if (flag ==0 ) +return 0 ; +pr_err ("DIF protection not supported by backend: %s\n" , dev->transport->name);return -ENOSYS ;
Greg Kroah-Hartman
maintainerPATCH 176/228 Target/iser: Fix wrong connection requests list addition
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sagi Grimberg <[email protected]>
commit 9fe63c88b1d59f1ce054d6948ccd3096496ecedb upstream.
Should be adding list_add_tail($new, $head) and not the other way around.
--- drivers/infiniband/ulp/isert/ib_isert.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/ulp/isert/ib_isert.c +1 -1
@@ -582,7 +582,7 @@ isert_connect_request(struct rdma_cm_id goto out_conn_dev;mutex_lock (&isert_np->np_accept_mutex); -list_add_tail (&isert_np->np_accept_list, &isert_conn->conn_accept_node); +list_add_tail (&isert_conn->conn_accept_node, &isert_np->np_accept_list);mutex_unlock (&isert_np->np_accept_mutex);pr_debug ("isert_connect_request() waking up np_accept_wq: %p\n" , np);
Greg Kroah-Hartman
maintainerPATCH 177/228 Target/iser: Fix iscsit_accept_np and rdma_cm racy flow
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sagi Grimberg <[email protected]>
commit 531b7bf4bd795d9a09eac92504322a472c010bc8 upstream.
RDMA CM and iSCSI target flows are asynchronous and completely uncorrelated. Relying on the fact that iscsi_accept_np will be called after CM connection request event and will wait for it is a mistake.
When attempting to login to a few targets this flow is racy and unpredictable, but for parallel login to dozens of targets will race and hang every time.
The correct synchronizing mechanism in this case is pending on a semaphore rather than a wait_for_event. We keep the pending interruptible for iscsi_np cleanup stage.
(Squash patch to remove dead code into parent - nab)
--- drivers/infiniband/ulp/isert/ib_isert.c | 25 ++++++------------------- drivers/infiniband/ulp/isert/ib_isert.h | 2 +- 2 files changed, 7 insertions(+), 20 deletions(-)
drivers/infiniband/ulp/isert/ib_isert.c +6 -19
@@ -28,6 +28,7 @@#include <target/target_core_base.h> #include <target/target_core_fabric.h> #include <target/iscsi/iscsi_transport.h> +#include <linux/semaphore.h> #include "isert_proto.h" #include "ib_isert.h"
@@ -585,8 +586,8 @@ isert_connect_request(struct rdma_cm_idlist_add_tail (&isert_conn->conn_accept_node, &isert_np->np_accept_list);mutex_unlock (&isert_np->np_accept_mutex); -pr_debug ("isert_connect_request() waking up np_accept_wq: %p\n" , np); -wake_up (&isert_np->np_accept_wq); +pr_debug ("isert_connect_request() up np_sem np: %p\n" , np); +up (&isert_np->np_sem);return 0 ; out_conn_dev:
@@ -2569,7 +2570,7 @@ isert_setup_np(struct iscsi_np *np,pr_err ("Unable to allocate struct isert_np\n" );return -ENOMEM ; } -init_waitqueue_head (&isert_np->np_accept_wq); +sema_init (&isert_np->np_sem,0 );mutex_init (&isert_np->np_accept_mutex);INIT_LIST_HEAD (&isert_np->np_accept_list);init_completion (&isert_np->np_login_comp);
@@ -2618,18 +2619,6 @@ out: }static int -isert_check_accept_queue (struct isert_np *isert_np) -{ -int empty; - -mutex_lock (&isert_np->np_accept_mutex); - empty =list_empty (&isert_np->np_accept_list); -mutex_unlock (&isert_np->np_accept_mutex); - -return empty; -} - -static int isert_rdma_accept (struct isert_conn *isert_conn) {struct rdma_cm_id *cm_id = isert_conn->conn_cm_id;
@@ -2721,16 +2710,14 @@ isert_accept_np(struct iscsi_np *np, strint max_accept =0 , ret; accept_wait: - ret =wait_event_interruptible (isert_np->np_accept_wq, - !isert_check_accept_queue (isert_np) || - np->np_thread_state ==ISCSI_NP_THREAD_RESET ); + ret =down_interruptible (&isert_np->np_sem);if (max_accept >5 )return -ENODEV ;spin_lock_bh (&np->np_thread_lock);if (np->np_thread_state ==ISCSI_NP_THREAD_RESET ) {spin_unlock_bh (&np->np_thread_lock); -pr_err ("ISCSI_NP_THREAD_RESET for isert_accept_np\n" ); +pr_debug ("ISCSI_NP_THREAD_RESET for isert_accept_np\n" );return -ENODEV ; }spin_unlock_bh (&np->np_thread_lock);
drivers/infiniband/ulp/isert/ib_isert.h +1 -1
@@ -158,7 +158,7 @@ struct isert_device { };struct isert_np { -wait_queue_head_t np_accept_wq; +struct semaphore np_sem;struct rdma_cm_id *np_cm_id;struct mutex np_accept_mutex;struct list_head np_accept_list;
Greg Kroah-Hartman
maintainerPATCH 178/228 iscsi-target: Change BUG_ON to REJECT in iscsit_process_nop_out
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit 7cbfcc953789ff864c2bf8365a82a3fba4869649 upstream.
This patch changes an incorrect use of BUG_ON to instead generate a REJECT + PROTOCOL_ERROR in iscsit_process_nop_out() code. This case can occur with traditional TCP where a flood of zeros in the data stream can reach this block for what is presumed to be a NOP-OUT with a solicited reply, but without a valid iscsi_cmd pointer.
This incorrect BUG_ON was introduced during the v3.11-rc timeframe with the following commit:
commit 778de368964c5b7e8100cde9f549992d521e9c89
Author: Nicholas Bellinger <[email protected]> Date: Fri Jun 14 16:07:47 2013 -0700
iscsi/isert-target: Refactor ISCSI_OP_NOOP RX handling
--- drivers/target/iscsi/iscsi_target.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/target/iscsi/iscsi_target.c +3 -1
@@ -1564,7 +1564,9 @@ int iscsit_process_nop_out(struct iscsi_* Initiator is expecting a NopIN ping reply.. */ if (hdr->itt !=RESERVED_ITT ) { -BUG_ON (!cmd); +if (!cmd) +return iscsit_add_reject (conn,ISCSI_REASON_PROTOCOL_ERROR , + (unsigned char *)hdr);spin_lock_bh (&conn->cmd_lock);list_add_tail (&cmd->i_conn_node, &conn->conn_cmd_list);
Greg Kroah-Hartman
maintainerPATCH 179/228 target: Dont allow setting WC emulation if device doesnt support
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Grover <[email protected]>
commit 07b8dae38b09bcfede7e726f172e39b5ce8390d9 upstream.
Just like for pSCSI, if the transport sets get_write_cache, then it is not valid to enable write cache emulation for it. Return an error.
see https://bugzilla.redhat.com/show_bug.cgi?id=1082675
--- drivers/target/target_core_device.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/target/target_core_device.c +4 -4
@@ -798,10 +798,10 @@ int se_dev_set_emulate_write_cache(strucpr_err ("emulate_write_cache not supported for pSCSI\n" );return -EINVAL ; } -if (dev->transport->get_write_cache) { -pr_warn ("emulate_write_cache cannot be changed when underlying" -" HW reports WriteCacheEnabled, ignoring request\n" ); -return 0 ; +if (flag && + dev->transport->get_write_cache) { +pr_err ("emulate_write_cache not supported for this device\n" ); +return -EINVAL ; } dev->dev_attrib.emulate_write_cache = flag;
Greg Kroah-Hartman
maintainerPATCH 180/228 target: fix memory leak on XCOPY
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 1e1110c43b1cda9fe77fc4a04835e460550e6b3c upstream.
On each processed XCOPY command, two "kmalloc-512" memory objects are leaked. These represent two allocations of struct xcopy_pt_cmd in target_core_xcopy.c.
The reason for the memory leak is that the cmd_kref field is not initialized (thus, it is zero because the allocations were done with kzalloc). When we decrement zero kref in target_put_sess_cmd, the result is not zero, thus target_release_cmd_kref is not called.
This patch fixes the bug by moving kref initialization from target_get_sess_cmd to transport_init_se_cmd (this function is called from target_core_xcopy.c, so it will correctly initialize cmd_kref). It can be easily verified that all code that calls target_get_sess_cmd also calls transport_init_se_cmd earlier, thus moving kref_init shouldn't introduce any new problems.
--- drivers/target/target_core_transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/target/target_core_transport.c +1 -1
@@ -1102,6 +1102,7 @@ void transport_init_se_cmd(init_completion (&cmd->cmd_wait_comp);init_completion (&cmd->task_stop_comp);spin_lock_init (&cmd->t_state_lock); +kref_init (&cmd->cmd_kref); cmd->transport_state =CMD_T_DEV_ACTIVE ; cmd->se_tfo = tfo;
@@ -2292,7 +2293,6 @@ int target_get_sess_cmd(struct se_sessiounsigned long flags;int ret =0 ; -kref_init (&se_cmd->cmd_kref);/* * Add a second kref if the fabric caller is expecting to handle * fabric acknowledgement that requires two target_put_sess_cmd()
Greg Kroah-Hartman
maintainerPATCH 182/228 drm/i915: move power domain init earlier during system resume
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Imre Deak <[email protected]>
This is commit 76c4b250080fff6e4befaa36199424 upstream.
During resume the intel hda audio driver depends on the i915 driver reinitializing the audio power domain. Since the order of calling the i915 resume handler wrt. that of the audio driver is not guaranteed, move the power domain reinitialization step to the resume_early handler. This is guaranteed to run before the resume handler of any other driver.
The power domain initialization in turn requires us to enable the i915 pci device first, so move that part earlier too.
Accordingly disabling of the i915 pci device should happen after the audio suspend handler ran. So move the disabling later from the i915 resume handler to the resume_late handler.
v2:
- move intel_uncore_sanitize/early_sanitize earlier too, so they don't get reordered wrt. intel_power_domains_init_hw()
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76152
[danvet: Fix "Should it be static?" sparse warning reported by Wu Fengguang's kbuilder.]
--- drivers/gpu/drm/i915/i915_drv.c | 90 +++++++++++++++++++++++++++++++++------- 1 file changed, 75 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +75 -15
@@ -614,15 +614,20 @@ static void intel_resume_hotplug(structdrm_helper_hpd_irq_event (dev); } +static int i915_drm_thaw_early (struct drm_device *dev) +{ +intel_uncore_early_sanitize (dev); +intel_uncore_sanitize (dev); +intel_power_domains_init_hw (dev); + +return 0 ; +} +static int __i915_drm_thaw (struct drm_device *dev,bool restore_gtt_mappings) {struct drm_i915_private *dev_priv = dev->dev_private;int error =0 ; -intel_uncore_early_sanitize (dev); - -intel_uncore_sanitize (dev); -if (drm_core_check_feature (dev,DRIVER_MODESET ) && restore_gtt_mappings) {mutex_lock (&dev->struct_mutex);
@@ -630,8 +635,6 @@ static int __i915_drm_thaw(struct drm_demutex_unlock (&dev->struct_mutex); } -intel_power_domains_init_hw (dev); -i915_restore_state (dev);intel_opregion_setup (dev);
@@ -700,19 +703,33 @@ static int i915_drm_thaw(struct drm_devireturn __i915_drm_thaw (dev, true); } -int i915_resume (struct drm_device *dev) +static int i915_resume_early (struct drm_device *dev) { -struct drm_i915_private *dev_priv = dev->dev_private; -int ret; -if (dev->switch_power_state ==DRM_SWITCH_POWER_OFF )return 0 ; +/* +* We have a resume ordering issue with the snd-hda driver also +* requiring our device to be power up. Due to the lack of a +* parent/child relationship we currently solve this with an early +* resume hook. +* +* FIXME: This should be solved with a special hdmi sink device or +* similar so that power domains can be employed. +*/ if (pci_enable_device (dev->pdev))return -EIO ;pci_set_master (dev->pdev); +return i915_drm_thaw_early (dev); +} + +int i915_resume (struct drm_device *dev) +{ +struct drm_i915_private *dev_priv = dev->dev_private; +int ret; +/* * Platforms with opregion should have sane BIOS, older ones (gen3 and * earlier) need to restore the GTT mappings since the BIOS might clear
@@ -726,6 +743,14 @@ int i915_resume(struct drm_device *dev)return 0 ; } +static int i915_resume_legacy (struct drm_device *dev) +{ +i915_resume_early (dev); +i915_resume (dev); + +return 0 ; +} +/** * i915_reset - reset chip after a hang * @dev: drm device to reset
@@ -846,7 +871,6 @@ static int i915_pm_suspend(struct device {struct pci_dev *pdev =to_pci_dev (dev);struct drm_device *drm_dev =pci_get_drvdata (pdev); -int error;if (!drm_dev || !drm_dev->dev_private) {dev_err (dev,"DRM not initialized, aborting suspend.\n" );
@@ -856,9 +880,25 @@ static int i915_pm_suspend(struct deviceif (drm_dev->switch_power_state ==DRM_SWITCH_POWER_OFF )return 0 ; - error =i915_drm_freeze (drm_dev); -if (error) -return error; +return i915_drm_freeze (drm_dev); +} + +static int i915_pm_suspend_late (struct device *dev) +{ +struct pci_dev *pdev =to_pci_dev (dev); +struct drm_device *drm_dev =pci_get_drvdata (pdev); + +/* +* We have a suspedn ordering issue with the snd-hda driver also +* requiring our device to be power up. Due to the lack of a +* parent/child relationship we currently solve this with an late +* suspend hook. +* +* FIXME: This should be solved with a special hdmi sink device or +* similar so that power domains can be employed. +*/ +if (drm_dev->switch_power_state ==DRM_SWITCH_POWER_OFF ) +return 0 ;pci_disable_device (pdev);pci_set_power_state (pdev, PCI_D3hot);
@@ -866,6 +906,14 @@ static int i915_pm_suspend(struct devicereturn 0 ; } +static int i915_pm_resume_early (struct device *dev) +{ +struct pci_dev *pdev =to_pci_dev (dev); +struct drm_device *drm_dev =pci_get_drvdata (pdev); + +return i915_resume_early (drm_dev); +} +static int i915_pm_resume (struct device *dev) {struct pci_dev *pdev =to_pci_dev (dev);
@@ -887,6 +935,14 @@ static int i915_pm_freeze(struct devicereturn i915_drm_freeze (drm_dev); } +static int i915_pm_thaw_early (struct device *dev) +{ +struct pci_dev *pdev =to_pci_dev (dev); +struct drm_device *drm_dev =pci_get_drvdata (pdev); + +return i915_drm_thaw_early (drm_dev); +} +static int i915_pm_thaw (struct device *dev) {struct pci_dev *pdev =to_pci_dev (dev);
@@ -948,10 +1004,14 @@ static int i915_runtime_resume(struct destatic const struct dev_pm_ops i915_pm_ops = { .suspend = i915_pm_suspend, + .suspend_late = i915_pm_suspend_late, + .resume_early = i915_pm_resume_early, .resume = i915_pm_resume, .freeze = i915_pm_freeze, + .thaw_early = i915_pm_thaw_early, .thaw = i915_pm_thaw, .poweroff = i915_pm_poweroff, + .restore_early = i915_pm_resume_early, .restore = i915_pm_resume, .runtime_suspend = i915_runtime_suspend, .runtime_resume = i915_runtime_resume,
@@ -994,7 +1054,7 @@ static struct drm_driver driver = {/* Used in place of i915_pm_ops for non-DRIVER_MODESET */ .suspend = i915_suspend, - .resume = i915_resume, + .resume = i915_resume_legacy, .device_is_agp = i915_driver_device_is_agp, .master_create = i915_master_create,
Greg Kroah-Hartman
maintainerPATCH 183/228 drm/i915: Fix unsafe loop iteration over vma whilst unbinding them
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Wilson <[email protected]>
This is commit df6f783a4ef6790780a67c491897ac upstream.
On non-LLC platforms, when changing the cache level of an object, we may need to unbind it so that prefetching across page boundaries does not cross into a different memory domain. This requires us to unbind conflicting vma, but we did so iterating over the objects vma in an unsafe manner (as the list was being modified as we iterated).
The regression was introduced in
commit 3089c6f239d7d2c4cb2dd5c353e8984cf79af1d7
Author: Ben Widawsky <[email protected]> Date: Wed Jul 31 17:00:03 2013 -0700
drm/i915: make caching operate on all address spaces
apparently as far back as v3.12-rc1, but it has only just begun to trigger real world bug reports.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76384
--- drivers/gpu/drm/i915/i915_gem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +2 -2
@@ -3529,7 +3529,7 @@ int i915_gem_object_set_cache_level(stru {struct drm_device *dev = obj->base.dev;drm_i915_private_t *dev_priv = dev->dev_private; -struct i915_vma *vma; +struct i915_vma *vma, *next;int ret;if (obj->cache_level == cache_level)
@@ -3540,7 +3540,7 @@ int i915_gem_object_set_cache_level(strureturn -EBUSY ; } -list_for_each_entry (vma, &obj->vma_list, vma_link) { +list_for_each_entry_safe (vma, next, &obj->vma_list, vma_link) {if (!i915_gem_valid_gtt_space (dev, &vma->node, cache_level)) { ret =i915_vma_unbind (vma);if (ret)
Greg Kroah-Hartman
maintainerPATCH 185/228 iwlwifi: mvm: BT Coex - fix Look Up Table
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
commit a6bc92803e7f765e02c923cf37c8e280e729642a upstream.
A few entries were wrong and this caused throughput issues.
--- drivers/net/wireless/iwlwifi/mvm/bt-coex.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/wireless/iwlwifi/mvm/bt-coex.c +6 -6
@@ -188,7 +188,7 @@ static const __le32 iwl_combined_lookup[cpu_to_le32 (0xcc00aaaa ),cpu_to_le32 (0x0000aaaa ),cpu_to_le32 (0xc0004000 ), -cpu_to_le32 (0x00000000 ), +cpu_to_le32 (0x00004000 ),cpu_to_le32 (0xf0005000 ), cpu_to_le32(0xf0005000), },
@@ -211,16 +211,16 @@ static const __le32 iwl_combined_lookup[/* Tx Tx disabled */ cpu_to_le32(0xaaaaaaaa), cpu_to_le32(0xaaaaaaaa), - cpu_to_le32(0xaaaaaaaa), + cpu_to_le32(0xeeaaaaaa), cpu_to_le32(0xaaaaaaaa), cpu_to_le32(0xcc00ff28), cpu_to_le32(0x0000aaaa), cpu_to_le32(0xcc00aaaa), cpu_to_le32(0x0000aaaa), - cpu_to_le32(0xC0004000), - cpu_to_le32(0xC0004000), - cpu_to_le32(0xF0005000), - cpu_to_le32(0xF0005000), + cpu_to_le32(0xc0004000), + cpu_to_le32(0xc0004000), + cpu_to_le32(0xf0005000), + cpu_to_le32(0xf0005000), }, };
Greg Kroah-Hartman
maintainerPATCH 186/228 PCI: Wrong register used to check pending traffic
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gavin Shan <[email protected]>
commit d0b4cc4e32705ff00d90d32da7783c266c702c04 upstream.
The incorrect register offset is passed to pci_wait_for_pending(), which is caused by commit 157e876ffe ("PCI: Add pci_wait_for_pending() (refactor pci_wait_for_pending_transaction())").
--- drivers/pci/pci.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/pci/pci.c +3 -2
@@ -3043,7 +3043,8 @@ int pci_wait_for_pending_transaction(strif (!pci_is_pcie (dev))return 1 ; -return pci_wait_for_pending (dev,PCI_EXP_DEVSTA ,PCI_EXP_DEVSTA_TRPND ); +return pci_wait_for_pending (dev,pci_pcie_cap (dev) +PCI_EXP_DEVSTA , +PCI_EXP_DEVSTA_TRPND ); }EXPORT_SYMBOL (pci_wait_for_pending_transaction);
@@ -3085,7 +3086,7 @@ static int pci_af_flr(struct pci_dev *dereturn 0 ;/* Wait for Transaction Pending bit clean */ -if (pci_wait_for_pending (dev,PCI_AF_STATUS ,PCI_AF_STATUS_TP )) +if (pci_wait_for_pending (dev, pos +PCI_AF_STATUS ,PCI_AF_STATUS_TP )) goto clear; dev_err(&dev->dev, "transaction is not cleared; "
Re: [PATCH 3.14 186/228] PCI: Wrong register used to check pending traffic
Quoted 35 lines · Greg Kroah-Hartman
3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gavin Shan <[email protected]>
commit
d0b4cc4e32705ff00d90d32da7783c266c702c04upstream.The incorrect register offset is passed to
pci_wait_for_pending(), which is caused by commit157e876ffe("PCI: Addpci_wait_for_pending()(refactorpci_wait_for_pending_transaction())").Fixes 157e876ffe ("PCI: Add pci_wait_for_pending() (refactor pci_wait_for_pending_transaction())Signed-off-by Gavin Shan <[email protected]>Signed-off-by Bjorn Helgaas <[email protected]>Acked-by Alex Williamson <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/pci/pci.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/pci/pci.c +2
-1@@ -3043,7 +3043,8 @@ int pci_wait_for_pending_transaction(strif (!pci_is_pcie (dev))return 1 ; -return pci_wait_for_pending (dev,PCI_EXP_DEVSTA ,PCI_EXP_DEVSTA_TRPND ); +return pci_wait_for_pending (dev,pci_pcie_cap (dev) +PCI_EXP_DEVSTA , +PCI_EXP_DEVSTA_TRPND ); }EXPORT_SYMBOL (pci_wait_for_pending_transaction);
drivers/pci/pci.c static int pci_af_flr(struct pci_dev *de · line 3092
Quoted 8 lines
drivers/pci/pci.c +1
-1@@ -3085,7 +3086,7 @@ static int pci_af_flr(struct pci_dev *dereturn 0 ;/* Wait for Transaction Pending bit clean */ -if (pci_wait_for_pending (dev,PCI_AF_STATUS ,PCI_AF_STATUS_TP )) +if (pci_wait_for_pending (dev, pos +PCI_AF_STATUS ,PCI_AF_STATUS_TP )) goto clear; dev_err(&dev->dev, "transaction is not cleared; "
This still seems to be broken because pci_wait_for_pending() does pci_read_config_word() but PCI_AF_STATUS is not word-aligned.
Ben.
Signature · 2 lines
Ben Hutchings Never attribute to conspiracy what can adequately be explained by stupidity.
Bjorn Helgaas
maintainerRe: [PATCH 3.14 186/228] PCI: Wrong register used to check pending traffic
Quoted 43 lines · Ben Hutchings
Quoted 42 lines · Greg Kroah-Hartman
3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gavin Shan <[email protected]>
commit
d0b4cc4e32705ff00d90d32da7783c266c702c04upstream.The incorrect register offset is passed to
pci_wait_for_pending(), which is caused by commit157e876ffe("PCI: Addpci_wait_for_pending()(refactorpci_wait_for_pending_transaction())").Fixes 157e876ffe ("PCI: Add pci_wait_for_pending() (refactor pci_wait_for_pending_transaction())Signed-off-by Gavin Shan <[email protected]>Signed-off-by Bjorn Helgaas <[email protected]>Acked-by Alex Williamson <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/pci/pci.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/pci/pci.c +3
-2@@ -3043,7 +3043,8 @@ int pci_wait_for_pending_transaction(strif (!pci_is_pcie (dev))return 1 ; -return pci_wait_for_pending (dev,PCI_EXP_DEVSTA ,PCI_EXP_DEVSTA_TRPND ); +return pci_wait_for_pending (dev,pci_pcie_cap (dev) +PCI_EXP_DEVSTA , +PCI_EXP_DEVSTA_TRPND ); }EXPORT_SYMBOL (pci_wait_for_pending_transaction);@@ -3085,7 +3086,7 @@ static int pci_af_flr(struct pci_dev *dereturn 0 ;/* Wait for Transaction Pending bit clean */ -if (pci_wait_for_pending (dev,PCI_AF_STATUS ,PCI_AF_STATUS_TP )) +if (pci_wait_for_pending (dev, pos +PCI_AF_STATUS ,PCI_AF_STATUS_TP )) goto clear;
Quoted 4 lines
drivers/pci/pci.c static int pci_af_flr(struct pci_dev *de · line 3092
Quoted 1 line
drivers/pci/pci.c +0
-0dev_err(&dev->dev, "transaction is not cleared; "This still seems to be broken because
pci_wait_for_pending()doespci_read_config_word()butPCI_AF_STATUSis not word-aligned.
I agree; this does seem broken. I think pci_read_config_word() will return PCIBIOS_BAD_REGISTER_NUMBER without updating the value returned, so I think we'll test garbage from the stack.
What do you think, Alex?
Bjorn
Re: [PATCH 3.14 186/228] PCI: Wrong register used to check pending traffic
Quoted 49 lines · Bjorn Helgaas
Quoted 43 lines · Ben Hutchings
Quoted 42 lines · Greg Kroah-Hartman
3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gavin Shan <[email protected]>
commit
d0b4cc4e32705ff00d90d32da7783c266c702c04upstream.The incorrect register offset is passed to
pci_wait_for_pending(), which is caused by commit157e876ffe("PCI: Addpci_wait_for_pending()(refactorpci_wait_for_pending_transaction())").Fixes 157e876ffe ("PCI: Add pci_wait_for_pending() (refactor pci_wait_for_pending_transaction())Signed-off-by Gavin Shan <[email protected]>Signed-off-by Bjorn Helgaas <[email protected]>Acked-by Alex Williamson <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/pci/pci.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/pci/pci.c +3
-2@@ -3043,7 +3043,8 @@ int pci_wait_for_pending_transaction(strif (!pci_is_pcie (dev))return 1 ; -return pci_wait_for_pending (dev,PCI_EXP_DEVSTA ,PCI_EXP_DEVSTA_TRPND ); +return pci_wait_for_pending (dev,pci_pcie_cap (dev) +PCI_EXP_DEVSTA , +PCI_EXP_DEVSTA_TRPND ); }EXPORT_SYMBOL (pci_wait_for_pending_transaction);@@ -3085,7 +3086,7 @@ static int pci_af_flr(struct pci_dev *dereturn 0 ;/* Wait for Transaction Pending bit clean */ -if (pci_wait_for_pending (dev,PCI_AF_STATUS ,PCI_AF_STATUS_TP )) +if (pci_wait_for_pending (dev, pos +PCI_AF_STATUS ,PCI_AF_STATUS_TP )) goto clear;Quoted 4 lines
drivers/pci/pci.c static int pci_af_flr(struct pci_dev *de · line 3092
Quoted 1 line
drivers/pci/pci.c +0
-0dev_err(&dev->dev, "transaction is not cleared; "This still seems to be broken because
pci_wait_for_pending()doespci_read_config_word()butPCI_AF_STATUSis not word-aligned.
Quoted 5 lines
I agree; this does seem broken. I think
pci_read_config_word()will returnPCIBIOS_BAD_REGISTER_NUMBERwithout updating the value returned, so I think we'll test garbage from the stack.What do you think, Alex?
Yep, looks broken. The simple fix would be to pass the AF control offset instead of status, shift the mask, and maybe add a BUG_ON(pos &
1) to pci_read_config_word() to better enforce it. Alternatively we could make the function take a width and use an appropriate accessor for the size. I'm inclined to double-check the current users and take the first option unless anyone objects. Thanks,
Alex
Re: [PATCH 3.14 186/228] PCI: Wrong register used to check pending traffic
Quoted 54 lines · Alex Williamson
Quoted 53 lines · Bjorn Helgaas
Quoted 43 lines · Ben Hutchings
Quoted 42 lines · Greg Kroah-Hartman
3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gavin Shan <[email protected]>
commit
d0b4cc4e32705ff00d90d32da7783c266c702c04upstream.The incorrect register offset is passed to
pci_wait_for_pending(), which is caused by commit157e876ffe("PCI: Addpci_wait_for_pending()(refactorpci_wait_for_pending_transaction())").Fixes 157e876ffe ("PCI: Add pci_wait_for_pending() (refactor pci_wait_for_pending_transaction())Signed-off-by Gavin Shan <[email protected]>Signed-off-by Bjorn Helgaas <[email protected]>Acked-by Alex Williamson <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/pci/pci.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/pci/pci.c +3
-2@@ -3043,7 +3043,8 @@ int pci_wait_for_pending_transaction(strif (!pci_is_pcie (dev))return 1 ; -return pci_wait_for_pending (dev,PCI_EXP_DEVSTA ,PCI_EXP_DEVSTA_TRPND ); +return pci_wait_for_pending (dev,pci_pcie_cap (dev) +PCI_EXP_DEVSTA , +PCI_EXP_DEVSTA_TRPND ); }EXPORT_SYMBOL (pci_wait_for_pending_transaction);@@ -3085,7 +3086,7 @@ static int pci_af_flr(struct pci_dev *dereturn 0 ;/* Wait for Transaction Pending bit clean */ -if (pci_wait_for_pending (dev,PCI_AF_STATUS ,PCI_AF_STATUS_TP )) +if (pci_wait_for_pending (dev, pos +PCI_AF_STATUS ,PCI_AF_STATUS_TP )) goto clear;Quoted 4 lines
drivers/pci/pci.c static int pci_af_flr(struct pci_dev *de · line 3092
Quoted 1 line
drivers/pci/pci.c +0
-0dev_err(&dev->dev, "transaction is not cleared; "This still seems to be broken because
pci_wait_for_pending()doespci_read_config_word()butPCI_AF_STATUSis not word-aligned.I agree; this does seem broken. I think
pci_read_config_word()will returnPCIBIOS_BAD_REGISTER_NUMBERwithout updating the value returned, so I think we'll test garbage from the stack.
Quoted 9 lines
Quoted 1 line
What do you think, Alex?
Yep, looks broken. The simple fix would be to pass the AF control offset instead of status, shift the mask, and maybe add a BUG_ON(pos &
1) topci_read_config_word()to better enforce it. Alternatively we could make the function take a width and use an appropriate accessor for the size. I'm inclined to double-check the current users and take the first option unless anyone objects. Thanks,
Hrm, I didn't notice that PCI_AF_STATUS isn't word-aligned. I agree with Alex to just use PCI_AF_CTRL with shifted PCI_AF_STATUS_TP. If we're going to add BUG_ON() for pci_read_config_word(), we have to add that for other accessors (dword, user_word, user_dword, bus_word, bus_dword). I guess we just need the first part here. Bjorn/Alex, please let me know if I need come up with a followup fix for this, or Alex can handle it.
Thanks,
Gavin
Greg Kroah-Hartman
maintainerPATCH 187/228 dm crypt: fix cpu hotplug crash by removing per-cpu structure
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 610f2de3559c383caf8fbbf91e9968102dff7ca0 upstream.
The DM crypt target used per-cpu structures to hold pointers to a ablkcipher_request structure. The code assumed that the work item keeps executing on a single CPU, so it didn't use synchronization when accessing this structure.
If a CPU is disabled by writing 0 to /sys/devices/system/cpu/cpu*/online, the work item could be moved to another CPU. This causes dm-crypt crashes, like the following, because the code starts using an incorrect ablkcipher_request:
smpboot: CPU 7 is now offline
BUG: unable to handle kernel NULL pointer dereference at 0000000000000130 IP: [<ffffffffa1862b3d>] crypt_convert+0x12d/0x3c0 [dm_crypt] ... Call Trace: [<ffffffffa1864415>] ? kcryptd_crypt+0x305/0x470 [dm_crypt] [<ffffffff81062060>] ? finish_task_switch+0x40/0xc0 [<ffffffff81052a28>] ? process_one_work+0x168/0x470 [<ffffffff8105366b>] ? worker_thread+0x10b/0x390 [<ffffffff81053560>] ? manage_workers.isra.26+0x290/0x290 [<ffffffff81058d9f>] ? kthread+0xaf/0xc0 [<ffffffff81058cf0>] ? kthread_create_on_node+0x120/0x120 [<ffffffff813464ac>] ? ret_from_fork+0x7c/0xb0 [<ffffffff81058cf0>] ? kthread_create_on_node+0x120/0x120
Fix this bug by removing the per-cpu definition. The structure ablkcipher_request is accessed via a pointer from convert_context. Consequently, if the work item is rescheduled to a different CPU, the thread still uses the same ablkcipher_request.
This change may undermine performance improvements intended by commit c0297721 ("dm crypt: scale to multiple cpus") on select hardware. In practice no performance difference was observed on recent hardware. But regardless, correctness is more important than performance.
--- drivers/md/dm-crypt.c | 61 +++++++++----------------------------------------- 1 file changed, 12 insertions(+), 49 deletions(-)
drivers/md/dm-crypt.c +12 -49
@@ -19,7 +19,6 @@#include <linux/crypto.h> #include <linux/workqueue.h> #include <linux/backing-dev.h> -#include <linux/percpu.h> #include <linux/atomic.h> #include <linux/scatterlist.h> #include <asm/page.h>
@@ -43,6 +42,7 @@ struct convert_context {struct bvec_iter iter_out;sector_t cc_sector;atomic_t cc_pending; +struct ablkcipher_request *req; };/*
@@ -111,15 +111,7 @@ struct iv_tcw_private {enum flags {DM_CRYPT_SUSPENDED ,DM_CRYPT_KEY_VALID };/* -* Duplicated per-CPU state for cipher. -*/ -struct crypt_cpu { -struct ablkcipher_request *req; -}; - -/* -* The fields in here must be read only after initialization, -* changing state should be in crypt_cpu. +* The fields in here must be read only after initialization. */ struct crypt_config {struct dm_dev *dev;
@@ -150,12 +142,6 @@ struct crypt_config {sector_t iv_offset;unsigned int iv_size; -/* -* Duplicated per cpu state. Access through -* per_cpu_ptr() only. -*/ -struct crypt_cpu __percpu *cpu; -/* ESSIV: struct crypto_cipher *essiv_tfm */ void *iv_private;struct crypto_ablkcipher **tfms;
@@ -192,11 +178,6 @@ static void clone_init(struct dm_crypt_istatic void kcryptd_queue_crypt (struct dm_crypt_io *io);static u8 *iv_of_dmreq (struct crypt_config *cc,struct dm_crypt_request *dmreq); -static struct crypt_cpu *this_crypt_config (struct crypt_config *cc) -{ -return this_cpu_ptr (cc->cpu); -} -/* * Use this to access cipher attributes that are the same for each CPU. */
@@ -903,16 +884,15 @@ static void kcryptd_async_done(struct crstatic void crypt_alloc_req (struct crypt_config *cc,struct convert_context *ctx) { -struct crypt_cpu *this_cc =this_crypt_config (cc);unsigned key_index = ctx->cc_sector & (cc->tfms_count -1 ); -if (!this_cc->req) - this_cc->req =mempool_alloc (cc->req_pool,GFP_NOIO ); +if (!ctx->req) + ctx->req =mempool_alloc (cc->req_pool,GFP_NOIO ); -ablkcipher_request_set_tfm (this_cc->req, cc->tfms[key_index]); -ablkcipher_request_set_callback (this_cc->req, +ablkcipher_request_set_tfm (ctx->req, cc->tfms[key_index]); +ablkcipher_request_set_callback (ctx->req,CRYPTO_TFM_REQ_MAY_BACKLOG |CRYPTO_TFM_REQ_MAY_SLEEP , - kcryptd_async_done,dmreq_of_req (cc, this_cc->req)); + kcryptd_async_done,dmreq_of_req (cc, ctx->req)); }/*
@@ -921,7 +901,6 @@ static void crypt_alloc_req(struct cryptstatic int crypt_convert (struct crypt_config *cc,struct convert_context *ctx) { -struct crypt_cpu *this_cc =this_crypt_config (cc);int r;atomic_set (&ctx->cc_pending,1 );
@@ -932,7 +911,7 @@ static int crypt_convert(struct crypt_coatomic_inc (&ctx->cc_pending); - r =crypt_convert_block (cc, ctx, this_cc->req); + r =crypt_convert_block (cc, ctx, ctx->req);switch (r) {/* async */
@@ -941,7 +920,7 @@ static int crypt_convert(struct crypt_coreinit_completion (&ctx->restart);/* fall through*/ case -EINPROGRESS : - this_cc->req =NULL ; + ctx->req =NULL ; ctx->cc_sector++;continue ;
@@ -1040,6 +1019,7 @@ static struct dm_crypt_io *crypt_io_allo io->sector = sector; io->error =0 ; io->base_io =NULL ; + io->ctx.req =NULL ;atomic_set (&io->io_pending,0 );return io;
@@ -1065,6 +1045,8 @@ static void crypt_dec_pending(struct dm_if (!atomic_dec_and_test (&io->io_pending))return ; +if (io->ctx.req) +mempool_free (io->ctx.req, cc->req_pool);mempool_free (io, cc->io_pool);if (likely (!base_io))
@@ -1492,8 +1474,6 @@ static int crypt_wipe_key(struct crypt_cstatic void crypt_dtr (struct dm_target *ti) {struct crypt_config *cc = ti->private; -struct crypt_cpu *cpu_cc; -int cpu; ti->private =NULL ;
@@ -1505,13 +1485,6 @@ static void crypt_dtr(struct dm_target *if (cc->crypt_queue)destroy_workqueue (cc->crypt_queue); -if (cc->cpu) -for_each_possible_cpu (cpu) { - cpu_cc =per_cpu_ptr (cc->cpu, cpu); -if (cpu_cc->req) -mempool_free (cpu_cc->req, cc->req_pool); - } -crypt_free_tfms (cc);if (cc->bs)
@@ -1530,9 +1503,6 @@ static void crypt_dtr(struct dm_target *if (cc->dev)dm_put_device (ti, cc->dev); -if (cc->cpu) -free_percpu (cc->cpu); -kzfree (cc->cipher);kzfree (cc->cipher_string);
@@ -1588,13 +1558,6 @@ static int crypt_ctr_cipher(struct dm_taif (tmp)DMWARN ("Ignoring unexpected additional cipher options" ); - cc->cpu =__alloc_percpu (sizeof (*(cc->cpu)), - __alignof__(struct crypt_cpu )); -if (!cc->cpu) { - ti->error ="Cannot allocate per cpu state" ; - goto bad_mem; - } -/* * For compatibility with the original dm-crypt mapping format, if * only the cipher name is supplied, use cbc-plain.
Greg Kroah-Hartman
maintainerPATCH 188/228 dm thin: allow metadata commit if pool is in PM_OUT_OF_DATA_SPACE mode
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Thornber <[email protected]>
commit 8d07e8a5f5bc7b90f755d9b427ea930024f4c986 upstream.
Commit 3e1a0699 ("dm thin: fix out of data space handling") introduced a regression in the metadata commit() method by returning an error if the pool is in PM_OUT_OF_DATA_SPACE mode. This oversight caused a thin device to return errors even if the default queue_if_no_space ENOSPC handling mode is used.
Fix commit() to only fail if pool is in PM_READ_ONLY or PM_FAIL mode.
--- drivers/md/dm-thin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-thin.c +1 -1
@@ -920,7 +920,7 @@ static int commit(struct pool *pool) {int r; -if (get_pool_mode (pool) !=PM_WRITE ) +if (get_pool_mode (pool) >=PM_READ_ONLY )return -EINVAL ; r =dm_pool_commit_metadata (pool->pmd);
Greg Kroah-Hartman
maintainerPATCH 189/228 dm thin: add timeout to stop out-of-data-space mode holding IO forever
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Thornber <[email protected]>
commit 85ad643b7e7e52d37620fb272a9fd577a8095647 upstream.
If the pool runs out of data space, dm-thin can be configured to either error IOs that would trigger provisioning, or hold those IOs until the pool is resized. Unfortunately, holding IOs until the pool is resized can result in a cascade of tasks hitting the hung_task_timeout, which may render the system unavailable.
Add a fixed timeout so IOs can only be held for a maximum of 60 seconds. If LVM is going to resize a thin-pool that is out of data space it needs to be prompt about it.
--- drivers/md/dm-thin.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
drivers/md/dm-thin.c +21 -0
@@ -25,6 +25,7 @@#define MAPPING_POOL_SIZE 1024#define PRISON_CELLS 1024#define COMMIT_PERIOD HZ +#define NO_SPACE_TIMEOUT (HZ * 60)DECLARE_DM_KCOPYD_THROTTLE_WITH_MODULE_PARM (snapshot_copy_throttle,"A percentage of time allocated for copy on write" );
@@ -173,6 +174,7 @@ struct pool {struct workqueue_struct *wq;struct work_struct worker;struct delayed_work waker; +struct delayed_work no_space_timeout;unsigned long last_commit_jiffies;unsigned ref_count;
@@ -1449,6 +1451,20 @@ static void do_waker(struct work_structqueue_delayed_work (pool->wq, &pool->waker,COMMIT_PERIOD ); } +/* +* We're holding onto IO to allow userland time to react. After the +* timeout either the pool will have been resized (and thus back in +* PM_WRITE mode), or we degrade to PM_READ_ONLY and start erroring IO. +*/ +static void do_no_space_timeout (struct work_struct *ws) +{ + struct pool *pool = container_of(to_delayed_work(ws), struct pool, + no_space_timeout); + +if (get_pool_mode (pool) ==PM_OUT_OF_DATA_SPACE && !pool->pf.error_if_no_space) +set_pool_mode (pool,PM_READ_ONLY ); +} +/*----------------------------------------------------------------*/ struct noflush_work {
@@ -1574,6 +1590,9 @@ static void set_pool_mode(struct pool *p pool->process_discard = process_discard; pool->process_prepared_mapping = process_prepared_mapping; pool->process_prepared_discard = process_prepared_discard_passdown; + +if (!pool->pf.error_if_no_space) +queue_delayed_work (pool->wq, &pool->no_space_timeout,NO_SPACE_TIMEOUT );break ;case PM_WRITE :
@@ -1956,6 +1975,7 @@ static struct pool *pool_create(struct mINIT_WORK (&pool->worker, do_worker);INIT_DELAYED_WORK (&pool->waker, do_waker); +INIT_DELAYED_WORK (&pool->no_space_timeout, do_no_space_timeout);spin_lock_init (&pool->lock);bio_list_init (&pool->deferred_bios);bio_list_init (&pool->deferred_flush_bios);
@@ -2519,6 +2539,7 @@ static void pool_postsuspend(struct dm_tstruct pool *pool = pt->pool;cancel_delayed_work (&pool->waker); +cancel_delayed_work (&pool->no_space_timeout);flush_workqueue (pool->wq); (void )commit (pool); }
Greg Kroah-Hartman
maintainerPATCH 190/228 dmaengine: fix dmaengine_unmap failure
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xuelin Shi <[email protected]>
commit c1f43dd9c20d85e66c4d77e284f64ac114abe3f8 upstream.
The count which is used to get_unmap_data maybe not the same as the count computed in dmaengine_unmap which causes to free data in a wrong pool.
This patch fixes this issue by keeping the map count with unmap_data structure and use this count to get the pool.
--- drivers/dma/dmaengine.c | 2 ++ include/linux/dmaengine.h | 1 + 2 files changed, 3 insertions(+)
drivers/dma/dmaengine.c +2 -0
@@ -1014,6 +1014,7 @@ static void dmaengine_unmap(struct krefdma_unmap_page (dev, unmap->addr[i], unmap->len,DMA_BIDIRECTIONAL ); } + cnt = unmap->map_cnt;mempool_free (unmap,__get_unmap_pool (cnt)->pool); }
@@ -1079,6 +1080,7 @@ dmaengine_get_unmap_data(struct device *memset (unmap,0 ,sizeof (*unmap));kref_init (&unmap->kref); unmap->dev = dev; + unmap->map_cnt = nr;return unmap; }
include/linux/dmaengine.h +1 -0
@@ -433,6 +433,7 @@ typedef bool (*dma_filter_fn)(struct dmatypedef void (*dma_async_tx_callback )(void *dma_async_param);struct dmaengine_unmap_data { +u8 map_cnt;u8 to_cnt;u8 from_cnt;u8 bidi_cnt;
Greg Kroah-Hartman
maintainerPATCH 191/228 dma: mv_xor: Flush descriptors before activating a channel
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ezequiel Garcia <[email protected]>
commit 5a9a55bf9157d3490b0c8c4c81d4708602c26e07 upstream.
We need to use writel() instead of writel_relaxed() when starting a channel, to ensure all the descriptors have been flushed before the activation.
While at it, remove the unneeded read-modify-write and make the code simpler.
--- drivers/dma/mv_xor.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/dma/mv_xor.c +3 -5
@@ -191,12 +191,10 @@ static void mv_set_mode(struct mv_xor_chstatic void mv_chan_activate (struct mv_xor_chan *chan) { -u32 activation; -dev_dbg (mv_chan_to_devp (chan)," activate chan.\n" ); - activation =readl_relaxed (XOR_ACTIVATION (chan)); - activation |=0x1 ; -writel_relaxed (activation,XOR_ACTIVATION (chan)); + +/* writel ensures all descriptors are flushed before activation */ +writel (BIT (0 ),XOR_ACTIVATION (chan)); }static char mv_chan_is_busy (struct mv_xor_chan *chan)
Greg Kroah-Hartman
maintainerPATCH 192/228 dmaengine: dw: went back to plain {request,free}_irq() calls
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
commit 97977f7576a89cb9436c000ae703c0d515e748ac upstream.
The commit dbde5c29 "dw_dmac: use devm_* functions to simplify code" turns probe function to use devm_* helpers and simultaneously brings a regression. We need to ensure irq is disabled, followed by ensuring that don't schedule any more tasklets and then its safe to use tasklet_kill().
The free_irq() will ensure that the irq is disabled and also wait till all scheduled interrupts are executed by invoking synchronize_irq(). So we need to only do tasklet_kill() after invoking free_irq().
--- drivers/dma/dw/core.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/dma/dw/core.c +6 -5
@@ -1545,11 +1545,6 @@ int dw_dma_probe(struct dw_dma_chip *chi/* Disable BLOCK interrupts as well */ channel_clear_bit (dw,MASK .BLOCK, dw->all_chan_mask); - err =devm_request_irq (chip->dev, chip->irq, dw_dma_interrupt, -IRQF_SHARED ,"dw_dmac" , dw); -if (err) -return err; -/* Create a pool of consistent memory blocks for hardware descriptors */ dw->desc_pool =dmam_pool_create ("dw_dmac_desc_pool" , chip->dev,sizeof (struct dw_desc ),4 ,0 );
@@ -1560,6 +1555,11 @@ int dw_dma_probe(struct dw_dma_chip *chitasklet_init (&dw->tasklet, dw_dma_tasklet, (unsigned long )dw); + err =request_irq (chip->irq, dw_dma_interrupt,IRQF_SHARED , +"dw_dmac" , dw); +if (err) +return err; +INIT_LIST_HEAD (&dw->dma.channels);for (i =0 ; i < nr_channels; i++) {struct dw_dma_chan *dwc = &dw->chan[i];
@@ -1664,6 +1664,7 @@ int dw_dma_remove(struct dw_dma_chip *chdw_dma_off (dw);dma_async_device_unregister (&dw->dma); +free_irq (chip->irq, dw);tasklet_kill (&dw->tasklet); list_for_each_entry_safe(dwc, _dwc, &dw->dma.channels,
Greg Kroah-Hartman
maintainerPATCH 193/228 tcm_fc: Fix free-after-use regression in ft_free_cmd
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit ed8ec8f707ed4760c124d47b27c93df8ec5b1eba upstream.
This patch fixes a free-after-use regression in ft_free_cmd(), where ft_sess_put() is called with cmd->sess after percpu_ida_free() has already released the tag.
Fix this bug by saving the ft_sess pointer ahead of percpu_ida_free(), and pass it directly to ft_sess_put().
The regression was originally introduced in v3.13-rc1 commit:
commit 5f544cfac956971099e906f94568bc3fd1a7108a
Author: Nicholas Bellinger <[email protected]>
Date: Mon Sep 23 12:12:42 2013 -0700
tcm_fc: Convert to per-cpu command map pre-allocation of ft_cmd
--- drivers/target/tcm_fc/tfc_cmd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/target/tcm_fc/tfc_cmd.c +4 -4
@@ -90,18 +90,18 @@ static void ft_free_cmd(struct ft_cmd *c {struct fc_frame *fp;struct fc_lport *lport; -struct se_session *se_sess; +struct ft_sess *sess;if (!cmd)return ; - se_sess = cmd->sess->se_sess; + sess = cmd->sess; fp = cmd->req_frame; lport =fr_dev (fp);if (fr_seq (fp)) lport->tt.seq_release (fr_seq (fp));fc_frame_free (fp); -percpu_ida_free (&se_sess->sess_tag_pool, cmd->se_cmd.map_tag); -ft_sess_put (cmd->sess);/* undo get from lookup at recv */ +percpu_ida_free (&sess->se_sess->sess_tag_pool, cmd->se_cmd.map_tag); +ft_sess_put (sess);/* undo get from lookup at recv */ }void ft_release_cmd (struct se_cmd *se_cmd)
Greg Kroah-Hartman
maintainerPATCH 194/228 libata: clean up ZPODD when a port is detached
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Levente Kurusa <[email protected]>
commit a6f9bf4d2f965b862b95213303d154e02957eed8 upstream.
When a ZPODD device is unbound via sysfs, the ACPI notify handler is not removed. This causes panics as observed in Bug #74601. The panic only happens when the wake happens from outside the kernel (i.e. inserting a media or pressing a button). Add a loop to ata_port_detach which loops through the port's devices and checks if zpodd is enabled, if so call zpodd_exit.
--- drivers/ata/libata-core.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/ata/libata-core.c +9 -0
@@ -6329,6 +6329,8 @@ int ata_host_activate(struct ata_host *hstatic void ata_port_detach (struct ata_port *ap) {unsigned long flags; +struct ata_link *link; +struct ata_device *dev;if (!ap->ops->error_handler) goto skip_eh;
@@ -6348,6 +6350,13 @@ static void ata_port_detach(struct ata_pcancel_delayed_work_sync (&ap->hotplug_task); skip_eh: +/* clean up zpodd on port removal */ +ata_for_each_link (link, ap,HOST_FIRST ) { +ata_for_each_dev (dev, link,ALL ) { +if (zpodd_dev_enabled (dev)) +zpodd_exit (dev); + } + }if (ap->pmp_link) {int i;for (i =0 ; i <SATA_PMP_MAX_PORTS ; i++)
Greg Kroah-Hartman
maintainerPATCH 195/228 ACPICA: Tables: Fix invalid pointer accesses in acpi_tb_parse_root_table().
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lv Zheng <[email protected]>
commit d48dc067450d84324067f4472dc0b169e9af4454 upstream.
Linux XSDT validation mechanism backport has introduced a regreession:
Commit: 671cc68dc61f029d44b43a681356078e02d8dab8
Subject: ACPICA: Back port and refine validation of the XSDT root table.
There is a pointer still accessed after unmapping.
This patch fixes this issue. Lv Zheng.
References: https://bugzilla.kernel.org/show_bug.cgi?id=73911
References: https://bugs.archlinux.org/task/39811
--- drivers/acpi/acpica/tbutils.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/acpi/acpica/tbutils.c +5 -2
@@ -461,6 +461,7 @@ acpi_status __init acpi_tb_parse_root_tau32 table_count;struct acpi_table_header *table;acpi_physical_address address; +acpi_physical_address rsdt_address;u32 length;u8 *table_entry;acpi_status status;
@@ -488,11 +489,14 @@ acpi_status __init acpi_tb_parse_root_ta* as per the ACPI specification. */ address = (acpi_physical_address ) rsdp->xsdt_physical_address; + rsdt_address = + (acpi_physical_address ) rsdp->rsdt_physical_address; table_entry_size =ACPI_XSDT_ENTRY_SIZE ; }else {/* Root table is an RSDT (32-bit physical addresses) */ address = (acpi_physical_address ) rsdp->rsdt_physical_address; + rsdt_address = address; table_entry_size =ACPI_RSDT_ENTRY_SIZE ; }
@@ -515,8 +519,7 @@ acpi_status __init acpi_tb_parse_root_ta/* Fall back to the RSDT */ - address = - (acpi_physical_address ) rsdp->rsdt_physical_address; + address = rsdt_address; table_entry_size =ACPI_RSDT_ENTRY_SIZE ; } }
Greg Kroah-Hartman
maintainerPATCH 196/228 ACPICA: Tables: Restore old behavor to favor 32-bit FADT addresses.
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lv Zheng <[email protected]>
commit 85dbd5801f62b66e2aa7826aaefcaebead44c8a6 upstream.
We need to find a smarter way to switch to 64-bit FADT addresses according to the bug report. This patch reverts Linux to the original behavior.
References: https://bugzilla.kernel.org/show_bug.cgi?id=74021
--- drivers/acpi/acpica/acglobal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/acpi/acpica/acglobal.h +2 -2
@@ -132,9 +132,9 @@ u8 ACPI_INIT_GLOBAL(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 FALSE, do not favor the 32-bit addresses. +* address. Default is TRUE, favor the 32-bit addresses. */ -u8 ACPI_INIT_GLOBAL (acpi_gbl_use32_bit_fadt_addresses ,FALSE ); +u8 ACPI_INIT_GLOBAL (acpi_gbl_use32_bit_fadt_addresses ,TRUE );/* * Optionally truncate I/O addresses to 16 bits. Provides compatibility
Greg Kroah-Hartman
maintainerPATCH 197/228 ACPI: Revert "ACPI: Remove CONFIG_ACPI_PROCFS_POWER and cm_sbsc.c"
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lan Tianyu <[email protected]>
commit e2a7c3d7812369daae56f069eab2e8f3e548d231 upstream.
The commit 1e2d9cd and 7d7ee95 remove ACPI Proc Battery directory and breaks some old userspace tools. This patch is to revert 7d7ee95.
--- drivers/acpi/Kconfig | 17 ++++++++ drivers/acpi/Makefile | 1 drivers/acpi/cm_sbs.c | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 123 insertions(+)
drivers/acpi/Kconfig +17 -0
@@ -56,6 +56,23 @@ config ACPI_PROCFS Say N to delete /proc/acpi/ files that have moved to /sys/ +config ACPI_PROCFS_POWER + bool "Deprecated power /proc/acpi directories" + depends on PROC_FS + help + For backwards compatibility, this option allows + deprecated power /proc/acpi/ directories to exist, even when + they have been replaced by functions in /sys. + The deprecated directories (and their replacements) include: + /proc/acpi/battery/* (/sys/class/power_supply/*) + /proc/acpi/ac_adapter/* (sys/class/power_supply/*) + This option has no effect on /proc/acpi/ directories + and functions, which do not yet exist in /sys + This option, together with the proc directories, will be + deleted in 2.6.39. + + Say N to delete power /proc/acpi/ directories that have moved to /sys/ + config ACPI_EC_DEBUGFS tristate "EC read/write access through /sys/kernel/debug/ec" default n
drivers/acpi/Makefile +1 -0
@@ -47,6 +47,7 @@ acpi-y += sysfs.o acpi-$(CONFIG_X86) += acpi_cmos_rtc.o acpi-$(CONFIG_DEBUG_FS) += debugfs.o acpi-$(CONFIG_ACPI_NUMA) += numa.o +acpi-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o ifdef CONFIG_ACPI_VIDEO acpi-y += video_detect.o endif
drivers/acpi/cm_sbs.c new file +105 -0
105 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 198/228 ACPI: Revert "ACPI / Battery: Remove batterys proc directory"
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lan Tianyu <[email protected]>
commit 3a670cc79342c36d308decd5f90351830ed1685c upstream.
The commit 1e2d9cd and 7d7ee95 remove ACPI Proc Battery directory and breaks some old userspace tools. This patch is to revert commit 1e2d9cd.
--- drivers/acpi/battery.c | 329 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 328 insertions(+), 1 deletion(-)
drivers/acpi/battery.c +328 -1
@@ -36,6 +36,12 @@#include <linux/suspend.h> #include <asm/unaligned.h> +#ifdef CONFIG_ACPI_PROCFS_POWER +#include <linux/proc_fs.h> +#include <linux/seq_file.h> +#include <asm/uaccess.h> +#endif +#include <linux/acpi.h> #include <linux/power_supply.h>
@@ -66,6 +72,19 @@ static unsigned int cache_time = 1000;module_param (cache_time, uint,0644 );MODULE_PARM_DESC (cache_time,"cache time in milliseconds" ); +#ifdef CONFIG_ACPI_PROCFS_POWER +extern struct proc_dir_entry *acpi_lock_battery_dir (void ); +extern void *acpi_unlock_battery_dir (struct proc_dir_entry *acpi_battery_dir); + +enum acpi_battery_files { + info_tag =0 , + state_tag, + alarm_tag, +ACPI_BATTERY_NUMFILES , +}; + +#endif +static const struct acpi_device_id battery_device_ids[] = { {"PNP0C0A" ,0 }, {"" ,0 },
@@ -301,6 +320,14 @@ static enum power_supply_property energy POWER_SUPPLY_PROP_SERIAL_NUMBER, }; +#ifdef CONFIG_ACPI_PROCFS_POWER +inline char *acpi_battery_units (struct acpi_battery *battery) +{ +return (battery->power_unit ==ACPI_BATTERY_POWER_UNIT_MA ) ? +"mA" :"mW" ; +} +#endif +/* -------------------------------------------------------------------------- Battery Management -------------------------------------------------------------------------- */
@@ -719,6 +746,279 @@ static void acpi_battery_refresh(struct }/* -------------------------------------------------------------------------- +FS Interface (/proc) +-------------------------------------------------------------------------- */ + +#ifdef CONFIG_ACPI_PROCFS_POWER +static struct proc_dir_entry *acpi_battery_dir; + +static int acpi_battery_print_info (struct seq_file *seq,int result) +{ +struct acpi_battery *battery = seq->private; + +if (result) + goto end; + +seq_printf (seq,"present: %s\n" , +acpi_battery_present (battery) ?"yes" :"no" ); +if (!acpi_battery_present (battery)) + goto end; +if (battery->design_capacity ==ACPI_BATTERY_VALUE_UNKNOWN ) +seq_printf (seq,"design capacity: unknown\n" ); +else +seq_printf (seq,"design capacity: %d %sh\n" , + battery->design_capacity, +acpi_battery_units (battery)); + +if (battery->full_charge_capacity ==ACPI_BATTERY_VALUE_UNKNOWN ) +seq_printf (seq,"last full capacity: unknown\n" ); +else +seq_printf (seq,"last full capacity: %d %sh\n" , + battery->full_charge_capacity, +acpi_battery_units (battery)); + +seq_printf (seq,"battery technology: %srechargeable\n" , + (!battery->technology)?"non-" :"" ); + +if (battery->design_voltage ==ACPI_BATTERY_VALUE_UNKNOWN ) +seq_printf (seq,"design voltage: unknown\n" ); +else +seq_printf (seq,"design voltage: %d mV\n" , + battery->design_voltage); +seq_printf (seq,"design capacity warning: %d %sh\n" , + battery->design_capacity_warning, +acpi_battery_units (battery)); +seq_printf (seq,"design capacity low: %d %sh\n" , + battery->design_capacity_low, +acpi_battery_units (battery)); +seq_printf (seq,"cycle count: %i\n" , battery->cycle_count); +seq_printf (seq,"capacity granularity 1: %d %sh\n" , + battery->capacity_granularity_1, +acpi_battery_units (battery)); +seq_printf (seq,"capacity granularity 2: %d %sh\n" , + battery->capacity_granularity_2, +acpi_battery_units (battery)); +seq_printf (seq,"model number: %s\n" , battery->model_number); +seq_printf (seq,"serial number: %s\n" , battery->serial_number); +seq_printf (seq,"battery type: %s\n" , battery->type); +seq_printf (seq,"OEM info: %s\n" , battery->oem_info); + end: +if (result) +seq_printf (seq,"ERROR: Unable to read battery info\n" ); +return result; +} + +static int acpi_battery_print_state (struct seq_file *seq,int result) +{ +struct acpi_battery *battery = seq->private; + +if (result) + goto end; + +seq_printf (seq,"present: %s\n" , +acpi_battery_present (battery) ?"yes" :"no" ); +if (!acpi_battery_present (battery)) + goto end; + +seq_printf (seq,"capacity state: %s\n" , + (battery->state &0x04 ) ?"critical" :"ok" ); +if ((battery->state &0x01 ) && (battery->state &0x02 )) +seq_printf (seq, +"charging state: charging/discharging\n" ); +else if (battery->state &0x01 ) +seq_printf (seq,"charging state: discharging\n" ); +else if (battery->state &0x02 ) +seq_printf (seq,"charging state: charging\n" ); +else +seq_printf (seq,"charging state: charged\n" ); + +if (battery->rate_now ==ACPI_BATTERY_VALUE_UNKNOWN ) +seq_printf (seq,"present rate: unknown\n" ); +else +seq_printf (seq,"present rate: %d %s\n" , + battery->rate_now,acpi_battery_units (battery)); + +if (battery->capacity_now ==ACPI_BATTERY_VALUE_UNKNOWN ) +seq_printf (seq,"remaining capacity: unknown\n" ); +else +seq_printf (seq,"remaining capacity: %d %sh\n" , + battery->capacity_now,acpi_battery_units (battery)); +if (battery->voltage_now ==ACPI_BATTERY_VALUE_UNKNOWN ) +seq_printf (seq,"present voltage: unknown\n" ); +else +seq_printf (seq,"present voltage: %d mV\n" , + battery->voltage_now); + end: +if (result) +seq_printf (seq,"ERROR: Unable to read battery state\n" ); + +return result; +} + +static int acpi_battery_print_alarm (struct seq_file *seq,int result) +{ +struct acpi_battery *battery = seq->private; + +if (result) + goto end; + +if (!acpi_battery_present (battery)) { +seq_printf (seq,"present: no\n" ); + goto end; + } +seq_printf (seq,"alarm: " ); +if (!battery->alarm) +seq_printf (seq,"unsupported\n" ); +else +seq_printf (seq,"%u %sh\n" , battery->alarm, +acpi_battery_units (battery)); + end: +if (result) +seq_printf (seq,"ERROR: Unable to read battery alarm\n" ); +return result; +} + +static ssize_t acpi_battery_write_alarm (struct file *file, +const char __user * buffer, +size_t count,loff_t * ppos) +{ +int result =0 ; +char alarm_string[12 ] = {'\0' }; +struct seq_file *m = file->private_data; +struct acpi_battery *battery = m->private; + +if (!battery || (count >sizeof (alarm_string) -1 )) +return -EINVAL ; +if (!acpi_battery_present (battery)) { + result = -ENODEV ; + goto end; + } +if (copy_from_user (alarm_string, buffer, count)) { + result = -EFAULT ; + goto end; + } + alarm_string[count] ='\0' ; + battery->alarm =simple_strtol (alarm_string,NULL ,0 ); + result =acpi_battery_set_alarm (battery); + end: +if (!result) +return count; +return result; +} + +typedef int (*print_func )(struct seq_file *seq,int result); + +static print_func acpi_print_funcs[ACPI_BATTERY_NUMFILES ] = { + acpi_battery_print_info, + acpi_battery_print_state, + acpi_battery_print_alarm, +}; + +static int acpi_battery_read (int fid,struct seq_file *seq) +{ +struct acpi_battery *battery = seq->private; +int result =acpi_battery_update (battery); +return acpi_print_funcs[fid](seq, result); +} + +#define DECLARE_FILE_FUNCTIONS (_name) \ +static int acpi_battery_read_##_name(struct seq_file *seq, void *offset) \ +{ \ + return acpi_battery_read(_name##_tag, seq); \ +} \ +static int acpi_battery_##_name##_open_fs(struct inode *inode, struct file *file) \ +{ \ + return single_open(file, acpi_battery_read_##_name, PDE_DATA(inode)); \ +} + +DECLARE_FILE_FUNCTIONS (info); +DECLARE_FILE_FUNCTIONS (state); +DECLARE_FILE_FUNCTIONS (alarm); + +#undef DECLARE_FILE_FUNCTIONS + +#define FILE_DESCRIPTION_RO (_name) \ + { \ + .name = __stringify(_name), \ + .mode = S_IRUGO, \ + .ops = { \ + .open = acpi_battery_##_name##_open_fs, \ + .read = seq_read, \ + .llseek = seq_lseek, \ + .release = single_release, \ + .owner = THIS_MODULE, \ + }, \ + } + +#define FILE_DESCRIPTION_RW (_name) \ + { \ + .name = __stringify(_name), \ + .mode = S_IFREG | S_IRUGO | S_IWUSR, \ + .ops = { \ + .open = acpi_battery_##_name##_open_fs, \ + .read = seq_read, \ + .llseek = seq_lseek, \ + .write = acpi_battery_write_##_name, \ + .release = single_release, \ + .owner = THIS_MODULE, \ + }, \ + } + +static const struct battery_file { +struct file_operations ops; +umode_t mode; +const char *name; +} acpi_battery_file[] = { +FILE_DESCRIPTION_RO (info), +FILE_DESCRIPTION_RO (state), +FILE_DESCRIPTION_RW (alarm), +}; + +#undef FILE_DESCRIPTION_RO +#undef FILE_DESCRIPTION_RW + +static int acpi_battery_add_fs (struct acpi_device *device) +{ +struct proc_dir_entry *entry =NULL ; +int i; + + printk(KERN_WARNING PREFIX "Deprecated procfs I/F for battery is loaded," + " please retry with CONFIG_ACPI_PROCFS_POWER cleared\n"); +if (!acpi_device_dir (device)) { +acpi_device_dir (device) =proc_mkdir (acpi_device_bid (device), + acpi_battery_dir); +if (!acpi_device_dir (device)) +return -ENODEV ; + } + +for (i =0 ; i <ACPI_BATTERY_NUMFILES ; ++i) { + entry =proc_create_data (acpi_battery_file[i].name, + acpi_battery_file[i].mode, +acpi_device_dir (device), + &acpi_battery_file[i].ops, +acpi_driver_data (device)); +if (!entry) +return -ENODEV ; + } +return 0 ; +} + +static void acpi_battery_remove_fs (struct acpi_device *device) +{ +int i; +if (!acpi_device_dir (device)) +return ; +for (i =0 ; i <ACPI_BATTERY_NUMFILES ; ++i) +remove_proc_entry (acpi_battery_file[i].name, +acpi_device_dir (device)); + +remove_proc_entry (acpi_device_bid (device), acpi_battery_dir); +acpi_device_dir (device) =NULL ; +} + +#endif + +/* -------------------------------------------------------------------------- Driver Interface -------------------------------------------------------------------------- */
@@ -791,6 +1091,15 @@ static int acpi_battery_add(struct acpi_ result =acpi_battery_update (battery);if (result) goto fail; +#ifdef CONFIG_ACPI_PROCFS_POWER + result =acpi_battery_add_fs (device); +#endif +if (result) { +#ifdef CONFIG_ACPI_PROCFS_POWER +acpi_battery_remove_fs (device); +#endif + goto fail; + } printk(KERN_INFO PREFIX "%s Slot [%s] (battery %s)\n", ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device),
@@ -817,6 +1126,9 @@ static int acpi_battery_remove(struct acreturn -EINVAL ; battery =acpi_driver_data (device);unregister_pm_notifier (&battery->pm_nb); +#ifdef CONFIG_ACPI_PROCFS_POWER +acpi_battery_remove_fs (device); +#endif sysfs_remove_battery (battery);mutex_destroy (&battery->lock);mutex_destroy (&battery->sysfs_lock);
@@ -867,7 +1179,19 @@ static void __init acpi_battery_init_asyif (dmi_check_system (bat_dmi_table)) battery_bix_broken_package =1 ; -acpi_bus_register_driver (&acpi_battery_driver); + +#ifdef CONFIG_ACPI_PROCFS_POWER + acpi_battery_dir =acpi_lock_battery_dir (); +if (!acpi_battery_dir) +return ; +#endif +if (acpi_bus_register_driver (&acpi_battery_driver) <0 ) { +#ifdef CONFIG_ACPI_PROCFS_POWER +acpi_unlock_battery_dir (acpi_battery_dir); +#endif +return ; + } +return ; }static int __init acpi_battery_init (void )
@@ -879,6 +1203,9 @@ static int __init acpi_battery_init(void static void __exit acpi_battery_exit(void) {acpi_bus_unregister_driver (&acpi_battery_driver); +#ifdef CONFIG_ACPI_PROCFS_POWER +acpi_unlock_battery_dir (acpi_battery_dir); +#endif }module_init (acpi_battery_init);
Greg Kroah-Hartman
maintainerPATCH 199/228 ACPI / video: Add use_native_backlight quirks for more systems
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit 43d9490244254d2d6adb0f3c6275c7b8d032a2dd upstream.
ThinkPad T430: extend the T430s entry to also cover the T430 (note we also have another entry for T430's with a different DMI_PRODUCT_VERSION).
ThinkPad T430
References: https://bugzilla.kernel.org/show_bug.cgi?id=51231
Thinkpad T530
References: https://bugzilla.redhat.com/show_bug.cgi?id=1089545
Acer Aspire 5742G
References: https://bugzilla.kernel.org/show_bug.cgi?id=35622
--- drivers/acpi/video.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
drivers/acpi/video.c +18 -2
@@ -459,10 +459,10 @@ static struct dmi_system_id video_dmi_ta }, { .callback = video_set_use_native_backlight, - .ident = "ThinkPad T430s", + .ident = "ThinkPad T430 and T430s", .matches = {DMI_MATCH (DMI_SYS_VENDOR ,"LENOVO" ), - DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T430s"), + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T430"), }, }, {
@@ -474,6 +474,14 @@ static struct dmi_system_id video_dmi_ta }, }, { + .callback = video_set_use_native_backlight, + .ident = "ThinkPad T530", + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T530"), + }, + }, + { .callback = video_set_use_native_backlight, .ident = "ThinkPad X1 Carbon", .matches = {
@@ -506,6 +514,14 @@ static struct dmi_system_id video_dmi_ta }, }, { + .callback = video_set_use_native_backlight, + .ident = "Acer Aspire 5742G", + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Acer" ), + DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5742G"), + }, + }, + { .callback = video_set_use_native_backlight, .ident = "Acer Aspire V5-431", .matches = {
Greg Kroah-Hartman
maintainerPATCH 200/228 ACPI / blacklist: Add dmi_enable_osi_linux quirk for Asus EEE PC 1015PX
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit f6e6e1b9fee88c90586787b71dc49bb3ce62bb89 upstream.
Without this this EEE PC exports a non working WMI interface, with this it exports a working "good old" eeepc_laptop interface, fixing brightness control not working as well as rfkill being stuck in a permanent wireless blocked state.
This is not an ideal way to fix this, but various attempts to fix this otherwise have failed, see:
References: https://bugzilla.redhat.com/show_bug.cgi?id=1067181
--- drivers/acpi/blacklist.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/acpi/blacklist.c +13 -0
@@ -374,6 +374,19 @@ static struct dmi_system_id acpi_osi_dmi DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T500"), }, }, +/* +* Without this this EEEpc exports a non working WMI interface, with +* this it exports a working "good old" eeepc_laptop interface, fixing +* both brightness control, and rfkill not working. +*/ + { + .callback = dmi_enable_osi_linux, + .ident = "Asus EEE PC 1015PX", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "1015PX"), + }, + }, {} };
Greg Kroah-Hartman
maintainerPATCH 201/228 ACPI / processor: do not mark present at boot but not onlined CPU as onlined
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Igor Mammedov <[email protected]>
commit 0b9d46dd7debf8e6dc8614106f1c1909fa8de64d upstream.
acpi_processor_add() assumes that present at boot CPUs are always onlined, it is not so if a CPU failed to become onlined. As result acpi_processor_add() will mark such CPU device as onlined in sysfs and following attempts to online/offline it using /sys/device/system/cpu/cpuX/online attribute will fail.
Do not poke into device internals in acpi_processor_add() and touch "struct device { .offline }" attribute, since for CPUs onlined at boot it's set by:
topology_init() -> arch_register_cpu() -> register_cpu()
before ACPI device tree is parsed, and for hotplugged CPUs it's set when userspace onlines CPU via sysfs.
--- drivers/acpi/acpi_processor.c | 1 - 1 file changed, 1 deletion(-)
drivers/acpi/acpi_processor.c +0 -1
@@ -405,7 +405,6 @@ static int acpi_processor_add(struct acp goto err; pr->dev = dev; - dev->offline = pr->flags.need_hotplug_init;/* Trigger the processor driver's .probe() if present. */ if (device_attach (dev) >=0 )
Greg Kroah-Hartman
maintainerPATCH 202/228 ACPI: Revert "ACPI / AC: convert ACPI ac driver to platform bus"
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit 98012849e0cbf980326f8e34d571f4474866a88e upstream.
Revert commit cc8ef5270734 (ACPI / AC: convert ACPI ac driver to platform bus) that is reported to break thermal management on MacBook Air 2013 with ArchLinux.
References: https://bugzilla.kernel.org/show_bug.cgi?id=71711
--- drivers/acpi/ac.c | 117 +++++++++++++++++++++---------------------- drivers/acpi/acpi_platform.c | 1 2 files changed, 58 insertions(+), 60 deletions(-)
drivers/acpi/ac.c +58 -59
@@ -51,11 +51,39 @@ MODULE_AUTHOR("Paul Diefenbaugh");MODULE_DESCRIPTION ("ACPI AC Adapter Driver" );MODULE_LICENSE ("GPL" ); +static int acpi_ac_add (struct acpi_device *device); +static int acpi_ac_remove (struct acpi_device *device); +static void acpi_ac_notify (struct acpi_device *device,u32 event); + +static const struct acpi_device_id ac_device_ids[] = { + {"ACPI0003" ,0 }, + {"" ,0 }, +}; +MODULE_DEVICE_TABLE (acpi, ac_device_ids); + +#ifdef CONFIG_PM_SLEEP +static int acpi_ac_resume (struct device *dev); +#endif +static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume); +static int ac_sleep_before_get_state_ms; +static struct acpi_driver acpi_ac_driver = { + .name ="ac" , + .class =ACPI_AC_CLASS , + .ids = ac_device_ids, + .flags =ACPI_DRIVER_ALL_NOTIFY_EVENTS , + .ops = { + .add = acpi_ac_add, + .remove = acpi_ac_remove, + .notify = acpi_ac_notify, + }, + .drv.pm = &acpi_ac_pm, +}; +struct acpi_ac {struct power_supply charger; -struct platform_device *pdev; +struct acpi_device * device;unsigned long long state; };
@@ -67,10 +95,12 @@ struct acpi_ac {static int acpi_ac_get_state (struct acpi_ac *ac) { -acpi_status status; -acpi_handle handle =ACPI_HANDLE (&ac->pdev->dev); +acpi_status status =AE_OK ; + +if (!ac) +return -EINVAL ; - status =acpi_evaluate_integer (handle,"_PSR" ,NULL , + status =acpi_evaluate_integer (ac->device->handle,"_PSR" ,NULL , &ac->state);if (ACPI_FAILURE (status)) { ACPI_EXCEPTION((AE_INFO, status,
@@ -115,10 +145,9 @@ static enum power_supply_property ac_proDriver Model -------------------------------------------------------------------------- */ -static void acpi_ac_notify_handler (acpi_handle handle,u32 event,void *data) +static void acpi_ac_notify (struct acpi_device *device,u32 event) { -struct acpi_ac *ac = data; -struct acpi_device *adev; +struct acpi_ac *ac =acpi_driver_data (device);if (!ac)return ;
@@ -141,11 +170,10 @@ static void acpi_ac_notify_handler(acpi_msleep (ac_sleep_before_get_state_ms);acpi_ac_get_state (ac); - adev =ACPI_COMPANION (&ac->pdev->dev); -acpi_bus_generate_netlink_event (adev->pnp.device_class, -dev_name (&ac->pdev->dev), - event, (u32 ) ac->state); -acpi_notifier_call_chain (adev, event, (u32 ) ac->state); +acpi_bus_generate_netlink_event (device->pnp.device_class, +dev_name (&device->dev), event, + (u32 ) ac->state); +acpi_notifier_call_chain (device, event, (u32 ) ac->state);kobject_uevent (&ac->charger.dev->kobj,KOBJ_CHANGE ); }
@@ -170,49 +198,39 @@ static struct dmi_system_id ac_dmi_table {}, }; -static int acpi_ac_probe (struct platform_device *pdev) +static int acpi_ac_add (struct acpi_device *device) {int result =0 ;struct acpi_ac *ac =NULL ; -struct acpi_device *adev; -if (!pdev) -return -EINVAL ; - adev =ACPI_COMPANION (&pdev->dev); -if (!adev) -return -ENODEV ; +if (!device) +return -EINVAL ; ac =kzalloc (sizeof (struct acpi_ac ),GFP_KERNEL );if (!ac)return -ENOMEM ; -strcpy (acpi_device_name (adev),ACPI_AC_DEVICE_NAME ); -strcpy (acpi_device_class (adev),ACPI_AC_CLASS ); - ac->pdev = pdev; -platform_set_drvdata (pdev, ac); + ac->device = device; +strcpy (acpi_device_name (device),ACPI_AC_DEVICE_NAME ); +strcpy (acpi_device_class (device),ACPI_AC_CLASS ); + device->driver_data = ac; result =acpi_ac_get_state (ac);if (result) goto end; - ac->charger.name =acpi_device_bid (adev); + ac->charger.name =acpi_device_bid (device); ac->charger.type =POWER_SUPPLY_TYPE_MAINS ; ac->charger.properties = ac_props; ac->charger.num_properties =ARRAY_SIZE (ac_props); ac->charger.get_property = get_ac_property; - result =power_supply_register (&pdev->dev, &ac->charger); + result =power_supply_register (&ac->device->dev, &ac->charger);if (result) goto end; - result =acpi_install_notify_handler (ACPI_HANDLE (&pdev->dev), -ACPI_ALL_NOTIFY , acpi_ac_notify_handler, ac); -if (result) { -power_supply_unregister (&ac->charger); - goto end; - } printk(KERN_INFO PREFIX "%s [%s] (%s)\n", -acpi_device_name (adev),acpi_device_bid (adev), +acpi_device_name (device),acpi_device_bid (device), ac->state ? "on-line" : "off-line"); end:
@@ -232,7 +250,7 @@ static int acpi_ac_resume(struct deviceif (!dev)return -EINVAL ; - ac =platform_get_drvdata (to_platform_device (dev)); + ac =acpi_driver_data (to_acpi_device (dev));if (!ac)return -EINVAL ;
@@ -246,19 +264,17 @@ static int acpi_ac_resume(struct device#else #define acpi_ac_resume NULL#endif -static SIMPLE_DEV_PM_OPS(acpi_ac_pm_ops, NULL, acpi_ac_resume); -static int acpi_ac_remove (struct platform_device *pdev) +static int acpi_ac_remove (struct acpi_device *device) { -struct acpi_ac *ac; +struct acpi_ac *ac =NULL ; -if (!pdev) + +if (!device || !acpi_driver_data (device))return -EINVAL ; -acpi_remove_notify_handler (ACPI_HANDLE (&pdev->dev), -ACPI_ALL_NOTIFY , acpi_ac_notify_handler); + ac =acpi_driver_data (device); - ac =platform_get_drvdata (pdev);if (ac->charger.dev)power_supply_unregister (&ac->charger);
@@ -267,23 +283,6 @@ static int acpi_ac_remove(struct platforreturn 0 ; } -static const struct acpi_device_id acpi_ac_match[] = { - {"ACPI0003" ,0 }, - { } -}; -MODULE_DEVICE_TABLE (acpi, acpi_ac_match); - -static struct platform_driver acpi_ac_driver = { - .probe = acpi_ac_probe, - .remove = acpi_ac_remove, - .driver = { - .name ="acpi-ac" , - .owner =THIS_MODULE , - .pm = &acpi_ac_pm_ops, - .acpi_match_table =ACPI_PTR (acpi_ac_match), - }, -}; -static int __init acpi_ac_init (void ) {int result;
@@ -291,7 +290,7 @@ static int __init acpi_ac_init(void)if (acpi_disabled)return -ENODEV ; - result =platform_driver_register (&acpi_ac_driver); + result =acpi_bus_register_driver (&acpi_ac_driver);if (result <0 )return -ENODEV ;
@@ -300,7 +299,7 @@ static int __init acpi_ac_init(void) static void __exit acpi_ac_exit(void) { -platform_driver_unregister (&acpi_ac_driver); +acpi_bus_unregister_driver (&acpi_ac_driver); }module_init (acpi_ac_init);module_exit (acpi_ac_exit);
drivers/acpi/acpi_platform.c +0 -1
@@ -29,7 +29,6 @@ ACPI_MODULE_NAME("platform");static const struct acpi_device_id acpi_platform_device_ids[] = { {"PNP0D40" }, - {"ACPI0003" }, {"VPC2004" }, {"BCM4752" },
Greg Kroah-Hartman
maintainerPATCH 203/228 ACPI: blacklist win8 OSI for Dell Inspiron 7737
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Lin <[email protected]>
commit b753631b3576bf343151a82513c5d56fcda1e24f upstream.
With win8 capabiltiy, the machine will boot itself immediately after shutdown command has executed.
Work around this issue by disabling win8 capcability. This workaround also makes wireless hotkey work.
--- drivers/acpi/blacklist.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/acpi/blacklist.c +8 -0
@@ -314,6 +314,14 @@ static struct dmi_system_id acpi_osi_dmi DMI_MATCH(DMI_PRODUCT_VERSION, "2349D15"), }, }, + { + .callback = dmi_disable_osi_win8, + .ident = "Dell Inspiron 7737", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 7737"), + }, + },/* * BIOS invocation of _OSI(Linux) is almost always a BIOS bug.
Greg Kroah-Hartman
maintainerPATCH 204/228 ACPI / TPM: Fix resume regression on Chromebooks
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Rafael J. Wysocki" <[email protected]>
commit f759546498d820670934c901a2fdf1ce948d2e5c upstream.
Chromebooks (at least Acer C720 and Pixel) implement an ACPI object for TPM, but don't implement the _DSM method to support PPI. As a result, the TPM driver fails to load on those machines after commit 1569a4c4ceba (ACPI / TPM: detect PPI features by checking availability of _DSM functions) which causes them to fail to resume from system suspend, becuase they require the TPM hardware to be put into the right state during resume and the TPM driver is necessary for that.
Fix the problem by making tpm_add_ppi() return 0 when tpm_ppi_handle is still NULL after walking the ACPI namespace in search for the PPI _DSM, which allows the TPM driver to load and operate the hardware (during system resume in particular), but avoid creating the PPI sysfs group in that case.
This change is based on a prototype patch from Jiang Liu.
References: https://bugzilla.kernel.org/show_bug.cgi?id=74021
--- drivers/char/tpm/tpm_ppi.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/char/tpm/tpm_ppi.c +3 -5
@@ -328,13 +328,11 @@ int tpm_add_ppi(struct kobject *parent)/* Cache TPM ACPI handle and version string */ acpi_walk_namespace (ACPI_TYPE_DEVICE ,ACPI_ROOT_OBJECT ,ACPI_UINT32_MAX , ppi_callback,NULL ,NULL , &tpm_ppi_handle); -if (tpm_ppi_handle ==NULL ) -return -ENODEV ; - -return sysfs_create_group (parent, &ppi_attr_grp); +return tpm_ppi_handle ?sysfs_create_group (parent, &ppi_attr_grp) :0 ; }void tpm_remove_ppi (struct kobject *parent) { -sysfs_remove_group (parent, &ppi_attr_grp); +if (tpm_ppi_handle) +sysfs_remove_group (parent, &ppi_attr_grp); }
Greg Kroah-Hartman
maintainerPATCH 206/228 ACPI / video: Revert native brightness quirk for ThinkPad T530
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit 07d1d29ee1e194b932328ad2dc1d40297062ab7f upstream.
Seems it helps some users, but causes issues for other users:
https://bugzilla.redhat.com/show_bug.cgi?id=1089545
So lets drop it for now until we've figured out a better fix.
References: https://bugzilla.redhat.com/show_bug.cgi?id=1089545
--- drivers/acpi/video.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/acpi/video.c +0 -8
@@ -475,14 +475,6 @@ static struct dmi_system_id video_dmi_ta }, { .callback = video_set_use_native_backlight, - .ident = "ThinkPad T530", - .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"LENOVO" ), - DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T530"), - }, - }, - { - .callback = video_set_use_native_backlight, .ident = "ThinkPad X1 Carbon", .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
Greg Kroah-Hartman
maintainerPATCH 207/228 i2c: rcar: bail out on zero length transfers
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
commit d7653964c590ba846aa11a8f6edf409773cbc492 upstream.
This hardware does not support zero length transfers. Instead, the driver does one (random) byte transfers currently with undefined results for the slaves. We now bail out.
--- drivers/i2c/busses/i2c-rcar.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-rcar.c +8 -1
@@ -561,6 +561,12 @@ static int rcar_i2c_master_xfer(struct i ret = -EINVAL ;for (i =0 ; i < num; i++) { +/* This HW can't send STOP after address phase */ +if (msgs[i].len ==0 ) { + ret = -EOPNOTSUPP ; +break ; + } +/*-------------- spin lock -----------------*/ spin_lock_irqsave (&priv->lock, flags);
@@ -625,7 +631,8 @@ static int rcar_i2c_master_xfer(struct istatic u32 rcar_i2c_func (struct i2c_adapter *adap) { -return I2C_FUNC_I2C |I2C_FUNC_SMBUS_EMUL ; +/* This HW can't do SMBUS_QUICK and NOSTART */ +return I2C_FUNC_I2C | (I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK ); }static const struct i2c_algorithm rcar_i2c_algo = {
Greg Kroah-Hartman
maintainerPATCH 208/228 i2c: designware: Mask all interrupts during i2c controller enable
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Du, Wenkai" <[email protected]>
commit 47bb27e78867997040a228328f2a631c3c7f2c82 upstream.
There have been "i2c_designware 80860F41:00: controller timed out" errors on a number of Baytrail platforms. The issue is caused by incorrect value in Interrupt Mask Register (DW_IC_INTR_MASK) when i2c core is being enabled. This causes call to __i2c_dw_enable() to immediately start the transfer which leads to timeout. There are 3 failure modes observed:
1. Failure in S0 to S3 resume path
The default value after reset for DW_IC_INTR_MASK is 0x8ff. When we start the first transaction after resuming from system sleep, TX_EMPTY interrupt is already unmasked because of the hardware default.
2. Failure in normal operational path
This failure happens rarely and is hard to reproduce. Debug trace showed that DW_IC_INTR_MASK had value of 0x254 when failure occurred, which meant TX_EMPTY was unmasked.
3. Failure in S3 to S0 suspend path
This failure also happens rarely and is hard to reproduce. Adding debug trace that read DW_IC_INTR_MASK made this failure not reproducible. But from ISR call trace we could conclude TX_EMPTY was unmasked when problem occurred.
The patch masks all interrupts before the controller is enabled to resolve the faulty DW_IC_INTR_MASK conditions.
--- drivers/i2c/busses/i2c-designware-core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/i2c/busses/i2c-designware-core.c +3 -0
@@ -417,6 +417,9 @@ static void i2c_dw_xfer_init(struct dw_i*/ dw_writel (dev, msgs[dev->msg_write_idx].addr | ic_tar,DW_IC_TAR ); +/* enforce disabled interrupts (due to HW issues) */ +i2c_dw_disable_int (dev); +/* Enable the adapter */ __i2c_dw_enable (dev, true);
Greg Kroah-Hartman
maintainerPATCH 209/228 i2c: s3c2410: resume race fix
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Olof Johansson <[email protected]>
commit ce78cc071f5f541480e381cc0241d37590041a9d upstream.
Don't unmark the device as suspended until after it's been re-setup.
The main race would be w.r.t. an i2c driver that gets resumed at the same time (asyncronously), that is allowed to do a transfer since suspended is set to 0 before reinit, but really should have seen the -EIO return instead.
--- drivers/i2c/busses/i2c-s3c2410.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-s3c2410.c +1 -1
@@ -1247,10 +1247,10 @@ static int s3c24xx_i2c_resume(struct devstruct platform_device *pdev =to_platform_device (dev);struct s3c24xx_i2c *i2c =platform_get_drvdata (pdev); - i2c->suspended =0 ;clk_prepare_enable (i2c->clk);s3c24xx_i2c_init (i2c);clk_disable_unprepare (i2c->clk); + i2c->suspended =0 ;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 210/228 intel_pstate: Set turbo VID for BayTrail
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dirk Brandewie <[email protected]>
commit 21855ff5bcbdd075e1c99772827a84912ab083dd upstream.
A documentation update exposed that there is a separate set of VID values that must be used in the turbo/boost P state range. Add enumerating and setting the correct VID for P states in the turbo range.
--- drivers/cpufreq/intel_pstate.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
drivers/cpufreq/intel_pstate.c +15 -6
@@ -37,6 +37,7 @@#define BYT_RATIOS 0x66a#define BYT_VIDS 0x66b#define BYT_TURBO_RATIOS 0x66c +#define BYT_TURBO_VIDS 0x66d#define FRAC_BITS 6
@@ -70,8 +71,9 @@ struct pstate_data { };struct vid_data { -int32_t min; -int32_t max; +int min; +int max; +int turbo;int32_t ratio; };
@@ -360,14 +362,14 @@ static int byt_get_min_pstate(void) {u64 value;rdmsrl (BYT_RATIOS , value); -return (value >>8 ) &0xFF ; +return (value >>8 ) &0x3F ; }static int byt_get_max_pstate (void ) {u64 value;rdmsrl (BYT_RATIOS , value); -return (value >>16 ) &0xFF ; +return (value >>16 ) &0x3F ; }static int byt_get_turbo_pstate (void )
@@ -394,6 +396,9 @@ static void byt_set_pstate(struct cpudat vid_fp =clamp_t (int32_t, vid_fp, cpudata->vid.min, cpudata->vid.max); vid =fp_toint (vid_fp); +if (pstate > cpudata->pstate.max_pstate) + vid = cpudata->vid.turbo; + val |= vid;wrmsrl (MSR_IA32_PERF_CTL , val);
@@ -403,13 +408,17 @@ static void byt_get_vid(struct cpudata * {u64 value; +rdmsrl (BYT_VIDS , value); - cpudata->vid.min =int_tofp ((value >>8 ) &0x7f ); - cpudata->vid.max =int_tofp ((value >>16 ) &0x7f ); + cpudata->vid.min =int_tofp ((value >>8 ) &0x3f ); + cpudata->vid.max =int_tofp ((value >>16 ) &0x3f ); cpudata->vid.ratio =div_fp ( cpudata->vid.max - cpudata->vid.min,int_tofp (cpudata->pstate.max_pstate - cpudata->pstate.min_pstate)); + +rdmsrl (BYT_TURBO_VIDS , value); + cpudata->vid.turbo = value &0x7f ; }
Greg Kroah-Hartman
maintainerPATCH 211/228 intel_pstate: remove setting P state to MAX on init
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dirk Brandewie <[email protected]>
commit d40a63c45b506b0681918d7c62a15cc9d48c8681 upstream.
Setting the P state of the core to max at init time is a hold over from early implementation of intel_pstate where intel_pstate disabled cpufreq and loaded VERY early in the boot sequence. This was to ensure that intel_pstate did not affect boot time. This in not needed now that intel_pstate is a cpufreq driver.
Removing this covers the case where a CPU has gone through a manual CPU offline/online cycle and the P state is set to MAX on init and the CPU immediately goes idle. Due to HW coordination the P state request on the idle CPU will drag all cores to MAX P state until the load is reevaluated when to core goes non-idle.
--- drivers/cpufreq/intel_pstate.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/cpufreq/intel_pstate.c +1 -12
@@ -555,12 +555,7 @@ static void intel_pstate_get_cpu_pstatesif (pstate_funcs.get_vid) pstate_funcs.get_vid (cpu); - -/* -* goto max pstate so we don't slow up boot if we are built-in if we are -* a module we will take care of it during normal operation -*/ -intel_pstate_set_pstate (cpu, cpu->pstate.max_pstate); +intel_pstate_set_pstate (cpu, cpu->pstate.min_pstate); } static inline void intel_pstate_calc_busy(struct cpudata *cpu,
@@ -706,11 +701,6 @@ static int intel_pstate_init_cpu(unsigne cpu = all_cpu_data[cpunum];intel_pstate_get_cpu_pstates (cpu); -if (!cpu->pstate.current_pstate) { - all_cpu_data[cpunum] =NULL ; -kfree (cpu); -return -ENODATA ; - } cpu->cpu = cpunum;
@@ -721,7 +711,6 @@ static int intel_pstate_init_cpu(unsigne cpu->timer.expires = jiffies +HZ /100 ;intel_pstate_busy_pid_reset (cpu);intel_pstate_sample (cpu); -intel_pstate_set_pstate (cpu, cpu->pstate.max_pstate);add_timer_on (&cpu->timer, cpunum);
Greg Kroah-Hartman
maintainerPATCH 212/228 crypto: caam - add allocation failure handling in SPRINTFCAT macro
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Horia Geanta <[email protected]>
commit 27c5fb7a84242b66bf1e0b2fe6bf40d19bcc5c04 upstream.
GFP_ATOMIC memory allocation could fail.
In this case, avoid NULL pointer dereference and notify user.
--- drivers/crypto/caam/error.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/crypto/caam/error.c +7 -3
@@ -16,9 +16,13 @@char *tmp; \ \ tmp =kmalloc (sizeof (format) + max_alloc,GFP_ATOMIC ); \ -sprintf (tmp, format, param); \ -strcat (str, tmp); \ -kfree (tmp); \ +if (likely (tmp)) { \ +sprintf (tmp, format, param); \ +strcat (str, tmp); \ +kfree (tmp); \ + }else { \ +strcat (str,"kmalloc failure in SPRINTFCAT" ); \ + } \ }static void report_jump_idx (u32 status,char *outstr)
Greg Kroah-Hartman
maintainerPATCH 213/228 crypto: s390 - fix aes,des ctr mode concurrency finding.
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Harald Freudenberger <[email protected]>
commit 3901c1124ec5099254a9396085f7798153a7293f upstream.
An additional testcase found an issue with the last series of patches applied: the fallback solution may not save the iv value after operation. This very small fix just makes sure the iv is copied back to the walk/desc struct.
--- arch/s390/crypto/aes_s390.c | 3 +++ arch/s390/crypto/des_s390.c | 3 +++ 2 files changed, 6 insertions(+)
arch/s390/crypto/aes_s390.c +3 -0
@@ -820,6 +820,9 @@ static int ctr_aes_crypt(struct blkcipheelse memcpy (walk->iv, ctrptr,AES_BLOCK_SIZE );spin_unlock (&ctrblk_lock); + }else { +if (!nbytes) +memcpy (walk->iv, ctrptr,AES_BLOCK_SIZE ); }/* * final block may be < AES_BLOCK_SIZE, copy only nbytes
arch/s390/crypto/des_s390.c +3 -0
@@ -429,6 +429,9 @@ static int ctr_desall_crypt(struct blkcielse memcpy (walk->iv, ctrptr,DES_BLOCK_SIZE );spin_unlock (&ctrblk_lock); + }else { +if (!nbytes) +memcpy (walk->iv, ctrptr,DES_BLOCK_SIZE ); }/* final block may be < DES_BLOCK_SIZE, copy only nbytes */ if (nbytes) {
Greg Kroah-Hartman
maintainerPATCH 214/228 clk: Fix double free due to devm_clk_register()
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Boyd <[email protected]>
commit 293ba3b4a4fd54891b900f2911d1a57e1ed4a843 upstream.
Now that clk_unregister() frees the struct clk we're unregistering we'll free memory twice: first we'll call kfree() in __clk_release() with an address kmalloc doesn't know about and second we'll call kfree() in the devres layer. Remove the allocation of struct clk in devm_clk_register() and let clk_release() handle it. This fixes slab errors like:
=============================================================================
BUG kmalloc-128 (Not tainted): Invalid object pointer 0xed08e8d0
-----------------------------------------------------------------------------
Disabling lock debugging due to kernel taint
INFO: Slab 0xeec503f8 objects=25 used=15 fp=0xed08ea00 flags=0x4081
CPU: 2 PID: 73 Comm: rmmod Tainted: G B 3.14.0-11032-g526e9c764381 #34 [<c0014be0>] (unwind_backtrace) from [<c0012240>] (show_stack+0x10/0x14) [<c0012240>] (show_stack) from [<c04b74dc>] (dump_stack+0x70/0xbc) [<c04b74dc>] (dump_stack) from [<c00f6778>] (slab_err+0x74/0x84) [<c00f6778>] (slab_err) from [<c04b6278>] (free_debug_processing+0x2cc/0x31c) [<c04b6278>] (free_debug_processing) from [<c04b6300>] (__slab_free+0x38/0x41c) [<c04b6300>] (__slab_free) from [<c03931bc>] (clk_unregister+0xd4/0x140) [<c03931bc>] (clk_unregister) from [<c02fb774>] (release_nodes+0x164/0x1d8) [<c02fb774>] (release_nodes) from [<c02f8698>] (__device_release_driver+0x60/0xb0) [<c02f8698>] (__device_release_driver) from [<c02f9080>] (driver_detach+0xb4/0xb8) [<c02f9080>] (driver_detach) from [<c02f8480>] (bus_remove_driver+0x5c/0xc4) [<c02f8480>] (bus_remove_driver) from [<c008c9b8>] (SyS_delete_module+0x148/0x1d8) [<c008c9b8>] (SyS_delete_module) from [<c000ef80>] (ret_fast_syscall+0x0/0x48)
FIX kmalloc-128: Object at 0xed08e8d0 not freed
--- drivers/clk/clk.c | 71 ++++++++++++++++++++++-------------------------------- 1 file changed, 30 insertions(+), 41 deletions(-)
drivers/clk/clk.c +30 -41
@@ -1977,9 +1977,28 @@ struct clk *__clk_register(struct device }EXPORT_SYMBOL_GPL (__clk_register); -static int _clk_register (struct device *dev,struct clk_hw *hw,struct clk *clk) +/** +* clk_register - allocate a new clock, register it and return an opaque cookie +* @dev: device that is registering this clock +* @hw: link to hardware-specific clock data +* +* clk_register is the primary interface for populating the clock tree with new +* clock nodes. It returns a pointer to the newly allocated struct clk which +* cannot be dereferenced by driver code but may be used in conjuction with the +* rest of the clock API. In the event of an error clk_register will return an +* error code; drivers must test for an error code after calling clk_register. +*/ +struct clk *clk_register (struct device *dev,struct clk_hw *hw) {int i, ret; +struct clk *clk; + + clk =kzalloc (sizeof (*clk),GFP_KERNEL ); +if (!clk) { +pr_err ("%s: could not allocate clk\n" , __func__); + ret = -ENOMEM ; + goto fail_out; + } clk->name =kstrdup (hw->init->name,GFP_KERNEL );if (!clk->name) {
@@ -2019,7 +2038,7 @@ static int _clk_register(struct device * ret =__clk_init (dev, clk);if (!ret) -return 0 ; +return clk; fail_parent_names_copy:while (--i >=0 )
@@ -2028,36 +2047,6 @@ fail_parent_names_copy: fail_parent_names:kfree (clk->name); fail_name: -return ret; -} - -/** -* clk_register - allocate a new clock, register it and return an opaque cookie -* @dev: device that is registering this clock -* @hw: link to hardware-specific clock data -* -* clk_register is the primary interface for populating the clock tree with new -* clock nodes. It returns a pointer to the newly allocated struct clk which -* cannot be dereferenced by driver code but may be used in conjuction with the -* rest of the clock API. In the event of an error clk_register will return an -* error code; drivers must test for an error code after calling clk_register. -*/ -struct clk *clk_register (struct device *dev,struct clk_hw *hw) -{ -int ret; -struct clk *clk; - - clk =kzalloc (sizeof (*clk),GFP_KERNEL ); -if (!clk) { -pr_err ("%s: could not allocate clk\n" , __func__); - ret = -ENOMEM ; - goto fail_out; - } - - ret =_clk_register (dev, hw, clk); -if (!ret) -return clk; -kfree (clk); fail_out:return ERR_PTR (ret);
@@ -2166,7 +2155,7 @@ EXPORT_SYMBOL_GPL(clk_unregister);static void devm_clk_release (struct device *dev,void *res) { -clk_unregister (res); +clk_unregister (*(struct clk **)res); }/**
@@ -2181,18 +2170,18 @@ static void devm_clk_release(struct devistruct clk *devm_clk_register (struct device *dev,struct clk_hw *hw) {struct clk *clk; -int ret; +struct clk **clkp; - clk =devres_alloc (devm_clk_release,sizeof (*clk),GFP_KERNEL ); -if (!clk) + clkp =devres_alloc (devm_clk_release,sizeof (*clkp),GFP_KERNEL ); +if (!clkp)return ERR_PTR (-ENOMEM ); - ret =_clk_register (dev, hw, clk); -if (!ret) { -devres_add (dev, clk); + clk =clk_register (dev, hw); +if (!IS_ERR (clk)) { + *clkp = clk; +devres_add (dev, clkp); }else { -devres_free (clk); - clk =ERR_PTR (ret); +devres_free (clkp); }return clk;
Greg Kroah-Hartman
maintainerPATCH 215/228 clk: Fix slab corruption in clk_unregister()
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Boyd <[email protected]>
commit 874f224cc52d64c912087e68e3724be95ad80ee7 upstream.
When a clock is unregsitered, we iterate over the list of children and reparent them to NULL (i.e. orphan list). While iterating the list, we should use the safe iterators because the children list for this clock is changing when we reparent the children to NULL. Failure to iterate safely can lead to slab corruption like this:
=============================================================================
BUG kmalloc-128 (Not tainted): Poison overwritten
-----------------------------------------------------------------------------
Disabling lock debugging due to kernel taint
INFO: 0xed0c4900-0xed0c4903. First byte 0x0 instead of 0x6b
INFO: Allocated in clk_register+0x20/0x1bc age=297 cpu=2 pid=70
__slab_alloc.isra.39.constprop.42+0x410/0x454 kmem_cache_alloc_trace+0x200/0x24c clk_register+0x20/0x1bc devm_clk_register+0x34/0x68 0xbf0000f0 platform_drv_probe+0x18/0x48 driver_probe_device+0x94/0x360 __driver_attach+0x94/0x98 bus_for_each_dev+0x54/0x88 bus_add_driver+0xe8/0x204 driver_register+0x78/0xf4 do_one_initcall+0xc4/0x17c load_module+0x19ac/0x2294 SyS_init_module+0xa4/0x110 ret_fast_syscall+0x0/0x48 INFO: Freed in clk_unregister+0xd4/0x140 age=23 cpu=2 pid=73 __slab_free+0x38/0x41c clk_unregister+0xd4/0x140 release_nodes+0x164/0x1d8 __device_release_driver+0x60/0xb0 driver_detach+0xb4/0xb8 bus_remove_driver+0x5c/0xc4 SyS_delete_module+0x148/0x1d8 ret_fast_syscall+0x0/0x48
INFO: Slab 0xeec50b90 objects=25 used=0 fp=0xed0c5400 flags=0x4080
INFO: Object 0xed0c48c0 @offset=2240 fp=0xed0c4a00
Bytes b4 ed0c48b0: 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a ZZZZZZZZZZZZZZZZ Object ed0c48c0: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk Object ed0c48d0: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk Object ed0c48e0: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk Object ed0c48f0: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk Object ed0c4900: 00 00 00 00 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b ....kkkkkkkkkkkk Object ed0c4910: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk Object ed0c4920: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk Object ed0c4930: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b a5 kkkkkkkkkkkkkkk.
Redzone ed0c4940: bb bb bb bb ....
Padding ed0c49e8: 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a ZZZZZZZZZZZZZZZZ
Padding ed0c49f8: 5a 5a 5a 5a 5a 5a 5a 5a ZZZZZZZZ
CPU: 3 PID: 75 Comm: mdev Tainted: G B 3.14.0-11033-g2054ba5ca781 #35 [<c0014be0>] (unwind_backtrace) from [<c0012240>] (show_stack+0x10/0x14) [<c0012240>] (show_stack) from [<c04b74a0>] (dump_stack+0x70/0xbc) [<c04b74a0>] (dump_stack) from [<c00f7a78>] (check_bytes_and_report+0xbc/0x100) [<c00f7a78>] (check_bytes_and_report) from [<c00f7c48>] (check_object+0x18c/0x218) [<c00f7c48>] (check_object) from [<c00f7efc>] (__free_slab+0x104/0x144) [<c00f7efc>] (__free_slab) from [<c04b6668>] (__slab_free+0x3dc/0x41c) [<c04b6668>] (__slab_free) from [<c014c008>] (load_elf_binary+0x88/0x12b4) [<c014c008>] (load_elf_binary) from [<c0105a44>] (search_binary_handler+0x78/0x18c) [<c0105a44>] (search_binary_handler) from [<c0106fc0>] (do_execve+0x490/0x5dc) [<c0106fc0>] (do_execve) from [<c0036b8c>] (____call_usermodehelper+0x134/0x168) [<c0036b8c>] (____call_usermodehelper) from [<c000f048>] (ret_from_fork+0x14/0x2c)
FIX kmalloc-128: Restoring 0xed0c4900-0xed0c4903=0x6b
--- drivers/clk/clk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/clk/clk.c +2 -1
@@ -2133,9 +2133,10 @@ void clk_unregister(struct clk *clk)if (!hlist_empty (&clk->children)) {struct clk *child; +struct hlist_node *t;/* Reparent all children to the orphan list. */ -hlist_for_each_entry (child, &clk->children, child_node) +hlist_for_each_entry_safe (child, t, &clk->children, child_node)clk_set_parent (child,NULL ); }
Greg Kroah-Hartman
maintainerPATCH 216/228 powerpc/powernv: Reset root port in firmware
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gavin Shan <[email protected]>
commit 372cf1244d7c271806b83b32b09a1c8b1b31b353 upstream.
Resetting root port has more stuff to do than that for PCIe switch ports and we should have resetting root port done in firmware instead of the kernel itself. The problem was introduced by commit 5b2e198e ("powerpc/powernv: Rework EEH reset").
--- arch/powerpc/platforms/powernv/eeh-ioda.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/platforms/powernv/eeh-ioda.c +2 -1
@@ -549,7 +549,8 @@ static int ioda_eeh_reset(struct eeh_pe ret =ioda_eeh_phb_reset (hose, option); }else { bus =eeh_pe_bus_get (pe); -if (pci_is_root_bus (bus)) +if (pci_is_root_bus (bus) || +pci_is_root_bus (bus->parent)) ret =ioda_eeh_root_reset (hose, option);else ret =ioda_eeh_bridge_reset (hose, bus->self, option);
Greg Kroah-Hartman
maintainerPATCH 217/228 powerpc: irq work racing with timer interrupt can result in timer interrupt hang
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anton Blanchard <[email protected]>
commit 8050936caf125fbe54111ba5e696b68a360556ba upstream.
I am seeing an issue where a CPU running perf eventually hangs. Traces show timer interrupts happening every 4 seconds even when a userspace task is running on the CPU. /proc/timer_list also shows pending hrtimers have not run in over an hour, including the scheduler.
Looking closer, decrementers_next_tb is getting set to 0xffffffffffffffff, and at that point we will never take a timer interrupt again.
In __timer_interrupt() we set decrementers_next_tb to 0xffffffffffffffff and rely on ->event_handler to update it:
*next_tb = ~(u64)0;
if (evt->event_handler)
evt->event_handler(evt);In this case ->event_handler is hrtimer_interrupt. This will eventually call back through the clockevents code with the next event to be programmed:
static int decrementer_set_next_event(unsigned long evt,
struct clock_event_device *dev)
{
/* Don't adjust the decrementer if some irq work is pending */
if (test_irq_work_pending())
return 0;
__get_cpu_var(decrementers_next_tb) = get_tb_or_rtc() + evt;If irq work came in between these two points, we will return before updating decrementers_next_tb and we never process a timer interrupt again.
This looks to have been introduced by 0215f7d8c53f (powerpc: Fix races with irq_work). Fix it by removing the early exit and relying on code later on in the function to force an early decrementer:
/* We may have raced with new irq work */
if (test_irq_work_pending())
set_dec(1);--- arch/powerpc/kernel/time.c | 3 --- 1 file changed, 3 deletions(-)
arch/powerpc/kernel/time.c +0 -3
@@ -805,9 +805,6 @@ static void __init clocksource_init(voidstatic int decrementer_set_next_event (unsigned long evt,struct clock_event_device *dev) { -/* Don't adjust the decrementer if some irq work is pending */ -if (test_irq_work_pending ()) -return 0 ;__get_cpu_var (decrementers_next_tb) =get_tb_or_rtc () + evt;set_dec (evt);
Greg Kroah-Hartman
maintainerPATCH 218/228 powerpc: Fix 64 bit builds with binutils 2.24
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit 7998eb3dc700aaf499f93f50b3d77da834ef9e1d upstream.
With binutils 2.24, various 64 bit builds fail with relocation errors such as
arch/powerpc/kernel/built-in.o: In function `exc_debug_crit_book3e':
(.text+0x165ee): relocation truncated to fit: R_PPC64_ADDR16_HI against symbol `interrupt_base_book3e' defined in .text section in arch/powerpc/kernel/built-in.o arch/powerpc/kernel/built-in.o: In function `exc_debug_crit_book3e': (.text+0x16602): relocation truncated to fit: R_PPC64_ADDR16_HI against symbol `interrupt_end_book3e' defined in .text section in arch/powerpc/kernel/built-in.o
The assembler maintainer says:
I changed the ABI, something that had to be done but unfortunately happens to break the booke kernel code. When building up a 64-bit value with lis, ori, shl, oris, ori or similar sequences, you now should use @high and @higha in place of @h and @ha. @h and @ha (and their associated relocs R_PPC64_ADDR16_HI and R_PPC64_ADDR16_HA) now report overflow if the value is out of 32-bit signed range. ie. @h and @ha assume you're building a 32-bit value. This is needed to report out-of-range -mcmodel=medium toc pointer offsets in @toc@h and @toc@ha expressions, and for consistency I did the same for all other @h and @ha relocs.
Replacing @h with @high in one strategic location fixes the relocation errors. This has to be done conditionally since the assembler either supports @h or @high but not both.
--- arch/powerpc/Makefile | 4 +++- arch/powerpc/include/asm/ppc_asm.h | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-)
arch/powerpc/Makefile +3 -1
@@ -149,7 +149,9 @@ endif CFLAGS-$(CONFIG_TUNE_CELL) += $(call cc-option,-mtune=cell) -KBUILD_CPPFLAGS += -Iarch/$(ARCH) +asinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1) + +KBUILD_CPPFLAGS += -Iarch/$(ARCH) $(asinstr) KBUILD_AFLAGS += -Iarch/$(ARCH) KBUILD_CFLAGS += -msoft-float -pipe -Iarch/$(ARCH) $(CFLAGS-y) CPP = $(CC) -E $(KBUILD_CFLAGS)
arch/powerpc/include/asm/ppc_asm.h +6 -1
@@ -318,11 +318,16 @@ n: addi reg,reg,(name - 0b)@l;#ifdef __powerpc64__ +#ifdef HAVE_AS_ATHIGH +#define __AS_ATHIGH high +#else +#define __AS_ATHIGH h +#endif #define LOAD_REG_IMMEDIATE (reg,expr) \ lis reg,(expr)@highest; \ ori reg,reg,(expr)@higher; \ rldicr reg,reg,32,31; \ - oris reg,reg,(expr)@h; \ + oris reg,reg,(expr)@__AS_ATHIGH; \ ori reg,reg,(expr)@l;#define LOAD_REG_ADDR (reg,name) \
Greg Kroah-Hartman
maintainerPATCH 219/228 powerpc, kexec: Fix "Processor X is stuck" issue during kexec from ST mode
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Srivatsa S. Bhat" <[email protected]>
commit 011e4b02f1da156ac7fea28a9da878f3c23af739 upstream.
If we try to perform a kexec when the machine is in ST (Single-Threaded) mode (ppc64_cpu --smt=off), the kexec operation doesn't succeed properly, and we get the following messages during boot:
[ 0.089866] POWER8 performance monitor hardware support registered [ 0.089985] power8-pmu: PMAO restore workaround active. [ 5.095419] Processor 1 is stuck. [ 10.097933] Processor 2 is stuck. [ 15.100480] Processor 3 is stuck. [ 20.102982] Processor 4 is stuck. [ 25.105489] Processor 5 is stuck. [ 30.108005] Processor 6 is stuck. [ 35.110518] Processor 7 is stuck. [ 40.113369] Processor 9 is stuck. [ 45.115879] Processor 10 is stuck. [ 50.118389] Processor 11 is stuck. [ 55.120904] Processor 12 is stuck. [ 60.123425] Processor 13 is stuck. [ 65.125970] Processor 14 is stuck. [ 70.128495] Processor 15 is stuck. [ 75.131316] Processor 17 is stuck.
Note that only the sibling threads are stuck, while the primary threads (0, 8, 16 etc) boot just fine. Looking closer at the previous step of kexec, we observe that kexec tries to wakeup (bring online) the sibling threads of all the cores, before performing kexec:
[ 9464.131231] Starting new kernel [ 9464.148507] kexec: Waking offline cpu 1. [ 9464.148552] kexec: Waking offline cpu 2. [ 9464.148600] kexec: Waking offline cpu 3. [ 9464.148636] kexec: Waking offline cpu 4. [ 9464.148671] kexec: Waking offline cpu 5. [ 9464.148708] kexec: Waking offline cpu 6. [ 9464.148743] kexec: Waking offline cpu 7. [ 9464.148779] kexec: Waking offline cpu 9. [ 9464.148815] kexec: Waking offline cpu 10. [ 9464.148851] kexec: Waking offline cpu 11. [ 9464.148887] kexec: Waking offline cpu 12. [ 9464.148922] kexec: Waking offline cpu 13. [ 9464.148958] kexec: Waking offline cpu 14. [ 9464.148994] kexec: Waking offline cpu 15. [ 9464.149030] kexec: Waking offline cpu 17.
Instrumenting this piece of code revealed that the cpu_up() operation actually fails with -EBUSY. Thus, only the primary threads of all the cores are online during kexec, and hence this is a sure-shot receipe for disaster, as explained in commit e8e5c2155b (powerpc/kexec: Fix orphaned offline CPUs across kexec), as well as in the comment above wake_offline_cpus().
It turns out that cpu_up() was returning -EBUSY because the variable 'cpu_hotplug_disabled' was set to 1; and this disabling of CPU hotplug was done by migrate_to_reboot_cpu() inside kernel_kexec().
Now, migrate_to_reboot_cpu() was originally written with the assumption that any further code will not need to perform CPU hotplug, since we are anyway in the reboot path. However, kexec is clearly not such a case, since we depend on onlining CPUs, atleast on powerpc.
So re-enable cpu-hotplug after returning from migrate_to_reboot_cpu() in the kexec path, to fix this regression in kexec on powerpc.
Also, wrap the cpu_up() in powerpc kexec code within a WARN_ON(), so that we can catch such issues more easily in the future.
--- arch/powerpc/kernel/machine_kexec_64.c | 2 +- kernel/kexec.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-)
arch/powerpc/kernel/machine_kexec_64.c +1 -1
@@ -237,7 +237,7 @@ static void wake_offline_cpus(void)if (!cpu_online (cpu)) {printk (KERN_INFO "kexec: Waking offline cpu %d.\n" , cpu); -cpu_up (cpu); +WARN_ON (cpu_up (cpu)); } } }
kernel/kexec.c +8 -0
@@ -1682,6 +1682,14 @@ int kernel_kexec(void) kexec_in_progress = true;kernel_restart_prepare (NULL );migrate_to_reboot_cpu (); + +/* +* migrate_to_reboot_cpu() disables CPU hotplug assuming that +* no further code needs to use CPU hotplug (which is true in +* the reboot case). However, the kexec path depends on using +* CPU hotplug again; so re-enable it here. +*/ +cpu_hotplug_enable ();printk (KERN_EMERG "Starting new kernel\n" );machine_shutdown (); }
Greg Kroah-Hartman
maintainerPATCH 220/228 spi: core: Ignore unsupported Dual/Quad Transfer Mode bits
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
commit 83596fbeb5d28e8cb8878786133945d4dc7c0090 upstream.
The availability of SPI Dual or Quad Transfer Mode as indicated by the "spi-tx-bus-width" and "spi-rx-bus-width" properties in the device tree is a hardware property of the SPI master, SPI slave, and board wiring. Hence the SPI core should not reject an SPI slave because an SPI master driver doesn't (yet) support Dual or Quad Transfer Mode.
Change the lack of Dual or Quad Transfer Mode support in the SPI master driver from an error condition to a warning condition, and ignore the unsupported mode bits, falling back to Single Transfer Mode, to avoid breakages when running old kernels with new device trees.
--- drivers/spi/spi.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/spi/spi.c +10 -1
@@ -1568,7 +1568,7 @@ EXPORT_SYMBOL_GPL(spi_busnum_to_master);*/ int spi_setup (struct spi_device *spi) { -unsigned bad_bits; +unsigned bad_bits, ugly_bits;int status =0 ;/* check mode to prevent that DUAL and QUAD set at the same time
@@ -1588,6 +1588,15 @@ int spi_setup(struct spi_device *spi)* that aren't supported with their current master */ bad_bits = spi->mode & ~spi->master->mode_bits; + ugly_bits = bad_bits & + (SPI_TX_DUAL |SPI_TX_QUAD |SPI_RX_DUAL |SPI_RX_QUAD ); +if (ugly_bits) { +dev_warn (&spi->dev, +"setup: ignoring unsupported mode bits %x\n" , + ugly_bits); + spi->mode &= ~ugly_bits; + bad_bits &= ~ugly_bits; + }if (bad_bits) {dev_err (&spi->dev,"setup: unsupported mode bits %x\n" , bad_bits);
Greg Kroah-Hartman
maintainerPATCH 221/228 libceph: fix corruption when using page_count 0 page in rbd
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chunwei Chen <[email protected]>
commit 178eda29ca721842f2146378e73d43e0044c4166 upstream.
It has been reported that using ZFSonLinux on rbd will result in memory corruption. The bug report can be found here:
https://github.com/zfsonlinux/spl/issues/241
http://tracker.ceph.com/issues/7790
The reason is that ZFS will send pages with page_count 0 into rbd, which in turns send them to tcp_sendpage. However, tcp_sendpage cannot deal with page_count 0, as it will do get_page and put_page, and erroneously free the page.
This type of issue has been noted before, and handled in iscsi, drbd, etc. So, rbd should also handle this. This fix address this issue by fall back to slower sendmsg when page_count 0 detected.
--- net/ceph/messenger.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
net/ceph/messenger.c +19 -1
@@ -557,7 +557,7 @@ static int ceph_tcp_sendmsg(struct sockereturn r; } -static int ceph_tcp_sendpage (struct socket *sock,struct page *page, +static int __ceph_tcp_sendpage (struct socket *sock,struct page *page,int offset,size_t size,bool more) {int flags =MSG_DONTWAIT |MSG_NOSIGNAL | (more ?MSG_MORE :MSG_EOR );
@@ -570,6 +570,24 @@ static int ceph_tcp_sendpage(struct sockreturn ret; } +static int ceph_tcp_sendpage (struct socket *sock,struct page *page, +int offset,size_t size,bool more) +{ +int ret; +struct kvec iov; + +/* sendpage cannot properly handle pages with page_count == 0, +* we need to fallback to sendmsg if that's the case */ +if (page_count (page) >=1 ) +return __ceph_tcp_sendpage (sock, page, offset, size, more); + + iov.iov_base =kmap (page) + offset; + iov.iov_len = size; + ret =ceph_tcp_sendmsg (sock, &iov,1 , size, more); +kunmap (page); + +return ret; +}/* * Shutdown/close the socket for the given connection.
Greg Kroah-Hartman
maintainerPATCH 222/228 iommu/amd: Fix interrupt remapping for aliased devices
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Williamson <[email protected]>
commit e028a9e6b8a637af09ac4114083280df4a7045f1 upstream.
An apparent cut and paste error prevents the correct flags from being set on the alias device resulting in MSI on conventional PCI devices failing to work. This also produces error events from the IOMMU like:
AMD-Vi: Event logged [INVALID_DEVICE_REQUEST device=00:14.4 address=0x000000fdf8000000 flags=0x0a00]
Where 14.4 is a PCIe-to-PCI bridge with a device behind it trying to use MSI interrupts.
--- drivers/iommu/amd_iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/amd_iommu.c +1 -1
@@ -3999,7 +3999,7 @@ static struct irq_remap_table *get_irq_tiommu_flush_dte (iommu, devid);if (devid != alias) { irq_lookup_table[alias] = table; -set_dte_irq_entry (devid, table); +set_dte_irq_entry (alias, table);iommu_flush_dte (iommu, alias); }
Greg Kroah-Hartman
maintainerPATCH 223/228 media: fc2580: fix tuning failure on 32-bit arch
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Antti Palosaari <[email protected]>
commit 8845cc6415ec28ef8d57b3fb81c75ef9bce69c5f upstream.
There was some frequency calculation overflows which caused tuning failure on 32-bit architecture. Use 64-bit numbers where needed in order to avoid calculation overflows.
Thanks for the Finnish person, who asked remain anonymous, reporting, testing and suggesting the fix.
--- drivers/media/tuners/fc2580.c | 6 +++--- drivers/media/tuners/fc2580_priv.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/media/tuners/fc2580.c +3 -3
@@ -195,7 +195,7 @@ static int fc2580_set_params(struct dvb_ f_ref =2UL * priv->cfg->clock / r_val; n_val =div_u64_rem (f_vco, f_ref, &k_val); - k_val_reg =1UL * k_val * (1 <<20 ) / f_ref; + k_val_reg =div_u64 (1ULL * k_val * (1 <<20 ), f_ref); ret =fc2580_wr_reg (priv,0x18 , r18_val | ((k_val_reg >>16 ) &0xff ));if (ret <0 )
@@ -348,8 +348,8 @@ static int fc2580_set_params(struct dvb_if (ret <0 ) goto err; - ret =fc2580_wr_reg (priv,0x37 ,1UL * priv->cfg->clock * \ - fc2580_if_filter_lut[i].mul /1000000000 ); + ret =fc2580_wr_reg (priv,0x37 ,div_u64 (1ULL * priv->cfg->clock * + fc2580_if_filter_lut[i].mul,1000000000 ));if (ret <0 ) goto err;
drivers/media/tuners/fc2580_priv.h +1 -0
@@ -22,6 +22,7 @@#define FC2580_PRIV_H #include "fc2580.h" +#include <linux/math64.h> struct fc2580_reg_val {u8 reg;
Greg Kroah-Hartman
maintainerPATCH 224/228 iwlwifi: mvm: disable beacon filtering
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
commit 7bacc782270ff7db3b9f29fa5d24ad2ee1e8e81d upstream.
This feature has been causing trouble - disable it for now.
--- drivers/net/wireless/iwlwifi/mvm/mac80211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/iwlwifi/mvm/mac80211.c +1 -1
@@ -606,7 +606,7 @@ static int iwl_mvm_mac_add_interface(strif (ret) goto out_remove_mac; -if (!mvm->bf_allowed_vif && +if (!mvm->bf_allowed_vif && false && vif->type ==NL80211_IFTYPE_STATION && !vif->p2p && mvm->fw->ucode_capa.flags &IWL_UCODE_TLV_FLAGS_BF_UPDATED ){ mvm->bf_allowed_vif = mvmvif;
Greg Kroah-Hartman
maintainerPATCH 225/228 iwlwifi: add rs_rate_scale_clear_tbl_windows helper function
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eliad Peller <[email protected]>
commit 3ca71f603bb1a0f55e1ba24618ba45617bc36f70 upstream.
instead of duplicating the same loop multiple times, use a new function for it.
this will be later used also for clearing other
windows in the table.
--- drivers/net/wireless/iwlwifi/mvm/rs.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)
drivers/net/wireless/iwlwifi/mvm/rs.c +12 -11
@@ -519,6 +519,14 @@ static void rs_rate_scale_clear_window(s window->average_tpt =IWL_INVALID_VALUE ; } +static void rs_rate_scale_clear_tbl_windows (struct iwl_scale_tbl_info *tbl) +{ +int i; + +for (i =0 ; i <IWL_RATE_COUNT ; i++) +rs_rate_scale_clear_window (&tbl->win[i]); +} +static inline u8 rs_is_valid_ant (u8 valid_antenna,u8 ant_type) {return (ant_type & valid_antenna) == ant_type;
@@ -1397,7 +1405,6 @@ static u32 rs_bw_from_sta_bw(struct ieeestatic void rs_stay_in_table (struct iwl_lq_sta *lq_sta,bool force_search) {struct iwl_scale_tbl_info *tbl; -int i;int active_tbl;int flush_interval_passed =0 ;struct iwl_mvm *mvm;
@@ -1458,9 +1465,7 @@ static void rs_stay_in_table(struct iwl_IWL_DEBUG_RATE (mvm,"LQ: stay in table clear win\n" ); -for (i =0 ; i <IWL_RATE_COUNT ; i++) -rs_rate_scale_clear_window ( - &(tbl->win[i])); +rs_rate_scale_clear_tbl_windows (tbl); } }
@@ -1469,8 +1474,7 @@ static void rs_stay_in_table(struct iwl_* "search" table). */ if (lq_sta->rs_state ==RS_STATE_SEARCH_CYCLE_STARTED ) {IWL_DEBUG_RATE (mvm,"Clearing up window stats\n" ); -for (i =0 ; i <IWL_RATE_COUNT ; i++) -rs_rate_scale_clear_window (&(tbl->win[i])); +rs_rate_scale_clear_tbl_windows (tbl); } } }
@@ -1751,7 +1755,6 @@ static void rs_rate_scale_perform(structint low =IWL_RATE_INVALID ;int high =IWL_RATE_INVALID ;int index; -int i;struct iwl_rate_scale_data *window =NULL ;int current_tpt =IWL_INVALID_VALUE ;int low_tpt =IWL_INVALID_VALUE ;
@@ -2036,8 +2039,7 @@ lq_update:if (lq_sta->search_better_tbl) {/* Access the "search" table, clear its history. */ tbl = &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); -for (i =0 ; i <IWL_RATE_COUNT ; i++) -rs_rate_scale_clear_window (&(tbl->win[i])); +rs_rate_scale_clear_tbl_windows (tbl);/* Use new "search" start rate */ index = tbl->rate.index;
@@ -2301,8 +2303,7 @@ void iwl_mvm_rs_rate_init(struct iwl_mvm lq_sta->lq.sta_id = sta_priv->sta_id;for (j =0 ; j <LQ_SIZE ; j++) -for (i =0 ; i <IWL_RATE_COUNT ; i++) -rs_rate_scale_clear_window (&lq_sta->lq_info[j].win[i]); +rs_rate_scale_clear_tbl_windows (&lq_sta->lq_info[j]); lq_sta->flush_timer =0 ; lq_sta->last_tx = jiffies;
Greg Kroah-Hartman
maintainerPATCH 226/228 iwlwifi: mvm: rs: clear per rate stats when aggregation changes
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eyal Shapira <[email protected]>
commit b804eeb6649d75caeccbeae9f5623fc7b8bdfdfa upstream.
The per rate stats should be cleared when aggregation state changes to avoid making rate scale decisions based on throughput figures which were collected prior to the aggregation state change and are now stale. While at it make sure any clearing of the per rate stats will get logged.
--- drivers/net/wireless/iwlwifi/mvm/rs.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/net/wireless/iwlwifi/mvm/rs.c +8 -6
@@ -519,10 +519,12 @@ static void rs_rate_scale_clear_window(s window->average_tpt =IWL_INVALID_VALUE ; } -static void rs_rate_scale_clear_tbl_windows (struct iwl_scale_tbl_info *tbl) +static void rs_rate_scale_clear_tbl_windows (struct iwl_mvm *mvm, +struct iwl_scale_tbl_info *tbl) {int i; +IWL_DEBUG_RATE (mvm,"Clearing up window stats\n" );for (i =0 ; i <IWL_RATE_COUNT ; i++)rs_rate_scale_clear_window (&tbl->win[i]); }
@@ -1465,7 +1467,7 @@ static void rs_stay_in_table(struct iwl_IWL_DEBUG_RATE (mvm,"LQ: stay in table clear win\n" ); -rs_rate_scale_clear_tbl_windows (tbl); +rs_rate_scale_clear_tbl_windows (mvm, tbl); } }
@@ -1473,8 +1475,7 @@ static void rs_stay_in_table(struct iwl_* bitmaps and stats in active table (this will become the new * "search" table). */ if (lq_sta->rs_state ==RS_STATE_SEARCH_CYCLE_STARTED ) { -IWL_DEBUG_RATE (mvm,"Clearing up window stats\n" ); -rs_rate_scale_clear_tbl_windows (tbl); +rs_rate_scale_clear_tbl_windows (mvm, tbl); } } }
@@ -1810,6 +1811,7 @@ static void rs_rate_scale_perform(struct"Aggregation changed: prev %d current %d. Update expected TPT table\n" , prev_agg, lq_sta->is_agg);rs_set_expected_tpt_table (lq_sta, tbl); +rs_rate_scale_clear_tbl_windows (mvm, tbl); }/* current tx rate */
@@ -2039,7 +2041,7 @@ lq_update:if (lq_sta->search_better_tbl) {/* Access the "search" table, clear its history. */ tbl = &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); -rs_rate_scale_clear_tbl_windows (tbl); +rs_rate_scale_clear_tbl_windows (mvm, tbl);/* Use new "search" start rate */ index = tbl->rate.index;
@@ -2303,7 +2305,7 @@ void iwl_mvm_rs_rate_init(struct iwl_mvm lq_sta->lq.sta_id = sta_priv->sta_id;for (j =0 ; j <LQ_SIZE ; j++) -rs_rate_scale_clear_tbl_windows (&lq_sta->lq_info[j]); +rs_rate_scale_clear_tbl_windows (mvm, &lq_sta->lq_info[j]); lq_sta->flush_timer =0 ; lq_sta->last_tx = jiffies;
Greg Kroah-Hartman
maintainerPATCH 227/228 media: V4L2: ov7670: fix a wrong index, potentially Oopsing the kernel from user-space
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guennadi Liakhovetski <[email protected]>
commit cfece5857ca51d1dcdb157017aba226f594e9dcf upstream.
Commit 75e2bdad8901a0b599e01a96229be922eef1e488 "ov7670: allow configuration of image size, clock speed, and I/O method" uses a wrong index to iterate an array. Apart from being wrong, it also uses an unchecked value from user-space, which can cause access to unmapped memory in the kernel, triggered by a normal desktop user with rights to use V4L2 devices.
--- drivers/media/i2c/ov7670.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/ov7670.c +1 -1
@@ -1109,7 +1109,7 @@ static int ov7670_enum_framesizes(struct* windows that fall outside that. */ for (i =0 ; i < n_win_sizes; i++) { -struct ov7670_win_size *win = &info->devtype->win_sizes[index]; +struct ov7670_win_size *win = &info->devtype->win_sizes[i];if (info->min_width && win->width < info->min_width)continue ;if (info->min_height && win->height < info->min_height)
Greg Kroah-Hartman
maintainerPATCH 228/228 media: V4L2: fix VIDIOC_CREATE_BUFS in 64- / 32-bit compatibility mode
In reply to Greg Kroah-Hartman3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guennadi Liakhovetski <[email protected]>
commit 97d9d23dda6f37d90aefeec4ed619d52df525382 upstream.
If a struct contains 64-bit fields, it is aligned on 64-bit boundaries within containing structs in 64-bit compilations. This is the case with struct v4l2_window, which contains pointers and is embedded into struct v4l2_format, and that one is embedded into struct v4l2_create_buffers. Unlike some other structs, used as a part of the kernel ABI as ioctl() arguments, that are packed, these structs aren't packed. This isn't a problem per se, but the ioctl-compat code for VIDIOC_CREATE_BUFS contains a bug, that triggers in such 64-bit builds. That code wrongly assumes, that in struct v4l2_create_buffers, struct v4l2_format immediately follows the __u32 memory field, which in fact isn't the case. This bug wasn't visible until now, because until recently hardly any applications used this ioctl() and mostly embedded 32-bit only drivers implemented it. This is changing now with addition of this ioctl() to some USB drivers, e.g. UVC. This patch fixes the bug by copying parts of struct v4l2_create_buffers separately.
--- drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/media/v4l2-core/v4l2-compat-ioctl32.c +7 -5
@@ -178,6 +178,9 @@ struct v4l2_create_buffers32 {static int __get_v4l2_format32 (struct v4l2_format *kp,struct v4l2_format32 __user *up) { +if (get_user (kp->type, &up->type)) +return -EFAULT ; +switch (kp->type) {case V4L2_BUF_TYPE_VIDEO_CAPTURE :case V4L2_BUF_TYPE_VIDEO_OUTPUT :
@@ -204,17 +207,16 @@ static int __get_v4l2_format32(struct v4static int get_v4l2_format32 (struct v4l2_format *kp,struct v4l2_format32 __user *up) { -if (!access_ok (VERIFY_READ , up,sizeof (struct v4l2_format32 )) || -get_user (kp->type, &up->type)) -return -EFAULT ; +if (!access_ok (VERIFY_READ , up,sizeof (struct v4l2_format32 ))) +return -EFAULT ;return __get_v4l2_format32 (kp, up); }static int get_v4l2_create32 (struct v4l2_create_buffers *kp,struct v4l2_create_buffers32 __user *up) {if (!access_ok (VERIFY_READ , up,sizeof (struct v4l2_create_buffers32 )) || - copy_from_user(kp, up, offsetof(struct v4l2_create_buffers32, format.fmt))) -return -EFAULT ; +copy_from_user (kp, up, offsetof(struct v4l2_create_buffers32 , format))) +return -EFAULT ;return __get_v4l2_format32 (&kp->format, &up->format); }
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 8 lines · Holger Hoffstätte
Quoted 1 line · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.14.6 release.
Built & running fine on 3 different machines (
x86_64), mix of old and new HW. So far no regressions. Minor hitch: theMakefiledid not apply cleanly for me because apparently the release name changed too; not sure if that was intended.
What do you mean by this? The release name changed in the 3.14.5 release, right? Not in this patch set. What did you apply this patch to?
thanks,
greg k-h
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.14.6 release. There are 228 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 Fri Jun 6 23:23:11 UTC 2014. Anything received after that time might be too late.
Build results:
total: 143 pass: 136 skipped: 4 fail: 3
Qemu tests all passed.
Failing builds are:
powerpc:allmodconfig with binutils 2.23
powerpc:allmodconfig with binutils 2.24
unicore32:defconfig
Results are as expected.
Details are available at http://server.roeck-us.net:8010/builders.
I'll check with Ben if his fix for the powerpc build problem is going to make it upstream; I have not seen it applied yet.
Guenter
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.14.6 release. There are 228 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 Fri Jun 6 23:23:11 UTC 2014. Anything received after that time might be too late.
Quoted 8 lines
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.14.6-rc1.gzand the diffstat can be found below.
thanks,
greg k-h
Compiled and booted on my test system with no dmesg regressions.
-- Shuah
Signature · 4 lines
Shuah Khan Senior Linux Kernel Developer - Open Source Group Samsung Research America(Silicon Valley) [email protected] | (970) 672-0658
Greg Kroah-Hartman
maintainerQuoted 11 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.14.6 release. There are 228 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 Fri Jun 6 23:23:11 UTC 2014. 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/v3.0/stable-review/patch-3.14.6-rc1.gzand the diffstat can be found below.
I've updated the stable tree with the futex patches as lots of people have been asking me about them, so here is a -rc2 with them incorporated:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.14.6-rc1.gz
Quoted 9 lines · Greg Kroah-Hartman
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.14.6 release. There are 228 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 Fri Jun 6 23:23:11 UTC 2014. Anything received after that time might be too late.
Quoted 9 lines
Quoted 3 lines
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.14.6-rc1.gzand the diffstat can be found below.
I've updated the stable tree with the futex patches as lots of people have been asking me about them, so here is a -rc2 with them incorporated:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.14.6-rc1.gz
Build and qemu tests are still ok. Same applies to 3.4 and 3.10.
Guenter
Hi Greg,
At Fri, 6 Jun 2014 00:53:10 -0700,
Quoted 11 lines · Guenter Roeck
Quoted 9 lines · Greg Kroah-Hartman
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.14.6 release. There are 228 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 Fri Jun 6 23:23:11 UTC 2014. Anything received after that time might be too late.
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.14.6-rc1.gzand the diffstat can be found below.
I've updated the stable tree with the futex patches as lots of people have been asking me about them, so here is a -rc2 with them incorporated:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.14.6-rc1.gz
"s/-rc1/-rc2/" ? I used the following one.
https://www.kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.14.6-rc2.xz
Quoted 3 lines
Quoted 1 line
Build and qemu tests are still ok. Same applies to 3.4 and 3.10.
3.14.6-rc2, 3.10.42-rc1, and 3.4.92-rc1 passed my test.
- Test Cases:
- Build this kernel.
- Boot this kernel.
- Build the latest mainline kernel with this kernel.
- Test Tool:
https://github.com/satoru-takeuchi/test-linux-stable
- Test Result (kernel .config, ktest config and test log):
http://satoru-takeuchi.org/test-linux-stable/results/<version>-<test datetime>.tar.xz
- Build Environment:
- OS: Debian Jessy x86_64
- CPU: Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz x 4
- memory: 8GB
- Test Target Environment:
- Debian Jessy x86_64 (KVM guest on the Build Environment)
- # of vCPU: 2
- memory: 2GB
Thanks,
Satoru
Greg Kroah-Hartman
maintainerQuoted 19 lines · Satoru Takeuchi
Hi Greg,
At Fri, 6 Jun 2014 00:53:10 -0700,
Quoted 15 lines · Guenter Roeck
Quoted 13 lines · Greg Kroah-Hartman
Quoted 11 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.14.6 release. There are 228 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 Fri Jun 6 23:23:11 UTC 2014. 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/v3.0/stable-review/patch-3.14.6-rc1.gzand the diffstat can be found below.
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
I've updated the stable tree with the futex patches as lots of people have been asking me about them, so here is a -rc2 with them incorporated:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.14.6-rc1.gz"s/-rc1/-rc2/" ? I used the following one.
Yes, sorry :(
Quoted 24 lines
https://www.kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.14.6-rc2.xz
Quoted 3 lines
Quoted 1 line
Build and qemu tests are still ok. Same applies to 3.4 and 3.10.
3.14.6-rc2, 3.10.42-rc1, and 3.4.92-rc1 passed my test.
- Test Cases:
- Build this kernel.
- Boot this kernel.
- Build the latest mainline kernel with this kernel.- Test Tool:
https://github.com/satoru-takeuchi/test-linux-stable- Test Result (kernel .config, ktest config and test log):
http://satoru-takeuchi.org/test-linux-stable/results/<version>-<test datetime>.tar.xz- Build Environment:
- OS: Debian Jessyx86_64
- CPU: Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz x 4
- memory: 8GB
Quoted 4 lines
- Test Target Environment:
- Debian Jessyx86_64(KVM guest on the Build Environment)
- # of vCPU: 2
- memory: 2GB
Great, thanks for testing and letting me know.
greg k-h