2.6.39.1-stable review
Subsystems (87)
cover 2.6.39.1-stable review
This is the start of the stable review cycle for the 2.6.39.1 release. There are 165 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 us know. If anyone is a maintainer of the proper subsystem, and wants to add a Signed-off-by: line to the patch, please respond with it.
Responses should be made by Friday, June 3, 2011, 15:00:00 UTC. 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/v2.6/stable-review/patch-2.6.39.1-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
Documentation/i2c/writing-clients | 2 +- Documentation/usb/linux-cdc-acm.inf | 4 +- Documentation/usb/linux.inf | 6 +- Makefile | 4 +- arch/arm/mm/cache-v6.S | 1 + arch/arm/mm/cache-v7.S | 2 + arch/m68k/kernel/syscalltable.S | 4 +- arch/parisc/include/asm/unistd.h | 8 +- arch/parisc/kernel/sys_parisc32.c | 8 + arch/parisc/kernel/syscall_table.S | 6 + arch/powerpc/kernel/crash.c | 2 +- arch/powerpc/kernel/misc_64.S | 13 +- arch/powerpc/oprofile/op_model_power4.c | 24 +++- arch/sh/kernel/cpu/Makefile | 4 +- arch/um/Kconfig.x86 | 4 +- arch/x86/include/asm/cpufeature.h | 2 +- arch/x86/include/asm/uaccess.h | 2 +- arch/x86/kernel/apic/io_apic.c | 4 +- arch/x86/kernel/cpu/amd.c | 16 ++- arch/x86/kernel/cpu/common.c | 3 +- arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c | 4 +- arch/x86/kernel/setup.c | 7 + arch/x86/lib/copy_user_64.S | 4 +- arch/x86/oprofile/op_model_amd.c | 95 ++++++++------ arch/x86/platform/efi/efi.c | 45 ++++++- arch/x86/platform/efi/efi_64.c | 5 +- arch/x86/xen/mmu.c | 2 +- arch/x86/xen/p2m.c | 30 ++++- arch/x86/xen/setup.c | 6 +- block/blk-flush.c | 16 ++- block/blk-settings.c | 9 +- block/blk-sysfs.c | 3 +- block/blk.h | 24 +++- block/genhd.c | 2 +- drivers/ata/libata-scsi.c | 15 +- drivers/ata/pata_cmd64x.c | 42 +++++- drivers/block/brd.c | 11 +- drivers/block/loop.c | 11 +- drivers/block/paride/pcd.c | 1 + drivers/cdrom/viocd.c | 3 +- drivers/char/i8k.c | 4 +- drivers/cpufreq/cpufreq.c | 20 +++- drivers/cpufreq/cpufreq_stats.c | 21 +++- drivers/cpuidle/governors/menu.c | 4 +- drivers/gpu/drm/i915/intel_ringbuffer.c | 29 ++++- drivers/gpu/drm/radeon/evergreen.c | 6 +- drivers/gpu/drm/radeon/evergreend.h | 2 + drivers/gpu/drm/radeon/ni.c | 8 +- drivers/gpu/drm/radeon/nid.h | 2 + drivers/gpu/drm/radeon/radeon_asic.c | 4 + drivers/hid/hid-magicmouse.c | 10 ++- drivers/hwmon/pmbus_core.c | 1 + drivers/i2c/busses/i2c-tegra.c | 5 + drivers/ide/ide-cd.c | 3 +- drivers/md/bitmap.c | 10 +- drivers/md/dm-mpath.c | 2 +- drivers/md/dm-table.c | 17 +++ drivers/md/md.c | 11 +- drivers/media/dvb/frontends/dib0070.c | 40 ++++-- drivers/media/dvb/frontends/dib0090.c | 71 ++++++++--- drivers/media/dvb/frontends/dib7000m.c | 49 +++++--- drivers/media/dvb/frontends/dib7000p.c | 74 +++++++--- drivers/media/dvb/frontends/dib8000.c | 126 +++++++++++++----- drivers/media/dvb/frontends/dib9000.c | 172 +++++++++++++++--------- drivers/media/dvb/frontends/dibx000_common.c | 109 +++++++++------ drivers/media/dvb/frontends/dibx000_common.h | 5 + drivers/media/video/cx88/cx88-blackbird.c | 5 +- drivers/media/video/cx88/cx88-dvb.c | 2 + drivers/media/video/cx88/cx88-mpeg.c | 20 ++-- drivers/media/video/cx88/cx88.h | 7 +- drivers/mfd/omap-usb-host.c | 27 +++- drivers/mtd/mtdconcat.c | 4 +- drivers/mtd/nand/nand_base.c | 2 + drivers/mtd/nand/omap2.c | 12 +- drivers/net/bonding/bond_alb.c | 4 - drivers/net/bonding/bond_main.c | 16 ++- drivers/net/bonding/bond_sysfs.c | 6 - drivers/net/macvlan.c | 4 +- drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 14 ++- drivers/net/wireless/ath/ath9k/calib.c | 13 ++ drivers/net/wireless/iwlwifi/iwl-core.c | 10 ++ drivers/net/wireless/iwlwifi/iwl-dev.h | 19 ++- drivers/net/wireless/p54/p54usb.c | 1 + drivers/pci/quirks.c | 10 ++ drivers/scsi/bnx2i/bnx2i_hwi.c | 1 + drivers/scsi/bnx2i/bnx2i_init.c | 2 +- drivers/scsi/bnx2i/bnx2i_iscsi.c | 5 +- drivers/scsi/mpt2sas/mpt2sas_scsih.c | 94 ++++++++++---- drivers/scsi/qla2xxx/qla_attr.c | 5 +- drivers/scsi/qla2xxx/qla_fw.h | 3 +- drivers/scsi/qla2xxx/qla_nx.c | 4 +- drivers/scsi/qla2xxx/qla_os.c | 32 +++-- drivers/scsi/sr.c | 2 +- drivers/scsi/ultrastor.c | 2 +- drivers/sh/clk/cpg.c | 2 +- drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c | 13 +-- drivers/staging/rtl8712/rtl871x_ioctl_set.c | 5 +- drivers/staging/usbip/usbip_common.c | 2 +- drivers/target/target_core_device.c | 4 +- drivers/target/target_core_tmr.c | 7 +- drivers/target/target_core_transport.c | 46 +++++-- drivers/usb/class/cdc-acm.c | 13 ++- drivers/usb/class/cdc-acm.h | 1 + drivers/usb/core/hcd.c | 5 +- drivers/usb/gadget/at91_udc.c | 2 +- drivers/usb/gadget/f_rndis.c | 3 +- drivers/usb/host/ehci-hcd.c | 4 +- drivers/usb/host/ehci-sched.c | 8 +- drivers/usb/host/isp116x-hcd.c | 1 + drivers/usb/host/ohci-hcd.c | 4 +- drivers/usb/host/ohci-pci.c | 12 ++- drivers/usb/host/oxu210hp-hcd.c | 6 +- drivers/usb/host/xhci-mem.c | 11 +- drivers/usb/host/xhci-ring.c | 18 ++-- drivers/usb/host/xhci.c | 11 ++- drivers/usb/serial/cp210x.c | 4 + drivers/usb/serial/ftdi_sio.c | 1 + drivers/usb/serial/ftdi_sio_ids.h | 5 + drivers/usb/serial/garmin_gps.c | 20 ++- drivers/usb/serial/moto_modem.c | 1 + drivers/usb/serial/option.c | 10 ++- drivers/usb/storage/unusual_realtek.h | 10 +- fs/block_dev.c | 34 +++-- fs/cifs/connect.c | 31 +++-- fs/ecryptfs/inode.c | 2 + fs/ecryptfs/keystore.c | 46 +++---- fs/ext3/namei.c | 13 ++- fs/ext4/ext4.h | 4 - fs/ext4/mballoc.c | 2 + fs/ext4/page-io.c | 39 ++---- fs/ext4/super.c | 41 ++---- fs/jbd/commit.c | 9 +- fs/jbd/journal.c | 16 ++- fs/namei.c | 2 +- fs/nfs/nfs4proc.c | 9 +- fs/nfs/nfs4state.c | 6 +- fs/nfs/pnfs.c | 2 +- fs/partitions/ldm.c | 5 + fs/ubifs/sb.c | 3 +- fs/ubifs/super.c | 1 + include/linux/blkdev.h | 15 ++- include/linux/efi.h | 1 + include/linux/genhd.h | 1 + include/linux/pci_ids.h | 2 + include/linux/pm_qos_params.h | 4 + include/linux/seqlock.h | 4 +- include/net/dst.h | 2 + include/target/target_core_base.h | 1 + include/target/target_core_transport.h | 1 + init/main.c | 2 +- kernel/pm_qos_params.c | 37 ++++-- kernel/trace/ftrace.c | 12 +- lib/locking-selftest.c | 2 +- mm/kmemleak.c | 7 +- mm/page_alloc.c | 2 +- mm/shmem.c | 5 +- mm/slub.c | 14 ++- mm/vmscan.c | 11 +- net/atm/atm_sysfs.c | 10 ++ net/bridge/br_netfilter.c | 6 +- net/core/dev.c | 4 +- net/core/dst.c | 2 +- net/core/ethtool.c | 2 +- net/core/skbuff.c | 3 + net/ipv4/igmp.c | 10 +- net/mac80211/cfg.c | 12 +- net/mac80211/mlme.c | 2 +- net/netfilter/nf_conntrack_sip.c | 16 ++- net/sched/sch_sfq.c | 22 +-- net/sctp/associola.c | 16 +++ net/sctp/bind_addr.c | 10 +- net/socket.c | 6 +- net/sunrpc/xprtsock.c | 16 ++- net/wireless/nl80211.c | 8 - security/apparmor/lsm.c | 3 +- security/keys/process_keys.c | 1 + sound/pci/hda/hda_intel.c | 9 +- sound/pci/hda/patch_analog.c | 3 +- sound/pci/hda/patch_conexant.c | 1 + sound/pci/hda/patch_sigmatel.c | 2 +- sound/soc/codecs/wm_hubs.c | 24 ++-- sound/soc/pxa/raumfeld.c | 92 ++++++++----- 182 files changed, 1700 insertions(+), 782 deletions(-)
PATCH 1/165 tmpfs: fix highmem swapoff crash regression
2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1204
Lines: 45
From: Hugh Dickins <[email protected]>
commit e6c9366b2adb52cba64b359b3050200743c7568c upstream.
Commit 778dd893ae78 ("tmpfs: fix race between umount and swapoff") forgot the new rules for strict atomic kmap nesting, causing
WARNING: at arch/x86/mm/highmem_32.c:81
from __kunmap_atomic(), then
BUG: unable to handle kernel paging request at fffb9000
from shmem_swp_set() when shmem_unuse_inode() is handling swapoff with highmem in use. My disgrace again.
See
https://bugzilla.kernel.org/show_bug.cgi?id=35352
--- mm/shmem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
mm/shmem.c +2 -1
@@ -916,11 +916,12 @@ static int shmem_unuse_inode(struct shmeif (size >ENTRIES_PER_PAGE ) size =ENTRIES_PER_PAGE ; offset =shmem_find_swp (entry, ptr, ptr+size); +shmem_swp_unmap (ptr);if (offset >=0 ) {shmem_dir_unmap (dir); + ptr =shmem_swp_map (subdir); goto found; } -shmem_swp_unmap (ptr); } } lost1:
PATCH 2/165 m68k: Really wire up sys_pselect6 and sys_ppoll
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1019
Lines: 31
From: Geert Uytterhoeven <[email protected]>
commit d6d42bb2f85d875dc0c421699de5a1401b2af6a6 upstream.
We reserved the numbers a long time ago, but never wired them up in the syscall table as they need TIF_RESTORE_SIGMASK, which we only got last year in commit cb6831d5d3099e772a510eb3e1ed0760ccffb45e ("m68k: Switch to saner sigsuspend()")
--- arch/m68k/kernel/syscalltable.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/m68k/kernel/syscalltable.S +2 -2
@@ -319,8 +319,8 @@ ENTRY(sys_call_table) .long sys_readlinkat .long sys_fchmodat .long sys_faccessat /* 300 */ - .long sys_ni_syscall /* Reserved for pselect6 */ - .long sys_ni_syscall /* Reserved for ppoll */ + .long sys_pselect6 + .long sys_ppoll .long sys_unshare .long sys_set_robust_list .long sys_get_robust_list /* 305 */
PATCH 3/165 kmemleak: Do not return a pointer to an object that kmemleak did not get
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1145
Lines: 37
From: Catalin Marinas <[email protected]>
commit 52c3ce4ec5601ee383a14f1485f6bac7b278896e upstream.
The kmemleak_seq_next() function tries to get an object (and increment its use count) before returning it. If it could not get the last object during list traversal (because it may have been freed), the function should return NULL rather than a pointer to such object that it did not get.
--- mm/kmemleak.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
mm/kmemleak.c +5 -2
@@ -1414,9 +1414,12 @@ static void *kmemleak_seq_next(struct se ++(*pos);list_for_each_continue_rcu (n, &object_list) { - next_obj = list_entry(n, struct kmemleak_object, object_list); -if (get_object (next_obj)) +struct kmemleak_object *obj = + list_entry(n, struct kmemleak_object, object_list); +if (get_object (obj)) { + next_obj = obj;break ; + } }put_object (prev_obj);
PATCH 4/165 kmemleak: Initialise kmemleak after debug_objects_mem_init()
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1022
Lines: 32
From: Catalin Marinas <[email protected]>
commit 9b090f2da85bd0df5e1a1ecfe4120b7b50358f48 upstream.
Kmemleak frees objects via RCU and when CONFIG_DEBUG_OBJECTS_RCU_HEAD is enabled, the RCU callback triggers a call to free_object() in lib/debugobjects.c. Since kmemleak is initialised before debug objects initialisation, it may result in a kernel panic during booting. This patch moves the kmemleak_init() call after debug_objects_mem_init().
--- init/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
init/main.c +1 -1
@@ -580,8 +580,8 @@ asmlinkage void __init start_kernel(void#endif page_cgroup_init ();enable_debug_pagealloc (); -kmemleak_init ();debug_objects_mem_init (); +kmemleak_init ();setup_per_cpu_pageset ();numa_policy_init ();if (late_time_init)
PATCH 5/165 Fix _OSC UUID in pcc-cpufreq
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1193
Lines: 39
From: Naga Chumbalkar <[email protected]>
commit 904cc1e637a00dba1b58e7752f485f90ebf2a568 upstream.
UUID needs to be written out the way it is described in Sec 18.5.124 of ACPI 4.0a Specification.
Platform firmware's use of this UUID/_OSC is optional, which is why we didn't notice this bug earlier.
--- arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c +2 -2
@@ -39,7 +39,7 @@#include <acpi/processor.h> -#define PCC_VERSION "1.00.00" +#define PCC_VERSION "1.10.00"#define POLL_LOOPS 300#define CMD_COMPLETE 0x1
@@ -102,7 +102,7 @@ static struct acpi_generic_address doorbstatic u64 doorbell_preserve;static u64 doorbell_write; -static u8 OSC_UUID [16 ] = {0x63 ,0x9B ,0x2C ,0x9F ,0x70 ,0x91 ,0x49 ,0x1f , +static u8 OSC_UUID [16 ] = {0x9F ,0x2C ,0x9B ,0x63 ,0x91 ,0x70 ,0x1f ,0x49 ,0xBB ,0x4F ,0xA5 ,0x98 ,0x2F ,0xA1 ,0xB5 ,0x46 };struct pcc_cpu {
PATCH 6/165 CPU hotplug, re-create sysfs directory and symlinks
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 2081
Lines: 63
From: Jacob Shin <[email protected]>
commit 27ecddc2a9f99ce4ac9a59a0acd77f7100b6d034 upstream.
When we discover CPUs that are affected by each other's frequency/voltage transitions, the first CPU gets a sysfs directory created, and rest of the siblings get symlinks. Currently, when we hotplug off only the first CPU, all of the symlinks and the sysfs directory gets removed. Even though rest of the siblings are still online and functional, they are orphaned, and no longer governed by cpufreq.
This patch, given the above scenario, creates a sysfs directory for the first sibling and symlinks for the rest of the siblings.
Please note the recursive call, it was rather too ugly to roll it out. And the removal of redundant NULL setting (it is already taken care of near the top of the function).
--- drivers/cpufreq/cpufreq.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
drivers/cpufreq/cpufreq.c +18 -2
@@ -1208,12 +1208,28 @@ static int __cpufreq_remove_dev(struct s cpufreq_driver->exit (data);unlock_policy_rwsem_write (cpu); +cpufreq_debug_enable_ratelimit (); + +#ifdef CONFIG_HOTPLUG_CPU +/* when the CPU which is the parent of the kobj is hotplugged +* offline, check for siblings, and create cpufreq sysfs interface +* and symlinks +*/ +if (unlikely (cpumask_weight (data->cpus) >1 )) { +/* first sibling now owns the new sysfs dir */ +cpumask_clear_cpu (cpu, data->cpus); +cpufreq_add_dev (get_cpu_sysdev (cpumask_first (data->cpus))); + +/* finally remove our own symlink */ +lock_policy_rwsem_write (cpu); +__cpufreq_remove_dev (sys_dev); + } +#endif +free_cpumask_var (data->related_cpus);free_cpumask_var (data->cpus);kfree (data); -per_cpu (cpufreq_cpu_data, cpu) =NULL ; -cpufreq_debug_enable_ratelimit ();return 0 ; }
PATCH 7/165 Fix memory leak in cpufreq_stat
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 2465
Lines: 76
From: steven finney <[email protected]>
commit 98586ed8b8878e10691203687e89a42fa3355300 upstream.
When a CPU is taken offline in an SMP system, cpufreq_remove_dev() nulls out the per-cpu policy before cpufreq_stats_free_table() can make use of it. cpufreq_stats_free_table() then skips the call to sysfs_remove_group(), leaving about 100 bytes of sysfs-related memory unclaimed each time a CPU-removal occurs. Break up cpu_stats_free_table into sysfs and table portions, and call the sysfs portion early.
--- drivers/cpufreq/cpufreq_stats.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
drivers/cpufreq/cpufreq_stats.c +18 -3
@@ -165,17 +165,27 @@ static int freq_table_get_index(struct creturn -1 ; } +/* should be called late in the CPU removal sequence so that the stats +* memory is still available in case someone tries to use it. +*/ static void cpufreq_stats_free_table (unsigned int cpu) {struct cpufreq_stats *stat =per_cpu (cpufreq_stats_table, cpu); -struct cpufreq_policy *policy =cpufreq_cpu_get (cpu); -if (policy && policy->cpu == cpu) -sysfs_remove_group (&policy->kobj, &stats_attr_group);if (stat) {kfree (stat->time_in_state);kfree (stat); }per_cpu (cpufreq_stats_table, cpu) =NULL ; +} + +/* must be called early in the CPU removal sequence (before +* cpufreq_remove_dev) so that policy is still valid. +*/ +static void cpufreq_stats_free_sysfs (unsigned int cpu) +{ +struct cpufreq_policy *policy =cpufreq_cpu_get (cpu); +if (policy && policy->cpu == cpu) +sysfs_remove_group (&policy->kobj, &stats_attr_group);if (policy)cpufreq_cpu_put (policy); }
@@ -316,6 +326,9 @@ static int __cpuinit cpufreq_stat_cpu_cacase CPU_ONLINE_FROZEN :cpufreq_update_policy (cpu);break ; +case CPU_DOWN_PREPARE : +cpufreq_stats_free_sysfs (cpu); +break ;case CPU_DEAD :case CPU_DEAD_FROZEN :cpufreq_stats_free_table (cpu);
@@ -324,9 +337,11 @@ static int __cpuinit cpufreq_stat_cpu_careturn NOTIFY_OK ; } +/* priority=1 so this will get called before cpufreq_remove_dev */ static struct notifier_block cpufreq_stat_cpu_notifier__refdata = { .notifier_call = cpufreq_stat_cpu_callback, + .priority =1 , };static struct notifier_block notifier_policy_block = {
PATCH 8/165 net: recvmmsg: Strip MSG_WAITFORONE when calling recvmsg
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1333
Lines: 44
From: Anton Blanchard <[email protected]>
commit b9eb8b8752804cecbacdb4d24b52e823cf07f107 upstream.
recvmmsg fails on a raw socket with EINVAL. The reason for this is packet_recvmsg checks the incoming flags:
err = -EINVAL;
if (flags & ~(MSG_PEEK|MSG_DONTWAIT|MSG_TRUNC|MSG_CMSG_COMPAT|MSG_ERRQUEUE))
goto out;This patch strips out MSG_WAITFORONE when calling recvmmsg which fixes the issue.
--- net/socket.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/socket.c +4 -2
@@ -2122,14 +2122,16 @@ int __sys_recvmmsg(int fd, struct mmsghd*/ if (MSG_CMSG_COMPAT & flags) { err =__sys_recvmsg (sock, (struct msghdr __user *)compat_entry, - &msg_sys, flags, datagrams); + &msg_sys, flags & ~MSG_WAITFORONE , + datagrams);if (err <0 )break ; err =__put_user (err, &compat_entry->msg_len); ++compat_entry; }else { err =__sys_recvmsg (sock, (struct msghdr __user *)entry, - &msg_sys, flags, datagrams); + &msg_sys, flags & ~MSG_WAITFORONE , + datagrams);if (err <0 )break ; err =put_user (err, &entry->msg_len);
PATCH 9/165 ftrace: Only update the function code on write to filter files
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1107
Lines: 40
From: Steven Rostedt <[email protected]>
commit 058e297d34a404caaa5ed277de15698d8dc43000 upstream.
If function tracing is enabled, a read of the filter files will cause the call to stop_machine to update the function trace sites. It should only call stop_machine on write.
--- kernel/trace/ftrace.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
kernel/trace/ftrace.c +7 -5
@@ -2413,14 +2413,16 @@ ftrace_regex_release(struct inode *inodeftrace_match_records (parser->buffer, parser->idx, enable); } -mutex_lock (&ftrace_lock); -if (ftrace_start_up && ftrace_enabled) -ftrace_run_update_code (FTRACE_ENABLE_CALLS ); -mutex_unlock (&ftrace_lock); -trace_parser_put (parser);kfree (iter); +if (file->f_mode &FMODE_WRITE ) { +mutex_lock (&ftrace_lock); +if (ftrace_start_up && ftrace_enabled) +ftrace_run_update_code (FTRACE_ENABLE_CALLS ); +mutex_unlock (&ftrace_lock); + } +mutex_unlock (&ftrace_regex_lock);return 0 ; }
PATCH 10/165 qla2xxx: Properly set the dsd_list_len for dsd_chaining in cmd type 6.
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1794
Lines: 48
From: Andrew Vasquez <[email protected]>
commit fa96d927362a422405d65491326f8ef763572e84 upstream.
The firmware spec has the fcp_data_dseg_len defined as a 32-bit value, while the corresponding field in the driver structure has it defined as a 16-bit value.
--- drivers/scsi/qla2xxx/qla_fw.h | 3 +-- drivers/scsi/qla2xxx/qla_nx.c | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-)
drivers/scsi/qla2xxx/qla_fw.h +1 -2
@@ -416,8 +416,7 @@ struct cmd_type_6 {uint8_t vp_index;uint32_t fcp_data_dseg_address[2 ];/* Data segment address. */ -uint16_t fcp_data_dseg_len;/* Data segment length. */ -uint16_t reserved_1;/* MUST be set to 0. */ +uint32_t fcp_data_dseg_len;/* Data segment length. */ };#define COMMAND_TYPE_7 0x18/* Command Type 7 entry */
drivers/scsi/qla2xxx/qla_nx.c +2 -2
@@ -2548,11 +2548,11 @@ qla2xx_build_scsi_type_6_iocbs(srb_t *sp dsd_seg = (uint32_t *)&cmd_pkt->fcp_data_dseg_address; *dsd_seg++ =cpu_to_le32 (LSD (dsd_ptr->dsd_list_dma)); *dsd_seg++ =cpu_to_le32 (MSD (dsd_ptr->dsd_list_dma)); - cmd_pkt->fcp_data_dseg_len = dsd_list_len; + *dsd_seg++ =cpu_to_le32 (dsd_list_len); }else { *cur_dsd++ =cpu_to_le32 (LSD (dsd_ptr->dsd_list_dma)); *cur_dsd++ =cpu_to_le32 (MSD (dsd_ptr->dsd_list_dma)); - *cur_dsd++ = dsd_list_len; + *cur_dsd++ =cpu_to_le32 (dsd_list_len); } cur_dsd = (uint32_t *)next_dsd;while (avail_dsds) {
PATCH 11/165 qla2xxx: Fix hang during driver unload when vport is active.
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1865
Lines: 58
From: Arun Easi <[email protected]>
commit 43ebf16d762b082663976b679b813e1b546548d1 upstream.
Bumping ref count during fc_vport_terminate() was the cause. vport delete would wait for ref count to drop to zero and that would never happen.
--- drivers/scsi/qla2xxx/qla_os.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +15 -10
@@ -2360,21 +2360,26 @@ qla2x00_remove_one(struct pci_dev *pdev) base_vha =pci_get_drvdata (pdev); ha = base_vha->hw; -spin_lock_irqsave (&ha->vport_slock, flags); -list_for_each_entry (vha, &ha->vp_list, list) { -atomic_inc (&vha->vref_count); +mutex_lock (&ha->vport_lock); +while (ha->cur_vport_count) { +struct Scsi_Host *scsi_host; -if (vha->fc_vport) { -spin_unlock_irqrestore (&ha->vport_slock, flags); +spin_lock_irqsave (&ha->vport_slock, flags); -fc_vport_terminate (vha->fc_vport); +BUG_ON (base_vha->list.next == &ha->vp_list); +/* This assumes first entry in ha->vp_list is always base vha */ + vha =list_first_entry (&base_vha->list, scsi_qla_host_t, list); + scsi_host =scsi_host_get (vha->host); -spin_lock_irqsave (&ha->vport_slock, flags); - } +spin_unlock_irqrestore (&ha->vport_slock, flags); +mutex_unlock (&ha->vport_lock); -atomic_dec (&vha->vref_count); +fc_vport_terminate (vha->fc_vport); +scsi_host_put (vha->host); + +mutex_lock (&ha->vport_lock); } -spin_unlock_irqrestore (&ha->vport_slock, flags); +mutex_unlock (&ha->vport_lock);set_bit (UNLOADING , &base_vha->dpc_flags);
PATCH 12/165 qla2xxx: Fix virtual port failing to login after chip reset.
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1531
Lines: 42
From: Saurav Kashyap <[email protected]>
commit cefcaba67ab97fb756b3a6af5139c94d861b660d upstream.
This patch ensures qla82xx_watchdog is not being run for the vport. It also makes sure that beacon ON is not done for the vport, as it will lead to the waking up of the dpc thread again and again.
--- drivers/scsi/qla2xxx/qla_os.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +4 -3
@@ -3609,7 +3609,8 @@ qla2x00_timer(scsi_qla_host_t *vha)if (!pci_channel_offline (ha->pdev))pci_read_config_word (ha->pdev,PCI_VENDOR_ID , &w); -if (IS_QLA82XX (ha)) { +/* Make sure qla82xx_watchdog is run only for physical port */ +if (!vha->vp_idx &&IS_QLA82XX (ha)) {if (test_bit (ISP_QUIESCE_NEEDED , &vha->dpc_flags)) start_dpc++;qla82xx_watchdog (vha);
@@ -3680,8 +3681,8 @@ qla2x00_timer(scsi_qla_host_t *vha) atomic_read(&vha->loop_down_timer))); } -/* Check if beacon LED needs to be blinked */ -if (ha->beacon_blink_led ==1 ) { +/* Check if beacon LED needs to be blinked for physical host only */ +if (!vha->vp_idx && (ha->beacon_blink_led ==1 )) {set_bit (BEACON_BLINK_NEEDED , &vha->dpc_flags); start_dpc++; }
PATCH 13/165 qla2xxx: Fix vport delete hang when logins are outstanding.
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1225
Lines: 37
From: Arun Easi <[email protected]>
commit 9f40682e2857a3c2ddb80a87b185af3c6a708346 upstream.
Timer is required to flush out entries that may be present in work queues.
--- drivers/scsi/qla2xxx/qla_attr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_attr.c +3 -2
@@ -1877,14 +1877,15 @@ qla24xx_vport_delete(struct fc_vport *fcscsi_remove_host (vha->host); +/* Allow timer to run to drain queued items, when removing vp */ +qla24xx_deallocate_vp_id (vha); +if (vha->timer_active) {qla2x00_vp_stop_timer (vha);DEBUG15 (printk (KERN_INFO "scsi(%ld): timer for the vport[%d]" " = %p has stopped\n" , vha->host_no, vha->vp_idx, vha)); } -qla24xx_deallocate_vp_id (vha); -/* No pending activities shall be there on the vha now */ DEBUG (msleep (random32 ()%10 ));/* Just to see if something falls on * the net we have placed below */
PATCH 14/165 powerpc/kdump64: Dont reference freed memory as pacas
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 983
Lines: 32
From: Milton Miller <[email protected]>
commit bd9e5eefecb3d69018bb95796298019d309cbec8 upstream.
Starting with 1426d5a3bd07589534286375998c0c8c6fdc5260 (powerpc:
Dynamically allocate pacas) the space for pacas beyond cpu_possible is freed, but we failed to update the loop in crash.c.
Since c1854e00727f50f7ac99e98d26ece04c087ef785 (powerpc: Set nr_cpu_ids early and use it to free PACAs) the number of pacas allocated is always nr_cpu_ids.
--- arch/powerpc/kernel/crash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/crash.c +1 -1
@@ -170,7 +170,7 @@ static void crash_kexec_wait_realmode(inint i; msecs =10000 ; -for (i=0 ; i <NR_CPUS && msecs >0 ; i++) { +for (i=0 ; i < nr_cpu_ids && msecs >0 ; i++) {if (i == cpu)continue ;
PATCH 15/165 powerpc/kexec: Fix memory corruption from unallocated slaves
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 2281
Lines: 70
From: Milton Miller <[email protected]>
commit 3d2cea732d68aa270c360f55d8669820ebce188a upstream.
Commit 1fc711f7ffb01089efc58042cfdbac8573d1b59a (powerpc/kexec: Fix race in kexec shutdown) moved the write to signal the cpu had exited the kernel from before the transition to real mode in kexec_smp_wait to kexec_wait.
Unfornately it missed that kexec_wait is used both by cpus leaving the kernel and by secondary slave cpus that were not allocated a paca for what ever reason -- they could be beyond nr_cpus or not described in the current device tree for whatever reason (for example, kexec-load was not refreshed after a cpu hotplug operation). Cpus coming through that path they will write to paca[NR_CPUS] which is beyond the space allocated for the paca data and overwrite memory not allocated to pacas but very likely still real mode accessable).
Move the write back to kexec_smp_wait, which is used only by cpus that found their paca, but after the transition to real mode.
--- arch/powerpc/kernel/misc_64.S | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
arch/powerpc/kernel/misc_64.S +8 -5
@@ -462,7 +462,8 @@ _GLOBAL(disable_kernel_fp) * wait for the flag to change, indicating this kernel is going away but * the slave code for the next one is at addresses 0 to 100. * - * This is used by all slaves. + * This is used by all slaves, even those that did not find a matching + * paca in the secondary startup code. * * Physical (hardware) cpu id should be in r3. */
@@ -471,10 +472,6 @@ _GLOBAL(kexec_wait) 1: mflr r5 addi r5,r5,kexec_flag-1b - li r4,KEXEC_STATE_REAL_MODE - stb r4,PACAKEXECSTATE(r13) - SYNC - 99: HMT_LOW #ifdef CONFIG_KEXEC /* use no memory without kexec */ lwz r4,0(r5)
@@ -499,11 +496,17 @@ kexec_flag: * * get phys id from paca * switch to real mode + * mark the paca as no longer used * join other cpus in kexec_wait(phys_id) */ _GLOBAL(kexec_smp_wait) lhz r3,PACAHWCPUID(r13) bl real_mode + + li r4,KEXEC_STATE_REAL_MODE + stb r4,PACAKEXECSTATE(r13) + SYNC + b .kexec_wait /*
PATCH 16/165 x86, cpufeature: Fix cpuid leaf 7 feature detection
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 947
Lines: 30
From: Fenghua Yu <[email protected]>
commit 2494b030ba9334c7dd7df9b9f7abe4eacc950ec5 upstream.
CPUID leaf 7, subleaf 0 returns the maximum subleaf in EAX, not the number of subleaves. Since so far only subleaf 0 is defined (and only the EBX bitfield) we do not need to qualify the test.
--- arch/x86/kernel/cpu/common.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/kernel/cpu/common.c +1 -2
@@ -565,8 +565,7 @@ void __cpuinit get_cpu_cap(struct cpuinfcpuid_count (0x00000007 ,0 , &eax, &ebx, &ecx, &edx); -if (eax >0 ) - c->x86_capability[9 ] = ebx; + c->x86_capability[9 ] = ebx; }/* AMD-defined flags: level 0x80000001 */
PATCH 17/165 ath9k_hw: do noise floor calibration only on required chains
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 2777
Lines: 79
From: Rajkumar Manoharan <[email protected]>
commit 28ef6450f0182f95c4f50aaa0ab2043a09c72b0a upstream.
At present the noise floor calibration is processed in supported control and extension chains rather than required chains. Unnccesarily doing nfcal in all supported chains leads to invalid nf readings on extn chains and these invalid values got updated into history buffer. While loading those values from history buffer is moving the chip to deaf state.
This issue was observed in AR9002/AR9003 chips while doing associate/dissociate in HT40 mode and interface up/down
in iterative manner. After some iterations, the chip was moved to deaf state. Somehow the pci devices are recovered by poll work after chip reset. Raading the nf values in all supported extension chains when the hw is not yet configured in HT40 mode results invalid values.
--- drivers/net/wireless/ath/ath9k/calib.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/net/wireless/ath/ath9k/calib.c +13 -0
@@ -69,15 +69,21 @@ static void ath9k_hw_update_nfcal_hist_b int16_t *nfarray) {struct ath_common *common =ath9k_hw_common (ah); +struct ieee80211_conf *conf = &common->hw->conf;struct ath_nf_limits *limit;struct ath9k_nfcal_hist *h;bool high_nf_mid = false; +u8 chainmask = (ah->rxchainmask <<3 ) | ah->rxchainmask;int i; h = cal->nfCalHist; limit =ath9k_hw_get_nf_limits (ah, ah->curchan);for (i =0 ; i <NUM_NF_READINGS ; i++) { +if (!(chainmask & (1 << i)) || + ((i >=AR5416_MAX_CHAINS ) && !conf_is_ht40 (conf))) +continue ; + h[i].nfCalBuffer[h[i].currIndex] = nfarray[i];if (++h[i].currIndex >=ATH9K_NF_CAL_HIST_MAX )
@@ -225,6 +231,7 @@ void ath9k_hw_loadnf(struct ath_hw *ah,int32_t val;u8 chainmask = (ah->rxchainmask <<3 ) | ah->rxchainmask;struct ath_common *common =ath9k_hw_common (ah); +struct ieee80211_conf *conf = &common->hw->conf;s16 default_nf =ath9k_hw_get_default_nf (ah, chan);if (ah->caldata)
@@ -234,6 +241,9 @@ void ath9k_hw_loadnf(struct ath_hw *ah,if (chainmask & (1 << i)) {s16 nfval; +if ((i >=AR5416_MAX_CHAINS ) && !conf_is_ht40 (conf)) +continue ; +if (h) nfval = h[i].privNF;else
@@ -293,6 +303,9 @@ void ath9k_hw_loadnf(struct ath_hw *ah,ENABLE_REGWRITE_BUFFER (ah);for (i =0 ; i <NUM_NF_READINGS ; i++) {if (chainmask & (1 << i)) { +if ((i >=AR5416_MAX_CHAINS ) && !conf_is_ht40 (conf)) +continue ; + val =REG_READ (ah, ah->nf_regs[i]); val &=0xFFFFFE00 ; val |= (((u32) (-50 ) <<1 ) &0x1ff );
PATCH 18/165 ath9k_hw: fix power for the HT40 duplicate frames
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1904
Lines: 49
From: Luis R. Rodriguez <[email protected]>
commit cf3a03b9c99a0b2715741d116f50f513f545bb2d upstream.
With AR9003 at about ~ 10 feet from an AP that uses RTS / CTS you will be able to associate but not not get data through given that the power for the rates used was set too low. This increases the power and permits data connectivity at longer distances from access points when connected with HT40. Without this you will not get any data through when associated to APs configured in HT40 at about more than 10 feet away.
--- drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +10 -0
@@ -3994,6 +3994,16 @@ static int ar9003_hw_tx_power_regwrite(sPOW_SM (pPwrArray[ALL_TARGET_LEGACY_1L_5L ],0 ) ); +/* Write the power for duplicated frames - HT40 */ + +/* dup40_cck (LSB), dup40_ofdm, ext20_cck, ext20_ofdm (MSB) */ +REG_WRITE (ah,0xa3e0 , +POW_SM (pPwrArray[ALL_TARGET_LEGACY_6_24 ],24 ) | +POW_SM (pPwrArray[ALL_TARGET_LEGACY_1L_5L ],16 ) | +POW_SM (pPwrArray[ALL_TARGET_LEGACY_6_24 ],8 ) | +POW_SM (pPwrArray[ALL_TARGET_LEGACY_1L_5L ],0 ) + ); +/* Write the HT20 power per rate set */ /* 0/8/16 (LSB), 1-3/9-11/17-19, 4, 5 (MSB) */
PATCH 19/165 ath9k_hw: fix dual band assumption for XB113
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1271
Lines: 35
From: Luis R. Rodriguez <[email protected]>
commit 9ba7f4f5eba5f4b44c7796bbad29f8ec3a7d5864 upstream.
The XB113 cards are single band, 5 GHz-only, but the default settings were configured to assume it was dual band. Users of these cards then would see 2.4 GHz channels but you would never get any scan results from these channels given that the radio is not present.
--- drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +1 -1
@@ -652,7 +652,7 @@ static const struct ar9300_eeprom ar9300 .regDmn = { LE16(0), LE16(0x1f) }, .txrxMask = 0x77, /* 4 bits tx and 4 bits rx */ .opCapFlags = { - .opFlags =AR5416_OPFLAGS_11G |AR5416_OPFLAGS_11A , + .opFlags =AR5416_OPFLAGS_11A , .eepMisc = 0, }, .rfSilent = 0,
PATCH 20/165 ath9k_hw: Fix STA connection issues with AR9380 (XB113).
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1147
Lines: 31
From: Senthil Balasubramanian <[email protected]>
commit be0e6aa5a0c487a2a0880dda8bc70f7f1860fc39 upstream.
XB113 (AR9380) 3x3 SB 5G only cards were failing to connect to APs due to incorrect xpabiaslevel configuration. fix it.
--- drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +1 -1
@@ -922,7 +922,7 @@ static const struct ar9300_eeprom ar9300 .db_stage2 = {3, 3, 3}, /* 3 chain */ .db_stage3 = {3, 3, 3}, /* doesn't exist for 2G */ .db_stage4 = {3, 3, 3}, /* don't exist for 2G */ - .xpaBiasLvl = 0, + .xpaBiasLvl = 0xf, .txFrameToDataStart = 0x0e, .txFrameToPaOn = 0x0e, .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
PATCH 21/165 powerpc/oprofile: Handle events that raise an exception without overflowing
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 2106
Lines: 62
From: Eric B Munson <[email protected]>
commit ad5d5292f16c6c1d7d3e257c4c7407594286b97e upstream.
Commit 0837e3242c73566fc1c0196b4ec61779c25ffc93 fixes a situation on POWER7 where events can roll back if a specualtive event doesn't actually complete. This can raise a performance monitor exception. We need to catch this to ensure that we reset the PMC. In all cases the PMC will be less than 256 cycles from overflow.
This patch lifts Anton's fix for the problem in perf and applies it to oprofile as well.
--- arch/powerpc/oprofile/op_model_power4.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)
arch/powerpc/oprofile/op_model_power4.c +23 -1
@@ -261,6 +261,28 @@ static int get_kernel(unsigned long pc,return is_kernel; } +static bool pmc_overflow (unsigned long val) +{ +if ((int )val <0 ) +return true; + +/* +* Events on POWER7 can roll back if a speculative event doesn't +* eventually complete. Unfortunately in some rare cases they will +* raise a performance monitor exception. We need to catch this to +* ensure we reset the PMC. In all cases the PMC will be 256 or less +* cycles from overflow. +* +* We only do this if the first pass fails to find any overflowing +* PMCs because a user might set a period of less than 256 and we +* don't want to mistakenly reset them. +*/ +if (__is_processor (PV_POWER7 ) && ((0x80000000 - val) <=256 )) +return true; + +return false; +} +static void power4_handle_interrupt (struct pt_regs *regs,struct op_counter_config *ctr) {
@@ -281,7 +303,7 @@ static void power4_handle_interrupt(strufor (i =0 ; i < cur_cpu_spec->num_pmcs; ++i) { val =classic_ctr_read (i); -if (val <0 ) { +if (pmc_overflow (val)) {if (oprofile_running && ctr[i].enabled) {oprofile_add_ext_sample (pc, regs, i, is_kernel);classic_ctr_write (i, reset_value[i]);
PATCH 22/165 iwlagn: fix iwl_is_any_associated
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 2312
Lines: 64
From: Johannes Berg <[email protected]>
commit 054ec924944912413e4ee927b8cf02f476d08783 upstream.
The function iwl_is_any_associated() was intended to check both contexts, but due to an oversight it only checks the BSS context. This leads to a problem with scanning since the passive dwell time isn't restricted appropriately and a scan that includes passive channels will never finish if only the PAN context is associated since the default dwell time of 120ms won't fit into the normal 100 TU DTIM interval.
Fix the function by using for_each_context() and also reorganise the other functions a bit to take advantage of each other making the code easier to read.
--- drivers/net/wireless/iwlwifi/iwl-dev.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/net/wireless/iwlwifi/iwl-dev.h +11 -8
@@ -1658,21 +1658,24 @@ iwl_rxon_ctx_from_vif(struct ieee80211_v ctx < &priv->contexts[NUM_IWL_RXON_CTX]; ctx++) \ if (priv->valid_contexts & BIT(ctx->ctxid)) -static inline int iwl_is_associated(struct iwl_priv *priv, -enum iwl_rxon_context_id ctxid) +static inline int iwl_is_associated_ctx(struct iwl_rxon_context *ctx) { -return (priv->contexts[ctxid].active.filter_flags & -RXON_FILTER_ASSOC_MSK ) ?1 :0 ; +return (ctx->active.filter_flags &RXON_FILTER_ASSOC_MSK ) ?1 :0 ; } -static inline int iwl_is_any_associated (struct iwl_priv *priv) +static inline int iwl_is_associated (struct iwl_priv *priv, +enum iwl_rxon_context_id ctxid) { -return iwl_is_associated (priv,IWL_RXON_CTX_BSS ); +return iwl_is_associated_ctx (&priv->contexts[ctxid]); } -static inline int iwl_is_associated_ctx (struct iwl_rxon_context *ctx) +static inline int iwl_is_any_associated (struct iwl_priv *priv) { -return (ctx->active.filter_flags &RXON_FILTER_ASSOC_MSK ) ?1 :0 ; +struct iwl_rxon_context *ctx; +for_each_context (priv, ctx) +if (iwl_is_associated_ctx (ctx)) +return true; +return false; }static inline int is_channel_valid (const struct iwl_channel_info *ch_info)
PATCH 23/165 ext4: dont set PageUptodate in ext4_end_bio()
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 3118
Lines: 99
From: Curt Wohlgemuth <[email protected]>
commit 39db00f1c45e770856264bdb3ceca27980b01965 upstream.
In the bio completion routine, we should not be setting PageUptodate at all -- it's set at sys_write() time, and is unaffected by success/failure of the write to disk.
This can cause a page corruption bug when the file system's block size is less than the architecture's VM page size.
if we have only written a single block -- we might end up setting the page's PageUptodate flag, indicating that page is completely read into memory, which may not be true. This could cause subsequent reads to get bad data.
This commit also takes the opportunity to clean up error handling in ext4_end_bio(), and remove some extraneous code:
- fixes ext4_end_bio() to set AS_EIO in the page->mapping->flags on error, which was left out by mistake. This is needed so that fsync() will return an error if there was an I/O error.
- remove the clear_buffer_dirty() call on unmapped buffers for each page.
- consolidate page/buffer error handling in a single section.
--- fs/ext4/page-io.c | 37 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 27 deletions(-)
fs/ext4/page-io.c +10 -27
@@ -203,46 +203,29 @@ static void ext4_end_bio(struct bio *biofor (i =0 ; i < io_end->num_io_pages; i++) {struct page *page = io_end->pages[i]->p_page;struct buffer_head *bh, *head; -int partial_write =0 ; +loff_t offset; +loff_t io_end_offset; - head =page_buffers (page); -if (error) +if (error) {SetPageError (page); -BUG_ON (!head); -if (head->b_size !=PAGE_CACHE_SIZE ) { -loff_t offset; -loff_t io_end_offset = io_end->offset + io_end->size; +set_bit (AS_EIO , &page->mapping->flags); + head =page_buffers (page); +BUG_ON (!head); + + io_end_offset = io_end->offset + io_end->size; offset = (sector_t ) page->index <<PAGE_CACHE_SHIFT ; bh = head;do {if ((offset >= io_end->offset) && - (offset+bh->b_size <= io_end_offset)) { -if (error) -buffer_io_error (bh); + (offset+bh->b_size <= io_end_offset)) +buffer_io_error (bh); - } -if (buffer_delay (bh)) - partial_write =1 ; -else if (!buffer_mapped (bh)) -clear_buffer_dirty (bh); -else if (buffer_dirty (bh)) - partial_write =1 ; offset += bh->b_size; bh = bh->b_this_page; }while (bh != head); } -/* -* If this is a partial write which happened to make -* all buffers uptodate then we can optimize away a -* bogus readpage() for the next read(). Here we -* 'discover' whether the page went uptodate as a -* result of this (potentially partial) write. -*/ -if (!partial_write) -SetPageUptodate (page); -put_io_page (io_end->pages[i]); } io_end->num_io_pages =0 ;
PATCH 24/165 block: move bd_set_size() above rescan_partitions() in
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
__blkdev_get()
Content-Length: 2050
Lines: 65
From: Tejun Heo <[email protected]>
commit 7e69723fef8771a9d57bd27d36281d756130b4b5 upstream.
02e352287a4 (block: rescan partitions on invalidated devices on -ENOMEDIA too) relocated partition rescan above explicit bd_set_size() to simplify condition check. As rescan_partitions() does its own bdev size setting, this doesn't break anything; however, rescan_partitions() prints out the following messages when adjusting bdev size, which can be confusing.
sda: detected capacity change from 0 to 146815737856
sdb: detected capacity change from 0 to 146815737856
This patch restores the original order and remove the warning messages.
stable: Please apply together with 02e352287a4 (block: rescan
partitions on invalidated devices on -ENOMEDIA too).
--- fs/block_dev.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
fs/block_dev.c +9 -8
@@ -1120,6 +1120,15 @@ static int __blkdev_get(struct block_dev goto restart; } } + +if (!ret && !bdev->bd_openers) { +bd_set_size (bdev,(loff_t )get_capacity (disk)<<9 ); + bdi =blk_get_backing_dev_info (bdev); +if (bdi ==NULL ) + bdi = &default_backing_dev_info; +bdev_inode_switch_bdi (bdev->bd_inode, bdi); + } +/* * If the device is invalidated, rescan partition * if open succeeded or failed with -ENOMEDIUM.
@@ -1130,14 +1139,6 @@ static int __blkdev_get(struct block_devrescan_partitions (disk, bdev);if (ret) goto out_clear; - -if (!bdev->bd_openers) { -bd_set_size (bdev,(loff_t )get_capacity (disk)<<9 ); - bdi =blk_get_backing_dev_info (bdev); -if (bdi ==NULL ) - bdi = &default_backing_dev_info; -bdev_inode_switch_bdi (bdev->bd_inode, bdi); - } }else {struct block_device *whole; whole =bdget_disk (disk,0 );
PATCH 25/165 block: add a non-queueable flush flag
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 2189
Lines: 66
From: "[email protected]" <[email protected]>
commit f3876930952390a31c3a7fd68dd621464a36eb80 upstream.
flush request isn't queueable in some drives. Add a flag to let driver notify block layer about this. We can optimize flush performance with the knowledge.
Stable: 2.6.39 only
--- block/blk-settings.c | 6 ++++++ include/linux/blkdev.h | 7 +++++++ 2 files changed, 13 insertions(+)
block/blk-settings.c +6 -0
@@ -790,6 +790,12 @@ void blk_queue_flush(struct request_queu }EXPORT_SYMBOL_GPL (blk_queue_flush); +void blk_queue_flush_queueable (struct request_queue *q,bool queueable) +{ + q->flush_not_queueable = !queueable; +} +EXPORT_SYMBOL_GPL (blk_queue_flush_queueable); +static int __init blk_settings_init (void ) { blk_max_low_pfn = max_low_pfn -1 ;
include/linux/blkdev.h +7 -0
@@ -364,6 +364,7 @@ struct request_queue* for flush operations */ unsigned int flush_flags; + unsigned int flush_not_queueable:1; unsigned int flush_pending_idx:1; unsigned int flush_running_idx:1;unsigned long flush_pending_since;
@@ -843,6 +844,7 @@ extern void blk_queue_softirq_done(strucextern void blk_queue_rq_timed_out (struct request_queue *,rq_timed_out_fn *);extern void blk_queue_rq_timeout (struct request_queue *,unsigned int );extern void blk_queue_flush (struct request_queue *q,unsigned int flush); +extern void blk_queue_flush_queueable (struct request_queue *q,bool queueable);extern struct backing_dev_info *blk_get_backing_dev_info (struct block_device *bdev);extern int blk_rq_map_sg (struct request_queue *,struct request *,struct scatterlist *);
@@ -1111,6 +1113,11 @@ static inline unsigned int block_size(streturn bdev->bd_block_size; } +static inline bool queue_flush_queueable (struct request_queue *q) +{ +return !q->flush_not_queueable; +} +typedef struct {struct page *v;}Sector ;unsigned char *read_dev_sector (struct block_device *,sector_t ,Sector *);
PATCH 26/165 block: hold queue if flush is running for non-queueable
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
flush drive
Content-Length: 3920
Lines: 106
From: "[email protected]" <[email protected]>
commit 3ac0cc4508709d42ec9aa351086c7d38bfc0660c upstream.
In some drives, flush requests are non-queueable. When flush request is running, normal read/write requests can't run. If block layer dispatches such request, driver can't handle it and requeue it. Tejun suggested we can hold the queue when flush is running. This can avoid unnecessary requeue. Also this can improve performance. For example, we have request flush1, write1, flush 2. flush1 is dispatched, then queue is hold, write1 isn't inserted to queue. After flush1 is finished, flush2 will be dispatched. Since disk cache is already clean, flush2 will be finished very soon, so looks like flush2 is folded to flush1.
In my test, the queue holding completely solves a regression introduced by commit 53d63e6b0dfb95882ec0219ba6bbd50cde423794:
block: make the flush insertion use the tail of the dispatch list
It's not a preempt type request, in fact we have to insert it behind requests that do specify INSERT_FRONT.
which causes about 20% regression running a sysbench fileio workload.
Stable: 2.6.39 only
--- block/blk-flush.c | 16 +++++++++++----- block/blk.h | 21 ++++++++++++++++++++- include/linux/blkdev.h | 1 + 3 files changed, 32 insertions(+), 6 deletions(-)
block/blk-flush.c +11 -5
@@ -212,13 +212,19 @@ static void flush_end_io(struct request }/* -* Moving a request silently to empty queue_head may stall the -* queue. Kick the queue in those cases. This function is called -* from request completion path and calling directly into -* request_fn may confuse the driver. Always use kblockd. +* Kick the queue to avoid stall for two cases: +* 1. Moving a request silently to empty queue_head may stall the +* queue. +* 2. When flush request is running in non-queueable queue, the +* queue is hold. Restart the queue after flush request is finished +* to avoid stall. +* This function is called from request completion path and calling +* directly into request_fn may confuse the driver. Always use +* kblockd. */ -if (queued) +if (queued || q->flush_queue_delayed)blk_run_queue_async (q); + q->flush_queue_delayed =0 ; }/**
block/blk.h +20 -1
@@ -61,7 +61,26 @@ static inline struct request *__elv_next rq =list_entry_rq (q->queue_head.next);return rq; } - +/* +* Flush request is running and flush request isn't queueable +* in the drive, we can hold the queue till flush request is +* finished. Even we don't do this, driver can't dispatch next +* requests and will requeue them. And this can improve +* throughput too. For example, we have request flush1, write1, +* flush 2. flush1 is dispatched, then queue is hold, write1 +* isn't inserted to queue. After flush1 is finished, flush2 +* will be dispatched. Since disk cache is already clean, +* flush2 will be finished very soon, so looks like flush2 is +* folded to flush1. +* Since the queue is hold, a flag is set to indicate the queue +* should be restarted later. Please see flush_end_io() for +* details. +*/ +if (q->flush_pending_idx != q->flush_running_idx && + !queue_flush_queueable (q)) { + q->flush_queue_delayed =1 ; +return NULL ; + }if (!q->elevator->ops->elevator_dispatch_fn (q,0 ))return NULL ; }
include/linux/blkdev.h +1 -0
@@ -365,6 +365,7 @@ struct request_queue*/ unsigned int flush_flags; unsigned int flush_not_queueable:1; + unsigned int flush_queue_delayed:1; unsigned int flush_pending_idx:1; unsigned int flush_running_idx:1;unsigned long flush_pending_since;
PATCH 27/165 block: Fix discard topology stacking and reporting
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 2984
Lines: 87
From: "Martin K. Petersen" <[email protected]>
commit a934a00a69e940b126b9bdbf83e630ef5fe43523 upstream.
In some cases we would end up stacking discard_zeroes_data incorrectly. Fix this by enabling the feature by default for stacking drivers and clearing it for low-level drivers. Incorporating a device that does not support dzd will then cause the feature to be disabled in the stacking driver.
Also ensure that the maximum discard value does not overflow when exported in sysfs and return 0 in the alignment and dzd fields for devices that don't support discard.
--- block/blk-settings.c | 3 ++- block/blk-sysfs.c | 3 ++- include/linux/blkdev.h | 7 +++++-- 3 files changed, 9 insertions(+), 4 deletions(-)
block/blk-settings.c +2 -1
@@ -120,7 +120,7 @@ void blk_set_default_limits(struct queue lim->discard_granularity =0 ; lim->discard_alignment =0 ; lim->discard_misaligned =0 ; - lim->discard_zeroes_data =-1 ; + lim->discard_zeroes_data =1 ; lim->logical_block_size = lim->physical_block_size = lim->io_min =512 ; lim->bounce_pfn = (unsigned long )(BLK_BOUNCE_ANY >>PAGE_SHIFT ); lim->alignment_offset =0 ;
@@ -166,6 +166,7 @@ void blk_queue_make_request(struct requeblk_set_default_limits (&q->limits);blk_queue_max_hw_sectors (q,BLK_SAFE_MAX_SECTORS ); + q->limits.discard_zeroes_data =0 ;/* * by default assume old behaviour and bounce for any highmem page
block/blk-sysfs.c +2 -1
@@ -152,7 +152,8 @@ static ssize_t queue_discard_granularitystatic ssize_t queue_discard_max_show (struct request_queue *q,char *page) { -return queue_var_show (q->limits.max_discard_sectors <<9 , page); +return sprintf (page,"%llu\n" , + (unsigned long long )q->limits.max_discard_sectors <<9 ); }static ssize_t queue_discard_zeroes_data_show (struct request_queue *q,char *page)
include/linux/blkdev.h +5 -2
@@ -257,7 +257,7 @@ struct queue_limits {unsigned char misaligned;unsigned char discard_misaligned;unsigned char cluster; -signed char discard_zeroes_data; +unsigned char discard_zeroes_data; };struct request_queue
@@ -1069,13 +1069,16 @@ static inline int queue_limit_discard_al {unsigned int alignment = (sector <<9 ) & (lim->discard_granularity -1 ); +if (!lim->max_discard_sectors) +return 0 ; +return (lim->discard_granularity + lim->discard_alignment - alignment) & (lim->discard_granularity -1 ); }static inline unsigned int queue_discard_zeroes_data (struct request_queue *q) { -if (q->limits.discard_zeroes_data ==1 ) +if (q->limits.max_discard_sectors && q->limits.discard_zeroes_data ==1 )return 1 ;return 0 ;
PATCH 28/165 block: add proper state guards to __elv_next_request
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 992
Lines: 32
From: James Bottomley <[email protected]>
commit 0a58e077eb600d1efd7e54ad9926a75a39d7f8ae upstream.
blk_cleanup_queue() calls elevator_exit() and after this, we can't touch the elevator without oopsing. __elv_next_request() must check for this state because in the refcounted queue model, we can still call it after blk_cleanup_queue() has been called.
This was reported as causing an oops attributable to scsi.
--- block/blk.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
block/blk.h +2 -1
@@ -81,7 +81,8 @@ static inline struct request *__elv_next q->flush_queue_delayed =1 ;return NULL ; } -if (!q->elevator->ops->elevator_dispatch_fn (q,0 )) +if (test_bit (QUEUE_FLAG_DEAD , &q->queue_flags) || + !q->elevator->ops->elevator_dispatch_fn (q,0 ))return NULL ; } }
PATCH 29/165 block: always allocate genhd->ev if check_events is
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
implemented
Content-Length: 1706
Lines: 45
From: Tejun Heo <[email protected]>
commit 75e3f3ee3c64968d42f4843ec49e579f84b5aa0c upstream.
9fd097b149 (block: unexport DISK_EVENT_MEDIA_CHANGE for legacy/fringe drivers) removed DISK_EVENT_MEDIA_CHANGE from legacy/fringe block drivers which have inadequate ->check_events(). Combined with earlier change 7c88a168da (block: don't propagate unlisted DISK_EVENTs to userland), this enables using ->check_events() for internal processing while avoiding enabling in-kernel block event polling which can lead to infinite event loop.
Unfortunately, this made many drivers including floppy without any bit set in disk->events and ->async_events in which case disk_add_events() simply skipped allocation of disk->ev, which disables whole event handling. As ->check_events() is still used during open processing for revalidation, this can lead to open failure.
This patch always allocates disk->ev if ->check_events is implemented. In the long term, it would make sense to simply include the event structure inline into genhd as it's now used by virtually all block devices.
--- block/genhd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/genhd.c +1 -1
@@ -1728,7 +1728,7 @@ static void disk_add_events(struct gendi {struct disk_events *ev; -if (!disk->fops->check_events || !(disk->events | disk->async_events)) +if (!disk->fops->check_events)return ; ev =kzalloc (sizeof (*ev),GFP_KERNEL );
PATCH 30/165 mtd: mtdconcat: fix NAND OOB write
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1181
Lines: 38
From: Felix Radensky <[email protected]>
commit 431e1ecabddcd7cbba237182ddf431771f98bb4c upstream.
Currently mtdconcat is broken for NAND. An attemtpt to create JFFS2 filesystem on concatenation of several NAND devices fails with OOB write errors. This patch fixes that problem.
--- drivers/mtd/mtdconcat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/mtdconcat.c +2 -2
@@ -319,7 +319,7 @@ concat_write_oob(struct mtd_info *mtd, lif (!(mtd->flags &MTD_WRITEABLE ))return -EROFS ; - ops->retlen =0 ; + ops->retlen = ops->oobretlen =0 ;for (i =0 ; i < concat->num_subdev; i++) {struct mtd_info *subdev = concat->subdev[i];
@@ -334,7 +334,7 @@ concat_write_oob(struct mtd_info *mtd, l devops.len = subdev->size - to; err = subdev->write_oob (subdev, to, &devops); - ops->retlen += devops.retlen; + ops->retlen += devops.oobretlen;if (err)return err;
PATCH 31/165 mtd: return badblockbits back
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1202
Lines: 35
From: Artem Bityutskiy <[email protected]>
commit 26d9be11485ea8c1102c3e8eaa7667412eef4950 upstream.
In commit c7b28e25cb9beb943aead770ff14551b55fa8c79 the initialization of the backblockbits was accidentally removed. This patch returns it back, because otherwise some NAND drivers are broken.
This problem was reported by "Saxena, Parth <[email protected]>" here:
http://lists.infradead.org/pipermail/linux-mtd/2011-April/035221.html
--- drivers/mtd/nand/nand_base.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/mtd/nand/nand_base.c +2 -0
@@ -3112,6 +3112,8 @@ ident_done: chip->chip_shift +=32 -1 ; } + chip->badblockbits =8 ; +/* Set the bad block position */ if (mtd->writesize >512 || (busw &NAND_BUSWIDTH_16 )) chip->badblockpos =NAND_LARGE_BADBLOCK_POS ;
PATCH 32/165 mtd: omap: fix subpage ecc issue with prefetch
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 2505
Lines: 68
From: Kishore Kadiyala <[email protected]>
commit c5d8c0cae4af7d78823d32fcd1c458ee1a1b5489 upstream.
When reading/writing a subpage (When HW ECC is not available/enabled) for number of bytes not aligned to 4, the mis-aligned bytes are handled first (by cpu copy method) before enabling the Prefetch engine to/from 'p'(start of buffer 'buf'). Then it reads/writes rest of the bytes with the help of Prefetch engine, if available, or again using cpu copy method. Currently, reading/writing of rest of bytes, is not done correctly since its trying to read/write again to/from begining of buffer 'buf', overwriting the mis-aligned bytes.
Read & write using prefetch engine got broken in commit '2c01946c'. We never hit a scenario of not getting 'gpmc_prefetch_enable' call success. So, problem did not get caught up.
--- drivers/mtd/nand/omap2.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/mtd/nand/omap2.c +5 -7
@@ -263,11 +263,10 @@ static void omap_read_buf_pref(struct mtif (ret) {/* PFPW engine is busy, use cpu copy method */ if (info->nand.options &NAND_BUSWIDTH_16 ) -omap_read_buf16 (mtd, buf, len); +omap_read_buf16 (mtd, (u_char *)p, len);else -omap_read_buf8 (mtd, buf, len); +omap_read_buf8 (mtd, (u_char *)p, len); }else { - p = (u32 *) buf; do { r_count = gpmc_read_status(GPMC_PREFETCH_FIFO_CNT); r_count = r_count >> 2;
@@ -293,7 +292,7 @@ static void omap_write_buf_pref(struct m struct omap_nand_info, mtd);uint32_t w_count =0 ;int i =0 , ret =0 ; -u16 *p; +u16 *p = (u16 *)buf;unsigned long tim, limit;/* take care of subpage writes */
@@ -309,11 +308,10 @@ static void omap_write_buf_pref(struct mif (ret) {/* PFPW engine is busy, use cpu copy method */ if (info->nand.options &NAND_BUSWIDTH_16 ) -omap_write_buf16 (mtd, buf, len); +omap_write_buf16 (mtd, (u_char *)p, len);else -omap_write_buf8 (mtd, buf, len); +omap_write_buf8 (mtd, (u_char *)p, len); }else { - p = (u16 *) buf;while (len) { w_count =gpmc_read_status (GPMC_PREFETCH_FIFO_CNT ); w_count = w_count >>1 ;
PATCH 33/165 SATA: enable non-queueable flush flag
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1988
Lines: 66
From: "[email protected]" <[email protected]>
commit 900e599eb0c16390ff671652a44e0ea90532220e upstream.
Enable non-queueable flush flag for SATA.
Stable: 2.6.39 only
--- drivers/ata/libata-scsi.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/ata/libata-scsi.c +7 -6
@@ -1089,21 +1089,21 @@ static int atapi_drain_needed(struct reqstatic int ata_scsi_dev_config (struct scsi_device *sdev,struct ata_device *dev) { +struct request_queue *q = sdev->request_queue; +if (!ata_id_has_unload (dev->id)) dev->flags |=ATA_DFLAG_NO_UNLOAD ;/* configure max sectors */ -blk_queue_max_hw_sectors (sdev->request_queue, dev->max_sectors); +blk_queue_max_hw_sectors (q, dev->max_sectors);if (dev->class ==ATA_DEV_ATAPI ) { -struct request_queue *q = sdev->request_queue;void *buf; sdev->sector_size =ATA_SECT_SIZE ;/* set DMA padding */ -blk_queue_update_dma_pad (sdev->request_queue, -ATA_DMA_PAD_SZ -1 ); +blk_queue_update_dma_pad (q,ATA_DMA_PAD_SZ -1 );/* configure draining */ buf =kmalloc (ATAPI_MAX_DRAIN , q->bounce_gfp |GFP_KERNEL );
@@ -1131,8 +1131,7 @@ static int ata_scsi_dev_config(struct sc"sector_size=%u > PAGE_SIZE, PIO may malfunction\n" , sdev->sector_size); -blk_queue_update_dma_alignment (sdev->request_queue, - sdev->sector_size -1 ); +blk_queue_update_dma_alignment (q, sdev->sector_size -1 );if (dev->flags &ATA_DFLAG_AN )set_bit (SDEV_EVT_MEDIA_CHANGE , sdev->supported_events);
@@ -1145,6 +1144,8 @@ static int ata_scsi_dev_config(struct scscsi_adjust_queue_depth (sdev,MSG_SIMPLE_TAG , depth); } +blk_queue_flush_queueable (q, false); + dev->sdev = sdev;return 0 ; }
PATCH 34/165 x86, 64-bit: Fix copy_[to/from]_user() checks for the
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
userspace address limit
Content-Length: 3719
Lines: 113
From: Jiri Olsa <[email protected]>
commit 26afb7c661080ae3f1f13ddf7f0c58c4f931c22b upstream.
As reported in BZ #30352:
https://bugzilla.kernel.org/show_bug.cgi?id=30352
there's a kernel bug related to reading the last allowed page on x86_64.
The _copy_to_user() and _copy_from_user() functions use the following check for address limit:
if (buf + size >= limit)
fail();
while it should be more permissive:
if (buf + size > limit)
fail();
That's because the size represents the number of bytes being read/write from/to buf address AND including the buf address. So the copy function will actually never touch the limit address even if "buf + size == limit".
Following program fails to use the last page as buffer due to the wrong limit check:
#include <sys/mman.h>
#include <sys/socket.h>
#include <assert.h>
#define PAGE_SIZE (4096)
#define LAST_PAGE ((void*)(0x7fffffffe000))
int main()
{
int fds[2], err;
void * ptr = mmap(LAST_PAGE, PAGE_SIZE, PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0);
assert(ptr == LAST_PAGE);
err = socketpair(AF_LOCAL, SOCK_STREAM, 0, fds);
assert(err == 0);
err = send(fds[0], ptr, PAGE_SIZE, 0);
perror("send");
assert(err == PAGE_SIZE);
err = recv(fds[1], ptr, PAGE_SIZE, MSG_WAITALL);
perror("recv");
assert(err == PAGE_SIZE);
return 0;}
The other place checking the addr limit is the access_ok() function, which is working properly. There's just a misleading comment for the __range_not_ok() macro - which this patch fixes as well.
The last page of the user-space address range is a guard page and Brian Gerst observed that the guard page itself due to an erratum on K8 cpus (#121 Sequential Execution Across Non-Canonical Boundary Causes Processor Hang).
However, the test code is using the last valid page before the guard page. The bug is that the last byte before the guard page can't be read because of the off-by-one error. The guard page is left in place.
This bug would normally not show up because the last page is part of the process stack and never accessed via syscalls.
--- arch/x86/include/asm/uaccess.h | 2 +- arch/x86/lib/copy_user_64.S | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
arch/x86/include/asm/uaccess.h +1 -1
@@ -42,7 +42,7 @@* Returns 0 if the range is valid, nonzero otherwise. * * This is equivalent to the following test: -* (u33)addr + (u33)size >= (u33)current->addr_limit.seg (u65 for x86_64) +* (u33)addr + (u33)size > (u33)current->addr_limit.seg (u65 for x86_64) * * This needs 33-bit (65-bit for x86_64) arithmetic. We have a carry... */
arch/x86/lib/copy_user_64.S +2 -2
@@ -72,7 +72,7 @@ ENTRY(_copy_to_user) addq %rdx,%rcx jc bad_to_user cmpq TI_addr_limit(%rax),%rcx - jae bad_to_user + ja bad_to_user ALTERNATIVE_JUMP X86_FEATURE_REP_GOOD,copy_user_generic_unrolled,copy_user_generic_string CFI_ENDPROC ENDPROC(_copy_to_user)
@@ -85,7 +85,7 @@ ENTRY(_copy_from_user) addq %rdx,%rcx jc bad_from_user cmpq TI_addr_limit(%rax),%rcx - jae bad_from_user + ja bad_from_user ALTERNATIVE_JUMP X86_FEATURE_REP_GOOD,copy_user_generic_unrolled,copy_user_generic_string CFI_ENDPROC ENDPROC(_copy_from_user)
PATCH 35/165 libata: Use Maximum Write Same Length to report discard size
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
limit
Content-Length: 1118
Lines: 33
From: "Martin K. Petersen" <[email protected]>
commit 5f4e206666f834340b69ddb43f86de3851c8675a upstream.
Previously we used Maximum Unmap LBA Count in the Block Limits VPD to signal the maximum number of sectors we could handle in a single Write Same command.
Starting with SBC3r26 the Block Limits VPD has an explicit limit on the number of blocks in a Write Same. This means we can stop abusing a field related to the Unmap command and let our SAT use the proper value in the VPD (Maximum Write Same Length).
--- drivers/ata/libata-scsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/libata-scsi.c +1 -1
@@ -2139,7 +2139,7 @@ static unsigned int ata_scsiop_inq_b0(st* with the unmap bit set. */ if (ata_id_has_trim (args->id)) { -put_unaligned_be32 (65535 *512 /8 , &rbuf[20 ]); +put_unaligned_be64 (65535 *512 /8 , &rbuf[36 ]);put_unaligned_be32 (1 , &rbuf[28 ]); }
PATCH 36/165 iwlwifi: fix bugs in change_interface
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1334
Lines: 46
From: Johannes Berg <[email protected]>
commit a2b76b3b31568da9d281a393845f17689594ccdf upstream.
If change_interface gets invoked during a firmware restart, it may crash; prevent that from happening by checking if ctx->vif is assigned.
Additionally, in my initial commit I forgot to set the vif->p2p variable correctly, so fix that too.
--- drivers/net/wireless/iwlwifi/iwl-core.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/net/wireless/iwlwifi/iwl-core.c +10 -0
@@ -1783,6 +1783,15 @@ int iwl_mac_change_interface(struct ieeemutex_lock (&priv->mutex); +if (!ctx->vif || !iwl_is_ready_rf (priv)) { +/* +* Huh? But wait ... this can maybe happen when +* we're in the middle of a firmware restart! +*/ + err = -EBUSY ; + goto out; + } + interface_modes = ctx->interface_modes | ctx->exclusive_interface_modes;if (!(interface_modes &BIT (newtype))) {
@@ -1810,6 +1819,7 @@ int iwl_mac_change_interface(struct ieee/* success */ iwl_teardown_interface (priv, vif, true); vif->type = newtype; + vif->p2p = newp2p; err =iwl_setup_interface (priv, ctx);WARN_ON (err);/*
PATCH 37/165 mac80211: use wake_queue to restart trasmit
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1073
Lines: 33
From: Rajkumar Manoharan <[email protected]>
commit 470ab2a23b453518ac86937572b4531d8925ca55 upstream.
netif_tx_start_all_queues is used to allow the upper layer to transmit frames but it does not restart transmission. To restart the trasmission use netif_tx_wake_all_queues. Not doing so, sometimes stalls the transmission and the application has to be restarted to proceed further.
This issue was originally found while sending udp traffic in higer bandwidth in open environment without bgscan.
--- net/mac80211/mlme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/mlme.c +1 -1
@@ -789,7 +789,7 @@ void ieee80211_dynamic_ps_enable_work(stieee80211_hw_config (local,IEEE80211_CONF_CHANGE_PS ); } -netif_tx_start_all_queues (sdata->dev); +netif_tx_wake_all_queues (sdata->dev); }void ieee80211_dynamic_ps_timer (unsigned long data)
PATCH 38/165 nl80211: Fix set_key regression with some drivers
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1678
Lines: 47
From: Jouni Malinen <[email protected]>
commit 0e579d6a8f4aea346da818f13ee71401c125e639 upstream.
Commit dbd2fd656f2060abfd3a16257f8b51ec60f6d2ed added a mechanism for user space to indicate whether a default key is being configured for only unicast or only multicast frames instead of all frames. This commit added a driver capability flag for indicating whether separate default keys are supported and validation of the set_key command based on that capability.
However, this single capability flag is not enough to cover possible difference based on mode (AP/IBSS/STA) and the way this change was introduced resulted in a regression with drivers that do not indicate the new capability (i.e.., more or less any non-mac80211 driver using cfg80211) when using a recent wpa_supplicant snapshot.
Fix the regression by removing the new check which is not strictly speaking needed. The new separate default key functionality is needed only for RSN IBSS which has a separate capability indication.
--- net/wireless/nl80211.c | 8 -------- 1 file changed, 8 deletions(-)
net/wireless/nl80211.c +0 -8
@@ -1679,14 +1679,6 @@ static int nl80211_set_key(struct sk_bufif (err) goto out; -if (!(rdev->wiphy.flags & -WIPHY_FLAG_SUPPORTS_SEPARATE_DEFAULT_KEYS )) { -if (!key.def_uni || !key.def_multi) { - err = -EOPNOTSUPP ; - goto out; - } - } - err = rdev->ops->set_default_key (&rdev->wiphy, dev, key.idx, key.def_uni, key.def_multi);
PATCH 39/165 mac80211: fix a few RCU issues
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1366
Lines: 47
From: Johannes Berg <[email protected]>
commit a3836e02ba4c50db958d32d710b226f2408623dc upstream.
A few configuration functions correctly do rcu_read_lock() but don't correctly reference some pointers protected by RCU. Fix that.
--- net/mac80211/cfg.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
net/mac80211/cfg.c +7 -5
@@ -228,11 +228,11 @@ static int ieee80211_get_key(struct wiph goto out;if (pairwise) - key = sta->ptk; + key =rcu_dereference (sta->ptk);else if (key_idx <NUM_DEFAULT_KEYS ) - key = sta->gtk[key_idx]; + key =rcu_dereference (sta->gtk[key_idx]); }else - key = sdata->keys[key_idx]; + key =rcu_dereference (sdata->keys[key_idx]);if (!key) goto out;
@@ -921,8 +921,10 @@ static int ieee80211_change_mpath(structstatic void mpath_set_pinfo (struct mesh_path *mpath,u8 *next_hop,struct mpath_info *pinfo) { -if (mpath->next_hop) -memcpy (next_hop, mpath->next_hop->sta.addr,ETH_ALEN ); +struct sta_info *next_hop_sta =rcu_dereference (mpath->next_hop); + +if (next_hop_sta) +memcpy (next_hop, next_hop_sta->sta.addr,ETH_ALEN );else memset (next_hop,0 ,ETH_ALEN );
PATCH 40/165 VFS: move BUG_ON test for symlink nd->depth after
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
current->link_count test
Content-Length: 1009
Lines: 37
From: Erez Zadok <[email protected]>
commit 1a4022f88d40e1255920b017556092ab926d7f66 upstream.
This solves a serious VFS-level bug in nested_symlink (which was rewritten from do_follow_link), and follows the order of depth tests that existed before.
The bug triggers a BUG_ON in fs/namei.c:1381, when running racer with symlink and rename ops.
--- fs/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/namei.c +1 -1
@@ -1378,12 +1378,12 @@ static inline int nested_symlink(struct {int res; -BUG_ON (nd->depth >=MAX_NESTED_LINKS );if (unlikely (current->link_count >=MAX_NESTED_LINKS )) {path_put_conditional (path, nd);path_put (&nd->path);return -ELOOP ; } +BUG_ON (nd->depth >=MAX_NESTED_LINKS ); nd->depth++; current->link_count++;
PATCH 41/165 wire up fanotify syscalls
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1706
Lines: 53
From: James Bottomley <[email protected]>
commit 1824074b07ee66fa0f714e08579ad85075132d7b upstream.
--- arch/parisc/include/asm/unistd.h | 4 +++- arch/parisc/kernel/sys_parisc32.c | 8 ++++++++ arch/parisc/kernel/syscall_table.S | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-)
arch/parisc/include/asm/unistd.h +3 -1
@@ -814,8 +814,10 @@#define __NR_recvmmsg (__NR_Linux + 319)#define __NR_accept4 (__NR_Linux + 320)#define __NR_prlimit64 (__NR_Linux + 321) +#define __NR_fanotify_init (__NR_Linux + 322) +#define __NR_fanotify_mark (__NR_Linux + 323) -#define __NR_Linux_syscalls (__NR_prlimit64 + 1) +#define __NR_Linux_syscalls (__NR_fanotify_mark + 1)#define __IGNORE_select/* newselect */
arch/parisc/kernel/sys_parisc32.c +8 -0
@@ -228,3 +228,11 @@ asmlinkage long compat_sys_fallocate(intreturn sys_fallocate (fd, mode, ((loff_t )offhi <<32 ) | offlo, ((loff_t )lenhi <<32 ) | lenlo); } + +asmlinkage long compat_sys_fanotify_mark (int fan_fd,int flags,u32 mask_hi, +u32 mask_lo,int fd, +const char __user *pathname) +{ +return sys_fanotify_mark (fan_fd, flags, ((u64 )mask_hi <<32 ) | mask_lo, + fd, pathname); +}
arch/parisc/kernel/syscall_table.S +2 -0
@@ -420,6 +420,8 @@ ENTRY_COMP(recvmmsg) ENTRY_SAME(accept4) /* 320 */ ENTRY_SAME(prlimit64) + ENTRY_SAME(fanotify_init) + ENTRY_COMP(fanotify_mark) /* Nothing yet */
PATCH 42/165 wire up clock_adjtime syscall
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1065
Lines: 36
From: James Bottomley <[email protected]>
commit c3f957a22eca106bd28136943305b390b4337ebf upstream.
--- arch/parisc/include/asm/unistd.h | 3 ++- arch/parisc/kernel/syscall_table.S | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
arch/parisc/include/asm/unistd.h +2 -1
@@ -816,8 +816,9 @@#define __NR_prlimit64 (__NR_Linux + 321)#define __NR_fanotify_init (__NR_Linux + 322)#define __NR_fanotify_mark (__NR_Linux + 323) +#define __NR_clock_adjtime (__NR_Linux + 324) -#define __NR_Linux_syscalls (__NR_fanotify_mark + 1) +#define __NR_Linux_syscalls (__NR_clock_adjtime + 1)#define __IGNORE_select/* newselect */
arch/parisc/kernel/syscall_table.S +1 -0
@@ -422,6 +422,7 @@ ENTRY_SAME(prlimit64) ENTRY_SAME(fanotify_init) ENTRY_COMP(fanotify_mark) + ENTRY_COMP(clock_adjtime) /* Nothing yet */
PATCH 43/165 wire up the fhandle syscalls
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1180
Lines: 38
From: James Bottomley <[email protected]>
commit a71aae4cec120ee85cf32608fca40a4605461214 upstream.
--- arch/parisc/include/asm/unistd.h | 4 +++- arch/parisc/kernel/syscall_table.S | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-)
arch/parisc/include/asm/unistd.h +3 -1
@@ -817,8 +817,10 @@#define __NR_fanotify_init (__NR_Linux + 322)#define __NR_fanotify_mark (__NR_Linux + 323)#define __NR_clock_adjtime (__NR_Linux + 324) +#define __NR_name_to_handle_at (__NR_Linux + 325) +#define __NR_open_by_handle_at (__NR_Linux + 326) -#define __NR_Linux_syscalls (__NR_clock_adjtime + 1) +#define __NR_Linux_syscalls (__NR_open_by_handle_at + 1)#define __IGNORE_select/* newselect */
arch/parisc/kernel/syscall_table.S +2 -0
@@ -423,6 +423,8 @@ ENTRY_SAME(fanotify_init) ENTRY_COMP(fanotify_mark) ENTRY_COMP(clock_adjtime) + ENTRY_SAME(name_to_handle_at) /* 325 */ + ENTRY_COMP(open_by_handle_at) /* Nothing yet */
PATCH 44/165 wire up syncfs syscall
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1082
Lines: 36
From: James Bottomley <[email protected]>
commit 2e7bad5f34b5beed47542490c760ed26574e38ba upstream.
--- arch/parisc/include/asm/unistd.h | 3 ++- arch/parisc/kernel/syscall_table.S | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
arch/parisc/include/asm/unistd.h +2 -1
@@ -819,8 +819,9 @@#define __NR_clock_adjtime (__NR_Linux + 324)#define __NR_name_to_handle_at (__NR_Linux + 325)#define __NR_open_by_handle_at (__NR_Linux + 326) +#define __NR_syncfs (__NR_Linux + 327) -#define __NR_Linux_syscalls (__NR_open_by_handle_at + 1) +#define __NR_Linux_syscalls (__NR_syncfs + 1)#define __IGNORE_select/* newselect */
arch/parisc/kernel/syscall_table.S +1 -0
@@ -425,6 +425,7 @@ ENTRY_COMP(clock_adjtime) ENTRY_SAME(name_to_handle_at) /* 325 */ ENTRY_COMP(open_by_handle_at) + ENTRY_SAME(syncfs) /* Nothing yet */
PATCH 45/165 pata_cm64x: fix boot crash on parisc
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 3628
Lines: 112
From: James Bottomley <[email protected]>
commit 9281b16caac1276817b77033c5b8a1f5ca30102c upstream.
The old IDE cmd64x checks the status of the CNTRL register to see if the ports are enabled before probing them. pata_cmd64x doesn't do this, which causes a HPMC on parisc when it tries to poke at the secondary port because apparently the BAR isn't wired up (and a non-responding piece of memory causes a HPMC).
Fix this by porting the CNTRL register port detection logic from IDE cmd64x. In addition, following converns from Alan Cox, add a check to see if a mobility electronics bridge is the immediate parent and forgo the check if it is (prevents problems on hotplug controllers).
--- drivers/ata/pata_cmd64x.c | 42 ++++++++++++++++++++++++++++++++++++++---- include/linux/pci_ids.h | 2 ++ 2 files changed, 40 insertions(+), 4 deletions(-)
drivers/ata/pata_cmd64x.c +38 -4
@@ -41,6 +41,9 @@enum {CFR =0x50 ,CFR_INTR_CH0 =0x04 , +CNTRL =0x51 , +CNTRL_CH0 =0x04 , +CNTRL_CH1 =0x08 ,CMDTIM =0x52 ,ARTTIM0 =0x53 ,DRWTIM0 =0x54 ,
@@ -328,9 +331,19 @@ static int cmd64x_init_one(struct pci_de .port_ops = &cmd648_port_ops } }; -const struct ata_port_info *ppi[] = { &cmd_info[id->driver_data],NULL }; -u8 mrdmode; +const struct ata_port_info *ppi[] = { + &cmd_info[id->driver_data], + &cmd_info[id->driver_data], +NULL + }; +u8 mrdmode, reg;int rc; +struct pci_dev *bridge = pdev->bus->self; +/* mobility split bridges don't report enabled ports correctly */ +int port_ok = !(bridge && bridge->vendor == +PCI_VENDOR_ID_MOBILITY_ELECTRONICS ); +/* all (with exceptions below) apart from 643 have CNTRL_CH0 bit */ +int cntrl_ch0_ok = (id->driver_data !=0 ); rc =pcim_enable_device (pdev);if (rc)
@@ -341,11 +354,18 @@ static int cmd64x_init_one(struct pci_deif (pdev->device ==PCI_DEVICE_ID_CMD_646 ) {/* Does UDMA work ? */ -if (pdev->revision >4 ) +if (pdev->revision >4 ) { ppi[0 ] = &cmd_info[2 ]; + ppi[1 ] = &cmd_info[2 ]; + }/* Early rev with other problems ? */ -else if (pdev->revision ==1 ) +else if (pdev->revision ==1 ) { ppi[0 ] = &cmd_info[3 ]; + ppi[1 ] = &cmd_info[3 ]; + } +/* revs 1,2 have no CNTRL_CH0 */ +if (pdev->revision <3 ) + cntrl_ch0_ok =0 ; }pci_write_config_byte (pdev,PCI_LATENCY_TIMER ,64 );
@@ -354,6 +374,20 @@ static int cmd64x_init_one(struct pci_de mrdmode |=0x02 ;/* Memory read line enable */ pci_write_config_byte (pdev,MRDMODE , mrdmode); +/* check for enabled ports */ +pci_read_config_byte (pdev,CNTRL , ®); +if (!port_ok) +dev_printk (KERN_NOTICE , &pdev->dev,"Mobility Bridge detected, ignoring CNTRL port enable/disable\n" ); +if (port_ok && cntrl_ch0_ok && !(reg &CNTRL_CH0 )) { +dev_printk (KERN_NOTICE , &pdev->dev,"Primary port is disabled\n" ); + ppi[0 ] = &ata_dummy_port_info; + + } +if (port_ok && !(reg &CNTRL_CH1 )) { +dev_printk (KERN_NOTICE , &pdev->dev,"Secondary port is disabled\n" ); + ppi[1 ] = &ata_dummy_port_info; + } +/* Force PIO 0 here.. */ /* PPC specific fixup copied from old driver */
include/linux/pci_ids.h +2 -0
@@ -608,6 +608,8 @@#define PCI_DEVICE_ID_MATROX_G550 0x2527#define PCI_DEVICE_ID_MATROX_VIA 0x4536 +#define PCI_VENDOR_ID_MOBILITY_ELECTRONICS 0x14f2 +#define PCI_VENDOR_ID_CT 0x102c#define PCI_DEVICE_ID_CT_69000 0x00c0#define PCI_DEVICE_ID_CT_65545 0x00d8
PATCH 46/165 usb-storage: fix up the unusual_realtek device list
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1573
Lines: 46
From: Alan Stern <[email protected]>
commit a8e62dd6d91f3bc3687abbb26227e5fc39c4829c upstream.
This patch (as1461) fixes the unusual_devs entries for the Realtek USB card reader. They should be ordered by PID, and they should not override the Subclass and Protocol values provided by the device. Otherwise a notification about unnecessary entries gets printed in the kernel log during probing.
--- drivers/usb/storage/unusual_realtek.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/usb/storage/unusual_realtek.h +5 -5
@@ -23,19 +23,19 @@#if defined(CONFIG_USB_STORAGE_REALTEK ) || \ defined(CONFIG_USB_STORAGE_REALTEK_MODULE ) -UNUSUAL_DEV (0x0bda ,0x0159 ,0x0000 ,0x9999 , +UNUSUAL_DEV (0x0bda ,0x0138 ,0x0000 ,0x9999 ,"Realtek" ,"USB Card Reader" , -USB_SC_SCSI ,USB_PR_BULK , init_realtek_cr,0 ), +USB_SC_DEVICE ,USB_PR_DEVICE , init_realtek_cr,0 ),UNUSUAL_DEV (0x0bda ,0x0158 ,0x0000 ,0x9999 ,"Realtek" ,"USB Card Reader" , -USB_SC_SCSI ,USB_PR_BULK , init_realtek_cr,0 ), +USB_SC_DEVICE ,USB_PR_DEVICE , init_realtek_cr,0 ), -UNUSUAL_DEV (0x0bda ,0x0138 ,0x0000 ,0x9999 , +UNUSUAL_DEV (0x0bda ,0x0159 ,0x0000 ,0x9999 ,"Realtek" ,"USB Card Reader" , - USB_SC_SCSI, USB_PR_BULK, init_realtek_cr, 0), + USB_SC_DEVICE, USB_PR_DEVICE, init_realtek_cr, 0), #endif /* defined(CONFIG_USB_STORAGE_REALTEK) || ... */
PATCH 47/165 ext3: Fix fs corruption when make_indexed_dir() fails
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1270
Lines: 43
From: Jan Kara <[email protected]>
commit 86c4f6d85595cd7da635dc6985d27bfa43b1ae10 upstream.
When make_indexed_dir() fails (e.g. because of ENOSPC) after it has allocated block for index tree root, we did not properly mark all changed buffers dirty. This lead to only some of these buffers being written out and thus effectively corrupting the directory.
Fix the issue by marking all changed data dirty even in the error failure case.
--- fs/ext3/namei.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
fs/ext3/namei.c +11 -2
@@ -1416,10 +1416,19 @@ static int make_indexed_dir(handle_t *ha frame->at = entries; frame->bh = bh; bh = bh2; +/* +* Mark buffers dirty here so that if do_split() fails we write a +* consistent set of buffers to disk. +*/ +ext3_journal_dirty_metadata (handle, frame->bh); +ext3_journal_dirty_metadata (handle, bh); de =do_split (handle,dir, &bh, frame, &hinfo, &retval); -dx_release (frames); -if (!(de)) +if (!de) { +ext3_mark_inode_dirty (handle, dir); +dx_release (frames);return retval; + } +dx_release (frames);return add_dirent_to_buf (handle, dentry, inode, de, bh); }
PATCH 48/165 jbd: Fix forever sleeping process in do_get_write_access()
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1412
Lines: 39
From: Jan Kara <[email protected]>
commit 2842bb20eed2e25cde5114298edc62c8883a1d9a upstream.
In do_get_write_access() we wait on BH_Unshadow bit for buffer to get from shadow state. The waking code in journal_commit_transaction() has a bug because it does not issue a memory barrier after the buffer is moved from the shadow state and before wake_up_bit() is called. Thus a waitqueue check can happen before the buffer is actually moved from the shadow state and waiting process may never be woken. Fix the problem by issuing proper barrier.
--- fs/jbd/commit.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
fs/jbd/commit.c +7 -2
@@ -722,8 +722,13 @@ wait_for_iobuf:required. */ JBUFFER_TRACE (jh,"file as BJ_Forget" );journal_file_buffer (jh, commit_transaction, BJ_Forget); -/* Wake up any transactions which were waiting for this -IO to complete */ +/* +* Wake up any transactions which were waiting for this +* IO to complete. The barrier must be here so that changes +* by journal_file_buffer() take effect before wake_up_bit() +* does the waitqueue check. +*/ +smp_mb ();wake_up_bit (&bh->b_state, BH_Unshadow);JBUFFER_TRACE (jh,"brelse shadowed buffer" );__brelse (bh);
PATCH 49/165 jbd: fix fsync() tid wraparound bug
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 2440
Lines: 64
From: Ted Ts'o <[email protected]>
commit d9b01934d56a96d9f4ae2d6204d4ea78a36f5f36 upstream.
If an application program does not make any changes to the indirect blocks or extent tree, i_datasync_tid will not get updated. If there are enough commits (i.e., 2**31) such that tid_geq()'s calculations wrap, and there isn't a currently active transaction at the time of the fdatasync() call, this can end up triggering a BUG_ON in fs/jbd/commit.c:
J_ASSERT(journal->j_running_transaction != NULL);
It's pretty rare that this can happen, since it requires the use of fdatasync() plus *very* frequent and excessive use of fsync(). But with the right workload, it can.
We fix this by replacing the use of tid_geq() with an equality test, since there's only one valid transaction id that is valid for us to
start: namely, the currently running transaction (if it exists).
--- fs/jbd/journal.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
fs/jbd/journal.c +13 -3
@@ -437,9 +437,12 @@ int __log_space_left(journal_t *journal)int __log_start_commit (journal_t *journal,tid_t target) {/* -* Are we already doing a recent enough commit? +* The only transaction we can possibly wait upon is the +* currently running transaction (if it exists). Otherwise, +* the target tid must be an old one. */ -if (!tid_geq (journal->j_commit_request, target)) { +if (journal->j_running_transaction && + journal->j_running_transaction->t_tid == target) {/* * We want a new commit: OK, mark the request and wakeup the * commit thread. We do _not_ do the commit ourselves.
@@ -451,7 +454,14 @@ int __log_start_commit(journal_t *journa journal->j_commit_sequence);wake_up (&journal->j_wait_commit);return 1 ; - } + }else if (!tid_geq (journal->j_commit_request, target)) +/* This should never happen, but if it does, preserve +the evidence before kjournald goes into a loop and +increments j_commit_sequence beyond all recognition. */ +WARN_ONCE (1 ,"jbd: bad log_start_commit: %u %u %u %u\n" , + journal->j_commit_request, journal->j_commit_sequence, + target, journal->j_running_transaction ? + journal->j_running_transaction->t_tid :0 );return 0 ; }
PATCH 50/165 ext4: release page cache in ext4_mb_load_buddy error path
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 643
Lines: 26
From: Yang Ruirui <[email protected]>
commit 26626f1172fb4f3f323239a6a5cf4e082643fa46 upstream.
Add missing page_cache_release in the error path of ext4_mb_load_buddy
--- fs/ext4/mballoc.c | 2 ++ 1 file changed, 2 insertions(+)
fs/ext4/mballoc.c +2 -0
@@ -1273,6 +1273,8 @@ repeat_load_buddy:return 0 ; err: +if (page) +page_cache_release (page);if (e4b->bd_bitmap_page)page_cache_release (e4b->bd_bitmap_page);if (e4b->bd_buddy_page)
PATCH 51/165 netfilter: nf_ct_sip: validate Content-Length in TCP SIP messages
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 813
Lines: 27
From: Patrick McHardy <[email protected]>
[ Upstream commit 274ea0e2a4cdf18110e5931b8ecbfef6353e5293 ]
Verify that the message length of a single SIP message, which is calculated based on the Content-Length field contained in the SIP message, does not exceed the packet boundaries.
--- net/netfilter/nf_conntrack_sip.c | 2 ++ 1 file changed, 2 insertions(+)
net/netfilter/nf_conntrack_sip.c +2 -0
@@ -1461,6 +1461,8 @@ static int sip_help_tcp(struct sk_buff * end +=strlen ("\r\n\r\n" ) + clen; msglen = origlen = end - dptr; +if (msglen > datalen) +return NF_DROP ; ret =process_sip_msg (skb, ct, dataoff, &dptr, &msglen);if (ret !=NF_ACCEPT )
PATCH 52/165 netfilter: nf_ct_sip: fix SDP parsing in TCP SIP messages for some Cisco phones
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1530
Lines: 49
From: Patrick McHardy <[email protected]>
[ Upstream commit e6e4d9ed11fb1fab8b3256a3dc14d71b5e984ac4 ]
Some Cisco phones do not place the Content-Length field at the end of the SIP message. This is valid, due to a misunderstanding of the specification the parser expects the SDP body to start directly after the Content-Length field. Fix the parser to scan for \r\n\r\n to locate the beginning of the SDP body.
--- net/netfilter/nf_conntrack_sip.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
net/netfilter/nf_conntrack_sip.c +10 -4
@@ -1419,6 +1419,7 @@ static int sip_help_tcp(struct sk_buff *const char *dptr, *end;s16 diff, tdiff =0 ;int ret =NF_ACCEPT ; +bool term;typeof (nf_nat_sip_seq_adjust_hook) nf_nat_sip_seq_adjust; if (ctinfo != IP_CT_ESTABLISHED &&
@@ -1453,10 +1454,15 @@ static int sip_help_tcp(struct sk_buff *if (dptr + matchoff == end)break ; -if (end +strlen ("\r\n\r\n" ) > dptr + datalen) -break ; -if (end[0 ] !='\r' || end[1 ] !='\n' || - end[2 ] !='\r' || end[3 ] !='\n' ) + term = false; +for (; end +strlen ("\r\n\r\n" ) <= dptr + datalen; end++) { +if (end[0 ] =='\r' && end[1 ] =='\n' && + end[2 ] =='\r' && end[3 ] =='\n' ) { + term = true; +break ; + } + } +if (!term)break ; end +=strlen ("\r\n\r\n" ) + clen;
PATCH 53/165 net: use hlist_del_rcu() in dev_change_name()
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 786
Lines: 30
From: Eric Dumazet <[email protected]>
[ Upstream commit 372b2312010bece1e36f577d6c99a6193ec54cbd ]
Using plain hlist_del() in dev_change_name() is wrong since a concurrent reader can crash trying to dereference LIST_POISON1.
Bug introduced in commit 72c9528bab94 (net: Introduce dev_get_by_name_rcu())
--- net/core/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/dev.c +1 -1
@@ -1007,7 +1007,7 @@ rollback: }write_lock_bh (&dev_base_lock); -hlist_del (&dev->name_hlist); +hlist_del_rcu (&dev->name_hlist);write_unlock_bh (&dev_base_lock);synchronize_rcu ();
PATCH 54/165 net: Change netdev_fix_features messages loglevel
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 825
Lines: 28
From: Michael S. Tsirkin <[email protected]>
[ Upstream commit 604ae14ffb6d75d6eef4757859226b758d6bf9e3 ]
Cool, how about we make 'Features changed' debug as well? This way userspace can't fill up the log just by tweaking tun features with an ioctl.
--- net/core/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/dev.c +1 -1
@@ -5258,7 +5258,7 @@ void netdev_update_features(struct net_dif (dev->features == features)return ; -netdev_info (dev,"Features changed: 0x%08x -> 0x%08x\n" , +netdev_dbg (dev,"Features changed: 0x%08x -> 0x%08x\n" , dev->features, features);if (dev->netdev_ops->ndo_set_features)
PATCH 55/165 net: ethtool: fix IPV6 checksum feature name string
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 921
Lines: 24
From: =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= <[email protected]>
[ Upstream commit 7cc31a9ae1477abc79d5992b3afe889f25c50c99 ]
--- net/core/ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/ethtool.c +1 -1
@@ -330,7 +330,7 @@ static const char netdev_features_string/* NETIF_F_IP_CSUM */ "tx-checksum-ipv4" ,/* NETIF_F_NO_CSUM */ "tx-checksum-unneeded" ,/* NETIF_F_HW_CSUM */ "tx-checksum-ip-generic" , -/* NETIF_F_IPV6_CSUM */ "tx_checksum-ipv6" , +/* NETIF_F_IPV6_CSUM */ "tx-checksum-ipv6" ,/* NETIF_F_HIGHDMA */ "highdma" ,/* NETIF_F_FRAGLIST */ "tx-scatter-gather-fraglist" , /* NETIF_F_HW_VLAN_TX */ "tx-vlan-hw-insert",
PATCH 56/165 net: add skb_dst_force() in sock_queue_err_skb()
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 2603
Lines: 69
From: Eric Dumazet <[email protected]>
[ Upstream commit abb57ea48fd9431fa320a5c55f73e6b5a44c2efb ]
Commit 7fee226ad239 (add a noref bit on skb dst) forgot to use skb_dst_force() on packets queued in sk_error_queue
This triggers following warning, for applications using IP_CMSG_PKTINFO receiving one error status
------------[ cut here ]------------ WARNING: at include/linux/skbuff.h:457 ip_cmsg_recv_pktinfo+0xa6/0xb0() Hardware name: 2669UYD Modules linked in: isofs vboxnetadp vboxnetflt nfsd ebtable_nat ebtables
lib80211_crypt_ccmp uinput xcbc hdaps tp_smapi thinkpad_ec radeonfb fb_ddc radeon ttm drm_kms_helper drm ipw2200 intel_agp intel_gtt libipw i2c_algo_bit i2c_i801 agpgart rng_core cfbfillrect cfbcopyarea cfbimgblt video raid10 raid1 raid0 linear md_mod vboxdrv
Pid: 4697, comm: miredo Not tainted 2.6.39-rc6-00569-g5895198-dirty #22
Call Trace: [<c17746b6>] ? printk+0x1d/0x1f [<c1058302>] warn_slowpath_common+0x72/0xa0 [<c15bbca6>] ? ip_cmsg_recv_pktinfo+0xa6/0xb0 [<c15bbca6>] ? ip_cmsg_recv_pktinfo+0xa6/0xb0 [<c1058350>] warn_slowpath_null+0x20/0x30 [<c15bbca6>] ip_cmsg_recv_pktinfo+0xa6/0xb0 [<c15bbdd7>] ip_cmsg_recv+0x127/0x260 [<c154f82d>] ? skb_dequeue+0x4d/0x70 [<c1555523>] ? skb_copy_datagram_iovec+0x53/0x300 [<c178e834>] ? sub_preempt_count+0x24/0x50 [<c15bdd2d>] ip_recv_error+0x23d/0x270 [<c15de554>] udp_recvmsg+0x264/0x2b0 [<c15ea659>] inet_recvmsg+0xd9/0x130 [<c1547752>] sock_recvmsg+0xf2/0x120 [<c11179cb>] ? might_fault+0x4b/0xa0 [<c15546bc>] ? verify_iovec+0x4c/0xc0 [<c1547660>] ? sock_recvmsg_nosec+0x100/0x100 [<c1548294>] __sys_recvmsg+0x114/0x1e0 [<c1093895>] ? __lock_acquire+0x365/0x780 [<c1148b66>] ? fget_light+0xa6/0x3e0 [<c1148b7f>] ? fget_light+0xbf/0x3e0 [<c1148aee>] ? fget_light+0x2e/0x3e0 [<c1549f29>] sys_recvmsg+0x39/0x60
Close bug https://bugzilla.kernel.org/show_bug.cgi?id=34622
--- net/core/skbuff.c | 3 +++ 1 file changed, 3 insertions(+)
net/core/skbuff.c +3 -0
@@ -2993,6 +2993,9 @@ int sock_queue_err_skb(struct sock *sk, skb->destructor = sock_rmem_free;atomic_add (skb->truesize, &sk->sk_rmem_alloc); +/* before exiting rcu section, make sure dst is refcounted */ +skb_dst_force (skb); +skb_queue_tail (&sk->sk_error_queue, skb);if (!sock_flag (sk,SOCK_DEAD )) sk->sk_data_ready (sk, skb->len);
PATCH 57/165 macvlan: fix panic if lowerdev in a bond
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1039
Lines: 41
From: Eric Dumazet <[email protected]>
[ Upstream commit d93515611bbc70c2fe4db232e5feb448ed8e4cc9 ]
commit a35e2c1b6d905 (macvlan: use rx_handler_data pointer to store macvlan_port pointer V2) added a bug in macvlan_port_create()
Steps to reproduce the bug:
# ifenslave bond0 eth0 eth1
# ip link add link eth0 up name eth0#1 type macvlan ->error EBUSY
# ip link add link eth0 up name eth0#1 type macvlan ->panic
Fix: Dont set IFF_MACVLAN_PORT in error case.
--- drivers/net/macvlan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/macvlan.c +2 -2
@@ -598,8 +598,8 @@ static int macvlan_port_create(struct ne err =netdev_rx_handler_register (dev, macvlan_handle_frame, port);if (err)kfree (port); - - dev->priv_flags |=IFF_MACVLAN_PORT ; +else + dev->priv_flags |=IFF_MACVLAN_PORT ;return err; }
PATCH 58/165 SCTP: fix race between sctp_bind_addr_free() and sctp_bind_addr_conflict()
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 2885
Lines: 71
From: Jacek Luczak <[email protected]>
[ Upstream commit c182f90bc1f22ce5039b8722e45621d5f96862c2 ]
During the sctp_close() call, we do not use rcu primitives to destroy the address list attached to the endpoint. At the same time, we do the removal of addresses from this list before attempting to remove the socket from the port hash
As a result, it is possible for another process to find the socket in the port hash that is in the process of being closed. It then proceeds to traverse the address list to find the conflict, only to have that address list suddenly disappear without rcu() critical section.
Fix issue by closing address list removal inside RCU critical section.
Race can result in a kernel crash with general protection fault or kernel NULL pointer dereference:
kernel: general protection fault: 0000 [#1] SMP kernel: RIP: 0010:[<ffffffffa02f3dde>] [<ffffffffa02f3dde>] sctp_bind_addr_conflict+0x64/0x82 [sctp] kernel: Call Trace: kernel: [<ffffffffa02f415f>] ? sctp_get_port_local+0x17b/0x2a3 [sctp] kernel: [<ffffffffa02f3d45>] ? sctp_bind_addr_match+0x33/0x68 [sctp] kernel: [<ffffffffa02f4416>] ? sctp_do_bind+0xd3/0x141 [sctp] kernel: [<ffffffffa02f5030>] ? sctp_bindx_add+0x4d/0x8e [sctp] kernel: [<ffffffffa02f5183>] ? sctp_setsockopt_bindx+0x112/0x4a4 [sctp] kernel: [<ffffffff81089e82>] ? generic_file_aio_write+0x7f/0x9b kernel: [<ffffffffa02f763e>] ? sctp_setsockopt+0x14f/0xfee [sctp] kernel: [<ffffffff810c11fb>] ? do_sync_write+0xab/0xeb kernel: [<ffffffff810e82ab>] ? fsnotify+0x239/0x282 kernel: [<ffffffff810c2462>] ? alloc_file+0x18/0xb1 kernel: [<ffffffff8134a0b1>] ? compat_sys_setsockopt+0x1a5/0x1d9 kernel: [<ffffffff8134aaf1>] ? compat_sys_socketcall+0x143/0x1a4 kernel: [<ffffffff810467dc>] ? sysenter_dispatch+0x7/0x32
--- net/sctp/bind_addr.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
net/sctp/bind_addr.c +4 -6
@@ -140,14 +140,12 @@ void sctp_bind_addr_init(struct sctp_bin/* Dispose of the address list. */ static void sctp_bind_addr_clean (struct sctp_bind_addr *bp) { -struct sctp_sockaddr_entry *addr; -struct list_head *pos, *temp; +struct sctp_sockaddr_entry *addr, *temp;/* Empty the bind address list. */ -list_for_each_safe (pos, temp, &bp->address_list) { - addr = list_entry(pos, struct sctp_sockaddr_entry, list); -list_del (pos); -kfree (addr); +list_for_each_entry_safe (addr, temp, &bp->address_list, list) { +list_del_rcu (&addr->list); +call_rcu (&addr->rcu, sctp_local_addr_free);SCTP_DBG_OBJCNT_DEC (addr); } }
PATCH 59/165 igmp: call ip_mc_clear_src() only when we have no users of ip_mc_list
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1911
Lines: 67
From: Veaceslav Falico <[email protected]>
[ Upstream commit 24cf3af3fed5edcf90bc2a0ed181e6ce1513d2dc ]
In igmp_group_dropped() we call ip_mc_clear_src(), which resets the number of source filters per mulitcast. However, igmp_group_dropped() is also called on NETDEV_DOWN, NETDEV_PRE_TYPE_CHANGE and NETDEV_UNREGISTER, which means that the group might get added back on NETDEV_UP, NETDEV_REGISTER and NETDEV_POST_TYPE_CHANGE respectively, leaving us with broken source filters.
To fix that, we must clear the source filters only when there are no users in the ip_mc_list, i.e. in ip_mc_dec_group() and on device destroy.
--- net/ipv4/igmp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
net/ipv4/igmp.c +5 -5
@@ -1169,20 +1169,18 @@ static void igmp_group_dropped(struct ipif (!in_dev->dead) {if (IGMP_V1_SEEN (in_dev)) - goto done; +return ;if (IGMP_V2_SEEN (in_dev)) {if (reporter)igmp_send_report (in_dev, im,IGMP_HOST_LEAVE_MESSAGE ); - goto done; +return ; }/* IGMPv3 */ igmpv3_add_delrec (in_dev, im);igmp_ifc_event (in_dev); } -done:#endif -ip_mc_clear_src (im); }static void igmp_group_added (struct ip_mc_list *im)
@@ -1319,6 +1317,7 @@ void ip_mc_dec_group(struct in_device *i *ip = i->next_rcu; in_dev->mc_count--;igmp_group_dropped (i); +ip_mc_clear_src (i);if (!in_dev->dead)ip_rt_multicast_event (in_dev);
@@ -1428,7 +1427,8 @@ void ip_mc_destroy_dev(struct in_device in_dev->mc_list = i->next_rcu; in_dev->mc_count--; -igmp_group_dropped (i); +/* We've dropped the groups in ip_mc_down already */ +ip_mc_clear_src (i);ip_ma_put (i); } }
PATCH 60/165 bridge: initialize fake_rtable metrics
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1254
Lines: 40
From: Eric Dumazet <[email protected]>
[ Upstream commit 33eb9873a283a2076f2b5628813d5365ca420ea9 ]
bridge netfilter code uses a fake_rtable, and we must init its _metric field or risk NULL dereference later.
Ref: https://bugzilla.kernel.org/show_bug.cgi?id=35672
--- net/bridge/br_netfilter.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/bridge/br_netfilter.c +5 -1
@@ -117,6 +117,10 @@ static struct dst_ops fake_dst_ops = {* ipt_REJECT needs it. Future netfilter modules might * require us to fill additional fields. */ +static const u32 br_dst_default_metrics[RTAX_MAX ] = { + [RTAX_MTU -1 ] =1500 , +}; +void br_netfilter_rtable_init (struct net_bridge *br) {struct rtable *rt = &br->fake_rtable;
@@ -124,7 +128,7 @@ void br_netfilter_rtable_init(struct netatomic_set (&rt->dst.__refcnt,1 ); rt->dst.dev = br->dev; rt->dst.path = &rt->dst; -dst_metric_set (&rt->dst,RTAX_MTU ,1500 ); +dst_init_metrics (&rt->dst, br_dst_default_metrics, true); rt->dst.flags =DST_NOXFRM ; rt->dst.ops = &fake_dst_ops; }
PATCH 61/165 sctp: fix memory leak of the ASCONF queue when free asoc
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1823
Lines: 57
From: Wei Yongjun <[email protected]>
[ Upstream commit 8b4472cc13136d04727e399c6fdadf58d2218b0a ]
If an ASCONF chunk is outstanding, then the following ASCONF chunk will be queued for later transmission. But when we free the asoc, we forget to free the ASCONF queue at the same time, this will cause memory leak.
--- net/sctp/associola.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
net/sctp/associola.c +16 -0
@@ -64,6 +64,7 @@/* Forward declarations for internal functions. */ static void sctp_assoc_bh_rcv (struct work_struct *work);static void sctp_assoc_free_asconf_acks (struct sctp_association *asoc); +static void sctp_assoc_free_asconf_queue (struct sctp_association *asoc);/* Keep track of the new idr low so that we don't re-use association id * numbers too fast. It is protected by they idr spin lock is in the
@@ -446,6 +447,9 @@ void sctp_association_free(struct sctp_a/* Free any cached ASCONF_ACK chunk. */ sctp_assoc_free_asconf_acks (asoc); +/* Free the ASCONF queue. */ +sctp_assoc_free_asconf_queue (asoc); +/* Free any cached ASCONF chunk. */ if (asoc->addip_last_asconf)sctp_chunk_free (asoc->addip_last_asconf);
@@ -1578,6 +1582,18 @@ retry:return error; } +/* Free the ASCONF queue */ +static void sctp_assoc_free_asconf_queue (struct sctp_association *asoc) +{ +struct sctp_chunk *asconf; +struct sctp_chunk *tmp; + +list_for_each_entry_safe (asconf, tmp, &asoc->addip_chunk_list, list) { +list_del_init (&asconf->list); +sctp_chunk_free (asconf); + } +} +/* Free asconf_ack cache */ static void sctp_assoc_free_asconf_acks (struct sctp_association *asoc) {
PATCH 62/165 sch_sfq: fix peek() implementation
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1496
Lines: 53
From: Eric Dumazet <[email protected]>
[ Upstream commit 07bd8df5df4369487812bf85a237322ff3569b77 ]
Since commit eeaeb068f139 (sch_sfq: allow big packets and be fair), sfq_peek() can return a different skb that would be normally dequeued by sfq_dequeue() [ if current slot->allot is negative ]
Use generic qdisc_peek_dequeued() instead of custom implementation, to get consistent result.
--- net/sched/sch_sfq.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-)
net/sched/sch_sfq.c +1 -13
@@ -410,18 +410,6 @@ sfq_enqueue(struct sk_buff *skb, struct }static struct sk_buff * -sfq_peek (struct Qdisc *sch) -{ -struct sfq_sched_data *q =qdisc_priv (sch); - -/* No active slots */ -if (q->tail ==NULL ) -return NULL ; - -return q->slots[q->tail->next].skblist_next; -} - -static struct sk_buff *sfq_dequeue (struct Qdisc *sch) {struct sfq_sched_data *q =qdisc_priv (sch);
@@ -702,7 +690,7 @@ static struct Qdisc_ops sfq_qdisc_ops __ .priv_size = sizeof(struct sfq_sched_data), .enqueue = sfq_enqueue, .dequeue = sfq_dequeue, - .peek = sfq_peek, + .peek = qdisc_peek_dequeued, .drop = sfq_drop, .init = sfq_init, .reset = sfq_reset,
PATCH 63/165 bonding: prevent deadlock on slave store with alb mode (v3)
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 6275
Lines: 155
From: Neil Horman <[email protected]>
[ Upstream commit 9fe0617d9b6d21f700ee9e658e1c9fe3be2fb402 ]
This soft lockup was recently reported:
[root@dell-per715-01 ~]# echo +bond5 > /sys/class/net/bonding_masters [root@dell-per715-01 ~]# echo +eth1 > /sys/class/net/bond5/bonding/slaves
bonding: bond5: doing slave updates when interface is down. bonding bond5: master_dev is not up in bond_enslave [root@dell-per715-01 ~]# echo -eth1 > /sys/class/net/bond5/bonding/slaves
bonding: bond5: doing slave updates when interface is down.
BUG: soft lockup - CPU#12 stuck for 60s! [bash:6444] CPU 12: Modules linked in: bonding autofs4 hidp rfcomm l2cap bluetooth lockd sunrpc be2d Pid: 6444, comm: bash Not tainted 2.6.18-262.el5 #1 RIP: 0010:[<ffffffff80064bf0>] [<ffffffff80064bf0>] .text.lock.spinlock+0x26/00 RSP: 0018:ffff810113167da8 EFLAGS: 00000286 RAX: ffff810113167fd8 RBX: ffff810123a47800 RCX: 0000000000ff1025 RDX: 0000000000000000 RSI: ffff810123a47800 RDI: ffff81021b57f6f8 RBP: ffff81021b57f500 R08: 0000000000000000 R09: 000000000000000c R10: 00000000ffffffff R11: ffff81011d41c000 R12: ffff81021b57f000 R13: 0000000000000000 R14: 0000000000000282 R15: 0000000000000282 FS: 00002b3b41ef3f50(0000) GS:ffff810123b27940(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b CR2: 00002b3b456dd000 CR3: 000000031fc60000 CR4: 00000000000006e0 Call Trace: [<ffffffff80064af9>] _spin_lock_bh+0x9/0x14 [<ffffffff886937d7>] :bonding:tlb_clear_slave+0x22/0xa1 [<ffffffff8869423c>] :bonding:bond_alb_deinit_slave+0xba/0xf0 [<ffffffff8868dda6>] :bonding:bond_release+0x1b4/0x450 [<ffffffff8006457b>] __down_write_nested+0x12/0x92 [<ffffffff88696ae4>] :bonding:bonding_store_slaves+0x25c/0x2f7 [<ffffffff801106f7>] sysfs_write_file+0xb9/0xe8 [<ffffffff80016b87>] vfs_write+0xce/0x174 [<ffffffff80017450>] sys_write+0x45/0x6e [<ffffffff8005d28d>] tracesys+0xd5/0xe0
It occurs because we are able to change the slave configuarion of a bond while the bond interface is down. The bonding driver initializes some data structures only after its ndo_open routine is called. Among them is the initalization of the alb tx and rx hash locks. So if we add or remove a slave without first opening the bond master device, we run the risk of trying to lock/unlock a spinlock that has garbage for data in it, which results in our above softlock.
Note that sometimes this works, because in many cases an unlocked spinlock has the raw_lock parameter initialized to zero (meaning that the kzalloc of the net_device private data is equivalent to calling spin_lock_init), but thats not true in all cases, and we aren't guaranteed that condition, so we need to pass the relevant spinlocks through the spin_lock_init function.
Fix it by moving the spin_lock_init calls for the tx and rx hashtable locks to the ndo_init path, so they are ready for use by the bond_store_slaves path.
Change notes:
v2) Based on conversation with Jay and Nicolas it seems that the ability to enslave devices while the bond master is down should be safe to do. As such this is an outlier bug, and so instead we'll just initalize the errant spinlocks in the init path rather than the open path, solving the problem. We'll also remove the warnings about the bond being down during enslave operations, since it should be safe
v3) Fix spelling error
--- drivers/net/bonding/bond_alb.c | 4 ---- drivers/net/bonding/bond_main.c | 16 ++++++++++------ drivers/net/bonding/bond_sysfs.c | 6 ------ 3 files changed, 10 insertions(+), 16 deletions(-)
drivers/net/bonding/bond_alb.c +0 -4
@@ -163,8 +163,6 @@ static int tlb_initialize(struct bondingstruct tlb_client_info *new_hashtbl;int i; -spin_lock_init (&(bond_info->tx_hashtbl_lock)); - new_hashtbl =kzalloc (size,GFP_KERNEL );if (!new_hashtbl) { pr_err("%s: Error: Failed to allocate TLB hash table\n",
@@ -764,8 +762,6 @@ static int rlb_initialize(struct bondingint size =RLB_HASH_TABLE_SIZE *sizeof (struct rlb_client_info );int i; -spin_lock_init (&(bond_info->rx_hashtbl_lock)); - new_hashtbl =kmalloc (size,GFP_KERNEL );if (!new_hashtbl) { pr_err("%s: Error: Failed to allocate RLB hash table\n",
drivers/net/bonding/bond_main.c +10 -6
@@ -1535,12 +1535,6 @@ int bond_enslave(struct net_device *bond bond_dev->name, slave_dev->name); } -/* bond must be initialized by bond_open() before enslaving */ -if (!(bond_dev->flags &IFF_UP )) { -pr_warning ("%s: master_dev is not up in bond_enslave\n" , - bond_dev->name); - } -/* already enslaved */ if (slave_dev->flags &IFF_SLAVE ) {pr_debug ("Error, Device was already enslaved\n" );
@@ -4975,9 +4969,19 @@ static int bond_init(struct net_device * {struct bonding *bond =netdev_priv (bond_dev);struct bond_net *bn =net_generic (dev_net (bond_dev), bond_net_id); +struct alb_bond_info *bond_info = &(BOND_ALB_INFO (bond));pr_debug ("Begin bond_init for %s\n" , bond_dev->name); +/* +* Initialize locks that may be required during +* en/deslave operations. All of the bond_open work +* (of which this is part) should really be moved to +* a phase prior to dev_open +*/ +spin_lock_init (&(bond_info->tx_hashtbl_lock)); +spin_lock_init (&(bond_info->rx_hashtbl_lock)); + bond->wq =create_singlethread_workqueue (bond_dev->name);if (!bond->wq)return -ENOMEM ;
drivers/net/bonding/bond_sysfs.c +0 -6
@@ -227,12 +227,6 @@ static ssize_t bonding_store_slaves(strustruct net_device *dev;struct bonding *bond =to_bond (d); -/* Quick sanity check -- is the bond interface up? */ -if (!(bond->dev->flags &IFF_UP )) { -pr_warning ("%s: doing slave updates when interface is down.\n" , - bond->dev->name); - } -if (!rtnl_trylock ())return restart_syscall ();
PATCH 64/165 sch_sfq: avoid giving spurious NET_XMIT_CN signals
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1719
Lines: 55
From: Eric Dumazet <[email protected]>
[ Upstream commit 8efa885406359af300d46910642b50ca82c0fe47 ]
While chasing a possible net_sched bug, I found that IP fragments have litle chance to pass a congestioned SFQ qdisc :
- Say SFQ qdisc is full because one flow is non responsive.
- ip_fragment() wants to send two fragments belonging to an idle flow.
- sfq_enqueue() queues first packet, but see queue limit reached :
- sfq_enqueue() drops one packet from 'big consumer', and returns NET_XMIT_CN.
- ip_fragment() cancel remaining fragments.
This patch restores fairness, making sure we return NET_XMIT_CN only if we dropped a packet from the same flow.
--- net/sched/sch_sfq.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/sched/sch_sfq.c +6 -2
@@ -361,7 +361,7 @@ sfq_enqueue(struct sk_buff *skb, struct {struct sfq_sched_data *q =qdisc_priv (sch);unsigned int hash; -sfq_index x; +sfq_index x, qlen;struct sfq_slot *slot;int uninitialized_var (ret );
@@ -405,8 +405,12 @@ sfq_enqueue(struct sk_buff *skb, structif (++sch->q.qlen <= q->limit)return NET_XMIT_SUCCESS ; + qlen = slot->qlen;sfq_drop (sch); -return NET_XMIT_CN ; +/* Return Congestion Notification only if we dropped a packet +* from this flow. +*/ +return (qlen != slot->qlen) ?NET_XMIT_CN :NET_XMIT_SUCCESS ; } static struct sk_buff *
PATCH 65/165 net: fix __dst_destroy_metrics_generic()
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 760
Lines: 26
From: Eric Dumazet <[email protected]>
[ Upstream commit b30c516f875004f025f4d10147bde28c5e98466b ]
dst_default_metrics is readonly, we dont want to kfree() it later.
--- net/core/dst.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/dst.c +1 -1
@@ -314,7 +314,7 @@ void __dst_destroy_metrics_generic(struc {unsigned long prev, new; - new = (unsigned long ) dst_default_metrics; + new = ((unsigned long ) dst_default_metrics) |DST_METRICS_READ_ONLY ; prev =cmpxchg (&dst->_metrics, old, new);if (prev == old)kfree (__DST_METRICS_PTR (old));
PATCH 66/165 dst: catch uninitialized metrics
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 700
Lines: 27
From: Stephen Hemminger <[email protected]>
[ Upstream commit 1f37070d3ff325827c6213e51b57f21fd5ac9d05 ]
Catch cases where dst_metric_set() and other functions are called but _metrics is NULL.
--- include/net/dst.h | 2 ++ 1 file changed, 2 insertions(+)
include/net/dst.h +2 -0
@@ -120,6 +120,8 @@ static inline u32 *dst_metrics_write_ptr {unsigned long p = dst->_metrics; +BUG_ON (!p); +if (p &DST_METRICS_READ_ONLY )return dst->ops->cow_metrics (dst, p);return __DST_METRICS_PTR (p);
PATCH 67/165 mpt2sas: move even handling of
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
MPT2SAS_TURN_ON_FAULT_LED into process context
Content-Length: 5421
Lines: 168
From: "Kashyap, Desai" <[email protected]>
commit 3ace8e052be5293ebb3e00f819effccc64108a38 upstream.
Driver was a sending a SEP request during interrupt context which required to go to sleep.
The fix is to rearrange the code so a fake event MPT2SAS_TURN_ON_FAULT_LED is fired from interrupt context, then later during the kernel worker threads processing, the SEP request is issued to firmware.
--- drivers/scsi/mpt2sas/mpt2sas_scsih.c | 94 +++++++++++++++++++++++++---------- 1 file changed, 68 insertions(+), 26 deletions(-)
drivers/scsi/mpt2sas/mpt2sas_scsih.c +68 -26
@@ -113,6 +113,7 @@ struct sense_info { }; +#define MPT2SAS_TURN_ON_FAULT_LED (0xFFFC)#define MPT2SAS_RESCAN_AFTER_HOST_RESET (0xFFFF)/**
@@ -121,6 +122,7 @@ struct sense_info {* @work: work object (ioc->fault_reset_work_q) * @cancel_pending_work: flag set during reset handling * @ioc: per adapter object +* @device_handle: device handle * @VF_ID: virtual function id * @VP_ID: virtual port id * @ignore: flag meaning this event has been marked to ignore
@@ -134,6 +136,7 @@ struct fw_event_work {u8 cancel_pending_work;struct delayed_work delayed_work;struct MPT2SAS_ADAPTER *ioc; +u16 device_handle;u8 VF_ID ;u8 VP_ID ;u8 ignore;
@@ -3708,17 +3711,75 @@ _scsih_scsi_ioc_info(struct MPT2SAS_ADAP#endif /** -* _scsih_smart_predicted_fault - illuminate Fault LED +* _scsih_turn_on_fault_led - illuminate Fault LED * @ioc: per adapter object * @handle: device handle +* Context: process * * Return nothing. */ static void -_scsih_smart_predicted_fault (struct MPT2SAS_ADAPTER *ioc,u16 handle) +_scsih_turn_on_fault_led (struct MPT2SAS_ADAPTER *ioc,u16 handle) {Mpi2SepReply_t mpi_reply;Mpi2SepRequest_t mpi_request; + +memset (&mpi_request,0 ,sizeof (Mpi2SepRequest_t)); + mpi_request.Function =MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR ; + mpi_request.Action =MPI2_SEP_REQ_ACTION_WRITE_STATUS ; + mpi_request.SlotStatus = +cpu_to_le32 (MPI2_SEP_REQ_SLOTSTATUS_PREDICTED_FAULT ); + mpi_request.DevHandle =cpu_to_le16 (handle); + mpi_request.Flags =MPI2_SEP_REQ_FLAGS_DEVHANDLE_ADDRESS ; +if ((mpt2sas_base_scsi_enclosure_processor (ioc, &mpi_reply, + &mpi_request)) !=0 ) { +printk (MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n" , ioc->name, + __FILE__, __LINE__, __func__); +return ; + } + +if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) { +dewtprintk (ioc,printk (MPT2SAS_INFO_FMT "enclosure_processor: " +"ioc_status (0x%04x), loginfo(0x%08x)\n" , ioc->name, +le16_to_cpu (mpi_reply.IOCStatus), +le32_to_cpu (mpi_reply.IOCLogInfo))); +return ; + } +} + +/** +* _scsih_send_event_to_turn_on_fault_led - fire delayed event +* @ioc: per adapter object +* @handle: device handle +* Context: interrupt. +* +* Return nothing. +*/ +static void +_scsih_send_event_to_turn_on_fault_led (struct MPT2SAS_ADAPTER *ioc,u16 handle) +{ +struct fw_event_work *fw_event; + + fw_event =kzalloc (sizeof (struct fw_event_work ),GFP_ATOMIC ); +if (!fw_event) +return ; + fw_event->event =MPT2SAS_TURN_ON_FAULT_LED ; + fw_event->device_handle = handle; + fw_event->ioc = ioc; +_scsih_fw_event_add (ioc, fw_event); +} + +/** +* _scsih_smart_predicted_fault - process smart errors +* @ioc: per adapter object +* @handle: device handle +* Context: interrupt. +* +* Return nothing. +*/ +static void +_scsih_smart_predicted_fault (struct MPT2SAS_ADAPTER *ioc,u16 handle) +{struct scsi_target *starget;struct MPT2SAS_TARGET *sas_target_priv_data;Mpi2EventNotificationReply_t *event_reply;
@@ -3745,30 +3806,8 @@ _scsih_smart_predicted_fault(struct MPT2starget_printk (KERN_WARNING , starget,"predicted fault\n" );spin_unlock_irqrestore (&ioc->sas_device_lock, flags); -if (ioc->pdev->subsystem_vendor ==PCI_VENDOR_ID_IBM ) { -memset (&mpi_request,0 ,sizeof (Mpi2SepRequest_t)); - mpi_request.Function =MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR ; - mpi_request.Action =MPI2_SEP_REQ_ACTION_WRITE_STATUS ; - mpi_request.SlotStatus = -cpu_to_le32 (MPI2_SEP_REQ_SLOTSTATUS_PREDICTED_FAULT ); - mpi_request.DevHandle =cpu_to_le16 (handle); - mpi_request.Flags =MPI2_SEP_REQ_FLAGS_DEVHANDLE_ADDRESS ; -if ((mpt2sas_base_scsi_enclosure_processor (ioc, &mpi_reply, - &mpi_request)) !=0 ) { -printk (MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n" , - ioc->name, __FILE__, __LINE__, __func__); -return ; - } - -if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) { -dewtprintk (ioc,printk (MPT2SAS_INFO_FMT -"enclosure_processor: ioc_status (0x%04x), " -"loginfo(0x%08x)\n" , ioc->name, -le16_to_cpu (mpi_reply.IOCStatus), -le32_to_cpu (mpi_reply.IOCLogInfo))); -return ; - } - } +if (ioc->pdev->subsystem_vendor ==PCI_VENDOR_ID_IBM ) +_scsih_send_event_to_turn_on_fault_led (ioc, handle);/* insert into event log */ sz = offsetof(Mpi2EventNotificationReply_t, EventData) +
@@ -6330,6 +6369,9 @@ _firmware_event_work(struct work_struct }switch (fw_event->event) { +case MPT2SAS_TURN_ON_FAULT_LED : +_scsih_turn_on_fault_led (ioc, fw_event->device_handle); +break ;case MPI2_EVENT_SAS_TOPOLOGY_CHANGE_LIST :_scsih_sas_topology_change_event (ioc, fw_event);break ;
PATCH 68/165 bnx2i: Fixed packet error created when the sq_size is
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
set to 16
Content-Length: 1619
Lines: 44
From: Eddie Wai <[email protected]>
commit 7287c63e986fe1a51a89f4bb1327320274a7a741 upstream.
The number of chip's internal command cell, which is use to generate SCSI cmd packets to the target, was not initialized correctly by the driver when the sq_size is changed from the default 128. This, in turn, will create a problem where the chip's transmit pipe will erroneously reuse an old command cell that is no longer valid. The fix is to correctly initialize the chip's command cell upon setup.
--- drivers/scsi/bnx2i/bnx2i_hwi.c | 1 + drivers/scsi/bnx2i/bnx2i_iscsi.c | 3 +++ 2 files changed, 4 insertions(+)
drivers/scsi/bnx2i/bnx2i_hwi.c +1 -0
@@ -1274,6 +1274,7 @@ int bnx2i_send_fw_iscsi_init_msg(struct iscsi_init.dummy_buffer_addr_hi = (u32) ((u64 ) hba->dummy_buf_dma >>32 ); + hba->num_ccell = hba->max_sqes >>1 ; hba->ctx_ccell_tasks = ((hba->num_ccell &0xFFFF ) | (hba->max_sqes <<16 )); iscsi_init.num_ccells_per_conn = hba->num_ccell;
drivers/scsi/bnx2i/bnx2i_iscsi.c +3 -0
@@ -1208,6 +1208,9 @@ static int bnx2i_task_xmit(struct iscsi_struct bnx2i_cmd *cmd = task->dd_data;struct iscsi_cmd *hdr = (struct iscsi_cmd *) task->hdr; +if (bnx2i_conn->ep->num_active_cmds +1 > hba->max_sqes) +return -ENOMEM ; +/* * If there is no scsi_cmnd this must be a mgmt task */
PATCH 69/165 bnx2i: Updated the connection shutdown/cleanup
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
timeout
Content-Length: 1597
Lines: 41
From: Eddie Wai <[email protected]>
commit d5307a078bb0288945c900c6f4a2fd77ba6d0817 upstream.
Modified the 10s wait time for inflight offload connections to advance to the next state to 2s based on test result. Modified the 20s shutdown timeout to 30s based on test result.
--- drivers/scsi/bnx2i/bnx2i_init.c | 2 +- drivers/scsi/bnx2i/bnx2i_iscsi.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/bnx2i/bnx2i_init.c +1 -1
@@ -244,7 +244,7 @@ void bnx2i_stop(void *handle)wait_event_interruptible_timeout (hba->eh_wait, (list_empty (&hba->ep_ofld_list) &&list_empty (&hba->ep_destroy_list)), -10 *HZ ); +2 *HZ );/* Wait for all endpoints to be torn down, Chip will be reset once * control returns to network driver. So it is required to cleanup and * release all connection resources before returning from this routine.
drivers/scsi/bnx2i/bnx2i_iscsi.c +1 -1
@@ -858,7 +858,7 @@ struct bnx2i_hba *bnx2i_alloc_hba(structmutex_init (&hba->net_dev_lock);init_waitqueue_head (&hba->eh_wait);if (test_bit (BNX2I_NX2_DEV_57710 , &hba->cnic_dev_type)) { - hba->hba_shutdown_tmo =20 *HZ ; + hba->hba_shutdown_tmo =30 *HZ ; hba->conn_teardown_tmo =20 *HZ ; hba->conn_ctx_destroy_tmo =6 *HZ ; }else {/* 5706/5708/5709 */
PATCH 70/165 Fix Ultrastor asm snippet
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 894
Lines: 36
From: Samuel Thibault <[email protected]>
commit fad4dab5e44e10acf6b0235e469cb8e773b58e31 upstream.
Commit 1292500b replaced
"=m" (*field) : "1" (*field)
with
"=m" (*field) :
with comment "The following patch fixes it by using the '+' operator on the (*field) operand, marking it as read-write to gcc."
'+' was actually forgotten. This really puts it.
--- drivers/scsi/ultrastor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/ultrastor.c +1 -1
@@ -307,7 +307,7 @@ static inline int find_and_clear_bit_16("0: bsfw %1,%w0\n\t" "btr %0,%1\n\t" "jnc 0b" - : "=&r" (rv), "=m" (*field) :); + : "=&r" (rv), "+m" (*field) :); return rv; }
PATCH 71/165 target: Fix multi task->task_sg[] chaining logic bug
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 3386
Lines: 94
From: Nicholas Bellinger <[email protected]>
commit 97868c8905a1537153d406c4a3aa39a503a5c299 upstream.
This patch fixes a bug in transport_do_task_sg_chain() used by HW target mode modules with sg_chain() to provide a single sg_next() walkable memory layout for use with pci_map_sg() and friends. This patch addresses an issue with mapping multiple small block max_sector tasks across multiple struct se_task->task_sg[] mappings for HW target mode operation.
This was causing OOPs with (cmd->t_task->t_tasks_no > 1) I/O traffic for HW target drivers using transport_do_task_sg_chain(), and has been tested so far with tcm_fc(openfcoe), tcm_qla2xxx, and ib_srpt fabrics with t_tasks_no > 1 IBLOCK backends using a smaller max_sectors to trigger the original issue.
--- drivers/target/target_core_transport.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-)
drivers/target/target_core_transport.c +15 -11
@@ -4776,18 +4776,20 @@ void transport_do_task_sg_chain(struct s sg_end_cur->page_link &= ~0x02 ;sg_chain (sg_head, task_sg_num, sg_head_cur); - sg_count += (task->task_sg_num +1 ); - }else sg_count += task->task_sg_num; + task_sg_num = (task->task_sg_num +1 ); + }else { +sg_chain (sg_head, task_sg_num, sg_head_cur); + sg_count += task->task_sg_num; + task_sg_num = task->task_sg_num; + } sg_head = sg_head_cur; sg_link = sg_link_cur; - task_sg_num = task->task_sg_num;continue ; } sg_head = sg_first = &task->task_sg[0 ]; sg_link = &task->task_sg[task->task_sg_num]; - task_sg_num = task->task_sg_num;/* * Check for single task.. */
@@ -4798,9 +4800,12 @@ void transport_do_task_sg_chain(struct s*/ sg_end = &task->task_sg[task->task_sg_num -1 ]; sg_end->page_link &= ~0x02 ; - sg_count += (task->task_sg_num +1 ); - }else sg_count += task->task_sg_num; + task_sg_num = (task->task_sg_num +1 ); + }else { + sg_count += task->task_sg_num; + task_sg_num = task->task_sg_num; + } }/* * Setup the starting pointer and total t_tasks_sg_linked_no including
@@ -4809,21 +4814,20 @@ void transport_do_task_sg_chain(struct sT_TASK (cmd)->t_tasks_sg_chained = sg_first;T_TASK (cmd)->t_tasks_sg_chained_no = sg_count; -DEBUG_CMD_M ("Setup T_TASK(cmd)->t_tasks_sg_chained: %p and" -" t_tasks_sg_chained_no: %u\n" ,T_TASK (cmd)->t_tasks_sg_chained, +DEBUG_CMD_M ("Setup cmd: %p T_TASK(cmd)->t_tasks_sg_chained: %p and" +" t_tasks_sg_chained_no: %u\n" , cmd,T_TASK (cmd)->t_tasks_sg_chained,T_TASK (cmd)->t_tasks_sg_chained_no);for_each_sg (T_TASK (cmd)->t_tasks_sg_chained, sg,T_TASK (cmd)->t_tasks_sg_chained_no, i) { -DEBUG_CMD_M ("SG: %p page: %p length: %d offset: %d\n" , - sg,sg_page (sg), sg->length, sg->offset); +DEBUG_CMD_M ("SG[%d]: %p page: %p length: %d offset: %d, magic: 0x%08x\n" , + i, sg,sg_page (sg), sg->length, sg->offset, sg->sg_magic);if (sg_is_chain (sg))DEBUG_CMD_M ("SG: %p sg_is_chain=1\n" , sg);if (sg_is_last (sg))DEBUG_CMD_M ("SG: %p sg_is_last=1\n" , sg); } - }EXPORT_SYMBOL (transport_do_task_sg_chain);
PATCH 72/165 target: Fix interrupt context bug with stats_lock and
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
core_tmr_alloc_req
Content-Length: 2259
Lines: 66
From: Nicholas Bellinger <[email protected]>
commit 53ab6709b4d35b1924240854d794482fd7d33d4a upstream.
This patch fixes two bugs wrt to the interrupt context usage of target core with HW target mode drivers. It first converts the usage of struct se_device->stats_lock in transport_get_lun_for_cmd() and core_tmr_lun_reset() to properly use spin_lock_irq() to address an BUG with CONFIG_LOCKDEP_SUPPORT=y enabled.
This patch also adds a 'in_interrupt()' check to allow GFP_ATOMIC usage from core_tmr_alloc_req() to fix a 'sleeping in interrupt context' BUG with HW target fabrics that require this logic to function.
--- drivers/target/target_core_device.c | 4 ++-- drivers/target/target_core_tmr.c | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-)
drivers/target/target_core_device.c +2 -2
@@ -150,13 +150,13 @@ out: {struct se_device *dev = se_lun->lun_se_dev; -spin_lock (&dev->stats_lock); +spin_lock_irq (&dev->stats_lock); dev->num_cmds++;if (se_cmd->data_direction ==DMA_TO_DEVICE ) dev->write_bytes += se_cmd->data_length;else if (se_cmd->data_direction ==DMA_FROM_DEVICE ) dev->read_bytes += se_cmd->data_length; -spin_unlock (&dev->stats_lock); +spin_unlock_irq (&dev->stats_lock); }/*
drivers/target/target_core_tmr.c +4 -3
@@ -55,7 +55,8 @@ struct se_tmr_req *core_tmr_alloc_req( {struct se_tmr_req *tmr; - tmr =kmem_cache_zalloc (se_tmr_req_cache,GFP_KERNEL ); + tmr =kmem_cache_zalloc (se_tmr_req_cache, (in_interrupt ()) ? +GFP_ATOMIC :GFP_KERNEL );if (!(tmr)) {printk (KERN_ERR "Unable to allocate struct se_tmr_req\n" );return ERR_PTR (-ENOMEM );
@@ -398,9 +399,9 @@ int core_tmr_lun_reset(printk (KERN_INFO "LUN_RESET: SCSI-2 Released reservation\n" ); } -spin_lock (&dev->stats_lock); +spin_lock_irq (&dev->stats_lock); dev->num_resets++; -spin_unlock (&dev->stats_lock); +spin_unlock_irq (&dev->stats_lock); DEBUG_LR("LUN_RESET: %s for [%s] Complete\n", (preempt_and_abort_list) ? "Preempt" : "TMR",
PATCH 73/165 target: Fix bug with task_sg chained
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
transport_free_dev_tasks release
Content-Length: 3527
Lines: 92
From: Nicholas Bellinger <[email protected]>
commit f436677262a5b524ac87675014c6d4e8ee153029 upstream.
This patch addresses a bug in the target core release path for HW operation where transport_free_dev_tasks() was incorrectly being called from transport_lun_remove_cmd() while releasing a se_cmd reference and calling struct target_core_fabric_ops->queue_data_in().
This would result in a OOPs with HW target mode when the release of se_task->task_sg[] would happen before pci_unmap_sg() can be called in HW target mode fabric module code. This patch addresses the issue by moving transport_free_dev_tasks() from transport_lun_remove_cmd() into transport_generic_free_cmd(), and adding TRANSPORT_FREE_CMD_INTR and transport_generic_free_cmd_intr() to allow se_cmd descriptor release to happen fromfrom within transport_processing_thread() process context when release of se_cmd is not possible from HW interrupt context.
--- drivers/target/target_core_transport.c | 13 ++++++++++++- include/target/target_core_base.h | 1 + include/target/target_core_transport.h | 1 + 3 files changed, 14 insertions(+), 1 deletion(-)
drivers/target/target_core_transport.c +12 -1
@@ -762,7 +762,6 @@ static void transport_lun_remove_cmd(strtransport_all_task_dev_remove_state (cmd);spin_unlock_irqrestore (&T_TASK (cmd)->t_state_lock, flags); -transport_free_dev_tasks (cmd); check_lun:spin_lock_irqsave (&lun->lun_cmd_lock, flags);
@@ -2058,6 +2057,13 @@ int transport_generic_handle_tmr( }EXPORT_SYMBOL (transport_generic_handle_tmr); +void transport_generic_free_cmd_intr ( +struct se_cmd *cmd) +{ +transport_add_cmd_to_queue (cmd,TRANSPORT_FREE_CMD_INTR ); +} +EXPORT_SYMBOL (transport_generic_free_cmd_intr); +static int transport_stop_tasks_for_cmd (struct se_cmd *cmd) {struct se_task *task, *task_tmp;
@@ -5301,6 +5307,8 @@ void transport_generic_free_cmd(if (wait_for_tasks && cmd->transport_wait_for_tasks) cmd->transport_wait_for_tasks (cmd,0 ,0 ); +transport_free_dev_tasks (cmd); +transport_generic_remove (cmd, release_to_pool, session_reinstatement); }
@@ -6136,6 +6144,9 @@ get_cmd:case TRANSPORT_REMOVE :transport_generic_remove (cmd,1 ,0 );break ; +case TRANSPORT_FREE_CMD_INTR : +transport_generic_free_cmd (cmd,0 ,1 ,0 ); +break ;case TRANSPORT_PROCESS_TMR :transport_generic_do_tmr (cmd);break ;
include/target/target_core_base.h +1 -0
@@ -98,6 +98,7 @@ enum transport_state_table {TRANSPORT_REMOVE =14 ,TRANSPORT_FREE =15 ,TRANSPORT_NEW_CMD_MAP =16 , + TRANSPORT_FREE_CMD_INTR = 17, };/* Used for struct se_cmd->se_cmd_flags */
include/target/target_core_transport.h +1 -0
@@ -172,6 +172,7 @@ extern int transport_generic_handle_cdb_extern int transport_generic_handle_data (struct se_cmd *);extern void transport_new_cmd_failure (struct se_cmd *);extern int transport_generic_handle_tmr (struct se_cmd *); +extern void transport_generic_free_cmd_intr (struct se_cmd *);extern void __transport_stop_task_timer (struct se_task *,unsigned long *);extern unsigned char transport_asciihex_to_binaryhex (unsigned char val[2 ]); extern int transport_generic_map_mem_to_cmd(struct se_cmd *cmd, struct scatterlist *, u32,
PATCH 74/165 target: Fix task->task_execute_queue=1 clear bug +
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
LUN_RESET OOPs
Content-Length: 1731
Lines: 52
From: Nicholas Bellinger <[email protected]>
commit af57c3ac9947990da2608561b71f4799eb7795c6 upstream.
This patch fixes a bug where task->task_execute_queue=1 was not being cleared once se_task had been removed from se_device->execute_task_list, resulting in an OOPs in core_tmr_lun_reset() for the task->task_active=0 case where transport_remove_task_from_execute_queue() was incorrectly being called.
This patch fixes two cases in transport_get_task_from_execute_queue() and transport_remove_task_from_execute_queue() to properly clear task->task_execute_queue=0 once list_del(&task->t_execute_list) has been called.
It also adds an explict check in transport_remove_task_from_execute_queue() to dump_stack + return if called with task->task_execute_queue=0.
--- drivers/target/target_core_transport.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/target/target_core_transport.c +7 -0
@@ -1194,6 +1194,7 @@ transport_get_task_from_execute_queue(stbreak ;list_del (&task->t_execute_list); +atomic_set (&task->task_execute_queue,0 );atomic_dec (&dev->execute_tasks);return task;
@@ -1209,8 +1210,14 @@ void transport_remove_task_from_execute_ {unsigned long flags; +if (atomic_read (&task->task_execute_queue) ==0 ) { +dump_stack (); +return ; + } +spin_lock_irqsave (&dev->execute_task_lock, flags);list_del (&task->t_execute_list); +atomic_set (&task->task_execute_queue,0 );atomic_dec (&dev->execute_tasks);spin_unlock_irqrestore (&dev->execute_task_lock, flags); }
PATCH 75/165 um: Use RWSEM_GENERIC_SPINLOCK on x86
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1218
Lines: 40
From: Richard Weinberger <[email protected]>
commit 3a3679078aed2c451ebc32836bbd3b8219a65e01 upstream.
Commit d12337 (rwsem: Remove redundant asmregparm annotation) broke rwsem on UML.
As we cannot compile UML with -mregparm=3 and keeping asmregparm only for UML is inadequate the easiest solution is using RWSEM_GENERIC_SPINLOCK.
Thanks to Thomas Gleixner for the idea.
--- arch/um/Kconfig.x86 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/um/Kconfig.x86 +2 -2
@@ -29,10 +29,10 @@ config X86_64 def_bool 64BIT config RWSEM_XCHGADD_ALGORITHM - def_bool X86_XADD + def_bool X86_XADD && 64BIT config RWSEM_GENERIC_SPINLOCK - def_bool !X86_XADD + def_bool !RWSEM_XCHGADD_ALGORITHM config 3_LEVEL_PGTABLES bool "Three-level pagetables (EXPERIMENTAL)" if !64BIT
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
PATCH 76/165 x86, ioapic: Fix potential resume deadlock
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1478
Lines: 44
From: Daniel J Blueman <[email protected]>
commit b64ce24daffb634b5b3133a2e411bd4de50654e8 upstream.
Fix a potential deadlock when resuming; here the calling function has disabled interrupts, so we cannot sleep.
Change the memory allocation flag from GFP_KERNEL to GFP_ATOMIC.
TODO: We can do away with this memory allocation during resume
by reusing the ioapic suspend/resume code that uses boot time allocated buffers, but we want to keep this -stable patch simple.
--- arch/x86/kernel/apic/io_apic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/apic/io_apic.c +2 -2
@@ -621,14 +621,14 @@ struct IO_APIC_route_entry **alloc_ioapistruct IO_APIC_route_entry **ioapic_entries; ioapic_entries =kzalloc (sizeof (*ioapic_entries) * nr_ioapics, -GFP_KERNEL ); +GFP_ATOMIC );if (!ioapic_entries)return 0 ;for (apic =0 ; apic < nr_ioapics; apic++) { ioapic_entries[apic] =kzalloc (sizeof (struct IO_APIC_route_entry ) * - nr_ioapic_registers[apic],GFP_KERNEL ); + nr_ioapic_registers[apic],GFP_ATOMIC );if (!ioapic_entries[apic]) goto nomem; }
PATCH 77/165 x86, amd: Do not enable ARAT feature on AMD processors below
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
family 0x12
Content-Length: 1634
Lines: 46
From: Boris Ostrovsky <[email protected]>
commit e9cdd343a5e42c43bcda01e609fa23089e026470 upstream.
Commit b87cf80af3ba4b4c008b4face3c68d604e1715c6 added support for ARAT (Always Running APIC timer) on AMD processors that are not affected by erratum 400. This erratum is present on certain processor families and prevents APIC timer from waking up the CPU when it is in a deep C state, including C1E state.
Determining whether a processor is affected by this erratum may have some corner cases and handling these cases is somewhat complicated. In the interest of simplicity we won't claim ARAT support on processor families below 0x12 and will go back to broadcasting timer when going idle.
--- arch/x86/kernel/cpu/amd.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
arch/x86/kernel/cpu/amd.c +5 -2
@@ -612,8 +612,11 @@ static void __cpuinit init_amd(struct cp }#endif -/* As a rule processors have APIC timer running in deep C states */ -if (c->x86 >0xf && !cpu_has_amd_erratum (amd_erratum_400)) +/* +* Family 0x12 and above processors have APIC timer +* running in deep C states. +*/ +if (c->x86 >0x11 )set_cpu_cap (c,X86_FEATURE_ARAT );/*
PATCH 78/165 x86, amd: Use _safe() msr access for GartTlbWlk disable code
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1570
Lines: 55
From: "Roedel, Joerg" <[email protected]>
commit d47cc0db8fd6011de2248df505fc34990b7451bf upstream.
The workaround for Bugzilla:
https://bugzilla.kernel.org/show_bug.cgi?id=33012
introduced a read and a write to the MC4 mask msr.
Unfortunatly this MSR is not emulated by the KVM hypervisor so that the kernel will get a #GP and crashes when applying this workaround when running inside KVM.
This issue was reported as:
https://bugzilla.kernel.org/show_bug.cgi?id=35132
and is fixed with this patch. The change just let the kernel ignore any #GP it gets while accessing this MSR by using the _safe msr access methods.
--- arch/x86/kernel/cpu/amd.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
arch/x86/kernel/cpu/amd.c +6 -3
@@ -632,10 +632,13 @@ static void __cpuinit init_amd(struct cp* Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=33012 */ u64 mask; +int err; -rdmsrl (MSR_AMD64_MCx_MASK (4 ), mask); - mask |= (1 <<10 ); -wrmsrl (MSR_AMD64_MCx_MASK (4 ), mask); + err =rdmsrl_safe (MSR_AMD64_MCx_MASK (4 ), &mask); +if (err ==0 ) { + mask |= (1 <<10 ); +checking_wrmsrl (MSR_AMD64_MCx_MASK (4 ), mask); + } } }
PATCH 79/165 x86, efi: Retain boot service code until after switching to
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
virtual mode
Content-Length: 5890
Lines: 159
From: Matthew Garrett <[email protected]>
commit 916f676f8dc016103f983c7ec54c18ecdbb6e349 upstream.
UEFI stands for "Unified Extensible Firmware Interface", where "Firmware" is an ancient African word meaning "Why do something right when you can do it so wrong that children will weep and brave adults will cower before you", and "UEI" is Celtic for "We missed DOS so we burned it into your ROMs". The UEFI specification provides for runtime services (ie, another way for the operating system to be forced to depend on the firmware) and we rely on these for certain trivial tasks such as setting up the bootloader. But some hardware fails to work if we attempt to use these runtime services from physical mode, and so we have to switch into virtual mode. So far so dreadful.
The specification makes it clear that the operating system is free to do whatever it wants with boot services code after ExitBootServices() has been called. SetVirtualAddressMap() can't be called until ExitBootServices() has been. So, obviously, a whole bunch of EFI implementations call into boot services code when we do that. Since we've been charmingly naive and trusted that the specification may be somehow relevant to the real world, we've already stuffed a picture of a penguin or something in that address space. And just to make things more entertaining, we've also marked it non-executable.
This patch allocates the boot services regions during EFI init and makes sure that they're executable. Then, after SetVirtualAddressMap(), it discards them and everyone lives happily ever after. Except for the ones who have to work on EFI, who live sad lives haunted by the knowledge that someone's eventually going to write yet another firmware specification.
[ hpa: adding this to urgent with a stable tag since it fixes currently-broken
hardware. However, I do not know what the dependencies are and so I do not know which -stable versions this may be a candidate for. ]
--- arch/x86/kernel/setup.c | 7 ++++++ arch/x86/platform/efi/efi.c | 45 ++++++++++++++++++++++++++++++++++++++++- arch/x86/platform/efi/efi_64.c | 5 ++-- include/linux/efi.h | 1 4 files changed, 55 insertions(+), 3 deletions(-)
arch/x86/kernel/setup.c +7 -0
@@ -912,6 +912,13 @@ void __init setup_arch(char **cmdline_p) memblock.current_limit =get_max_mapped ();memblock_x86_fill (); +/* +* The EFI specification says that boot service code won't be called +* after ExitBootServices(). This is, in fact, a lie. +*/ +if (efi_enabled) +efi_reserve_boot_services (); +/* preallocate 4k for mptable mpc */ early_reserve_e820_mpc_new ();
arch/x86/platform/efi/efi.c +44 -1
63 lines not on this page · raw message
arch/x86/platform/efi/efi_64.c +3 -2
@@ -64,10 +64,11 @@ static void __init early_runtime_code_maif (!(__supported_pte_mask & _PAGE_NX))return ; -/* Make EFI runtime service code area executable */ +/* Make EFI service code area executable */ for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) { md = p; -if (md->type ==EFI_RUNTIME_SERVICES_CODE ) { +if (md->type ==EFI_RUNTIME_SERVICES_CODE || + md->type ==EFI_BOOT_SERVICES_CODE ) {unsigned long end; end = md->phys_addr + (md->num_pages <<EFI_PAGE_SHIFT );early_mapping_set_exec (md->phys_addr, end, executable);
include/linux/efi.h +1 -0
@@ -299,6 +299,7 @@ extern void efi_initialize_iomem_resourc struct resource *data_resource, struct resource *bss_resource);extern unsigned long efi_get_time (void );extern int efi_set_rtc_mmss (unsigned long nowtime); +extern void efi_reserve_boot_services (void );extern struct efi_memory_map memmap;/**
PATCH 80/165 x86, cpufeature: Update CPU feature RDRND to RDRAND
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1484
Lines: 34
From: Kees Cook <[email protected]>
commit 7ccafc5f75c87853f3c49845d5a884f2376e03ce upstream.
The Intel manual changed the name of the CPUID bit to match the instruction name. We should follow suit for sanity's sake. (See Intel SDM Volume 2, Table 3-20 "Feature Information Returned in the ECX Register".)
[ hpa: we can only do this at this time because there are currently no CPUs
with this feature on the market, hence this is pre-hardware enabling. However, Cc:'ing stable so that stable can present a consistent ABI. ]
--- arch/x86/include/asm/cpufeature.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/cpufeature.h +1 -1
@@ -125,7 +125,7 @@#define X86_FEATURE_OSXSAVE (4*32+27)/* "" XSAVE enabled in the OS */ #define X86_FEATURE_AVX (4*32+28)/* Advanced Vector Extensions */ #define X86_FEATURE_F16C (4*32+29)/* 16-bit fp conversions */ -#define X86_FEATURE_RDRND (4*32+30)/* The RDRAND instruction */ +#define X86_FEATURE_RDRAND (4*32+30)/* The RDRAND instruction */ #define X86_FEATURE_HYPERVISOR (4*32+31)/* Running on a hypervisor */ /* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */
PATCH 81/165 oprofile, x86: Enable preemption during pci device setup in
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
IBS init
Content-Length: 5139
Lines: 200
From: Robert Richter <[email protected]>
commit 3d2606f42984613d324ad3047cf503bcddc3880a upstream.
IBS initialization is a mix of per-core register access and per-node pci device setup. Register access should be pinned to the cpu, but pci setup must run with preemption enabled.
This patch better separates the code into non-/preemptible sections and fixes sleeping with preemption disabled. See bug message below.
Fixes also freeing the eilvt entry by introducing put_eilvt().
BUG: sleeping function called from invalid context at mm/slub.c:824 in_atomic(): 1, irqs_disabled(): 0, pid: 32357, name: modprobe INFO: lockdep is turned off. Pid: 32357, comm: modprobe Not tainted 2.6.39-rc7+ #14 Call Trace: [<ffffffff8104bdc8>] __might_sleep+0x112/0x117 [<ffffffff81129693>] kmem_cache_alloc_trace+0x4b/0xe7 [<ffffffff81278f14>] kzalloc.constprop.0+0x29/0x2b [<ffffffff81278f4c>] pci_get_subsys+0x36/0x78 [<ffffffff81022689>] ? setup_APIC_eilvt+0xfb/0x139 [<ffffffff81278fa4>] pci_get_device+0x16/0x18 [<ffffffffa06c8b5d>] op_amd_init+0xd3/0x211 [oprofile] [<ffffffffa064d000>] ? 0xffffffffa064cfff [<ffffffffa064d298>] op_nmi_init+0x21e/0x26a [oprofile] [<ffffffffa064d062>] oprofile_arch_init+0xe/0x26 [oprofile] [<ffffffffa064d010>] oprofile_init+0x10/0x42 [oprofile] [<ffffffff81002099>] do_one_initcall+0x7f/0x13a [<ffffffff81096524>] sys_init_module+0x132/0x281 [<ffffffff814cc682>] system_call_fastpath+0x16/0x1b
--- arch/x86/oprofile/op_model_amd.c | 95 ++++++++++++++++++++++----------------- 1 file changed, 54 insertions(+), 41 deletions(-)
arch/x86/oprofile/op_model_amd.c +54 -41
@@ -316,16 +316,23 @@ static void op_amd_stop_ibs(void)wrmsrl (MSR_AMD64_IBSOPCTL ,0 ); } -static inline int eilvt_is_available (int offset) +static inline int get_eilvt (int offset) { -/* check if we may assign a vector */ return !setup_APIC_eilvt (offset,0 ,APIC_EILVT_MSG_NMI ,1 ); } +static inline int put_eilvt (int offset) +{ +return !setup_APIC_eilvt (offset,0 ,0 ,1 ); +} +static inline int ibs_eilvt_valid (void ) {int offset;u64 val; +int valid =0 ; + +preempt_disable ();rdmsrl (MSR_AMD64_IBSCTL , val); offset = val &IBSCTL_LVT_OFFSET_MASK ;
@@ -333,16 +340,20 @@ static inline int ibs_eilvt_valid(void)if (!(val &IBSCTL_LVT_OFFSET_VALID )) {pr_err (FW_BUG "cpu %d, invalid IBS interrupt offset %d (MSR%08X=0x%016llx)\n" ,smp_processor_id (), offset,MSR_AMD64_IBSCTL , val); -return 0 ; + goto out; } -if (!eilvt_is_available (offset)) { +if (!get_eilvt (offset)) {pr_err (FW_BUG "cpu %d, IBS interrupt offset %d not available (MSR%08X=0x%016llx)\n" ,smp_processor_id (), offset,MSR_AMD64_IBSCTL , val); -return 0 ; + goto out; } -return 1 ; + valid =1 ; +out: +preempt_enable (); + +return valid; }static inline int get_ibs_offset (void )
@@ -600,67 +611,69 @@ static int setup_ibs_ctl(int ibs_eilvt_ostatic int force_ibs_eilvt_setup (void ) { -int i; +int offset;int ret; -/* find the next free available EILVT entry */ -for (i =1 ; i <4 ; i++) { -if (!eilvt_is_available (i)) -continue ; - ret =setup_ibs_ctl (i); -if (ret) -return ret; -pr_err (FW_BUG "using offset %d for IBS interrupts\n" , i); -return 0 ; +/* +* find the next free available EILVT entry, skip offset 0, +* pin search to this cpu +*/ +preempt_disable (); +for (offset =1 ; offset <APIC_EILVT_NR_MAX ; offset++) { +if (get_eilvt (offset)) +break ; } +preempt_enable (); -printk (KERN_DEBUG "No EILVT entry available\n" ); - -return -EBUSY ; -} - -static int __init_ibs_nmi (void ) -{ -int ret; - -if (ibs_eilvt_valid ()) -return 0 ; +if (offset ==APIC_EILVT_NR_MAX ) { +printk (KERN_DEBUG "No EILVT entry available\n" ); +return -EBUSY ; + } - ret =force_ibs_eilvt_setup (); + ret =setup_ibs_ctl (offset);if (ret) -return ret; + goto out; -if (!ibs_eilvt_valid ()) -return -EFAULT ; +if (!ibs_eilvt_valid ()) { + ret = -EFAULT ; + goto out; + } +pr_err (FW_BUG "using offset %d for IBS interrupts\n" , offset);pr_err (FW_BUG "workaround enabled for IBS LVT offset\n" );return 0 ; +out: +preempt_disable (); +put_eilvt (offset); +preempt_enable (); +return ret; }/* * check and reserve APIC extended interrupt LVT offset for IBS if * available -* -* init_ibs() preforms implicitly cpu-local operations, so pin this -* thread to its current CPU */ static void init_ibs (void ) { -preempt_disable (); - ibs_caps =get_ibs_caps (); +if (!ibs_caps) +return ; + +if (ibs_eilvt_valid ()) goto out; -if (__init_ibs_nmi () <0 ) - ibs_caps =0 ; -else -printk (KERN_INFO "oprofile: AMD IBS detected (0x%08x)\n" , ibs_caps); +if (!force_ibs_eilvt_setup ()) + goto out; + +/* Failed to setup ibs */ + ibs_caps =0 ; +return ; out: -preempt_enable (); +printk (KERN_INFO "oprofile: AMD IBS detected (0x%08x)\n" , ibs_caps); }static int (*create_arch_files)(struct super_block *sb,struct dentry *root);
PATCH 82/165 rcu: Fix unpaired rcu_irq_enter() from locking selftests
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1808
Lines: 51
From: Frederic Weisbecker <[email protected]>
commit ba9f207c9f82115aba4ce04b22e0081af0ae300f upstream.
HARDIRQ_ENTER() maps to irq_enter() which calls rcu_irq_enter(). But HARDIRQ_EXIT() maps to __irq_exit() which doesn't call rcu_irq_exit().
So for every locking selftest that simulates hardirq disabled, we create an imbalance in the rcu extended quiescent state internal state.
As a result, after the first missing rcu_irq_exit(), subsequent irqs won't exit dyntick-idle mode after leaving the interrupt handler. This means that RCU won't see the affected CPU as being in an extended quiescent state, resulting in long grace-period delays (as in grace periods extending for hours).
To fix this, just use __irq_enter() to simulate the hardirq context. This is sufficient for the locking selftests as we don't need to exit any extended quiescent state or perform any check that irqs normally do when they wake up from idle.
As a side effect, this patch makes it possible to restore "rcu: Decrease memory-barrier usage based on semi-formal proof", which eventually helped finding this bug.
--- lib/locking-selftest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/locking-selftest.c +1 -1
@@ -144,7 +144,7 @@ static void init_shared_classes(void)#define HARDIRQ_ENTER () \ local_irq_disable(); \ - irq_enter(); \ + __irq_enter(); \ WARN_ON(!in_irq());#define HARDIRQ_EXIT () \
PATCH 83/165 When mandatory encryption on share, fail mount
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 3343
Lines: 93
From: Steve French <[email protected]>
commit 6848b7334b24b47aa3d0e70342ff839ffa95d5fa upstream.
When mandatory encryption is configured in samba server on a share (smb.conf parameter "smb encrypt = mandatory") the server will hang up the tcp session when we try to send the first frame after the tree connect if it is not a QueryFSUnixInfo, this causes cifs mount to hang (it must be killed with ctl-c). Move the QueryFSUnixInfo call earlier in the mount sequence, and check whether the SetFSUnixInfo fails due to mandatory encryption so we can return a sensible error (EACCES) on mount.
In a future patch (for 2.6.40) we will support mandatory encryption.
--- fs/cifs/connect.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-)
fs/cifs/connect.c +22 -9
@@ -2447,7 +2447,7 @@ void reset_cifs_unix_caps(int xid, strucif (!CIFSSMBQFSUnixInfo (xid, tcon)) {__u64 cap =le64_to_cpu (tcon->fsUnixInfo.Capability); - +cFYI (1 ,"unix caps which server supports %lld" , cap);/* check for reconnect case in which we do not want to change the mount behavior if we can avoid it */ if (vol_info ==NULL ) {
@@ -2465,6 +2465,9 @@ void reset_cifs_unix_caps(int xid, struc } } +if (cap &CIFS_UNIX_TRANSPORT_ENCRYPTION_MANDATORY_CAP ) +cERROR (1 ,"per-share encryption not supported yet" ); + cap &=CIFS_UNIX_CAP_MASK ;if (vol_info && vol_info->no_psx_acl) cap &= ~CIFS_UNIX_POSIX_ACL_CAP ;
@@ -2513,6 +2516,10 @@ void reset_cifs_unix_caps(int xid, struccFYI (1 ,"very large read cap" );if (cap &CIFS_UNIX_LARGE_WRITE_CAP )cFYI (1 ,"very large write cap" ); +if (cap &CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP ) +cFYI (1 ,"transport encryption cap" ); +if (cap &CIFS_UNIX_TRANSPORT_ENCRYPTION_MANDATORY_CAP ) +cFYI (1 ,"mandatory transport encryption cap" );#endif /* CIFS_DEBUG2 */ if (CIFSSMBSetFSUnixInfo (xid, tcon, cap)) {if (vol_info ==NULL ) {
@@ -2831,20 +2838,26 @@ try_mount_again: goto remote_path_check; } -/* do not care if following two calls succeed - informational */ -if (!tcon->ipc) { -CIFSSMBQFSDeviceInfo (xid, tcon); -CIFSSMBQFSAttributeInfo (xid, tcon); - } -/* tell server which Unix caps we support */ -if (tcon->ses->capabilities &CAP_UNIX ) +if (tcon->ses->capabilities &CAP_UNIX ) {/* reset of caps checks mount to see if unix extensions disabled for just this mount */ reset_cifs_unix_caps (xid, tcon, sb, volume_info); -else +if ((tcon->ses->server->tcpStatus == CifsNeedReconnect) && + (le64_to_cpu (tcon->fsUnixInfo.Capability) & +CIFS_UNIX_TRANSPORT_ENCRYPTION_MANDATORY_CAP )) { + rc = -EACCES ; + goto mount_fail_check; + } + }else tcon->unix_ext =0 ;/* server does not support them */ +/* do not care if following two calls succeed - informational */ +if (!tcon->ipc) { +CIFSSMBQFSDeviceInfo (xid, tcon); +CIFSSMBQFSAttributeInfo (xid, tcon); + } +/* convert forward to back slashes in prepath here if needed */ if ((cifs_sb->mnt_cifs_flags &CIFS_MOUNT_POSIX_PATHS ) ==0 )convert_delimiter (cifs_sb->prepath,CIFS_DIR_SEP (cifs_sb));
PATCH 84/165 staging: usbip: fix wrong endian conversion
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 806
Lines: 27
From: David Chang <[email protected]>
commit cacd18a8476ce145ca5dcd46dc5b75585fd1289c upstream.
Fix number_of_packets wrong endian conversion in function correct_endian_ret_submit()
--- drivers/staging/usbip/usbip_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/usbip/usbip_common.c +1 -1
@@ -604,7 +604,7 @@ static void correct_endian_ret_submit(stbe32_to_cpus (&pdu->status);be32_to_cpus (&pdu->actual_length);be32_to_cpus (&pdu->start_frame); -cpu_to_be32s (&pdu->number_of_packets); +be32_to_cpus (&pdu->number_of_packets);be32_to_cpus (&pdu->error_count); } }
PATCH 85/165 staging: r8712u: Fix driver to support ad-hoc mode
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1331
Lines: 35
From: Jeff Chua <[email protected]>
commit 62819fd9481021db7f87d5f61f2e2fd2be1dfcfa upstream.
Driver r8712u is unable to handle ad-hoc mode. The issue is that when the driver first starts, there will not be an SSID for association. The fix is to always call the "select and join from scan" routine when in ad-hoc mode.
Note: Ad-hoc mode worked intermittently before. If the driver had previously been associated, then things were OK.
--- drivers/staging/rtl8712/rtl871x_ioctl_set.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/staging/rtl8712/rtl871x_ioctl_set.c +4 -1
@@ -68,7 +68,10 @@ static u8 do_join(struct _adapter *padap pmlmepriv->fw_state |= _FW_UNDER_LINKING; pmlmepriv->pscanned = plist; pmlmepriv->to_join = true; -if (_queue_empty (queue) == true) { + +/* adhoc mode will start with an empty queue, but skip checking */ +if (!check_fwstate (pmlmepriv,WIFI_ADHOC_STATE ) && +_queue_empty (queue)) {if (pmlmepriv->fw_state & _FW_UNDER_LINKING) pmlmepriv->fw_state ^= _FW_UNDER_LINKING;/* when set_ssid/set_bssid for do_join(), but scanning queue
PATCH 86/165 staging: brcm80211: bugfix for div by zero in
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
minstrel_ht_tx_status
Content-Length: 1944
Lines: 53
From: Roland Vossen <[email protected]>
commit e9c661e08c2a6015c1b7cba1cecefa27a089df71 upstream.
Caused by brcmsmac.ko suppling a 0 value to Mac80211. Mac80211 subsequently divides by this number. Bug only occurred on AMPDU traffic. This is a fix for https://bugzilla.kernel.org/show_bug.cgi?id=32032, titled 'Divide error in minstrel_ht_tx_status followed by hang', reported by Wouter Cloetens.
--- drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c +3 -10
@@ -1123,21 +1123,12 @@ wlc_ampdu_dotxstatus_complete(struct amp ini->txretry[index] =0 ;/* ampdu_ack_len: number of acked aggregated frames */ -/* ampdu_ack_map: block ack bit map for the aggregation */ /* ampdu_len: number of aggregated frames */ rate_status (wlc, tx_info, txs, mcs); tx_info->flags |=IEEE80211_TX_STAT_ACK ; tx_info->flags |=IEEE80211_TX_STAT_AMPDU ; - -/* XXX TODO: Make these accurate. */ tx_info->status.ampdu_ack_len = - (txs-> - status &TX_STATUS_FRM_RTX_MASK ) >> -TX_STATUS_FRM_RTX_SHIFT ; - tx_info->status.ampdu_len = - (txs-> - status &TX_STATUS_FRM_RTX_MASK ) >> -TX_STATUS_FRM_RTX_SHIFT ; + tx_info->status.ampdu_len =1 ;skb_pull (p,D11_PHY_HDR_LEN );skb_pull (p,D11_TXH_LEN );
@@ -1163,6 +1154,8 @@ wlc_ampdu_dotxstatus_complete(struct amp/* Retry timeout */ ini->tx_in_transit--;ieee80211_tx_info_clear_status (tx_info); + tx_info->status.ampdu_ack_len =0 ; + tx_info->status.ampdu_len =1 ; tx_info->flags |=IEEE80211_TX_STAT_AMPDU_NO_BACK ;skb_pull (p,D11_PHY_HDR_LEN );
PATCH 87/165 Fix for buffer overflow in ldm_frag_add not sufficient
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1139
Lines: 36
From: Timo Warns <[email protected]>
commit cae13fe4cc3f24820ffb990c09110626837e85d4 upstream.
As Ben Hutchings discovered [1], the patch for CVE-2011-1017 (buffer overflow in ldm_frag_add) is not sufficient. The original patch in commit c340b1d64000 ("fs/partitions/ldm.c: fix oops caused by corrupted partition table") does not consider that, for subsequent fragments, previously allocated memory is used.
[1] http://lkml.org/lkml/2011/5/6/407
--- fs/partitions/ldm.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/partitions/ldm.c +5 -0
@@ -1335,6 +1335,11 @@ static bool ldm_frag_add (const u8 *datalist_add_tail (&f->list, frags); found: +if (rec >= f->num) { +ldm_error ("REC value (%d) exceeds NUM value (%d)" , rec, f->num); +return false; + } +if (f->map & (1 << rec)) {ldm_error ("Duplicate VBLK, part %d." , rec); f->map &=0x7F ;/* Mark the group as broken */
Re: [Stable-review] [087/165] Fix for buffer overflow in ldm_frag_add not sufficient
Quoted 10 lines · Greg KH
2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1139
Lines: 36From: Timo Warns <[email protected]>
commit
cae13fe4cc3f24820ffb990c09110626837e85d4upstream.
Quoted 7 lines
As Ben Hutchings discovered [1], the patch for CVE-2011-1017 (buffer overflow in
ldm_frag_add) is not sufficient. The original patch in commitc340b1d64000("fs/partitions/ldm.c: fix oops caused by corrupted partition table") does not consider that, for subsequent fragments, previously allocated memory is used.
I still assert that the function is broken because the fragments are copied to incorrect offsets. However, this change should at least make it *harmless* junk.
Ben.
Quoted 30 lines
Reported-by Ben Hutchings <[email protected]>Signed-off-by Timo Warns <[email protected]>Signed-off-by Linus Torvalds <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- fs/partitions/ldm.c | 5 +++++ 1 file changed, 5 insertions(+)fs/partitions/ldm.c +5
-0@@ -1335,6 +1335,11 @@ static bool ldm_frag_add (const u8 *datalist_add_tail (&f->list, frags); found: +if (rec >= f->num) { +ldm_error ("REC value (%d) exceeds NUM value (%d)" , rec, f->num); +return false; + } +if (f->map & (1 << rec)) {ldm_error ("Duplicate VBLK, part %d." , rec); f->map &=0x7F ;/* Mark the group as broken */ _______________________________________________
Stable-review mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/stable-review
Signature · 2 lines
Ben Hutchings Once a job is fouled up, anything done to improve it makes it worse.
PATCH 88/165 seqlock: Dont smp_rmb in seqlock reader spin loop
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 2553
Lines: 71
From: Milton Miller <[email protected]>
commit 5db1256a5131d3b133946fa02ac9770a784e6eb2 upstream.
Move the smp_rmb after cpu_relax loop in read_seqlock and add ACCESS_ONCE to make sure the test and return are consistent.
A multi-threaded core in the lab didn't like the update from 2.6.35 to 2.6.36, to the point it would hang during boot when multiple threads were active. Bisection showed af5ab277ded04bd9bc6b048c5a2f0e7d70ef0867 (clockevents:
Remove the per cpu tick skew) as the culprit and it is supported with stack traces showing xtime_lock waits including tick_do_update_jiffies64 and/or update_vsyscall.
Experimentation showed the combination of cpu_relax and smp_rmb was significantly slowing the progress of other threads sharing the core, and this patch is effective in avoiding the hang.
A theory is the rmb is affecting the whole core while the cpu_relax is causing a resource rebalance flush, together they cause an interfernce cadance that is unbroken when the seqlock reader has interrupts disabled.
At first I was confused why the refactor in 3c22cd5709e8143444a6d08682a87f4c57902df3 (kernel: optimise seqlock) didn't affect this patch application, but after some study that affected seqcount not seqlock. The new seqcount was not factored back into the seqlock. I defer that the future.
While the removal of the timer interrupt offset created contention for the xtime lock while a cpu does the additonal work to update the system clock, the seqlock implementation with the tight rmb spin loop goes back much further, and is just waiting for the right trigger.
--- include/linux/seqlock.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/seqlock.h +2 -2
@@ -88,12 +88,12 @@ static __always_inline unsigned read_sequnsigned ret; repeat: - ret = sl->sequence; -smp_rmb (); + ret =ACCESS_ONCE (sl->sequence);if (unlikely (ret &1 )) {cpu_relax (); goto repeat; } +smp_rmb ();return ret; }
PATCH 89/165 md: Fix race when creating a new md device.
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 2950
Lines: 85
From: NeilBrown <[email protected]>
commit b0140891a8cea36469f58d23859e599b1122bd37 upstream.
There is a race when creating an md device by opening /dev/mdXX.
If two processes do this at much the same time they will follow the call path
__blkdev_get -> get_gendisk -> kobj_lookup
The first will call
-> md_probe -> md_alloc -> add_disk -> blk_register_region
and the race happens when the second gets to kobj_lookup after add_disk has called blk_register_region but before it returns to md_alloc.
In the case the second will not call md_probe (as the probe is already done) but will get a handle on the gendisk, return to __blkdev_get which will then call md_open (via the ->open) pointer.
As mddev->gendisk hasn't been set yet, md_open will think something is wrong an return with ERESTARTSYS.
This can loop endlessly while the first thread makes no progress through add_disk. Nothing is blocking it, but due to scheduler behaviour it doesn't get a turn.
So this is essentially a live-lock.
We fix this by simply moving the assignment to mddev->gendisk before the call the add_disk() so md_open doesn't get confused. Also move blk_queue_flush earlier because add_disk should be as late as possible.
To make sure that md_open doesn't complete until md_alloc has done all that is needed, we take mddev->open_mutex during the last part of md_alloc. md_open will wait for this.
This can cause a lock-up on boot so Cc:ing for stable. For 2.6.36 and earlier a different patch will be needed as the 'blk_queue_flush' call isn't there.
--- drivers/md/md.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/md/md.c +8 -3
@@ -4347,13 +4347,19 @@ static int md_alloc(dev_t dev, char *nam disk->fops = &md_fops; disk->private_data = mddev; disk->queue = mddev->queue; +blk_queue_flush (mddev->queue,REQ_FLUSH |REQ_FUA );/* Allow extended partitions. This makes the * 'mdp' device redundant, but we can't really * remove it now. */ disk->flags |=GENHD_FL_EXT_DEVT ; -add_disk (disk); mddev->gendisk = disk; +/* As soon as we call add_disk(), another thread could get +* through to md_open, so make sure it doesn't get too far +*/ +mutex_lock (&mddev->open_mutex); +add_disk (disk); + error =kobject_init_and_add (&mddev->kobj, &md_ktype, &disk_to_dev (disk)->kobj,"%s" ,"md" );if (error) {
@@ -4367,8 +4373,7 @@ static int md_alloc(dev_t dev, char *namif (mddev->kobj.sd &&sysfs_create_group (&mddev->kobj, &md_bitmap_group))printk (KERN_DEBUG "pointless warning\n" ); - -blk_queue_flush (mddev->queue,REQ_FLUSH |REQ_FUA ); +mutex_unlock (&mddev->open_mutex); abort:mutex_unlock (&disks_mutex);if (!error && mddev->kobj.sd) {
PATCH 90/165 md/bitmap: fix saving of events_cleared and other state.
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 2224
Lines: 63
From: NeilBrown <[email protected]>
commit 8258c53208d7a9b7207e7d4dae36d2ea384cb278 upstream.
If a bitmap is found to be 'stale' the events_cleared value is set to match 'events'.
However if the array is degraded this does not get stored on disk. This can subsequently lead to incorrect behaviour.
So change bitmap_update_sb to always update events_cleared in the superblock from the known events_cleared.
For neatness also set ->state from ->flags.
This requires updating ->state whenever we update ->flags, which makes sense anyway.
This is suitable for any active -stable release.
--- drivers/md/bitmap.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/md/bitmap.c +6 -4
@@ -493,11 +493,11 @@ void bitmap_update_sb(struct bitmap *bitspin_unlock_irqrestore (&bitmap->lock, flags); sb =kmap_atomic (bitmap->sb_page,KM_USER0 ); sb->events =cpu_to_le64 (bitmap->mddev->events); -if (bitmap->mddev->events < bitmap->events_cleared) { +if (bitmap->mddev->events < bitmap->events_cleared)/* rocking back to read-only */ bitmap->events_cleared = bitmap->mddev->events; - sb->events_cleared =cpu_to_le64 (bitmap->events_cleared); - } + sb->events_cleared =cpu_to_le64 (bitmap->events_cleared); + sb->state =cpu_to_le32 (bitmap->flags);/* Just in case these have been changed via sysfs: */ sb->daemon_sleep =cpu_to_le32 (bitmap->mddev->bitmap_info.daemon_sleep/HZ ); sb->write_behind =cpu_to_le32 (bitmap->mddev->bitmap_info.max_write_behind);
@@ -618,7 +618,7 @@ success:if (le32_to_cpu (sb->version) ==BITMAP_MAJOR_HOSTENDIAN ) bitmap->flags |=BITMAP_HOSTENDIAN ; bitmap->events_cleared =le64_to_cpu (sb->events_cleared); -if (sb->state &cpu_to_le32 (BITMAP_STALE )) +if (bitmap->flags &BITMAP_STALE ) bitmap->events_cleared = bitmap->mddev->events; err =0 ; out:
@@ -652,9 +652,11 @@ static int bitmap_mask_state(struct bitmswitch (op) {case MASK_SET : sb->state |=cpu_to_le32 (bits); + bitmap->flags |= bits;break ;case MASK_UNSET : sb->state &=cpu_to_le32 (~bits); + bitmap->flags &= ~bits;break ;default :BUG ();
PATCH 91/165 mm: vmscan: correct use of pgdat_balanced in
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
sleeping_prematurely
Content-Length: 2567
Lines: 66
From: Johannes Weiner <[email protected]>
commit afc7e326a3f5bafc41324d7926c324414e343ee5 upstream.
There are a few reports of people experiencing hangs when copying large amounts of data with kswapd using a large amount of CPU which appear to be due to recent reclaim changes. SLUB using high orders is the trigger but not the root cause as SLUB has been using high orders for a while. The root cause was bugs introduced into reclaim which are addressed by the following two patches.
Patch 1 corrects logic introduced by commit 1741c877 ("mm: kswapd:
keep kswapd awake for high-order allocations until a percentage of the node is balanced") to allow kswapd to go to sleep when balanced for high orders.
Patch 2 notes that it is possible for kswapd to miss every
cond_resched() and updates shrink_slab() so it'll at least reach that scheduling point.
Chris Wood reports that these two patches in isolation are sufficient to prevent the system hanging. AFAIK, they should also resolve similar hangs experienced by James Bottomley.
This patch:
Johannes Weiner poined out that the logic in commit 1741c877 ("mm: kswapd:
keep kswapd awake for high-order allocations until a percentage of the node is balanced") is backwards. Instead of allowing kswapd to go to sleep when balancing for high order allocations, it keeps it kswapd running uselessly.
--- mm/vmscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/vmscan.c +1 -1
@@ -2286,7 +2286,7 @@ static bool sleeping_prematurely(pg_data* must be balanced */ if (order) -return pgdat_balanced (pgdat, balanced, classzone_idx); +return !pgdat_balanced (pgdat, balanced, classzone_idx);else return !all_zones_ok; }
PATCH 92/165 mm: vmscan: correctly check if reclaimer should schedule
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
during shrink_slab
Content-Length: 3067
Lines: 80
From: Minchan Kim <[email protected]>
commit f06590bd718ed950c98828e30ef93204028f3210 upstream.
It has been reported on some laptops that kswapd is consuming large amounts of CPU and not being scheduled when SLUB is enabled during large amounts of file copying. It is expected that this is due to kswapd missing every cond_resched() point because;
shrink_page_list() calls cond_resched() if inactive pages were isolated
which in turn may not happen if all_unreclaimable is set in shrink_zones(). If for whatver reason, all_unreclaimable is set on all zones, we can miss calling cond_resched().
balance_pgdat() only calls cond_resched if the zones are not
balanced. For a high-order allocation that is balanced, it checks order-0 again. During that window, order-0 might have become unbalanced so it loops again for order-0 and returns that it was reclaiming for order-0 to kswapd(). It can then find that a caller has rewoken kswapd for a high-order and re-enters balance_pgdat() without ever calling cond_resched().
shrink_slab only calls cond_resched() if we are reclaiming slab
pages. If there are a large number of direct reclaimers, the shrinker_rwsem can be contended and prevent kswapd calling cond_resched().
This patch modifies the shrink_slab() case. If the semaphore is contended, the caller will still check cond_resched(). After each successful call into a shrinker, the check for cond_resched() remains in case one shrinker is particularly slow.
--- mm/vmscan.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
mm/vmscan.c +7 -2
@@ -230,8 +230,11 @@ unsigned long shrink_slab(unsigned longif (scanned ==0 ) scanned =SWAP_CLUSTER_MAX ; -if (!down_read_trylock (&shrinker_rwsem)) -return 1 ;/* Assume we'll be able to shrink next time */ +if (!down_read_trylock (&shrinker_rwsem)) { +/* Assume we'll be able to shrink next time */ + ret =1 ; + goto out; + }list_for_each_entry (shrinker, &shrinker_list, list) {unsigned long long delta;
@@ -282,6 +285,8 @@ unsigned long shrink_slab(unsigned long shrinker->nr += total_scan; }up_read (&shrinker_rwsem); +out: +cond_resched ();return ret; }
PATCH 93/165 slub: Make CONFIG_DEBUG_PAGE_ALLOC work with new fastpath
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1498
Lines: 50
From: Christoph Lameter <[email protected]>
commit 1393d9a1857471f816d0be1ccc1d6433a86050f6 upstream.
Fastpath can do a speculative access to a page that CONFIG_DEBUG_PAGE_ALLOC may have marked as invalid to retrieve the pointer to the next free object.
Use probe_kernel_read in that case in order not to cause a page fault.
--- mm/slub.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
mm/slub.c +13 -1
@@ -261,6 +261,18 @@ static inline void *get_freepointer(strureturn *(void **)(object + s->offset); } +static inline void *get_freepointer_safe (struct kmem_cache *s,void *object) +{ +void *p; + +#ifdef CONFIG_DEBUG_PAGEALLOC +probe_kernel_read (&p, (void **)(object + s->offset),sizeof (p)); +#else + p =get_freepointer (s, object); +#endif +return p; +} +static inline void set_freepointer (struct kmem_cache *s,void *object,void *fp) { *(void **)(object + s->offset) = fp;
@@ -1943,7 +1955,7 @@ redo:if (unlikely (!irqsafe_cpu_cmpxchg_double ( s->cpu_slab->freelist, s->cpu_slab->tid, object, tid, -get_freepointer (s, object),next_tid (tid)))) { +get_freepointer_safe (s, object),next_tid (tid)))) {note_cmpxchg_failure ("slab_alloc" , s, tid); goto redo;
PATCH 94/165 ALSA: HDA: Use one dmic only for Dell Studio 1558
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1027
Lines: 30
From: David Henningsson <[email protected]>
commit e033ebfb399227e01686260ac271029011bc6b47 upstream.
There are no signs of a dmic at node 0x0b, so the user is left with an additional internal mic which does not exist. This commit removes that non-existing mic.
--- sound/pci/hda/patch_sigmatel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/hda/patch_sigmatel.c +1 -1
@@ -1600,7 +1600,7 @@ static struct snd_pci_quirk stac92hd73xxSND_PCI_QUIRK (PCI_VENDOR_ID_DELL ,0x02fe ,"Dell Studio XPS 1645" ,STAC_DELL_M6_BOTH ),SND_PCI_QUIRK (PCI_VENDOR_ID_DELL ,0x0413 , - "Dell Studio 1558", STAC_DELL_M6_BOTH), + "Dell Studio 1558", STAC_DELL_M6_DMIC), {} /* terminator */ };
PATCH 95/165 ALSA: HDA: Add quirk for Lenovo U350
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1122
Lines: 28
From: David Henningsson <[email protected]>
commit d2859fd49200f1f3efd8acdb54b6d51d3ab82302 upstream.
Add model=asus quirk for Lenovo Ideapad U350 to make internal mic work correctly.
--- sound/pci/hda/patch_conexant.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_conexant.c +1 -0
@@ -3036,6 +3036,7 @@ static struct snd_pci_quirk cxt5066_cfg_SND_PCI_QUIRK (0x17aa ,0x215e ,"Lenovo Thinkpad" ,CXT5066_THINKPAD ),SND_PCI_QUIRK (0x17aa ,0x21da ,"Lenovo X220" ,CXT5066_THINKPAD ),SND_PCI_QUIRK (0x17aa ,0x21db ,"Lenovo X220-tablet" ,CXT5066_THINKPAD ), +SND_PCI_QUIRK (0x17aa ,0x3a0d ,"Lenovo U350" ,CXT5066_ASUS ),SND_PCI_QUIRK (0x17aa ,0x38af ,"Lenovo G560" ,CXT5066_ASUS ), SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", CXT5066_IDEAPAD), /* Fallback for Lenovos without dock mic */ {}
PATCH 96/165 ALSA: hda - Fix input-src parse in patch_analog.c
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1180
Lines: 35
From: Adrian Wilkins <[email protected]>
commit 5a2d227fdc7a02ed1b4cebba391d8fb9ad57caaf upstream.
Compare pin type enum to the pin type and not the array index. Fixes bug#0005368.
--- sound/pci/hda/patch_analog.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/pci/hda/patch_analog.c +2 -1
@@ -3070,6 +3070,7 @@ static void ad1988_auto_init_analog_inpufor (i =0 ; i < cfg->num_inputs; i++) {hda_nid_t nid = cfg->inputs[i].pin; +int type = cfg->inputs[i].type;switch (nid) {case 0x15 :/* port-C */ snd_hda_codec_write (codec,0x33 ,0 ,AC_VERB_SET_CONNECT_SEL ,0x0 );
@@ -3079,7 +3080,7 @@ static void ad1988_auto_init_analog_inpubreak ; }snd_hda_codec_write (codec, nid,0 ,AC_VERB_SET_PIN_WIDGET_CONTROL , - i ==AUTO_PIN_MIC ?PIN_VREF80 :PIN_IN ); + type ==AUTO_PIN_MIC ?PIN_VREF80 :PIN_IN );if (nid !=AD1988_PIN_CD_NID )snd_hda_codec_write (codec, nid,0 ,AC_VERB_SET_AMP_GAIN_MUTE ,AMP_OUT_MUTE );
PATCH 97/165 ALSA: hda - Use LPIB for ATI/AMD chipsets as default
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1188
Lines: 37
From: Takashi Iwai <[email protected]>
commit 50e3bbf9898840eead86f90a43b3625a2b2f4112 upstream.
ATI and AMD chipsets seem not providing the proper position-buffer information, and it also doesn't provide FIFO register required by VIACOMBO fix. It's better to use LPIB for these.
--- sound/pci/hda/hda_intel.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
sound/pci/hda/hda_intel.c +8 -1
@@ -2349,9 +2349,16 @@ static int __devinit check_position_fix(/* Check VIA/ATI HD Audio Controller exist */ switch (chip->driver_type) {case AZX_DRIVER_VIA : -case AZX_DRIVER_ATI :/* Use link position directly, avoid any transfer problem. */ return POS_FIX_VIACOMBO ; +case AZX_DRIVER_ATI : +/* ATI chipsets don't work well with position-buffer */ +return POS_FIX_LPIB ; +case AZX_DRIVER_GENERIC : +/* AMD chipsets also don't work with position-buffer */ +if (chip->pci->vendor ==PCI_VENDOR_ID_AMD ) +return POS_FIX_LPIB ; +break ; }return POS_FIX_AUTO ;
PATCH 98/165 ASoC: Ensure output PGA is enabled for line outputs in
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
wm_hubs
Content-Length: 2570
Lines: 61
From: Mark Brown <[email protected]>
commit d0b48af6c2b887354d0893e598d92911ce52620e upstream.
Also fix a left/right typo while we're at it.
--- sound/soc/codecs/wm_hubs.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
sound/soc/codecs/wm_hubs.c +8 -8
@@ -787,17 +787,17 @@ static const struct snd_soc_dapm_route astatic const struct snd_soc_dapm_route lineout1_diff_routes[] = { {"LINEOUT1 Mixer" ,"IN1L Switch" ,"IN1L PGA" }, {"LINEOUT1 Mixer" ,"IN1R Switch" ,"IN1R PGA" }, - {"LINEOUT1 Mixer" ,"Output Switch" ,"Left Output Mixer" }, + {"LINEOUT1 Mixer" ,"Output Switch" ,"Left Output PGA" }, {"LINEOUT1N Driver" ,NULL ,"LINEOUT1 Mixer" }, {"LINEOUT1P Driver" ,NULL ,"LINEOUT1 Mixer" }, };static const struct snd_soc_dapm_route lineout1_se_routes[] = { - {"LINEOUT1N Mixer" ,"Left Output Switch" ,"Left Output Mixer" }, - {"LINEOUT1N Mixer" ,"Right Output Switch" ,"Left Output Mixer" }, + {"LINEOUT1N Mixer" ,"Left Output Switch" ,"Left Output PGA" }, + {"LINEOUT1N Mixer" ,"Right Output Switch" ,"Right Output PGA" }, - {"LINEOUT1P Mixer" ,"Left Output Switch" ,"Left Output Mixer" }, + {"LINEOUT1P Mixer" ,"Left Output Switch" ,"Left Output PGA" }, {"LINEOUT1N Driver" ,NULL ,"LINEOUT1N Mixer" }, {"LINEOUT1P Driver" ,NULL ,"LINEOUT1P Mixer" },
@@ -806,17 +806,17 @@ static const struct snd_soc_dapm_route lstatic const struct snd_soc_dapm_route lineout2_diff_routes[] = { {"LINEOUT2 Mixer" ,"IN2L Switch" ,"IN2L PGA" }, {"LINEOUT2 Mixer" ,"IN2R Switch" ,"IN2R PGA" }, - {"LINEOUT2 Mixer" ,"Output Switch" ,"Right Output Mixer" }, + {"LINEOUT2 Mixer" ,"Output Switch" ,"Right Output PGA" }, {"LINEOUT2N Driver" ,NULL ,"LINEOUT2 Mixer" }, {"LINEOUT2P Driver" ,NULL ,"LINEOUT2 Mixer" }, };static const struct snd_soc_dapm_route lineout2_se_routes[] = { - {"LINEOUT2N Mixer" ,"Left Output Switch" ,"Left Output Mixer" }, - {"LINEOUT2N Mixer" ,"Right Output Switch" ,"Left Output Mixer" }, + {"LINEOUT2N Mixer" ,"Left Output Switch" ,"Left Output PGA" }, + {"LINEOUT2N Mixer" ,"Right Output Switch" ,"Right Output PGA" }, - {"LINEOUT2P Mixer" ,"Right Output Switch" ,"Right Output Mixer" }, + {"LINEOUT2P Mixer" ,"Right Output Switch" ,"Right Output PGA" }, {"LINEOUT2N Driver" ,NULL ,"LINEOUT2N Mixer" }, {"LINEOUT2P Driver" ,NULL ,"LINEOUT2P Mixer" },
PATCH 99/165 ASoC: Add some missing volume update bit sets for wm_hubs
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
devices
Content-Length: 1499
Lines: 39
From: Mark Brown <[email protected]>
commit fb5af53d421d80725172427e9076f6e889603df6 upstream.
--- sound/soc/codecs/wm_hubs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sound/soc/codecs/wm_hubs.c +6 -2
@@ -836,17 +836,21 @@ int wm_hubs_add_analogue_controls(structsnd_soc_update_bits (codec,WM8993_RIGHT_LINE_INPUT_3_4_VOLUME ,WM8993_IN2_VU ,WM8993_IN2_VU ); +snd_soc_update_bits (codec,WM8993_SPEAKER_VOLUME_LEFT , +WM8993_SPKOUT_VU ,WM8993_SPKOUT_VU );snd_soc_update_bits (codec,WM8993_SPEAKER_VOLUME_RIGHT ,WM8993_SPKOUT_VU ,WM8993_SPKOUT_VU );snd_soc_update_bits (codec,WM8993_LEFT_OUTPUT_VOLUME , -WM8993_HPOUT1L_ZC ,WM8993_HPOUT1L_ZC ); +WM8993_HPOUT1_VU |WM8993_HPOUT1L_ZC , +WM8993_HPOUT1_VU |WM8993_HPOUT1L_ZC );snd_soc_update_bits (codec,WM8993_RIGHT_OUTPUT_VOLUME ,WM8993_HPOUT1_VU |WM8993_HPOUT1R_ZC ,WM8993_HPOUT1_VU |WM8993_HPOUT1R_ZC );snd_soc_update_bits (codec,WM8993_LEFT_OPGA_VOLUME , -WM8993_MIXOUTL_ZC ,WM8993_MIXOUTL_ZC ); +WM8993_MIXOUTL_ZC |WM8993_MIXOUT_VU , +WM8993_MIXOUTL_ZC |WM8993_MIXOUT_VU );snd_soc_update_bits (codec,WM8993_RIGHT_OPGA_VOLUME ,WM8993_MIXOUTR_ZC |WM8993_MIXOUT_VU ,WM8993_MIXOUTR_ZC |WM8993_MIXOUT_VU );
PATCH 100/165 ASoC: fix raumfeld platform
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 4418
Lines: 152
From: Daniel Mack <[email protected]>
commit 477a66948ef8683f182682cc68e8520baf8a5b43 upstream.
Commit f0fba2ad (ASoC: multi-component - ASoC Multi-Component Support) broke support for Raumfeld platforms as it didn't take into account the different hardware features on individual devices.
In particular, Raumfeld speakers have no S/PDIF output, so the members of the snd_soc_card struct must be set dynamically.
--- sound/soc/pxa/raumfeld.c | 94 +++++++++++++++++++++++++++++------------------ 1 file changed, 59 insertions(+), 35 deletions(-)
sound/soc/pxa/raumfeld.c +59 -35
@@ -151,13 +151,13 @@ static struct snd_soc_ops raumfeld_cs427 .hw_params = raumfeld_cs4270_hw_params, }; -static int raumfeld_line_suspend (struct snd_soc_card *card) +static int raumfeld_analog_suspend (struct snd_soc_card *card) {raumfeld_enable_audio (false);return 0 ; } -static int raumfeld_line_resume (struct snd_soc_card *card) +static int raumfeld_analog_resume (struct snd_soc_card *card) {raumfeld_enable_audio (true);return 0 ;
@@ -225,32 +225,53 @@ static struct snd_soc_ops raumfeld_ak410 .hw_params = raumfeld_ak4104_hw_params, }; -static struct snd_soc_dai_link raumfeld_dai[] = { +#define DAI_LINK_CS4270 \ +{ \ + .name = "CS4270", \ + .stream_name = "CS4270", \ + .cpu_dai_name = "pxa-ssp-dai.0", \ + .platform_name = "pxa-pcm-audio", \ + .codec_dai_name = "cs4270-hifi", \ + .codec_name = "cs4270-codec.0-0048", \ + .ops = &raumfeld_cs4270_ops, \ +} + +#define DAI_LINK_AK4104 \ +{ \ + .name = "ak4104", \ + .stream_name = "Playback", \ + .cpu_dai_name = "pxa-ssp-dai.1", \ + .codec_dai_name = "ak4104-hifi", \ + .platform_name = "pxa-pcm-audio", \ + .ops = &raumfeld_ak4104_ops, \ + .codec_name = "spi0.0", \ +} + +static struct snd_soc_dai_link snd_soc_raumfeld_connector_dai[] = +{ +DAI_LINK_CS4270 , +DAI_LINK_AK4104 , +}; + +static struct snd_soc_dai_link snd_soc_raumfeld_speaker_dai[] = { - .name ="ak4104" , - .stream_name ="Playback" , - .cpu_dai_name ="pxa-ssp-dai.1" , - .codec_dai_name ="ak4104-hifi" , - .platform_name ="pxa-pcm-audio" , - .ops = &raumfeld_ak4104_ops, - .codec_name ="ak4104-codec.0" , -}, -{ - .name ="CS4270" , - .stream_name ="CS4270" , - .cpu_dai_name ="pxa-ssp-dai.0" , - .platform_name ="pxa-pcm-audio" , - .codec_dai_name ="cs4270-hifi" , - .codec_name ="cs4270-codec.0-0048" , - .ops = &raumfeld_cs4270_ops, -},}; - -static struct snd_soc_card snd_soc_raumfeld = { - .name ="Raumfeld" , - .dai_link = raumfeld_dai, - .suspend_post = raumfeld_line_suspend, - .resume_pre = raumfeld_line_resume, - .num_links =ARRAY_SIZE (raumfeld_dai), +DAI_LINK_CS4270 , +}; + +static struct snd_soc_card snd_soc_raumfeld_connector = { + .name ="Raumfeld Connector" , + .dai_link = snd_soc_raumfeld_connector_dai, + .num_links =ARRAY_SIZE (snd_soc_raumfeld_connector_dai), + .suspend_post = raumfeld_analog_suspend, + .resume_pre = raumfeld_analog_resume, +}; + +static struct snd_soc_card snd_soc_raumfeld_speaker = { + .name ="Raumfeld Speaker" , + .dai_link = snd_soc_raumfeld_speaker_dai, + .num_links =ARRAY_SIZE (snd_soc_raumfeld_speaker_dai), + .suspend_post = raumfeld_analog_suspend, + .resume_pre = raumfeld_analog_resume, };static struct platform_device *raumfeld_audio_device;
@@ -271,22 +292,25 @@ static int __init raumfeld_audio_init(voset_max9485_clk (MAX9485_MCLK_FREQ_122880 ); -/* Register LINE and SPDIF */ +/* Register analog device */ raumfeld_audio_device =platform_device_alloc ("soc-audio" ,0 );if (!raumfeld_audio_device)return -ENOMEM ; -platform_set_drvdata (raumfeld_audio_device, - &snd_soc_raumfeld); - ret =platform_device_add (raumfeld_audio_device); - -/* no S/PDIF on Speakers */ if (machine_is_raumfeld_speaker ()) +platform_set_drvdata (raumfeld_audio_device, + &snd_soc_raumfeld_speaker); + +if (machine_is_raumfeld_connector ()) +platform_set_drvdata (raumfeld_audio_device, + &snd_soc_raumfeld_connector); + + ret =platform_device_add (raumfeld_audio_device); +if (ret <0 )return ret;raumfeld_enable_audio (true); - -return ret; +return 0 ; } static void __exit raumfeld_audio_exit(void)
PATCH 101/165 HID: magicmouse: ignore ivalid report id while switching
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
modes
Content-Length: 1542
Lines: 48
From: Jiri Kosina <[email protected]>
commit 23746a66d7d9e73402c68ef00d708796b97ebd72 upstream.
The device reponds with 'invalid report id' when feature report switching it into multitouch mode is sent to it.
This has been silently ignored before 0825411ade ("HID: bt: Wait for ACK on Sent Reports"), but since this commit, it propagates -EIO from the _raw callback .
So let the driver ignore -EIO as response to 0xd7,0x01 report, as that's how the device reacts in normal mode.
Sad, but following reality.
This fixes https://bugzilla.kernel.org/show_bug.cgi?id=35022
--- drivers/hid/hid-magicmouse.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/hid/hid-magicmouse.c +9 -1
@@ -501,9 +501,17 @@ static int magicmouse_probe(struct hid_d } report->size =6 ; +/* +* The device reponds with 'invalid report id' when feature +* report switching it into multitouch mode is sent to it. +* +* This results in -EIO from the _raw low-level transport callback, +* but there seems to be no other way of switching the mode. +* Thus the super-ugly hacky success check below. +*/ ret = hdev->hid_output_raw_report (hdev, feature,sizeof (feature),HID_FEATURE_REPORT ); -if (ret !=sizeof (feature)) { +if (ret != -EIO ) {hid_err (hdev,"unable to request touch data (%d)\n" , ret); goto err_stop_hw; }
PATCH 102/165 mm/page_alloc.c: prevent unending loop in
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
__alloc_pages_slowpath()
Content-Length: 2450
Lines: 60
From: Andrew Barry <[email protected]>
commit cfa54a0fcfc1017c6f122b6f21aaba36daa07f71 upstream.
I believe I found a problem in __alloc_pages_slowpath, which allows a process to get stuck endlessly looping, even when lots of memory is available.
Running an I/O and memory intensive stress-test I see a 0-order page allocation with __GFP_IO and __GFP_WAIT, running on a system with very little free memory. Right about the same time that the stress-test gets killed by the OOM-killer, the utility trying to allocate memory gets stuck in __alloc_pages_slowpath even though most of the systems memory was freed by the oom-kill of the stress-test.
The utility ends up looping from the rebalance label down through the wait_iff_congested continiously. Because order=0, __alloc_pages_direct_compact skips the call to get_page_from_freelist. Because all of the reclaimable memory on the system has already been reclaimed, __alloc_pages_direct_reclaim skips the call to get_page_from_freelist. Since there is no __GFP_FS flag, the block with __alloc_pages_may_oom is skipped. The loop hits the wait_iff_congested, then jumps back to rebalance without ever trying to get_page_from_freelist. This loop repeats infinitely.
The test case is pretty pathological. Running a mix of I/O stress-tests that do a lot of fork() and consume all of the system memory, I can pretty reliably hit this on 600 nodes, in about 12 hours. 32GB/node.
--- mm/page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/page_alloc.c +1 -1
@@ -2064,6 +2064,7 @@ restart:first_zones_zonelist (zonelist, high_zoneidx,NULL , &preferred_zone); +rebalance:/* This is the last chance, in general, before the goto nopage. */ page = get_page_from_freelist(gfp_mask, nodemask, order, zonelist, high_zoneidx, alloc_flags & ~ALLOC_NO_WATERMARKS,
@@ -2071,7 +2072,6 @@ restart:if (page) goto got_pg; -rebalance:/* Allocate without watermarks if the context allows */ if (alloc_flags &ALLOC_NO_WATERMARKS ) { page = __alloc_pages_high_priority(gfp_mask, order,
PATCH 103/165 loop: limit max_part module param to DISK_MAX_PARTS
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 3356
Lines: 83
From: Namhyung Kim <[email protected]>
commit 78f4bb367fd147a0e7e3998ba6e47109999d8814 upstream.
The 'max_part' parameter controls the number of maximum partition a loop block device can have. However if a user specifies very large value it would exceed the limitation of device minor number and can cause a kernel panic (or, at least, produce invalid device nodes in some cases).
On my desktop system, following command kills the kernel. On qemu, it triggers similar oops but the kernel was alive:
$ sudo modprobe loop max_part0000 ------------[ cut here ]------------ kernel BUG at /media/Linux_Data/project/linux/fs/sysfs/group.c:65! invalid opcode: 0000 [#1] SMP last sysfs file: CPU 0 Modules linked in: loop(+)
Pid: 43, comm: insmod Tainted: G W 2.6.39-qemu+ #155 Bochs Bochs
RIP: 0010:[<ffffffff8113ce61>] [<ffffffff8113ce61>] internal_create_group= +0x2a/0x170 RSP: 0018:ffff880007b3fde8 EFLAGS: 00000246 RAX: 00000000ffffffef RBX: ffff880007b3d878 RCX: 00000000000007b4 RDX: ffffffff8152da50 RSI: 0000000000000000 RDI: ffff880007b3d878 RBP: ffff880007b3fe38 R08: ffff880007b3fde8 R09: 0000000000000000 R10: ffff88000783b4a8 R11: ffff880007b3d878 R12: ffffffff8152da50 R13: ffff880007b3d868 R14: 0000000000000000 R15: ffff880007b3d800 FS: 0000000002137880(0063) GS:ffff880007c00000(0000) knlGS:00000000000000=
00
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000422680 CR3: 0000000007b50000 CR4: 00000000000006b0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 0000000000000000 DR7: 0000000000000000 Process insmod (pid: 43, threadinfo ffff880007b3e000, task ffff880007afb9c=
0)
Stack: ffff880007b3fe58 ffffffff811e66dd ffff880007b3fe58 ffffffff811e570b 0000000000000010 ffff880007b3d800 ffff880007a7b390 ffff880007b3d868 0000000000400920 ffff880007b3d800 ffff880007b3fe48 ffffffff8113cfc8 Call Trace: [<ffffffff811e66dd>] ? device_add+0x4bc/0x5af [<ffffffff811e570b>] ? dev_set_name+0x3c/0x3e [<ffffffff8113cfc8>] sysfs_create_group+0xe/0x12 [<ffffffff810b420e>] blk_trace_init_sysfs+0x14/0x16 [<ffffffff8116a090>] blk_register_queue+0x47/0xf7 [<ffffffff8116f527>] add_disk+0xdf/0x290 [<ffffffffa00060eb>] loop_init+0xeb/0x1b8 [loop] [<ffffffffa0006000>] ? 0xffffffffa0005fff [<ffffffff8100020a>] do_one_initcall+0x7a/0x12e [<ffffffff81096804>] sys_init_module+0x9c/0x1e0 [<ffffffff813329bb>] system_call_fastpath+0x16/0x1b Code: c3 55 48 89 e5 41 57 41 56 41 89 f6 41 55 41 54 49 89 d4 53 48 89 fb= 48 83 ec 28 48 85 ff 74 0b 85 f6 75 0b 48 83 7f 30 00 75 14 <0f> 0b eb fe = 48 83 7f 30 00 b9 ea ff ff ff 0f 84 18 01 00 00 49 RIP [<ffffffff8113ce61>] internal_create_group+0x2a/0x170 RSP <ffff880007b3fde8> ---[ end trace a123eb592043acad ]---
--- drivers/block/loop.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/block/loop.c +3 -0
@@ -1691,6 +1691,9 @@ static int __init loop_init(void)if (max_part >0 ) part_shift =fls (max_part); +if ((1UL << part_shift) >DISK_MAX_PARTS ) +return -EINVAL ; +if (max_loop >1UL << (MINORBITS - part_shift))return -EINVAL ;
PATCH 104/165 loop: handle on-demand devices correctly
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 3328
Lines: 88
From: Namhyung Kim <[email protected]>
commit a1c15c59feee36267c43142a41152fbf7402afb6 upstream.
When finding or allocating a loop device, loop_probe() did not take partition numbers into account so that it can result to a different device. Consider following example:
$ sudo modprobe loop max_part=15 $ ls -l /dev/loop* brw-rw---- 1 root disk 7, 0 2011-05-24 22:16 /dev/loop0 brw-rw---- 1 root disk 7, 16 2011-05-24 22:16 /dev/loop1 brw-rw---- 1 root disk 7, 32 2011-05-24 22:16 /dev/loop2 brw-rw---- 1 root disk 7, 48 2011-05-24 22:16 /dev/loop3 brw-rw---- 1 root disk 7, 64 2011-05-24 22:16 /dev/loop4 brw-rw---- 1 root disk 7, 80 2011-05-24 22:16 /dev/loop5 brw-rw---- 1 root disk 7, 96 2011-05-24 22:16 /dev/loop6 brw-rw---- 1 root disk 7, 112 2011-05-24 22:16 /dev/loop7 $ sudo mknod /dev/loop8 b 7 128 $ sudo losetup /dev/loop8 ~/temp/disk-with-3-parts.img $ sudo losetup -a /dev/loop128: [0805]:278201 (/home/namhyung/temp/disk-with-3-parts.img) $ ls -l /dev/loop* brw-rw---- 1 root disk 7, 0 2011-05-24 22:16 /dev/loop0 brw-rw---- 1 root disk 7, 16 2011-05-24 22:16 /dev/loop1 brw-rw---- 1 root disk 7, 2048 2011-05-24 22:18 /dev/loop128 brw-rw---- 1 root disk 7, 2049 2011-05-24 22:18 /dev/loop128p1 brw-rw---- 1 root disk 7, 2050 2011-05-24 22:18 /dev/loop128p2 brw-rw---- 1 root disk 7, 2051 2011-05-24 22:18 /dev/loop128p3 brw-rw---- 1 root disk 7, 32 2011-05-24 22:16 /dev/loop2 brw-rw---- 1 root disk 7, 48 2011-05-24 22:16 /dev/loop3 brw-rw---- 1 root disk 7, 64 2011-05-24 22:16 /dev/loop4 brw-rw---- 1 root disk 7, 80 2011-05-24 22:16 /dev/loop5 brw-rw---- 1 root disk 7, 96 2011-05-24 22:16 /dev/loop6 brw-rw---- 1 root disk 7, 112 2011-05-24 22:16 /dev/loop7 brw-r--r-- 1 root root 7, 128 2011-05-24 22:17 /dev/loop8
After this patch, /dev/loop8 - instead of /dev/loop128 - was accessed correctly.
In addition, 'range' passed to blk_register_region() should include all range of dev_t that LOOP_MAJOR can address. It does not need to be limited by partition numbers unless 'max_loop' param was specified.
--- drivers/block/loop.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/block/loop.c +4 -4
@@ -1658,7 +1658,7 @@ static struct kobject *loop_probe(dev_tstruct kobject *kobj;mutex_lock (&loop_devices_mutex); - lo =loop_init_one (dev &MINORMASK ); + lo =loop_init_one (MINOR (dev) >> part_shift); kobj = lo ?get_disk (lo->lo_disk) :ERR_PTR (-ENOMEM );mutex_unlock (&loop_devices_mutex);
@@ -1699,10 +1699,10 @@ static int __init loop_init(void)if (max_loop) { nr = max_loop; - range = max_loop; + range = max_loop << part_shift; }else { nr =8 ; - range =1UL << (MINORBITS - part_shift); + range =1UL <<MINORBITS ; }if (register_blkdev (LOOP_MAJOR ,"loop" ))
@@ -1741,7 +1741,7 @@ static void __exit loop_exit(void)unsigned long range;struct loop_device *lo, *next; - range = max_loop ? max_loop :1UL << (MINORBITS - part_shift); + range = max_loop ? max_loop << part_shift :1UL <<MINORBITS ;list_for_each_entry_safe (lo, next, &loop_devices, lo_list)loop_del_one (lo);
PATCH 105/165 i2c: tegra: Enable new slave mode.
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1595
Lines: 46
From: Kenneth Waters <[email protected]>
commit 65a1a0ace554d61ea5a90377a54df1505275c1b1 upstream.
For Tegra i2c controller to function properly new slave mode must be enabled.
swarren notes:
In particular, I found this was needed when working on enabling the Tegra audio driver on the Seaboard board. There are two different PCB layouts for this board; a "clamshell" version, which works just fine without this change, and the original non-clamshell version, which needs this change in order for I2C to operate correctly. Without it, I2C probing fails for some devices, e.g. with:
wm8903 0-001a: Device with ID register 0 is not a WM8903 wm8903 0-001a: asoc: failed to probe CODEC wm8903.0-001a: -19
asoc: failed to instantiate card tegra-wm8903: -19 ALSA device list:
No soundcards found.
--- drivers/i2c/busses/i2c-tegra.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/i2c/busses/i2c-tegra.c +5 -0
@@ -330,6 +330,11 @@ static int tegra_i2c_init(struct tegra_ii2c_writel (i2c_dev,0 ,I2C_INT_MASK );clk_set_rate (i2c_dev->clk, i2c_dev->bus_clk_rate *8 ); +if (!i2c_dev->is_dvc) { +u32 sl_cfg =i2c_readl (i2c_dev,I2C_SL_CNFG ); +i2c_writel (i2c_dev, sl_cfg |I2C_SL_CNFG_NEWSL ,I2C_SL_CNFG ); + } + val =7 <<I2C_FIFO_CONTROL_TX_TRIG_SHIFT |0 <<I2C_FIFO_CONTROL_RX_TRIG_SHIFT ;i2c_writel (i2c_dev, val,I2C_FIFO_CONTROL );
PATCH 106/165 i2c/writing-clients: Fix foo_driver.id_table
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 748
Lines: 27
From: Vikram Narayanan <[email protected]>
commit 3116c86033079a1d4d4e84c40028f96b614843b8 upstream.
The i2c_device_id structure variable's name is not used in the i2c_driver structure.
--- Documentation/i2c/writing-clients | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/i2c/writing-clients +1 -1
@@ -38,7 +38,7 @@ static struct i2c_driver foo_driver = { .name = "foo", }, - .id_table = foo_ids, + .id_table = foo_idtable, .probe = foo_probe, .remove = foo_remove, /* if device autodetection is needed: */
PATCH 107/165 USB: CP210x Add 4 Device IDs for AC-Services Devices
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1214
Lines: 28
From: Craig Shelley <[email protected]>
commit 4eff0b40a7174896b860312910e0db51f2dcc567 upstream.
This patch adds 4 device IDs for CP2102 based devices manufactured by AC-Services. See http://www.ac-services.eu for further info.
--- drivers/usb/serial/cp210x.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/serial/cp210x.c +4 -0
@@ -112,6 +112,10 @@ static const struct usb_device_id id_tab { USB_DEVICE(0x10C4, 0x8418) }, /* IRZ Automation Teleport SG-10 GSM/GPRS Modem */ { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */ { USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */ + { USB_DEVICE(0x10C4, 0x85EA) }, /* AC-Services IBUS-IF */ + { USB_DEVICE(0x10C4, 0x85EB) }, /* AC-Services CIS-IBUS */ + { USB_DEVICE(0x10C4, 0x8664) }, /* AC-Services CAN-IF */ + { USB_DEVICE(0x10C4, 0x8665) }, /* AC-Services OBD-IF */ { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ { USB_DEVICE(0x10C4, 0xEA71) }, /* Infinity GPS-MIC-1 Radio Monophone */
PATCH 108/165 USB: moto_modem: Add USB identifier for the Motorola VE240.
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 841
Lines: 25
From: Elizabeth Jennifer Myers <[email protected]>
commit 3938a0b32dc12229e76735679b37095bc2bc1578 upstream.
Tested on my phone, the ttyUSB device is created and is fully functional.
--- drivers/usb/serial/moto_modem.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/serial/moto_modem.c +1 -0
@@ -25,6 +25,7 @@ static const struct usb_device_id id_tab { USB_DEVICE(0x05c6, 0x3197) }, /* unknown Motorola phone */ { USB_DEVICE(0x0c44, 0x0022) }, /* unknown Mororola phone */ { USB_DEVICE(0x22b8, 0x2a64) }, /* Motorola KRZR K1m */ + { USB_DEVICE(0x22b8, 0x2c84) }, /* Motorola VE240 phone */ { USB_DEVICE(0x22b8, 0x2c64) }, /* Motorola V950 phone */ { }, };
PATCH 109/165 USB: serial: ftdi_sio: adding support for TavIR STK500
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1182
Lines: 40
From: =?UTF-8?q?Benedek=20L=C3=A1szl=C3=B3?= <[email protected]>
commit 37909fe588c9e09ab57cd267e98678a17ceda64a upstream.
Adding support for the TavIR STK500 (id 0403:FA33) Atmel AVR programmer device based on FTDI FT232RL.
--- drivers/usb/serial/ftdi_sio.c | 1 + drivers/usb/serial/ftdi_sio_ids.h | 5 +++++ 2 files changed, 6 insertions(+)
drivers/usb/serial/ftdi_sio.c +1 -0
@@ -566,6 +566,7 @@ static struct usb_device_id id_table_com { USB_DEVICE(FTDI_VID, FTDI_IBS_APP70_PID) }, { USB_DEVICE(FTDI_VID, FTDI_IBS_PEDO_PID) }, { USB_DEVICE(FTDI_VID, FTDI_IBS_PROD_PID) }, + { USB_DEVICE(FTDI_VID, FTDI_TAVIR_STK500_PID) },/* * ELV devices: */
drivers/usb/serial/ftdi_sio_ids.h +5 -0
@@ -491,6 +491,11 @@/* www.canusb.com Lawicel CANUSB device (FTDI_VID) */ #define FTDI_CANUSB_PID 0xFFA8/* Product Id */ +/* +* TavIR AVR product ids (FTDI_VID) +*/ +#define FTDI_TAVIR_STK500_PID 0xFA33/* STK500 AVR programmer */ +/********************************/
PATCH 110/165 USB: gadget: g_multi: fixed vendor and product ID in inf
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
files
Content-Length: 2150
Lines: 55
From: Michal Nazarewicz <[email protected]>
commit 7701846fd52f86dffe50715e0e63154088b7c982 upstream.
Commit 1c6529e92b "USB: gadget: g_multi: fixed vendor and product ID" replaced g_multi's vendor and product ID with proper ID's from Linux Foundation. This commit now updates INF files in the Documentation/usb directory which were omitted in the original commit.
--- Documentation/usb/linux-cdc-acm.inf | 4 ++-- Documentation/usb/linux.inf | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)
Documentation/usb/linux-cdc-acm.inf +2 -2
@@ -90,10 +90,10 @@ ServiceBinary=%12%\USBSER.sys [SourceDisksFiles] [SourceDisksNames] [DeviceList] -%DESCRIPTION%=DriverInstall, USB\VID_0525&PID_A4A7, USB\VID_0525&PID_A4AB&MI_02 +%DESCRIPTION%=DriverInstall, USB\VID_0525&PID_A4A7, USB\VID_1D6B&PID_0104&MI_02 [DeviceList.NTamd64] -%DESCRIPTION%=DriverInstall, USB\VID_0525&PID_A4A7, USB\VID_0525&PID_A4AB&MI_02 +%DESCRIPTION%=DriverInstall, USB\VID_0525&PID_A4A7, USB\VID_1D6B&PID_0104&MI_02 ;------------------------------------------------------------------------------
Documentation/usb/linux.inf +3 -3
@@ -18,15 +18,15 @@ DriverVer = 06/21/2006,6.0.600 ; Decoration for x86 architecture [LinuxDevices.NTx86] -%LinuxDevice% = RNDIS.NT.5.1, USB\VID_0525&PID_a4a2, USB\VID_0525&PID_a4ab&MI_00 +%LinuxDevice% = RNDIS.NT.5.1, USB\VID_0525&PID_a4a2, USB\VID_1d6b&PID_0104&MI_00 ; Decoration for x64 architecture [LinuxDevices.NTamd64] -%LinuxDevice% = RNDIS.NT.5.1, USB\VID_0525&PID_a4a2, USB\VID_0525&PID_a4ab&MI_00 +%LinuxDevice% = RNDIS.NT.5.1, USB\VID_0525&PID_a4a2, USB\VID_1d6b&PID_0104&MI_00 ; Decoration for ia64 architecture [LinuxDevices.NTia64] -%LinuxDevice% = RNDIS.NT.5.1, USB\VID_0525&PID_a4a2, USB\VID_0525&PID_a4ab&MI_00 +%LinuxDevice% = RNDIS.NT.5.1, USB\VID_0525&PID_a4a2, USB\VID_1d6b&PID_0104&MI_00 ;@@@ This is the common setting for setup [ControlFlags]
PATCH 111/165 USB: gamin_gps: Fix for data transfer problems in native
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
mode
Content-Length: 3831
Lines: 110
From: Hermann Kneissel <[email protected]>
commit b4026c4584cd70858d4d3450abfb1cd0714d4f32 upstream.
This patch fixes a problem where data received from the gps is sometimes transferred incompletely to the serial port. If used in native mode now all data received via the bulk queue will be forwarded to the serial port.
--- drivers/usb/serial/garmin_gps.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
drivers/usb/serial/garmin_gps.c +13 -7
@@ -1,7 +1,7 @@/* * Garmin GPS driver * -* Copyright (C) 2006-2009 Hermann Kneissel [email protected] +* Copyright (C) 2006-2011 Hermann Kneissel [email protected] * * The latest version of the driver can be found at * http://sourceforge.net/projects/garmin-gps/
@@ -51,7 +51,7 @@ static int debug;*/ #define VERSION_MAJOR 0 -#define VERSION_MINOR 33 +#define VERSION_MINOR 36#define _STR (s) #s#define _DRIVER_VERSION (a, b) "v" _STR(a) "." _STR(b)
@@ -410,6 +410,7 @@ static int gsp_send_ack(struct garmin_da*/ static int gsp_rec_packet (struct garmin_data *garmin_data_p,int count) { +unsigned long flags;const __u8 *recpkt = garmin_data_p->inbuffer+GSP_INITIAL_OFFSET ;__le32 *usbdata = (__le32 *) garmin_data_p->inbuffer;
@@ -458,7 +459,9 @@ static int gsp_rec_packet(struct garmin_/* if this was an abort-transfer command, flush all queued data. */ if (isAbortTrfCmnd (garmin_data_p->inbuffer)) { +spin_lock_irqsave (&garmin_data_p->lock, flags); garmin_data_p->flags |=FLAGS_DROP_DATA ; +spin_unlock_irqrestore (&garmin_data_p->lock, flags);pkt_clear (garmin_data_p); }
@@ -943,7 +946,7 @@ static int garmin_open(struct tty_structspin_lock_irqsave (&garmin_data_p->lock, flags); garmin_data_p->mode = initial_mode; garmin_data_p->count =0 ; - garmin_data_p->flags =0 ; + garmin_data_p->flags &=FLAGS_SESSION_REPLY1_SEEN ;spin_unlock_irqrestore (&garmin_data_p->lock, flags);/* shutdown any bulk reads that might be going on */
@@ -1178,7 +1181,8 @@ static int garmin_write_room(struct tty_static void garmin_read_process (struct garmin_data *garmin_data_p, -unsigned char *data,unsigned data_length) +unsigned char *data,unsigned data_length, +int bulk_data) {unsigned long flags;
@@ -1193,7 +1197,8 @@ static void garmin_read_process(struct gsend it directly to the tty port */ if (garmin_data_p->flags &FLAGS_QUEUING ) {pkt_add (garmin_data_p, data, data_length); - }else if (getLayerId (data) ==GARMIN_LAYERID_APPL ) { + }else if (bulk_data || +getLayerId (data) ==GARMIN_LAYERID_APPL ) {spin_lock_irqsave (&garmin_data_p->lock, flags); garmin_data_p->flags |=APP_RESP_SEEN ;
@@ -1237,7 +1242,7 @@ static void garmin_read_bulk_callback(stusb_serial_debug_data (debug, &port->dev, __func__, urb->actual_length, data); -garmin_read_process (garmin_data_p, data, urb->actual_length); +garmin_read_process (garmin_data_p, data, urb->actual_length,1 );if (urb->actual_length ==0 &&0 != (garmin_data_p->flags &FLAGS_BULK_IN_RESTART )) {
@@ -1346,7 +1351,7 @@ static void garmin_read_int_callback(str __func__, garmin_data_p->serial_num); } -garmin_read_process (garmin_data_p, data, urb->actual_length); +garmin_read_process (garmin_data_p, data, urb->actual_length,0 ); port->interrupt_in_urb->dev = port->serial->dev; retval =usb_submit_urb (urb,GFP_ATOMIC );
@@ -1461,6 +1466,7 @@ static int garmin_attach(struct usb_seri garmin_data_p->timer.function = timeout_handler; garmin_data_p->port = port; garmin_data_p->state =0 ; + garmin_data_p->flags =0 ; garmin_data_p->count =0 ;usb_set_serial_port_data (port, garmin_data_p);
PATCH 112/165 Bind only modem AT command endpoint to option module.
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1770
Lines: 40
From: "Marius B. Kotsbak" <[email protected]>
commit 15b2f3204a5c878c32939094775fb7349f707263 upstream.
Network interface is handled by upcoming gt_b3730 module.
Removed "GT-B3710" from comment, it is another modem with another USB ID.
--- drivers/usb/serial/option.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/usb/serial/option.c +7 -1
@@ -972,7 +972,7 @@ static const struct usb_device_id option { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) }, { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ { USB_DEVICE(ONDA_VENDOR_ID, ONDA_MT825UP) }, /* ONDA MT825UP modem */ - { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730/GT-B3710 LTE USB modem.*/ + { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730 LTE USB modem.*/ { } /* Terminating entry */ };MODULE_DEVICE_TABLE (usb, option_ids);
@@ -1109,6 +1109,12 @@ static int option_probe(struct usb_seria serial->interface->cur_altsetting->desc.bInterfaceNumber == 1)return -ENODEV ; +/* Don't bind network interface on Samsung GT-B3730, it is handled by a separate module */ +if (serial->dev->descriptor.idVendor ==SAMSUNG_VENDOR_ID && + serial->dev->descriptor.idProduct ==SAMSUNG_PRODUCT_GT_B3730 && + serial->interface->cur_altsetting->desc.bInterfaceClass !=USB_CLASS_CDC_DATA ) +return -ENODEV ; + data = serial->private =kzalloc (sizeof (struct usb_wwan_intf_private ),GFP_KERNEL );if (!data)
PATCH 113/165 USB: cdc_acm: Fix oops when Droids MuIn LCD is connected
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 2292
Lines: 66
From: Erik Slagter <[email protected]>
commit fd5054c169d29747a44b4e1419ff47f57ae82dbc upstream.
The Droids MuIn LCD operates like a serial remote terminal. Data received are displayed directly on the LCD. This patch fixes the kernel null pointer oops when it is plugged in.
Add NO_DATA_INTERFACE quirk to tell the driver that "control" and "data" interfaces are not separated for this device, which prevents dereferencing a null pointer in the device probe code.
--- drivers/usb/class/cdc-acm.c | 13 +++++++++++-- drivers/usb/class/cdc-acm.h | 1 + 2 files changed, 12 insertions(+), 2 deletions(-)
drivers/usb/class/cdc-acm.c +11 -2
@@ -946,7 +946,7 @@ static int acm_probe(struct usb_interfacu8 ac_management_function =0 ;u8 call_management_function =0 ;int call_interface_num =-1 ; -int data_interface_num; +int data_interface_num =-1 ;unsigned long quirks;int num_rx_buf;int i;
@@ -1030,7 +1030,11 @@ next_desc:if (!union_header) {if (call_interface_num >0 ) {dev_dbg (&intf->dev,"No union descriptor, using call management descriptor\n" ); - data_interface =usb_ifnum_to_if (usb_dev, (data_interface_num = call_interface_num)); +/* quirks for Droids MuIn LCD */ +if (quirks &NO_DATA_INTERFACE ) + data_interface =usb_ifnum_to_if (usb_dev,0 ); +else + data_interface =usb_ifnum_to_if (usb_dev, (data_interface_num = call_interface_num)); control_interface = intf; }else {if (intf->cur_altsetting->desc.bNumEndpoints !=3 ) {
@@ -1622,6 +1626,11 @@ static const struct usb_device_id acm_id .driver_info = NOT_A_MODEM, }, +/* Support for Droids MuIn LCD */ + { USB_DEVICE(0x04d8, 0x000b), + .driver_info =NO_DATA_INTERFACE , + }, + /* control interfaces without any protocol set */ { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, USB_CDC_PROTO_NONE) },
drivers/usb/class/cdc-acm.h +1 -0
@@ -137,3 +137,4 @@ struct acm {#define SINGLE_RX_URB 2#define NO_CAP_LINE 4#define NOT_A_MODEM 8 +#define NO_DATA_INTERFACE 16
PATCH 114/165 xhci: Fix bug in control transfer cancellation.
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 3172
Lines: 80
From: Sarah Sharp <[email protected]>
commit 3abeca998a44205cfd837fa0bf1f7c24f8294acb upstream.
When the xHCI driver attempts to cancel a transfer, it issues a Stop Endpoint command and waits for the host controller to indicate which TRB it was in the middle of processing. The host will put an event TRB with completion code COMP_STOP on the event ring if it stops on a control transfer TRB (or other types of transfer TRBs). The ring handling code is supposed to set ep->stopped_trb to the TRB that the host stopped on when this happens.
Unfortunately, there is a long-standing bug in the control transfer completion code. It doesn't actually check to see if COMP_STOP is set before attempting to process the transfer based on which part of the control TD completed. So when we get an event on the data phase of the control TRB with COMP_STOP set, it thinks it's a normal completion of the transfer and doesn't set ep->stopped_td or ep->stopped_trb.
When the ring handling code goes on to process the completion of the Stop Endpoint command, it sees that ep->stopped_trb is not a part of the TD it's trying to cancel. It thinks the hardware has its enqueue pointer somewhere further up in the ring, and thinks it's safe to turn the control TRBs into no-op TRBs. Since the hardware was in the middle of the control TRBs to be cancelled, the proper software behavior is to issue a Set TR dequeue pointer command.
It turns out that the NEC host controllers can handle active TRBs being set to no-op TRBs after a stop endpoint command, but other host controllers have issues with this out-of-spec software behavior. Fix this behavior.
This patch should be backported to kernels as far back as 2.6.31, but it may be a bit challenging, since process_ctrl_td() was introduced in some refactoring done in 2.6.36, and some endian-safe patches added in 2.6.40 that touch the same lines.
--- drivers/usb/host/xhci-ring.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/usb/host/xhci-ring.c +9 -9
@@ -1632,6 +1632,9 @@ static int process_ctrl_td(struct xhci_helse *status =0 ;break ; +case COMP_STOP_INVAL : +case COMP_STOP : +return finish_td (xhci, td, event_trb, event, ep, status, false);default :if (!xhci_requires_manual_halt_cleanup (xhci, ep_ctx, trb_comp_code))
@@ -1676,15 +1679,12 @@ static int process_ctrl_td(struct xhci_h } }else {/* Maybe the event was for the data stage? */ -if (trb_comp_code !=COMP_STOP_INVAL ) { -/* We didn't stop on a link TRB in the middle */ - td->urb->actual_length = - td->urb->transfer_buffer_length - -TRB_LEN (event->transfer_len); -xhci_dbg (xhci,"Waiting for status " -"stage event\n" ); -return 0 ; - } + td->urb->actual_length = + td->urb->transfer_buffer_length - +TRB_LEN (le32_to_cpu (event->transfer_len)); +xhci_dbg (xhci,"Waiting for status " +"stage event\n" ); +return 0 ; } }
PATCH 115/165 usb/gadget: at91sam9g20 fix end point max packet size
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 800
Lines: 26
From: Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
commit bf1f0a05d472e33dda8e5e69525be1584cdbd03a upstream.
on 9g20 they are the same as the 9260
--- drivers/usb/gadget/at91_udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/at91_udc.c +1 -1
@@ -1767,7 +1767,7 @@ static int __init at91udc_probe(struct p }/* newer chips have more FIFO memory than rm9200 */ -if (cpu_is_at91sam9260 ()) { +if (cpu_is_at91sam9260 () ||cpu_is_at91sam9g20 ()) { udc->ep[0 ].maxpacket =64 ; udc->ep[3 ].maxpacket =64 ; udc->ep[4 ].maxpacket =512 ;
PATCH 116/165 usb: gadget: rndis: dont test against req->length
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1073
Lines: 34
From: Felipe Balbi <[email protected]>
commit 472b91274a6c6857877b5caddb875dcb5ecdfcb8 upstream.
composite.c always sets req->length to zero and expects function driver's setup handlers to return the amount of bytes to be used on req->length. If we test against req->length w_length will always be greater than req->length thus making us always stall that particular SEND_ENCAPSULATED_COMMAND request.
Tested against a Windows XP SP3.
--- drivers/usb/gadget/f_rndis.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/usb/gadget/f_rndis.c +1 -2
@@ -420,8 +420,7 @@ rndis_setup(struct usb_function *f, cons*/ case ((USB_DIR_OUT |USB_TYPE_CLASS |USB_RECIP_INTERFACE ) <<8 ) |USB_CDC_SEND_ENCAPSULATED_COMMAND : -if (w_length > req->length || w_value - || w_index != rndis->ctrl_id) +if (w_value || w_index != rndis->ctrl_id) goto invalid;/* read the request; process it later */ value = w_length;
PATCH 117/165 xhci: Fix full speed bInterval encoding.
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 2520
Lines: 59
From: Sarah Sharp <[email protected]>
commit b513d44751bfb609a3c20463f764c8ce822d63e9 upstream.
Dmitry's patch
dfa49c4ad120a784ef1ff0717168aa79f55a483a USB: xhci - fix math in xhci_get_endpoint_interval()
introduced a bug. The USB 2.0 spec says that full speed isochronous endpoints' bInterval must be decoded as an exponent to a power of two (e.g. interval = 2^(bInterval - 1)). Full speed interrupt endpoints, on the other hand, don't use exponents, and the interval in frames is encoded straight into bInterval.
Dmitry's patch was supposed to fix up the full speed isochronous to parse bInterval as an exponent, but instead it changed the *interrupt* endpoint bInterval decoding. The isochronous endpoint encoding was the same.
This caused full speed devices with interrupt endpoints (including mice, hubs, and USB to ethernet devices) to fail under NEC 0.96 xHCI host controllers:
[ 100.909818] xhci_hcd 0000:06:00.0: add ep 0x83, slot id 1, new drop flags = 0x0, new add flags = 0x99, new slot info = 0x38100000 [ 100.909821] xhci_hcd 0000:06:00.0: xhci_check_bandwidth called for udev ffff88011f0ea000 ... [ 100.910187] xhci_hcd 0000:06:00.0: ERROR: unexpected command completion code 0x11. [ 100.910190] xhci_hcd 0000:06:00.0: xhci_reset_bandwidth called for udev ffff88011f0ea000
When the interrupt endpoint was added and a Configure Endpoint command was issued to the host, the host controller would return a very odd error message (0x11 means "Slot Not Enabled", which isn't true because the slot was enabled). Probably the host controller was getting very confused with the bad encoding.
--- drivers/usb/host/xhci-mem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/xhci-mem.c +2 -2
@@ -1046,12 +1046,12 @@ static unsigned int xhci_get_endpoint_inbreak ;case USB_SPEED_FULL : -if (usb_endpoint_xfer_int (&ep->desc)) { +if (usb_endpoint_xfer_isoc (&ep->desc)) { interval =xhci_parse_exponent_interval (udev, ep);break ; }/* -* Fall through for isochronous endpoint interval decoding +* Fall through for interrupt endpoint interval decoding * since it uses the same rules as low speed interrupt * endpoints. */
PATCH 118/165 xhci: Fix memory leak in ring cache deallocation.
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 2333
Lines: 60
From: Sarah Sharp <[email protected]>
commit 30f89ca021c3e584b61bc5a14eede89f74b2e826 upstream.
When an endpoint ring is freed, it is either cached in a per-device ring cache, or simply freed if the ring cache is full. If the ring was added to the cache, then virt_dev->num_rings_cached is incremented. The cache is designed to hold up to 31 endpoint rings, in array indexes 0 to 30. When the device is freed (when the slot was disabled), xhci_free_virt_device() is called, it would free the cached rings in array indexes 0 to virt_dev->num_rings_cached.
Unfortunately, the original code in xhci_free_or_cache_endpoint_ring() would put the first entry into the ring cache in array index 1, instead of array index 0. This was caused by the second assignment to rings_cached:
rings_cached = virt_dev->num_rings_cached;
if (rings_cached < XHCI_MAX_RINGS_CACHED) {
virt_dev->num_rings_cached++;
rings_cached = virt_dev->num_rings_cached;
virt_dev->ring_cache[rings_cached] =
virt_dev->eps[ep_index].ring;This meant that when the device was freed, cached rings with indexes 0 to N would be freed, and the last cached ring in index N+1 would not be freed. When the driver was unloaded, this caused interesting messages like:
xhci_hcd 0000:06:00.0: dma_pool_destroy xHCI ring segments, ffff880063040000 busy
This should be queued to stable kernels back to 2.6.33.
--- drivers/usb/host/xhci-mem.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/usb/host/xhci-mem.c +3 -4
@@ -207,14 +207,13 @@ void xhci_free_or_cache_endpoint_ring(st rings_cached = virt_dev->num_rings_cached;if (rings_cached <XHCI_MAX_RINGS_CACHED ) { - virt_dev->num_rings_cached++; - rings_cached = virt_dev->num_rings_cached; virt_dev->ring_cache[rings_cached] = virt_dev->eps[ep_index].ring; + virt_dev->num_rings_cached++;xhci_dbg (xhci,"Cached old ring, " "%d ring%s cached\n" , - rings_cached, - (rings_cached >1 ) ?"s" :"" ); + virt_dev->num_rings_cached, + (virt_dev->num_rings_cached >1 ) ?"s" :"" ); }else {xhci_ring_free (xhci, virt_dev->eps[ep_index].ring); xhci_dbg(xhci, "Ring cache full (%d rings), "
PATCH 119/165 xhci: Fix memory leak bug when dropping endpoints
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 2695
Lines: 61
From: Sarah Sharp <[email protected]>
commit 834cb0fc4712a3b21c6b8c5cb55bd13607191311 upstream.
When the USB core wants to change to an alternate interface setting that doesn't include an active endpoint, or de-configuring the device, the xHCI driver needs to issue a Configure Endpoint command to tell the host to drop some endpoints from the schedule. After the command completes, the xHCI driver needs to free rings for any endpoints that were dropped.
Unfortunately, the xHCI driver wasn't actually freeing the endpoint rings for dropped endpoints. The rings would be freed if the endpoint's information was simply changed (and a new ring was installed), but dropped endpoints never had their rings freed. This caused errors when the ring segment DMA pool was freed when the xHCI driver was unloaded:
[ 5582.883995] xhci_hcd 0000:06:00.0: dma_pool_destroy xHCI ring segments, ffff88003371d000 busy [ 5582.884002] xhci_hcd 0000:06:00.0: dma_pool_destroy xHCI ring segments, ffff880033716000 busy [ 5582.884011] xhci_hcd 0000:06:00.0: dma_pool_destroy xHCI ring segments, ffff880033455000 busy [ 5582.884018] xhci_hcd 0000:06:00.0: Freed segment pool [ 5582.884026] xhci_hcd 0000:06:00.0: Freed device context pool [ 5582.884033] xhci_hcd 0000:06:00.0: Freed small stream array pool [ 5582.884038] xhci_hcd 0000:06:00.0: Freed medium stream array pool [ 5582.884048] xhci_hcd 0000:06:00.0: xhci_stop completed - status = 1 [ 5582.884061] xhci_hcd 0000:06:00.0: USB bus 3 deregistered [ 5582.884193] xhci_hcd 0000:06:00.0: PCI INT A disabled
Fix this issue and free endpoint rings when their endpoints are successfully dropped.
This patch should be backported to kernels as old as 2.6.31.
--- drivers/usb/host/xhci.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/usb/host/xhci.c +10 -1
@@ -1692,8 +1692,17 @@ int xhci_check_bandwidth(struct usb_hcdxhci_dbg_ctx (xhci, virt_dev->out_ctx,LAST_CTX_TO_EP_NUM (slot_ctx->dev_info)); +/* Free any rings that were dropped, but not changed. */ +for (i =1 ; i <31 ; ++i) { +if ((ctrl_ctx->drop_flags & (1 << (i +1 ))) && + !(ctrl_ctx->add_flags & (1 << (i +1 )))) +xhci_free_or_cache_endpoint_ring (xhci, virt_dev, i); + }xhci_zero_in_ctx (xhci, virt_dev); -/* Install new rings and free or cache any old rings */ +/* +* Install any rings for completely new endpoints or changed endpoints, +* and free or cache any old rings from changed endpoints. +*/ for (i =1 ; i <31 ; ++i) {if (!virt_dev->eps[i].new_ring)continue ;
PATCH 120/165 USB: option: add support for Huawei E353 device
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1826
Lines: 39
From: =?UTF-8?q?Marcin=20Ga=C5=82czy=C5=84ski?= <[email protected]>
commit 610ba42f29c3dfa46a05ff8c2cadc29f544ff76d upstream.
I am sharing patch to the devices/usb/serial/option.c. This allows operation of Huawei E353 broadband modem using the “option” driver. The patch simply adds new constant with proper product ID and an entry to usb_device_id. I worked on the 2.6.38.6 sources. Tested on Dell inspiron 1764 (i3 core cpu) and brand new Huawei E353 modem, Fedora 15 beta.
Looking at the type of change, i doubt it has potential to introduce problems in other parts of kernel or the driver itself.
--- drivers/usb/serial/option.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/serial/option.c +2 -0
@@ -149,6 +149,7 @@ static void option_instat_callback(struc#define HUAWEI_PRODUCT_K3765 0x1465#define HUAWEI_PRODUCT_E14AC 0x14AC#define HUAWEI_PRODUCT_ETS1220 0x1803 +#define HUAWEI_PRODUCT_E353 0x1506#define QUANTA_VENDOR_ID 0x0408#define QUANTA_PRODUCT_Q101 0xEA02
@@ -532,6 +533,7 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_ETS1220, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E14AC, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x01) }, { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V740) },
PATCH 121/165 OHCI: fix regression caused by nVidia shutdown workaround
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 2476
Lines: 64
From: Alan Stern <[email protected]>
commit 2b7aaf503d56216b847c8265421d2a7d9b42df3e upstream.
This patch (as1463) fixes a regression caused by commit 3df7169e73fc1d71a39cffeacc969f6840cdf52b (OHCI: work around for nVidia shutdown problem).
The original problem encountered by people using NVIDIA chipsets was that USB devices were not turning off when the system shut down. For example, the LED on an optical mouse would remain on, draining a laptop's battery. The problem was caused by a bug in the chipset; an OHCI controller in the Reset state would continue to drive a bus reset signal even after system shutdown. The workaround was to put the controllers into the Suspend state instead.
It turns out that later NVIDIA chipsets do not suffer from this bug. Instead some have the opposite bug: If a system is shut down while an OHCI controller is in the Suspend state, USB devices remain powered! On other systems, shutting down with a Suspended controller causes the system to reboot immediately. Thus, working around the original bug on some machines exposes other bugs on other machines.
The best solution seems to be to limit the workaround to OHCI controllers with a low-numbered PCI product ID. I don't know exactly at what point NVIDIA changed their chipsets; the value used here is a guess. So far it was worked out okay for all the people who have tested it.
This fixes Bugzilla #35032.
--- drivers/usb/host/ohci-pci.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/usb/host/ohci-pci.c +10 -2
@@ -181,10 +181,18 @@ static int ohci_quirk_amd700(struct usb_*/ static int ohci_quirk_nvidia_shutdown (struct usb_hcd *hcd) { +struct pci_dev *pdev =to_pci_dev (hcd->self.controller);struct ohci_hcd *ohci =hcd_to_ohci (hcd); - ohci->flags |=OHCI_QUIRK_SHUTDOWN ; -ohci_dbg (ohci,"enabled nVidia shutdown quirk\n" ); +/* Evidently nVidia fixed their later hardware; this is a guess at +* the changeover point. +*/ +#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_USB 0x026d + +if (pdev->device <PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_USB ) { + ohci->flags |=OHCI_QUIRK_SHUTDOWN ; +ohci_dbg (ohci,"enabled nVidia shutdown quirk\n" ); + }return 0 ; }
PATCH 122/165 USB: remove remaining usages of hcd->state from usbcore and
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
fix regression
Content-Length: 6211
Lines: 187
From: Alan Stern <[email protected]>
commit 69fff59de4d844f8b4c2454c3c23d32b69dcbfd7 upstream.
This patch (as1467) removes the last usages of hcd->state from usbcore. We no longer check to see if an interrupt handler finds that a controller has died; instead we rely on host controller drivers to make an explicit call to usb_hc_died().
This fixes a regression introduced by commit 9b37596a2e860404503a3f2a6513db60c296bfdc (USB: move usbcore away from hcd->state). It used to be that when a controller shared an IRQ with another device and an interrupt arrived while hcd->state was set to HC_STATE_HALT, the interrupt handler would be skipped. The commit removed that test; as a result the current code doesn't skip calling the handler and ends up believing the controller has died, even though it's only temporarily stopped. The solution is to ignore HC_STATE_HALT following the handler's return.
As a consequence of this change, several of the host controller drivers need to be modified. They can no longer implicitly rely on usbcore realizing that a controller has died because of hcd->state. The patch adds calls to usb_hc_died() in the appropriate places.
The patch also changes a few of the interrupt handlers. They don't expect to be called when hcd->state is equal to HC_STATE_HALT, even if the controller is still alive. Early returns were added to avoid any confusion.
--- drivers/usb/core/hcd.c | 5 +---- drivers/usb/host/ehci-hcd.c | 4 +++- drivers/usb/host/ehci-sched.c | 8 ++++++-- drivers/usb/host/isp116x-hcd.c | 1 + drivers/usb/host/ohci-hcd.c | 4 +++- drivers/usb/host/oxu210hp-hcd.c | 6 +++++- 6 files changed, 19 insertions(+), 9 deletions(-)
drivers/usb/core/hcd.c +1 -4
@@ -986,7 +986,7 @@ static int register_root_hub(struct usb_spin_unlock_irq (&hcd_root_hub_lock);/* Did the HC die before the root hub was registered? */ -if (HCD_DEAD (hcd) || hcd->state ==HC_STATE_HALT ) +if (HCD_DEAD (hcd))usb_hc_died (hcd);/* This time clean up */ }
@@ -2128,9 +2128,6 @@ irqreturn_t usb_hcd_irq (int irq, void *set_bit (HCD_FLAG_SAW_IRQ , &hcd->flags);if (hcd->shared_hcd)set_bit (HCD_FLAG_SAW_IRQ , &hcd->shared_hcd->flags); - -if (unlikely (hcd->state ==HC_STATE_HALT )) -usb_hc_died (hcd); rc =IRQ_HANDLED ; }
drivers/usb/host/ehci-hcd.c +3 -1
@@ -777,8 +777,9 @@ static irqreturn_t ehci_irq (struct usb_ goto dead; } +/* Shared IRQ? */ masked_status = status &INTR_MASK ; -if (!masked_status) {/* irq sharing? */ +if (!masked_status ||unlikely (hcd->state ==HC_STATE_HALT )) {spin_unlock (&ehci->lock);return IRQ_NONE ; }
@@ -873,6 +874,7 @@ static irqreturn_t ehci_irq (struct usb_ dead:ehci_reset (ehci);ehci_writel (ehci,0 , &ehci->regs->configured_flag); +usb_hc_died (hcd);/* generic layer kills/unlinks all urbs, then * uses ehci_stop to clean up the rest */
drivers/usb/host/ehci-sched.c +6 -2
@@ -471,8 +471,10 @@ static int enable_periodic (struct ehci_*/ status =handshake_on_error_set_halt (ehci, &ehci->regs->status,STS_PSS ,0 ,9 *125 ); -if (status) +if (status) { +usb_hc_died (ehci_to_hcd (ehci));return status; + } cmd =ehci_readl (ehci, &ehci->regs->command) |CMD_PSE ;ehci_writel (ehci, cmd, &ehci->regs->command);
@@ -510,8 +512,10 @@ static int disable_periodic (struct ehci*/ status =handshake_on_error_set_halt (ehci, &ehci->regs->status,STS_PSS ,STS_PSS ,9 *125 ); -if (status) +if (status) { +usb_hc_died (ehci_to_hcd (ehci));return status; + } cmd =ehci_readl (ehci, &ehci->regs->command) & ~CMD_PSE ;ehci_writel (ehci, cmd, &ehci->regs->command);
drivers/usb/host/isp116x-hcd.c +1 -0
@@ -612,6 +612,7 @@ static irqreturn_t isp116x_irq(struct us/* IRQ's are off, we do no DMA, perfectly ready to die ... */ hcd->state =HC_STATE_HALT ; +usb_hc_died (hcd); ret =IRQ_HANDLED ; goto done; }
drivers/usb/host/ohci-hcd.c +3 -1
@@ -764,6 +764,7 @@ static irqreturn_t ohci_irq (struct usb_if (ints == ~(u32 )0 ) {disable (ohci);ohci_dbg (ohci,"device removed!\n" ); +usb_hc_died (hcd);return IRQ_HANDLED ; }
@@ -771,7 +772,7 @@ static irqreturn_t ohci_irq (struct usb_ ints &=ohci_readl (ohci, ®s->intrenable);/* interrupt for some other device? */ -if (ints ==0 ) +if (ints ==0 ||unlikely (hcd->state ==HC_STATE_HALT ))return IRQ_NOTMINE ;if (ints &OHCI_INTR_UE ) {
@@ -788,6 +789,7 @@ static irqreturn_t ohci_irq (struct usb_ }else {disable (ohci);ohci_err (ohci,"OHCI Unrecoverable Error, disabled\n" ); +usb_hc_died (hcd); }ohci_dump (ohci,1 );
drivers/usb/host/oxu210hp-hcd.c +5 -1
@@ -1884,6 +1884,7 @@ static int enable_periodic(struct oxu_hc status =handshake (oxu, &oxu->regs->status,STS_PSS ,0 ,9 *125 );if (status !=0 ) {oxu_to_hcd (oxu)->state =HC_STATE_HALT ; +usb_hc_died (oxu_to_hcd (oxu));return status; }
@@ -1909,6 +1910,7 @@ static int disable_periodic(struct oxu_h status =handshake (oxu, &oxu->regs->status,STS_PSS ,STS_PSS ,9 *125 );if (status !=0 ) {oxu_to_hcd (oxu)->state =HC_STATE_HALT ; +usb_hc_died (oxu_to_hcd (oxu));return status; }
@@ -2449,8 +2451,9 @@ static irqreturn_t oxu210_hcd_irq(struct goto dead; } +/* Shared IRQ? */ status &=INTR_MASK ; -if (!status) {/* irq sharing? */ +if (!status ||unlikely (hcd->state ==HC_STATE_HALT )) {spin_unlock (&oxu->lock);return IRQ_NONE ; }
@@ -2516,6 +2519,7 @@ static irqreturn_t oxu210_hcd_irq(struct dead:ehci_reset (oxu);writel (0 , &oxu->regs->configured_flag); +usb_hc_died (hcd);/* generic layer kills/unlinks all urbs, then * uses oxu_stop to clean up the rest */
PATCH 123/165 DiBxxxx: get rid of DMA buffer on stack
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 37816
Lines: 1184
From: Olivier Grenie <[email protected]>
commit 5a0deeed5741117ee8625d6305d0034e219f102c upstream.
This patch removes the remaining on-stack buffer for USB DMA transfer. This patch also reduces the stack memory usage.
--- drivers/media/dvb/frontends/dib0070.c | 40 ++++-- drivers/media/dvb/frontends/dib0090.c | 71 ++++++++--- drivers/media/dvb/frontends/dib7000m.c | 47 ++++--- drivers/media/dvb/frontends/dib7000p.c | 72 ++++++++--- drivers/media/dvb/frontends/dib8000.c | 126 ++++++++++++++----- drivers/media/dvb/frontends/dib9000.c | 172 +++++++++++++++++---------- drivers/media/dvb/frontends/dibx000_common.c | 113 ++++++++++------- drivers/media/dvb/frontends/dibx000_common.h | 5 8 files changed, 444 insertions(+), 202 deletions(-)
drivers/media/dvb/frontends/dib0070.c +30 -10
@@ -73,27 +73,47 @@ struct dib0070_state {u8 wbd_gain_current;u16 wbd_offset_3_3[2 ]; + +/* for the I2C transfer */ +struct i2c_msg msg[2 ]; +u8 i2c_write_buffer[3 ]; +u8 i2c_read_buffer[2 ]; };static uint16_t dib0070_read_reg (struct dib0070_state *state,u8 reg) { -u8 b[2 ]; -struct i2c_msg msg[2 ] = { - { .addr = state->cfg->i2c_address, .flags =0 , .buf = ®, .len =1 }, - { .addr = state->cfg->i2c_address, .flags =I2C_M_RD , .buf = b, .len =2 }, - }; -if (i2c_transfer (state->i2c, msg,2 ) !=2 ) { + state->i2c_write_buffer[0 ] = reg; + +memset (state->msg,0 ,2 *sizeof (struct i2c_msg )); + state->msg[0 ].addr = state->cfg->i2c_address; + state->msg[0 ].flags =0 ; + state->msg[0 ].buf = state->i2c_write_buffer; + state->msg[0 ].len =1 ; + state->msg[1 ].addr = state->cfg->i2c_address; + state->msg[1 ].flags =I2C_M_RD ; + state->msg[1 ].buf = state->i2c_read_buffer; + state->msg[1 ].len =2 ; + +if (i2c_transfer (state->i2c, state->msg,2 ) !=2 ) {printk (KERN_WARNING "DiB0070 I2C read failed\n" );return 0 ; } -return (b[0 ] <<8 ) | b[1 ]; +return (state->i2c_read_buffer[0 ] <<8 ) | state->i2c_read_buffer[1 ]; }static int dib0070_write_reg (struct dib0070_state *state,u8 reg,u16 val) { -u8 b[3 ] = { reg, val >>8 , val &0xff }; -struct i2c_msg msg = { .addr = state->cfg->i2c_address, .flags =0 , .buf = b, .len =3 }; -if (i2c_transfer (state->i2c, &msg,1 ) !=1 ) { + state->i2c_write_buffer[0 ] = reg; + state->i2c_write_buffer[1 ] = val >>8 ; + state->i2c_write_buffer[2 ] = val &0xff ; + +memset (state->msg,0 ,sizeof (struct i2c_msg )); + state->msg[0 ].addr = state->cfg->i2c_address; + state->msg[0 ].flags =0 ; + state->msg[0 ].buf = state->i2c_write_buffer; + state->msg[0 ].len =3 ; + +if (i2c_transfer (state->i2c, state->msg,1 ) !=1 ) {printk (KERN_WARNING "DiB0070 I2C write failed\n" );return -EREMOTEIO ; }
drivers/media/dvb/frontends/dib0090.c +54 -17
107 lines not on this page · raw message
drivers/media/dvb/frontends/dib7000m.c +31 -16
66 lines not on this page · raw message
drivers/media/dvb/frontends/dib7000p.c +52 -20
105 lines not on this page · raw message
drivers/media/dvb/frontends/dib8000.c +94 -32
207 lines not on this page · raw message
drivers/media/dvb/frontends/dib9000.c +111 -61
393 lines not on this page · raw message
drivers/media/dvb/frontends/dibx000_common.c +67 -46
149 lines not on this page · raw message
drivers/media/dvb/frontends/dibx000_common.h +5 -0
@@ -28,6 +28,11 @@ struct dibx000_i2c_master {u8 i2c_addr;u16 base_reg; + +/* for the I2C transfer */ +struct i2c_msg msg[34 ]; +u8 i2c_write_buffer[8 ]; +u8 i2c_read_buffer[2 ]; }; extern int dibx000_init_i2c_master(struct dibx000_i2c_master *mst,
PATCH 124/165 cx88: protect per-device driver list with device
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
lock
Content-Length: 5085
Lines: 156
From: Jonathan Nieder <[email protected]>
commit 8a317a8760cfffa8185b56ff59fb4b6c58488d79 upstream.
The BKL conversion of this driver seems to have gone wrong. Various uses of the sub-device and driver lists appear to be subject to race conditions.
In particular, some functions access drvlist without a relevant lock held, which will race against removal of drivers. Let's start with that --- clean up by consistently protecting dev->drvlist with dev->core->lock, noting driver functions that require the device lock to be held or not to be held.
After this patch, there are still some races --- e.g., cx8802_blackbird_remove can run between the time the blackbird driver is acquired and the time it is used in mpeg_release, and there's a similar race in cx88_dvb_bus_ctrl. Later patches will address the remaining known races and the deadlock noticed by Andi. This patch just makes the semantics clearer in preparation for those later changes.
Based on work by Ben Hutchings <[email protected]>.
--- drivers/media/video/cx88/cx88-blackbird.c | 3 ++- drivers/media/video/cx88/cx88-dvb.c | 3 +++ drivers/media/video/cx88/cx88-mpeg.c | 11 +++++++---- drivers/media/video/cx88/cx88.h | 9 ++++++++- 4 files changed, 20 insertions(+), 6 deletions(-)
drivers/media/video/cx88/cx88-blackbird.c +2 -1
@@ -1122,10 +1122,11 @@ static int mpeg_release(struct file *filmutex_lock (&dev->core->lock); file->private_data =NULL ;kfree (fh); -mutex_unlock (&dev->core->lock);/* Make sure we release the hardware */ drv =cx8802_get_driver (dev,CX88_MPEG_BLACKBIRD ); +mutex_unlock (&dev->core->lock); +if (drv) drv->request_release (drv);
drivers/media/video/cx88/cx88-dvb.c +3 -0
@@ -133,7 +133,10 @@ static int cx88_dvb_bus_ctrl(struct dvb_return -EINVAL ; } +mutex_lock (&dev->core->lock); drv =cx8802_get_driver (dev,CX88_MPEG_DVB ); +mutex_unlock (&dev->core->lock); +if (drv) {if (acquire){ dev->frontends.active_fe_id = fe_id;
drivers/media/video/cx88/cx88-mpeg.c +7 -4
@@ -748,6 +748,8 @@ int cx8802_unregister_driver(struct cx88 dev->pci->subsystem_device, dev->core->board.name, dev->core->boardnr); +mutex_lock (&dev->core->lock); +list_for_each_entry_safe (d, dtmp, &dev->drvlist, drvlist) {/* only unregister the correct driver type */ if (d->type_id != drv->type_id)
@@ -755,15 +757,14 @@ int cx8802_unregister_driver(struct cx88 err = d->remove (d);if (err ==0 ) { -mutex_lock (&drv->core->lock);list_del (&d->drvlist); -mutex_unlock (&drv->core->lock);kfree (d); }else printk (KERN_ERR "%s/2: cx8802 driver remove " "failed (%d)\n" , dev->core->name, err); } +mutex_unlock (&dev->core->lock); }return err;
@@ -827,6 +828,8 @@ static void __devexit cx8802_remove(struflush_request_modules (dev); +mutex_lock (&dev->core->lock); +if (!list_empty (&dev->drvlist)) {struct cx8802_driver *drv, *tmp;int err;
@@ -838,9 +841,7 @@ static void __devexit cx8802_remove(strulist_for_each_entry_safe (drv, tmp, &dev->drvlist, drvlist) { err = drv->remove (drv);if (err ==0 ) { -mutex_lock (&drv->core->lock);list_del (&drv->drvlist); -mutex_unlock (&drv->core->lock); }else printk (KERN_ERR "%s/2: cx8802 driver remove " "failed (%d)\n" , dev->core->name, err);
@@ -848,6 +849,8 @@ static void __devexit cx8802_remove(stru } } +mutex_unlock (&dev->core->lock); +/* Destroy any 8802 reference. */ dev->core->dvbdev =NULL ;
drivers/media/video/cx88/cx88.h +8 -1
@@ -506,7 +506,11 @@ struct cx8802_driver {int (*resume)(struct pci_dev *pci_dev);/* MPEG 8802 -> mini driver - Driver probe and configuration */ + +/* Caller must _not_ hold core->lock */ int (*probe)(struct cx8802_driver *drv); + +/* Caller must hold core->lock */ int (*remove)(struct cx8802_driver *drv);/* MPEG 8802 -> mini driver - Access for hardware control */
@@ -561,8 +565,9 @@ struct cx8802_dev {/* for switching modulation types */ unsigned char ts_gen_cntrl; -/* List of attached drivers */ +/* List of attached drivers; must hold core->lock to access */ struct list_head drvlist; +struct work_struct request_module_wk; };
@@ -685,6 +690,8 @@ int cx88_audio_thread(void *data);int cx8802_register_driver (struct cx8802_driver *drv);int cx8802_unregister_driver (struct cx8802_driver *drv); + +/* Caller must hold core->lock */ struct cx8802_driver *cx8802_get_driver (struct cx8802_dev *dev,enum cx88_board_type btype);/* ----------------------------------------------------------- */
PATCH 125/165 cx88: fix locking of sub-driver operations
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 3436
Lines: 112
From: Jonathan Nieder <[email protected]>
commit 1fe70e963028f34ba5e32488a7870ff4b410b19b upstream.
The BKL conversion of this driver seems to have gone wrong. Loading the cx88-blackbird driver deadlocks.
The cause: mpeg_ops::open in the cx2388x blackbird driver acquires the device lock and calls the sub-driver's request_acquire, which tries to acquire the lock again. Fix it by clarifying the semantics of request_acquire, request_release, advise_acquire, and advise_release:
now all will rely on the caller to acquire the device lock.
Based on work by Ben Hutchings <[email protected]>.
--- drivers/media/video/cx88/cx88-blackbird.c | 4 ++-- drivers/media/video/cx88/cx88-dvb.c | 3 +-- drivers/media/video/cx88/cx88-mpeg.c | 4 ---- drivers/media/video/cx88/cx88.h | 3 ++- 4 files changed, 5 insertions(+), 9 deletions(-)
drivers/media/video/cx88/cx88-blackbird.c +2 -2
@@ -1125,13 +1125,13 @@ static int mpeg_release(struct file *fil/* Make sure we release the hardware */ drv =cx8802_get_driver (dev,CX88_MPEG_BLACKBIRD ); -mutex_unlock (&dev->core->lock); -if (drv) drv->request_release (drv);atomic_dec (&dev->core->mpeg_users); +mutex_unlock (&dev->core->lock); +return 0 ; }
drivers/media/video/cx88/cx88-dvb.c +1 -2
@@ -135,8 +135,6 @@ static int cx88_dvb_bus_ctrl(struct dvb_mutex_lock (&dev->core->lock); drv =cx8802_get_driver (dev,CX88_MPEG_DVB ); -mutex_unlock (&dev->core->lock); -if (drv) {if (acquire){ dev->frontends.active_fe_id = fe_id;
@@ -146,6 +144,7 @@ static int cx88_dvb_bus_ctrl(struct dvb_ dev->frontends.active_fe_id =0 ; } } +mutex_unlock (&dev->core->lock);return ret; }
drivers/media/video/cx88/cx88-mpeg.c +0 -4
@@ -624,13 +624,11 @@ static int cx8802_request_acquire(structif (drv->advise_acquire) { -mutex_lock (&drv->core->lock); core->active_ref++;if (core->active_type_id ==CX88_BOARD_NONE ) { core->active_type_id = drv->type_id; drv->advise_acquire (drv); } -mutex_unlock (&drv->core->lock);mpeg_dbg (1 ,"%s() Post acquire GPIO=%x\n" , __func__,cx_read (MO_GP0_IO )); }
@@ -643,14 +641,12 @@ static int cx8802_request_release(struct {struct cx88_core *core = drv->core; -mutex_lock (&drv->core->lock);if (drv->advise_release && --core->active_ref ==0 ) { drv->advise_release (drv); core->active_type_id =CX88_BOARD_NONE ;mpeg_dbg (1 ,"%s() Post release GPIO=%x\n" , __func__,cx_read (MO_GP0_IO )); } -mutex_unlock (&drv->core->lock);return 0 ; }
drivers/media/video/cx88/cx88.h +2 -1
@@ -510,7 +510,8 @@ struct cx8802_driver {/* Caller must _not_ hold core->lock */ int (*probe)(struct cx8802_driver *drv); -/* Caller must hold core->lock */ +/* Callers to the following functions must hold core->lock */ +int (*remove)(struct cx8802_driver *drv);/* MPEG 8802 -> mini driver - Access for hardware control */
PATCH 126/165 cx88: hold device lock during sub-driver
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
initialization
Content-Length: 2838
Lines: 83
From: Jonathan Nieder <[email protected]>
commit 1d6213ab995c61f7d1d81cf6cf876acf15d6e714 upstream.
cx8802_blackbird_probe makes a device node for the mpeg sub-device before it has been added to dev->drvlist. If the device is opened during that time, the open succeeds but request_acquire cannot be called, so the reference count remains zero. Later, when the device is closed, the reference count becomes negative --- uh oh.
Close the race by holding core->lock during probe and not releasing until the device is in drvlist and initialization finished. Previously the BKL prevented this race.
--- drivers/media/video/cx88/cx88-blackbird.c | 2 -- drivers/media/video/cx88/cx88-mpeg.c | 5 ++--- drivers/media/video/cx88/cx88.h | 7 ++----- 3 files changed, 4 insertions(+), 10 deletions(-)
drivers/media/video/cx88/cx88-blackbird.c +0 -2
@@ -1335,11 +1335,9 @@ static int cx8802_blackbird_probe(structblackbird_register_video (dev);/* initial device configuration: needed ? */ -mutex_lock (&dev->core->lock);// init_controls(core); cx88_set_tvnorm (core,core->tvnorm);cx88_video_mux (core,0 ); -mutex_unlock (&dev->core->lock);return 0 ;
drivers/media/video/cx88/cx88-mpeg.c +2 -3
@@ -709,18 +709,17 @@ int cx8802_register_driver(struct cx8802 drv->request_release = cx8802_request_release;memcpy (driver, drv,sizeof (*driver)); +mutex_lock (&drv->core->lock); err = drv->probe (driver);if (err ==0 ) { i++; -mutex_lock (&drv->core->lock);list_add_tail (&driver->drvlist, &dev->drvlist); -mutex_unlock (&drv->core->lock); }else {printk (KERN_ERR "%s/2: cx8802 probe failed, err = %d\n" , dev->core->name, err); } - +mutex_unlock (&drv->core->lock); }return i ?0 : -ENODEV ;
drivers/media/video/cx88/cx88.h +2 -5
@@ -505,13 +505,10 @@ struct cx8802_driver {int (*suspend)(struct pci_dev *pci_dev,pm_message_t state);int (*resume)(struct pci_dev *pci_dev); -/* MPEG 8802 -> mini driver - Driver probe and configuration */ - -/* Caller must _not_ hold core->lock */ -int (*probe)(struct cx8802_driver *drv); -/* Callers to the following functions must hold core->lock */ +/* MPEG 8802 -> mini driver - Driver probe and configuration */ +int (*probe)(struct cx8802_driver *drv);int (*remove)(struct cx8802_driver *drv);/* MPEG 8802 -> mini driver - Access for hardware control */
PATCH 127/165 sh: clkfwk: fixup clk_rate_table_build parameter in div6
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
clock
Content-Length: 851
Lines: 28
From: Kuninori Morimoto <[email protected]>
commit 52c10ad22b7e317960b4d411c9a9ddeaf3d5ae39 upstream.
div6 clock should not use arch_flags for clk_rate_table_build, because SH_CLK_DIV6_EXT doesn't care .arch_flags. clk->freq_table[] will be all CPUFREQ_ENTRY_INVALID without this patch.
--- drivers/sh/clk/cpg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/sh/clk/cpg.c +1 -1
@@ -105,7 +105,7 @@ static int sh_clk_div6_set_parent(struct/* Rebuild the frequency table */ clk_rate_table_build (clk, clk->freq_table, table->nr_divisors, - table, &clk->arch_flags); + table,NULL );return 0 ; }
PATCH 128/165 sh: fixup fpu.o compile order
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1222
Lines: 34
From: Kuninori Morimoto <[email protected]>
commit a375b15164dd9264f724ad941825e52c90145151 upstream.
arch_ptrace() was modified to reference init_fpu() to fix up xstate initialization, which overlooked the fact that there are configurations that don't enable any of hard FPU support or emulation, resulting in build errors on DSP parts.
Given that init_fpu() simply sets up the xstate slab cache and is side-stepped entirely for the DSP case, we can simply always build in the helper and fix up the references.
--- arch/sh/kernel/cpu/Makefile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/sh/kernel/cpu/Makefile +1 -3
@@ -17,7 +17,5 @@ obj-$(CONFIG_ARCH_SHMOBILE) += shmobile/ obj-$(CONFIG_SH_ADC) += adc.o obj-$(CONFIG_SH_CLK_CPG_LEGACY) += clock-cpg.o -obj-$(CONFIG_SH_FPU) += fpu.o -obj-$(CONFIG_SH_FPU_EMU) += fpu.o -obj-y += irq/ init.o clock.o hwblk.o proc.o +obj-y += irq/ init.o clock.o fpu.o hwblk.o proc.o
PATCH 129/165 mfd: Fix omap usbhs crash when rmmoding ehci or ohci
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 2024
Lines: 63
From: Keshava Munegowda <[email protected]>
commit 6eb6fbbf3eca6dfba73e72de5ab2eeb52ae41f7a upstream.
The disabling of clocks and freeing GPIO are changed to fix the occurrence of the crash of rmmod of ehci and ohci drivers. The GPIOs should be freed after the spin locks are unlocked.
--- drivers/mfd/omap-usb-host.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-)
drivers/mfd/omap-usb-host.c +19 -8
@@ -994,22 +994,33 @@ static void usbhs_disable(struct devicedev_dbg (dev,"operation timed out\n" ); } -if (pdata->ehci_data->phy_reset) { -if (gpio_is_valid (pdata->ehci_data->reset_gpio_port[0 ])) -gpio_free (pdata->ehci_data->reset_gpio_port[0 ]); - -if (gpio_is_valid (pdata->ehci_data->reset_gpio_port[1 ])) -gpio_free (pdata->ehci_data->reset_gpio_port[1 ]); +if (is_omap_usbhs_rev2 (omap)) { +if (is_ehci_tll_mode (pdata->port_mode[0 ])) +clk_enable (omap->usbtll_p1_fck); +if (is_ehci_tll_mode (pdata->port_mode[1 ])) +clk_enable (omap->usbtll_p2_fck); +clk_disable (omap->utmi_p2_fck); +clk_disable (omap->utmi_p1_fck); } -clk_disable (omap->utmi_p2_fck); -clk_disable (omap->utmi_p1_fck);clk_disable (omap->usbtll_ick);clk_disable (omap->usbtll_fck);clk_disable (omap->usbhost_fs_fck);clk_disable (omap->usbhost_hs_fck);clk_disable (omap->usbhost_ick); +/* The gpio_free migh sleep; so unlock the spinlock */ +spin_unlock_irqrestore (&omap->lock, flags); + +if (pdata->ehci_data->phy_reset) { +if (gpio_is_valid (pdata->ehci_data->reset_gpio_port[0 ])) +gpio_free (pdata->ehci_data->reset_gpio_port[0 ]); + +if (gpio_is_valid (pdata->ehci_data->reset_gpio_port[1 ])) +gpio_free (pdata->ehci_data->reset_gpio_port[1 ]); + } +return ; + end_disble:spin_unlock_irqrestore (&omap->lock, flags); }
PATCH 130/165 p54usb: add zoom 4410 usbid
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 991
Lines: 24
From: Christian Lamparter <[email protected]>
commit 9368a9a2378ab721f82f59430a135b4ce4ff5109 upstream.
--- drivers/net/wireless/p54/p54usb.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/p54/p54usb.c +1 -0
@@ -82,6 +82,7 @@ static struct usb_device_id p54u_table[] {USB_DEVICE(0x06b9, 0x0121)}, /* Thomson SpeedTouch 121g */ {USB_DEVICE(0x0707, 0xee13)}, /* SMC 2862W-G version 2 */ {USB_DEVICE(0x083a, 0x4521)}, /* Siemens Gigaset USB Adapter 54 version 2 */ + {USB_DEVICE(0x083a, 0xc501)}, /* Zoom Wireless-G 4410 */ {USB_DEVICE(0x083a, 0xf503)}, /* Accton FD7050E ver 1010ec */ {USB_DEVICE(0x0846, 0x4240)}, /* Netgear WG111 (v2) */ {USB_DEVICE(0x0915, 0x2000)}, /* Cohiba Proto board */
PATCH 131/165 eCryptfs: Clear i_nlink in rmdir
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 932
Lines: 29
From: Tyler Hicks <[email protected]>
commit 07850552b92b3637fa56767b5e460b4238014447 upstream.
eCryptfs wasn't clearing the eCryptfs inode's i_nlink after a successful vfs_rmdir() on the lower directory. This resulted in the inode evict and destroy paths to be missed.
https://bugs.launchpad.net/ecryptfs/+bug/723518
--- fs/ecryptfs/inode.c | 2 ++ 1 file changed, 2 insertions(+)
fs/ecryptfs/inode.c +2 -0
@@ -527,6 +527,8 @@ static int ecryptfs_rmdir(struct inode *dget (lower_dentry); rc =vfs_rmdir (lower_dir_dentry->d_inode, lower_dentry);dput (lower_dentry); +if (!rc && dentry->d_inode) +clear_nlink (dentry->d_inode);fsstack_copy_attr_times (dir, lower_dir_dentry->d_inode); dir->i_nlink = lower_dir_dentry->d_inode->i_nlink;unlock_dir (lower_dir_dentry);
PATCH 132/165 eCryptfs: Allow 2 scatterlist entries for encrypted
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
filenames
Content-Length: 5671
Lines: 138
From: Tyler Hicks <[email protected]>
commit 8d08dab786ad5cc2aca2bf870de370144b78c85a upstream.
The buffers allocated while encrypting and decrypting long filenames can sometimes straddle two pages. In this situation, virt_to_scatterlist() will return -ENOMEM, causing the operation to fail and the user will get scary error messages in their logs:
kernel: ecryptfs_write_tag_70_packet: Internal error whilst attempting to convert filename memory to scatterlist; expected rc = 1; got rc = [-12]. block_aligned_filename_size = [272]
kernel: ecryptfs_encrypt_filename: Error attempting to generate tag 70 packet; rc = [-12]
kernel: ecryptfs_encrypt_and_encode_filename: Error attempting to encrypt filename; rc = [-12]
kernel: ecryptfs_lookup: Error attempting to encrypt and encode filename; rc = [-12]
The solution is to allow up to 2 scatterlist entries to be used.
--- fs/ecryptfs/keystore.c | 46 +++++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 25 deletions(-)
fs/ecryptfs/keystore.c +21 -25
@@ -599,8 +599,8 @@ struct ecryptfs_write_tag_70_packet_sillstruct mutex *tfm_mutex;char *block_aligned_filename;struct ecryptfs_auth_tok *auth_tok; -struct scatterlist src_sg; -struct scatterlist dst_sg; +struct scatterlist src_sg[2 ]; +struct scatterlist dst_sg[2 ];struct blkcipher_desc desc;char iv[ECRYPTFS_MAX_IV_BYTES ];char hash[ECRYPTFS_TAG_70_DIGEST_SIZE ];
@@ -816,23 +816,21 @@ ecryptfs_write_tag_70_packet(char *dest,memcpy (&s->block_aligned_filename[s->num_rand_bytes], filename, filename_size); rc =virt_to_scatterlist (s->block_aligned_filename, - s->block_aligned_filename_size, &s->src_sg,1 ); -if (rc !=1 ) { + s->block_aligned_filename_size, s->src_sg,2 ); +if (rc <1 ) {printk (KERN_ERR "%s: Internal error whilst attempting to " -"convert filename memory to scatterlist; " -"expected rc = 1; got rc = [%d]. " +"convert filename memory to scatterlist; rc = [%d]. " "block_aligned_filename_size = [%zd]\n" , __func__, rc, s->block_aligned_filename_size); goto out_release_free_unlock; } rc =virt_to_scatterlist (&dest[s->i], s->block_aligned_filename_size, - &s->dst_sg,1 ); -if (rc !=1 ) { + s->dst_sg,2 ); +if (rc <1 ) {printk (KERN_ERR "%s: Internal error whilst attempting to " "convert encrypted filename memory to scatterlist; " -"expected rc = 1; got rc = [%d]. " -"block_aligned_filename_size = [%zd]\n" , __func__, rc, - s->block_aligned_filename_size); +"rc = [%d]. block_aligned_filename_size = [%zd]\n" , + __func__, rc, s->block_aligned_filename_size); goto out_release_free_unlock; }/* The characters in the first block effectively do the job
@@ -855,7 +853,7 @@ ecryptfs_write_tag_70_packet(char *dest, mount_crypt_stat->global_default_fn_cipher_key_bytes); goto out_release_free_unlock; } - rc =crypto_blkcipher_encrypt_iv (&s->desc, &s->dst_sg, &s->src_sg, + rc =crypto_blkcipher_encrypt_iv (&s->desc, s->dst_sg, s->src_sg, s->block_aligned_filename_size);if (rc) { printk(KERN_ERR "%s: Error attempting to encrypt filename; "
@@ -891,8 +889,8 @@ struct ecryptfs_parse_tag_70_packet_sillstruct mutex *tfm_mutex;char *decrypted_filename;struct ecryptfs_auth_tok *auth_tok; -struct scatterlist src_sg; -struct scatterlist dst_sg; +struct scatterlist src_sg[2 ]; +struct scatterlist dst_sg[2 ];struct blkcipher_desc desc;char fnek_sig_hex[ECRYPTFS_SIG_SIZE_HEX +1 ];char iv[ECRYPTFS_MAX_IV_BYTES ];
@@ -1008,13 +1006,12 @@ ecryptfs_parse_tag_70_packet(char **file }mutex_lock (s->tfm_mutex); rc =virt_to_scatterlist (&data[(*packet_size)], - s->block_aligned_filename_size, &s->src_sg,1 ); -if (rc !=1 ) { + s->block_aligned_filename_size, s->src_sg,2 ); +if (rc <1 ) {printk (KERN_ERR "%s: Internal error whilst attempting to " "convert encrypted filename memory to scatterlist; " -"expected rc = 1; got rc = [%d]. " -"block_aligned_filename_size = [%zd]\n" , __func__, rc, - s->block_aligned_filename_size); +"rc = [%d]. block_aligned_filename_size = [%zd]\n" , + __func__, rc, s->block_aligned_filename_size); goto out_unlock; } (*packet_size) += s->block_aligned_filename_size;
@@ -1028,13 +1025,12 @@ ecryptfs_parse_tag_70_packet(char **file goto out_unlock; } rc =virt_to_scatterlist (s->decrypted_filename, - s->block_aligned_filename_size, &s->dst_sg,1 ); -if (rc !=1 ) { + s->block_aligned_filename_size, s->dst_sg,2 ); +if (rc <1 ) {printk (KERN_ERR "%s: Internal error whilst attempting to " "convert decrypted filename memory to scatterlist; " -"expected rc = 1; got rc = [%d]. " -"block_aligned_filename_size = [%zd]\n" , __func__, rc, - s->block_aligned_filename_size); +"rc = [%d]. block_aligned_filename_size = [%zd]\n" , + __func__, rc, s->block_aligned_filename_size); goto out_free_unlock; }/* The characters in the first block effectively do the job of
@@ -1065,7 +1061,7 @@ ecryptfs_parse_tag_70_packet(char **file mount_crypt_stat->global_default_fn_cipher_key_bytes); goto out_free_unlock; } - rc =crypto_blkcipher_decrypt_iv (&s->desc, &s->dst_sg, &s->src_sg, + rc =crypto_blkcipher_decrypt_iv (&s->desc, s->dst_sg, s->src_sg, s->block_aligned_filename_size);if (rc) { printk(KERN_ERR "%s: Error attempting to decrypt filename; "
PATCH 133/165 UBIFS: fix a rare memory leak in ro to rw remounting path
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1247
Lines: 40
From: Artem Bityutskiy <[email protected]>
commit eaeee242c531cd4b0a4a46e8b5dd7ef504380c42 upstream.
When re-mounting from R/O mode to R/W mode and the LEB count in the superblock is not up-to date, because for the underlying UBI volume became larger, we re-write the superblock. We allocate RAM for these purposes, but never free it. So this is a memory leak, although very rare one.
--- fs/ubifs/sb.c | 3 ++- fs/ubifs/super.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
fs/ubifs/sb.c +2 -1
@@ -475,7 +475,8 @@ failed:* @c: UBIFS file-system description object * * This function returns a pointer to the superblock node or a negative error -* code. +* code. Note, the user of this function is responsible of kfree()'ing the +* returned superblock buffer. */ struct ubifs_sb_node *ubifs_read_sb_node (struct ubifs_info *c) {
fs/ubifs/super.c +1 -0
@@ -1584,6 +1584,7 @@ static int ubifs_remount_rw(struct ubifs } sup->leb_cnt =cpu_to_le32 (c->leb_cnt); err =ubifs_write_sb_node (c, sup); +kfree (sup);if (err) goto out; }
PATCH 134/165 kbuild: Fix GNU make v3.80 compatibility
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1190
Lines: 33
From: Kevin Cernekee <[email protected]>
commit 43f67c98161c65f1b2e3af3a9ce6741850072c06 upstream.
According to Documentation/Changes, the kernel should be buildable with GNU make 3.80+. Commit 88d7be031f9f975bb3f50a0b5ef3796a671e7edf (kbuild:
Use a single clean rule for kernel and external modules) introduced the "$(or" construct, which requires make 3.81. This causes "make clean" to malfunction when it is used with external modules.
Replace "$(or" with an equivalent "$(if" expression, to restore backward compatibility.
--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
@@ -1374,7 +1374,7 @@ endif # KBUILD_EXTMOD clean: $(clean-dirs) $(call cmd,rmdirs) $(call cmd,rmfiles) - @find $(or $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \ + @find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \ \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ -o -name '*.symtypes' -o -name 'modules.order' \
PATCH 135/165 Set cred->user_ns in key_replace_session_keyring
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1072
Lines: 31
From: "Serge E. Hallyn" <[email protected]>
commit f7285b5d631fd6096b11c6af0058ed3a2b30ef4e upstream.
Since this cred was not created with copy_creds(), it needs to get initialized. Otherwise use of syscall(__NR_keyctl, KEYCTL_SESSION_TO_PARENT); can lead to a NULL deref. Thanks to Robert for finding this.
But introduced by commit 47a150edc2a ("Cache user_ns in struct cred").
--- security/keys/process_keys.c | 1 + 1 file changed, 1 insertion(+)
security/keys/process_keys.c +1 -0
@@ -845,6 +845,7 @@ void key_replace_session_keyring(void) new-> sgid = old-> sgid; new->fsgid = old->fsgid; new->user =get_uid (old->user); + new->user_ns = new->user->user_ns; new->group_info =get_group_info (old->group_info); new->securebits = old->securebits;
PATCH 136/165 i8k: Avoid lahf in 64-bit code
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1060
Lines: 35
From: Luca Tettamanti <[email protected]>
commit bc1f419c76a2d6450413ce4349f4e4a07be011d5 upstream.
i8k uses lahf to read the flag register in 64-bit code; early x86-64 CPUs, however, lack this instruction and we get an invalid opcode exception at runtime.
Use pushf to load the flag register into the stack instead.
--- drivers/char/i8k.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/i8k.c +2 -2
@@ -139,8 +139,8 @@ static int i8k_smm(struct smm_regs *regs "movl %%edi,20(%%rax)\n\t" "popq %%rdx\n\t" "movl %%edx,0(%%rax)\n\t" - "lahf\n\t" - "shrl $8,%%eax\n\t" + "pushfq\n\t" + "popq %%rax\n\t" "andl $1,%%eax\n" :"=a"(rc) : "a"(regs)
PATCH 137/165 hwmon: (pmbus) Initialize sysfs attributes
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 931
Lines: 28
From: Guenter Roeck <[email protected]>
commit eec752b2b99c794766926a9bac59b0d7df5b09c2 upstream.
Initialize sysfs attrs before device_create_file() call to suppress lockdep_init_map() warning:
WARNING: at kernel/lockdep.c:2701 lockdep_init_map+0x12d/0x140()
--- drivers/hwmon/pmbus_core.c | 1 + 1 file changed, 1 insertion(+)
drivers/hwmon/pmbus_core.c +1 -0
@@ -700,6 +700,7 @@ do { \ struct sensor_device_attribute *a \ = &data->_type##s[data->num_##_type##s].attribute; \ BUG_ON(data->num_attributes >= data->max_attributes); \ + sysfs_attr_init(&a->dev_attr.attr); \ a->dev_attr.attr.name = _name; \ a->dev_attr.attr.mode = _mode; \ a->dev_attr.show = _show; \
PATCH 138/165 cpuidle: menu: fixed wrapping timers at 4.294 seconds
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1325
Lines: 40
From: Tero Kristo <[email protected]>
commit 7467571f4480b273007517b26297c07154c73924 upstream.
Cpuidle menu governor is using u32 as a temporary datatype for storing nanosecond values which wrap around at 4.294 seconds. This causes errors in predicted sleep times resulting in higher than should be C state selection and increased power consumption. This also breaks cpuidle state residency statistics.
--- drivers/cpuidle/governors/menu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/cpuidle/governors/menu.c +3 -1
@@ -237,6 +237,7 @@ static int menu_select(struct cpuidle_deunsigned int power_usage =-1 ;int i;int multiplier; +struct timespec t;if (data->needs_update) {menu_update (dev);
@@ -251,8 +252,9 @@ static int menu_select(struct cpuidle_dereturn 0 ;/* determine the expected residency time, round up */ + t =ktime_to_timespec (tick_nohz_get_sleep_length ()); data->expected_us = -DIV_ROUND_UP ((u32 )ktime_to_ns (tick_nohz_get_sleep_length ()),1000 ); + t.tv_sec *USEC_PER_SEC + t.tv_nsec /NSEC_PER_USEC ; data->bucket =which_bucket (data->expected_us);
PATCH 139/165 idle governor: Avoid lock acquisition to read pm_qos before
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
entering idle
Content-Length: 5404
Lines: 155
From: Tim Chen <[email protected]>
commit 333c5ae9948194428fe6c5ef5c088304fc98263b upstream.
Thanks to the reviews and comments by Rafael, James, Mark and Andi. Here's version 2 of the patch incorporating your comments and also some update to my previous patch comments.
I noticed that before entering idle state, the menu idle governor will look up the current pm_qos target value according to the list of qos requests received. This look up currently needs the acquisition of a lock to access the list of qos requests to find the qos target value, slowing down the entrance into idle state due to contention by multiple cpus to access this list. The contention is severe when there are a lot of cpus waking and going into idle. For example, for a simple workload that has 32 pair of processes ping ponging messages to each other, where 64 cpu cores are active in test system, I see the following profile with 37.82% of cpu cycles spent in contention of pm_qos_lock:
- 37.82% swapper [kernel.kallsyms] [k]_raw_spin_lock_irqsave
- _raw_spin_lock_irqsave
- 95.65% pm_qos_request
menu_select
cpuidle_idle_call
- cpu_idle
99.98% start_secondary
A better approach will be to cache the updated pm_qos target value so reading it does not require lock acquisition as in the patch below. With this patch the contention for pm_qos_lock is removed and I saw a 2.2X increase in throughput for my message passing workload.
--- include/linux/pm_qos_params.h | 4 ++++ kernel/pm_qos_params.c | 37 +++++++++++++++++++++++++------------ 2 files changed, 29 insertions(+), 12 deletions(-)
include/linux/pm_qos_params.h +4 -0
@@ -16,6 +16,10 @@#define PM_QOS_NUM_CLASSES 4#define PM_QOS_DEFAULT_VALUE -1 +#define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) +#define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) +#define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0 +struct pm_qos_request_list {struct plist_node list;int pm_qos_class;
kernel/pm_qos_params.c +25 -12
@@ -53,11 +53,17 @@ enum pm_qos_type { PM_QOS_MIN /* return the smallest value */ }; +/* +* Note: The lockless read path depends on the CPU accessing +* target_value atomically. Atomic access is only guaranteed on all CPU +* types linux supports for 32 bit quantites +*/ struct pm_qos_object {struct plist_head requests;struct blocking_notifier_head *notifiers;struct miscdevice pm_qos_power_miscdev;char *name; +s32 target_value;/* Do not change to 64 bit */ s32 default_value;enum pm_qos_type type; };
@@ -70,7 +76,8 @@ static struct pm_qos_object cpu_dma_pm_q .requests = PLIST_HEAD_INIT(cpu_dma_pm_qos.requests, pm_qos_lock), .notifiers = &cpu_dma_lat_notifier, .name = "cpu_dma_latency", - .default_value = 2000 * USEC_PER_SEC, + .target_value = PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE, + .default_value = PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE, .type = PM_QOS_MIN, };
@@ -79,7 +86,8 @@ static struct pm_qos_object network_lat_ .requests = PLIST_HEAD_INIT(network_lat_pm_qos.requests, pm_qos_lock), .notifiers = &network_lat_notifier, .name = "network_latency", - .default_value = 2000 * USEC_PER_SEC, + .target_value = PM_QOS_NETWORK_LAT_DEFAULT_VALUE, + .default_value = PM_QOS_NETWORK_LAT_DEFAULT_VALUE, .type = PM_QOS_MIN };
@@ -89,7 +97,8 @@ static struct pm_qos_object network_thro .requests = PLIST_HEAD_INIT(network_throughput_pm_qos.requests, pm_qos_lock), .notifiers = &network_throughput_notifier, .name = "network_throughput", - .default_value = 0, + .target_value = PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE, + .default_value = PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE, .type = PM_QOS_MAX, };
@@ -135,6 +144,16 @@ static inline int pm_qos_get_value(struc } } +static inline s32 pm_qos_read_value (struct pm_qos_object *o) +{ +return o->target_value; +} + +static inline void pm_qos_set_value (struct pm_qos_object *o,s32 value) +{ + o->target_value = value; +} +static void update_target (struct pm_qos_object *o,struct plist_node *node,int del,int value) {
@@ -159,6 +178,7 @@ static void update_target(struct pm_qos_plist_add (node, &o->requests); } curr_value =pm_qos_get_value (o); +pm_qos_set_value (o, curr_value);spin_unlock_irqrestore (&pm_qos_lock, flags);if (prev_value != curr_value)
@@ -193,18 +213,11 @@ static int find_pm_qos_object_by_minor(i* pm_qos_request - returns current system wide qos expectation * @pm_qos_class: identification of which qos value is requested * -* This function returns the current target value in an atomic manner. +* This function returns the current target value. */ int pm_qos_request (int pm_qos_class) { -unsigned long flags; -int value; - -spin_lock_irqsave (&pm_qos_lock, flags); - value =pm_qos_get_value (pm_qos_array[pm_qos_class]); -spin_unlock_irqrestore (&pm_qos_lock, flags); - -return value; +return pm_qos_read_value (pm_qos_array[pm_qos_class]); }EXPORT_SYMBOL_GPL (pm_qos_request);
PATCH 140/165 dm table: reject devices without request fns
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 2490
Lines: 74
From: Milan Broz <[email protected]>
commit f4808ca99a203f20b4475601748e44b25a65bdec upstream.
This patch adds a check that a block device has a request function defined before it is used. Otherwise, misconfiguration can cause an oops.
Because we are allowing devices with zero size e.g. an offline multipath device as in commit 2cd54d9bedb79a97f014e86c0da393416b264eb3 ("dm: allow offline devices") there needs to be an additional check to ensure devices are initialised. Some block devices, like a loop device without a backing file, exist but have no request function.
Reproducer is trivial: dm-mirror on unbound loop device (no backing file on loop devices)
dmsetup create x --table "0 8 mirror core 2 8 sync 2 /dev/loop0 0 /dev/loop1 0"
and mirror resync will immediatelly cause OOps.
BUG: unable to handle kernel NULL pointer dereference at (null) ? generic_make_request+0x2bd/0x590 ? kmem_cache_alloc+0xad/0x190 submit_bio+0x53/0xe0 ? bio_add_page+0x3b/0x50 dispatch_io+0x1ca/0x210 [dm_mod] ? read_callback+0x0/0xd0 [dm_mirror] dm_io+0xbb/0x290 [dm_mod] do_mirror+0x1e0/0x748 [dm_mirror]
--- drivers/md/dm-table.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/md/dm-table.c +17 -0
@@ -362,6 +362,7 @@ static void close_dev(struct dm_dev_intestatic int device_area_is_invalid (struct dm_target *ti,struct dm_dev *dev,sector_t start,sector_t len,void *data) { +struct request_queue *q;struct queue_limits *limits = data;struct block_device *bdev = dev->bdev; sector_t dev_size =
@@ -370,6 +371,22 @@ static int device_area_is_invalid(struct limits->logical_block_size >>SECTOR_SHIFT ;char b[BDEVNAME_SIZE ]; +/* +* Some devices exist without request functions, +* such as loop devices not yet bound to backing files. +* Forbid the use of such devices. +*/ + q =bdev_get_queue (bdev); +if (!q || !q->make_request_fn) { +DMWARN ("%s: %s is not yet initialised: " +"start=%llu, len=%llu, dev_size=%llu" , +dm_device_name (ti->table->md),bdevname (bdev, b), + (unsigned long long )start, + (unsigned long long )len, + (unsigned long long )dev_size); +return 1 ; + } +if (!dev_size)return 0 ;
PATCH 141/165 dm mpath: do not fail paths after integrity errors
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 899
Lines: 29
From: "Martin K. Petersen" <[email protected]>
commit 6f13f6fba76edc7d0e7580c5deee829d59a41b2f upstream.
Integrity errors need to be passed to the owner of the integrity metadata for processing. Consequently EILSEQ should be passed up the stack.
--- drivers/md/dm-mpath.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-mpath.c +1 -1
@@ -1290,7 +1290,7 @@ static int do_end_io(struct multipath *mif (!error && !clone->errors)return 0 ;/* I/O complete */ -if (error == -EOPNOTSUPP || error == -EREMOTEIO ) +if (error == -EOPNOTSUPP || error == -EREMOTEIO || error == -EILSEQ )return error;if (mpio->pgpath)
PATCH 142/165 ARM: 6941/1: cache: ensure MVA is cacheline aligned in
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
flush_kern_dcache_area
Content-Length: 1550
Lines: 47
From: Will Deacon <[email protected]>
commit a248b13b21ae00b97638b4f435c8df3075808b5d upstream.
The v6 and v7 implementations of flush_kern_dcache_area do not align the passed MVA to the size of a cacheline in the data cache. If a misaligned address is used, only a subset of the requested area will be flushed. This has been observed to cause failures in SMP boot where the secondary_data initialised by the primary CPU is not cacheline aligned, causing the secondary CPUs to read incorrect values for their pgd and stack pointers.
This patch ensures that the base address is cacheline aligned before flushing the d-cache.
--- arch/arm/mm/cache-v6.S | 1 + arch/arm/mm/cache-v7.S | 2 ++ 2 files changed, 3 insertions(+)
arch/arm/mm/cache-v6.S +1 -0
@@ -176,6 +176,7 @@ ENDPROC(v6_coherent_kern_range) */ ENTRY(v6_flush_kern_dcache_area) add r1, r0, r1 + bic r0, r0, #D_CACHE_LINE_SIZE - 1 1: #ifdef HARVARD_CACHE mcr p15, 0, r0, c7, c14, 1 @ clean & invalidate D line
arch/arm/mm/cache-v7.S +2 -0
@@ -221,6 +221,8 @@ ENDPROC(v7_coherent_user_range) ENTRY(v7_flush_kern_dcache_area) dcache_line_size r2, r3 add r1, r0, r1 + sub r3, r2, #1 + bic r0, r0, r3 1: mcr p15, 0, r0, c7, c14, 1 @ clean & invalidate D line / unified line add r0, r0, r2
PATCH 143/165 tmpfs: fix race between truncate and writepage
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1738
Lines: 46
From: Hugh Dickins <[email protected]>
commit 826267cf1e6c6899eda1325a19f1b1d15c558b20 upstream.
While running fsx on tmpfs with a memhog then swapoff, swapoff was hanging (interruptibly), repeatedly failing to locate the owner of a 0xff entry in the swap_map.
Although shmem_writepage() does abandon when it sees incoming page index is beyond eof, there was still a window in which shmem_truncate_range() could come in between writepage's dropping lock and updating swap_map, find the half-completed swap_map entry, and in trying to free it, leave it in a state that swap_shmem_alloc() could not correct.
Arguably a bug in __swap_duplicate()'s and swap_entry_free()'s handling of the different cases, but easiest to fix by moving swap_shmem_alloc() under cover of the lock.
More interesting than the bug: it's been there since 2.6.33, why could I not see it with earlier kernels? The mmotm of two weeks ago seems to have some magic for generating races, this is just one of three I found.
With yesterday's git I first saw this in mainline, bisected in search of that magic, but the easy reproducibility evaporated. Oh well, fix the bug.
--- mm/shmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/shmem.c +1 -1
@@ -1101,8 +1101,8 @@ static int shmem_writepage(struct page *delete_from_page_cache (page);shmem_swp_set (info, entry, swap.val);shmem_swp_unmap (entry); -spin_unlock (&info->lock);swap_shmem_alloc (swap); +spin_unlock (&info->lock);BUG_ON (page_mapped (page));swap_writepage (page, wbc);return 0 ;
PATCH 144/165 atm: expose ATM device index in sysfs
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1808
Lines: 53
From: Dan Williams <[email protected]>
commit e7a46b4d0839c2a3aa2e0ae0b145f293f6738498 upstream.
It's currently exposed only through /proc which, besides requiring screen-scraping, doesn't allow userspace to distinguish between two identical ATM adapters with different ATM indexes. The ATM device index is required when using PPPoATM on a system with multiple ATM adapters.
--- net/atm/atm_sysfs.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
net/atm/atm_sysfs.c +10 -0
@@ -59,6 +59,14 @@ static ssize_t show_atmaddress(struct dereturn pos - buf; } +static ssize_t show_atmindex (struct device *cdev, +struct device_attribute *attr,char *buf) +{ +struct atm_dev *adev =to_atm_dev (cdev); + +return sprintf (buf,"%d\n" , adev->number); +} +static ssize_t show_carrier (struct device *cdev,struct device_attribute *attr,char *buf) {
@@ -99,6 +107,7 @@ static ssize_t show_link_rate(struct dev static DEVICE_ATTR(address, S_IRUGO, show_address, NULL); static DEVICE_ATTR(atmaddress, S_IRUGO, show_atmaddress, NULL); +static DEVICE_ATTR(atmindex, S_IRUGO, show_atmindex, NULL); static DEVICE_ATTR(carrier, S_IRUGO, show_carrier, NULL); static DEVICE_ATTR(type, S_IRUGO, show_type, NULL); static DEVICE_ATTR(link_rate, S_IRUGO, show_link_rate, NULL);
@@ -106,6 +115,7 @@ static DEVICE_ATTR(link_rate, S_IRUGO, sstatic struct device_attribute *atm_attrs[] = { &dev_attr_atmaddress, &dev_attr_address, + &dev_attr_atmindex, &dev_attr_carrier, &dev_attr_type, &dev_attr_link_rate,
PATCH 145/165 brd: limit max_part module param to DISK_MAX_PARTS
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 3373
Lines: 81
From: Namhyung Kim <[email protected]>
commit 315980c8688c4b06713c1a5fe9d64cdf8ab57a72 upstream.
The 'max_part' parameter controls the number of maximum partition a brd device can have. However if a user specifies very large value it would exceed the limitation of device minor number and can cause a kernel panic (or, at least, produce invalid device nodes in some cases).
On my desktop system, following command kills the kernel. On qemu, it triggers similar oops but the kernel was alive:
$ sudo modprobe brd max_part=100000 BUG: unable to handle kernel NULL pointer dereference at 0000000000000058 IP: [<ffffffff81110a9a>] sysfs_create_dir+0x2d/0xae PGD 7af1067 PUD 7b19067 PMD 0 Oops: 0000 [#1] SMP last sysfs file: CPU 0 Modules linked in: brd(+)
Pid: 44, comm: insmod Tainted: G W 2.6.39-qemu+ #158 Bochs Bochs
RIP: 0010:[<ffffffff81110a9a>] [<ffffffff81110a9a>] sysfs_create_dir+0x2d/0xae RSP: 0018:ffff880007b15d78 EFLAGS: 00000286 RAX: ffff880007b05478 RBX: ffff880007a52760 RCX: ffff880007b15dc8 RDX: ffff880007a4f900 RSI: ffff880007b15e48 RDI: ffff880007a52760 RBP: ffff880007b15da8 R08: 0000000000000002 R09: 0000000000000000 R10: ffff880007b15e48 R11: ffff880007b05478 R12: 0000000000000000 R13: ffff880007b05478 R14: 0000000000400920 R15: 0000000000000063 FS: 0000000002160880(0063) GS:ffff880007c00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000058 CR3: 0000000007b1c000 CR4: 00000000000006b0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 0000000000000000 DR7: 0000000000000000 Process insmod (pid: 44, threadinfo ffff880007b14000, task ffff880007acb980) Stack: ffff880007b15dc8 ffff880007b05478 ffff880007b15da8 00000000fffffffe ffff880007a52760 ffff880007b05478 ffff880007b15de8 ffffffff81143c0a 0000000000400920 ffff880007a52760 ffff880007b05478 0000000000000000 Call Trace: [<ffffffff81143c0a>] kobject_add_internal+0xdf/0x1a0 [<ffffffff81143da1>] kobject_add_varg+0x41/0x50 [<ffffffff81143e6b>] kobject_add+0x64/0x66 [<ffffffff8113bbe7>] blk_register_queue+0x5f/0xb8 [<ffffffff81140f72>] add_disk+0xdf/0x289 [<ffffffffa00040df>] brd_init+0xdf/0x1aa [brd] [<ffffffffa0004000>] ? 0xffffffffa0003fff [<ffffffffa0004000>] ? 0xffffffffa0003fff [<ffffffff8100020a>] do_one_initcall+0x7a/0x12e [<ffffffff8108516c>] sys_init_module+0x9c/0x1dc [<ffffffff812ff4bb>] system_call_fastpath+0x16/0x1b Code: 89 e5 41 55 41 54 53 48 89 fb 48 83 ec 18 48 85 ff 75 04 0f 0b eb fe 48 8b 47 18 49 c7 c4 70 1e 4d 81 48 85 c0 74 04 4c 8b 60 30 8b 44 24 58 45 31 ed 0f b6 c4 85 c0 74 0d 48 8b 43 28 48 89 RIP [<ffffffff81110a9a>] sysfs_create_dir+0x2d/0xae RSP <ffff880007b15d78> CR2: 0000000000000058 ---[ end trace aebb1175ce1f6739 ]---
--- drivers/block/brd.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/block/brd.c +3 -0
@@ -585,6 +585,9 @@ static int __init brd_init(void)if (max_part >0 ) part_shift =fls (max_part); +if ((1UL << part_shift) >DISK_MAX_PARTS ) +return -EINVAL ; +if (rd_nr >1UL << (MINORBITS - part_shift))return -EINVAL ;
PATCH 146/165 brd: handle on-demand devices correctly
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 2718
Lines: 79
From: Namhyung Kim <[email protected]>
commit af46566885a373b0a526932484cd8fef8de7b598 upstream.
When finding or allocating a ram disk device, brd_probe() did not take partition numbers into account so that it can result to a different device. Consider following example (I set CONFIG_BLK_DEV_RAM_COUNT=4 for simplicity) :
$ sudo modprobe brd max_part=15 $ ls -l /dev/ram* brw-rw---- 1 root disk 1, 0 2011-05-25 15:41 /dev/ram0 brw-rw---- 1 root disk 1, 16 2011-05-25 15:41 /dev/ram1 brw-rw---- 1 root disk 1, 32 2011-05-25 15:41 /dev/ram2 brw-rw---- 1 root disk 1, 48 2011-05-25 15:41 /dev/ram3 $ sudo mknod /dev/ram4 b 1 64 $ sudo dd if=/dev/zero of=/dev/ram4 bs=4k count=256 256+0 records in 256+0 records out 1048576 bytes (1.0 MB) copied, 0.00215578 s, 486 MB/s namhyung@leonhard:linux$ ls -l /dev/ram* brw-rw---- 1 root disk 1, 0 2011-05-25 15:41 /dev/ram0 brw-rw---- 1 root disk 1, 16 2011-05-25 15:41 /dev/ram1 brw-rw---- 1 root disk 1, 32 2011-05-25 15:41 /dev/ram2 brw-rw---- 1 root disk 1, 48 2011-05-25 15:41 /dev/ram3 brw-r--r-- 1 root root 1, 64 2011-05-25 15:45 /dev/ram4 brw-rw---- 1 root disk 1, 1024 2011-05-25 15:44 /dev/ram64
After this patch, /dev/ram4 - instead of /dev/ram64 - was accessed correctly.
In addition, 'range' passed to blk_register_region() should include all range of dev_t that RAMDISK_MAJOR can address. It does not need to be limited by partition numbers unless 'rd_nr' param was specified.
--- drivers/block/brd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/block/brd.c +4 -4
@@ -552,7 +552,7 @@ static struct kobject *brd_probe(dev_t dstruct kobject *kobj;mutex_lock (&brd_devices_mutex); - brd =brd_init_one (dev &MINORMASK ); + brd =brd_init_one (MINOR (dev) >> part_shift); kobj = brd ?get_disk (brd->brd_disk) :ERR_PTR (-ENOMEM );mutex_unlock (&brd_devices_mutex);
@@ -593,10 +593,10 @@ static int __init brd_init(void)if (rd_nr) { nr = rd_nr; - range = rd_nr; + range = rd_nr << part_shift; }else { nr =CONFIG_BLK_DEV_RAM_COUNT ; - range =1UL << (MINORBITS - part_shift); + range =1UL <<MINORBITS ; }if (register_blkdev (RAMDISK_MAJOR ,"ramdisk" ))
@@ -635,7 +635,7 @@ static void __exit brd_exit(void)unsigned long range;struct brd_device *brd, *next; - range = rd_nr ? rd_nr :1UL << (MINORBITS - part_shift); + range = rd_nr ? rd_nr << part_shift :1UL <<MINORBITS ;list_for_each_entry_safe (brd, next, &brd_devices, brd_list)brd_del_one (brd);
PATCH 147/165 drm/i915: fix user irq miss in BSD ring on g4x
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 2380
Lines: 75
From: Boqun Feng <[email protected]>
commit 5bfa1063a775836a84f97e4df863fc36e1f856ad upstream.
On g4x, user interrupt in BSD ring is missed.
This is because though g4x and ironlake share the same bsd_ring, their interrupt control interfaces have _two_ differences.
1.different irq enable/disable functions:
On g4x are i915_enable_irq and i915_disable_irq.
On ironlake are ironlake_enable_irq and ironlake_disable_irq. 2.different irq flag:
On g4x user interrupt flag in BSD ring on is I915_BSD_USER_INTERRUPT. On ironlake is GT_BSD_USER_INTERRUPT
Old bsd_ring_get/put_irq call ring_get_irq and ring_get_irq. ring_get_irq and ring_put_irq only call ironlake_enable/disable_irq. So comes the irq miss on g4x.
To fix this, as other rings' code do, conditionally call different functions(i915_enable/disable_irq and ironlake_enable/disable_irq) and use different interrupt flags in bsd_ring_get/put_irq.
--- drivers/gpu/drm/i915/intel_ringbuffer.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +27 -2
@@ -666,12 +666,37 @@ gen6_ring_put_irq(struct intel_ring_buffstatic bool bsd_ring_get_irq (struct intel_ring_buffer *ring) { -return ring_get_irq (ring,GT_BSD_USER_INTERRUPT ); +struct drm_device *dev = ring->dev; +drm_i915_private_t *dev_priv = dev->dev_private; + +if (!dev->irq_enabled) +return false; + +spin_lock (&ring->irq_lock); +if (ring->irq_refcount++ ==0 ) { +if (IS_G4X (dev)) +i915_enable_irq (dev_priv,I915_BSD_USER_INTERRUPT ); +else +ironlake_enable_irq (dev_priv,GT_BSD_USER_INTERRUPT ); + } +spin_unlock (&ring->irq_lock); + +return true; }static void bsd_ring_put_irq (struct intel_ring_buffer *ring) { -ring_put_irq (ring,GT_BSD_USER_INTERRUPT ); +struct drm_device *dev = ring->dev; +drm_i915_private_t *dev_priv = dev->dev_private; + +spin_lock (&ring->irq_lock); +if (--ring->irq_refcount ==0 ) { +if (IS_G4X (dev)) +i915_disable_irq (dev_priv,I915_BSD_USER_INTERRUPT ); +else +ironlake_disable_irq (dev_priv,GT_BSD_USER_INTERRUPT ); + } +spin_unlock (&ring->irq_lock); } static int
PATCH 148/165 drm/radeon/cayman: setup hdp to invalidate and flush when
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
asked
Content-Length: 1243
Lines: 41
From: Dave Airlie <[email protected]>
commit 0b65f83f9d2fab47b9b6040fe75fc2cfc73032d4 upstream.
On cayman we need to set the bit to cause HDP flushes to invalidate the HDP cache also.
--- drivers/gpu/drm/radeon/ni.c | 4 ++++ drivers/gpu/drm/radeon/nid.h | 2 ++ 2 files changed, 6 insertions(+)
drivers/gpu/drm/radeon/ni.c +4 -0
@@ -931,6 +931,10 @@ static void cayman_gpu_init(struct radeoWREG32 (CB_PERF_CTR3_SEL_0 ,0 );WREG32 (CB_PERF_CTR3_SEL_1 ,0 ); + tmp =RREG32 (HDP_MISC_CNTL ); + tmp |=HDP_FLUSH_INVALIDATE_CACHE ; +WREG32 (HDP_MISC_CNTL , tmp); + hdp_host_path_cntl =RREG32 (HDP_HOST_PATH_CNTL );WREG32 (HDP_HOST_PATH_CNTL , hdp_host_path_cntl);
drivers/gpu/drm/radeon/nid.h +2 -0
@@ -136,6 +136,8 @@#define HDP_NONSURFACE_INFO 0x2C08#define HDP_NONSURFACE_SIZE 0x2C0C#define HDP_ADDR_CONFIG 0x2F48 +#define HDP_MISC_CNTL 0x2F4C +#define HDP_FLUSH_INVALIDATE_CACHE (1 << 0)#define CC_SYS_RB_BACKEND_DISABLE 0x3F88#define GC_USER_SYS_RB_BACKEND_DISABLE 0x3F8C
PATCH 149/165 drm/radeon/evergreen/btc/fusion: setup hdp to invalidate and
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
flush when asked
Content-Length: 1663
Lines: 51
From: Alex Deucher <[email protected]>
commit f25a5c63bfa017498c9adecb24d649ae96ba5c68 upstream.
This needs to be explicitly set on btc. It's set by default on evergreen/fusion, so it fine to just unconditionally enable it for all chips.
--- drivers/gpu/drm/radeon/evergreen.c | 6 +++++- drivers/gpu/drm/radeon/evergreend.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/radeon/evergreen.c +5 -1
@@ -1578,7 +1578,7 @@ static void evergreen_gpu_init(struct rau32 sq_stack_resource_mgmt_2;u32 sq_stack_resource_mgmt_3;u32 vgt_cache_invalidation; -u32 hdp_host_path_cntl; +u32 hdp_host_path_cntl, tmp;int i, j, num_shader_engines, ps_thread_count;switch (rdev->family) {
@@ -2141,6 +2141,10 @@ static void evergreen_gpu_init(struct rafor (i =SQ_ALU_CONST_BUFFER_SIZE_HS_0 ; i <0x29000 ; i +=4 )WREG32 (i,0 ); + tmp =RREG32 (HDP_MISC_CNTL ); + tmp |=HDP_FLUSH_INVALIDATE_CACHE ; +WREG32 (HDP_MISC_CNTL , tmp); + hdp_host_path_cntl =RREG32 (HDP_HOST_PATH_CNTL );WREG32 (HDP_HOST_PATH_CNTL , hdp_host_path_cntl);
drivers/gpu/drm/radeon/evergreend.h +2 -0
@@ -64,6 +64,8 @@#define GB_BACKEND_MAP 0x98FC#define DMIF_ADDR_CONFIG 0xBD4#define HDP_ADDR_CONFIG 0x2F48 +#define HDP_MISC_CNTL 0x2F4C +#define HDP_FLUSH_INVALIDATE_CACHE (1 << 0)#define CC_SYS_RB_BACKEND_DISABLE 0x3F88#define GC_USER_RB_BACKEND_DISABLE 0x9B7C
PATCH 150/165 drm/radeon/kms: fix incorrect comparison in cayman setup
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
code.
Content-Length: 1043
Lines: 27
From: Dave Airlie <[email protected]>
commit c289cff10a265ec4afe4396425297ff979a840b5 upstream.
This was leading to a bogus value being programmed to the backend routing register.
--- drivers/gpu/drm/radeon/ni.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/ni.c +1 -1
@@ -417,7 +417,7 @@ static u32 cayman_get_tile_pipe_to_backe num_shader_engines =1 ;if (num_shader_engines > rdev->config.cayman.max_shader_engines) num_shader_engines = rdev->config.cayman.max_shader_engines; -if (num_backends_per_asic > num_shader_engines) +if (num_backends_per_asic < num_shader_engines) num_backends_per_asic = num_shader_engines;if (num_backends_per_asic > (rdev->config.cayman.max_backends_per_se * num_shader_engines)) num_backends_per_asic = rdev->config.cayman.max_backends_per_se * num_shader_engines;
PATCH 151/165 drm/radeon/kms: fix tile_config value reported to userspace
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
on cayman.
Content-Length: 987
Lines: 27
From: Dave Airlie <[email protected]>
commit cde5083b051e9c66c99a8764aefbc13349e7730d upstream.
cayman is reporting the wrong tile config value to userspace, this causes piglit mipmap generation tests to fail.
--- drivers/gpu/drm/radeon/ni.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/ni.c +1 -1
@@ -829,7 +829,7 @@ static void cayman_gpu_init(struct radeo rdev->config.cayman.tile_config |= ((mc_arb_ramcfg &NOOFBANK_MASK ) >>NOOFBANK_SHIFT ) <<4 ; rdev->config.cayman.tile_config |= - (gb_addr_config &PIPE_INTERLEAVE_SIZE_MASK ) >>PIPE_INTERLEAVE_SIZE_SHIFT ; + ((gb_addr_config &PIPE_INTERLEAVE_SIZE_MASK ) >>PIPE_INTERLEAVE_SIZE_SHIFT ) <<8 ; rdev->config.cayman.tile_config |= ((gb_addr_config &ROW_SIZE_MASK ) >>ROW_SIZE_SHIFT ) <<12 ;
PATCH 152/165 drm/radeon/kms: add wait idle ioctl for eg->cayman
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1943
Lines: 51
From: Dave Airlie <[email protected]>
commit 97bfd0acd32e9639c9136e03955d574655d5cc2b upstream.
None of the latest GPUs had this hooked up, this is necessary for correct operation in a lot of cases, however we should test this on a few GPUs in these families as we've had problems in this area before.
--- drivers/gpu/drm/radeon/radeon_asic.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/radeon/radeon_asic.c +4 -0
@@ -782,6 +782,7 @@ static struct radeon_asic evergreen_asic .hpd_fini = &evergreen_hpd_fini, .hpd_sense = &evergreen_hpd_sense, .hpd_set_polarity = &evergreen_hpd_set_polarity, + .ioctl_wait_idle = r600_ioctl_wait_idle, .gui_idle = &r600_gui_idle, .pm_misc = &evergreen_pm_misc, .pm_prepare = &evergreen_pm_prepare,
@@ -828,6 +829,7 @@ static struct radeon_asic sumo_asic = { .hpd_fini = &evergreen_hpd_fini, .hpd_sense = &evergreen_hpd_sense, .hpd_set_polarity = &evergreen_hpd_set_polarity, + .ioctl_wait_idle = r600_ioctl_wait_idle, .gui_idle = &r600_gui_idle, .pm_misc = &evergreen_pm_misc, .pm_prepare = &evergreen_pm_prepare,
@@ -874,6 +876,7 @@ static struct radeon_asic btc_asic = { .hpd_fini = &evergreen_hpd_fini, .hpd_sense = &evergreen_hpd_sense, .hpd_set_polarity = &evergreen_hpd_set_polarity, + .ioctl_wait_idle = r600_ioctl_wait_idle, .gui_idle = &r600_gui_idle, .pm_misc = &evergreen_pm_misc, .pm_prepare = &evergreen_pm_prepare,
@@ -920,6 +923,7 @@ static struct radeon_asic cayman_asic = .hpd_fini = &evergreen_hpd_fini, .hpd_sense = &evergreen_hpd_sense, .hpd_set_polarity = &evergreen_hpd_set_polarity, + .ioctl_wait_idle = r600_ioctl_wait_idle, .gui_idle = &r600_gui_idle, .pm_misc = &evergreen_pm_misc, .pm_prepare = &evergreen_pm_prepare,
PATCH 153/165 SUNRPC: Deal with the lack of a SYN_SENT sk->sk_state_change
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
callback...
Content-Length: 1759
Lines: 59
From: Trond Myklebust <[email protected]>
commit fe19a96b10032035a35779f42ad59e35d6dd8ffd upstream.
The TCP connection state code depends on the state_change() callback being called when the SYN_SENT state is set. However the networking layer doesn't actually call us back in that case.
--- net/sunrpc/xprtsock.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
net/sunrpc/xprtsock.c +13 -3
@@ -1344,7 +1344,6 @@ static void xs_tcp_state_change(struct scase TCP_CLOSE_WAIT :/* The server initiated a shutdown of the socket */ xprt_force_disconnect (xprt); -case TCP_SYN_SENT : xprt->connect_cookie++;case TCP_CLOSING :/*
@@ -1758,6 +1757,7 @@ static void xs_tcp_reuse_connection(strustatic int xs_tcp_finish_connecting (struct rpc_xprt *xprt,struct socket *sock) { struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); +int ret = -ENOTCONN ;if (!transport->inet) {struct sock *sk = sock->sk;
@@ -1789,12 +1789,22 @@ static int xs_tcp_finish_connecting(stru }if (!xprt_bound (xprt)) -return -ENOTCONN ; + goto out;/* Tell the socket layer to start connecting... */ xprt->stat.connect_count++; xprt->stat.connect_start = jiffies; -return kernel_connect (sock,xs_addr (xprt), xprt->addrlen,O_NONBLOCK ); + ret =kernel_connect (sock,xs_addr (xprt), xprt->addrlen,O_NONBLOCK ); +switch (ret) { +case 0 : +case -EINPROGRESS : +/* SYN_SENT! */ + xprt->connect_cookie++; +if (xprt->reestablish_timeout <XS_TCP_INIT_REEST_TO ) + xprt->reestablish_timeout =XS_TCP_INIT_REEST_TO ; + } +out: +return ret; }/**
PATCH 154/165 NFSv4: Handle expired stateids when the lease is still valid
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1764
Lines: 53
From: Trond Myklebust <[email protected]>
commit 0ced63d1a245ac11241a5d37932e6d04d9c8040d upstream.
Currently, if the server returns NFS4ERR_EXPIRED in reply to a READ or WRITE, but the RENEW test determines that the lease is still active, we fail to recover and end up looping forever in a READ/WRITE + RENEW death spiral.
--- fs/nfs/nfs4proc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
fs/nfs/nfs4proc.c +7 -2
@@ -267,9 +267,11 @@ static int nfs4_handle_exception(structbreak ;nfs4_schedule_stateid_recovery (server, state); goto wait_on_recovery; +case -NFS4ERR_EXPIRED : +if (state !=NULL ) +nfs4_schedule_stateid_recovery (server, state);case -NFS4ERR_STALE_STATEID :case -NFS4ERR_STALE_CLIENTID : -case -NFS4ERR_EXPIRED :nfs4_schedule_lease_recovery (clp); goto wait_on_recovery;#if defined(CONFIG_NFS_V4_1 )
@@ -3670,9 +3672,11 @@ nfs4_async_handle_error(struct rpc_taskbreak ;nfs4_schedule_stateid_recovery (server, state); goto wait_on_recovery; +case -NFS4ERR_EXPIRED : +if (state !=NULL ) +nfs4_schedule_stateid_recovery (server, state);case -NFS4ERR_STALE_STATEID :case -NFS4ERR_STALE_CLIENTID : -case -NFS4ERR_EXPIRED :nfs4_schedule_lease_recovery (clp); goto wait_on_recovery;#if defined(CONFIG_NFS_V4_1 )
@@ -4543,6 +4547,7 @@ int nfs4_lock_delegation_recall(struct ncase -ESTALE : goto out;case -NFS4ERR_EXPIRED : +nfs4_schedule_stateid_recovery (server, state);case -NFS4ERR_STALE_CLIENTID :case -NFS4ERR_STALE_STATEID :nfs4_schedule_lease_recovery (server->nfs_client);
PATCH 155/165 NFSv4.1: Fix the handling of NFS4ERR_SEQ_MISORDERED errors
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1201
Lines: 38
From: Trond Myklebust <[email protected]>
commit 444f72fe7e7b5f4db34cee933fa3546ebb8e9122 upstream.
Currently, the call to nfs4_schedule_session_recovery() will actually just result in a test of the lease when what we really want is to force a session reset.
--- fs/nfs/nfs4state.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/nfs/nfs4state.c +5 -1
@@ -1466,7 +1466,10 @@ static int nfs4_reclaim_lease(struct nfs#ifdef CONFIG_NFS_V4_1 void nfs4_schedule_session_recovery (struct nfs4_session *session) { -nfs4_schedule_lease_recovery (session->clp); +struct nfs_client *clp = session->clp; + +set_bit (NFS4CLNT_SESSION_RESET , &clp->cl_state); +nfs4_schedule_lease_recovery (clp); }EXPORT_SYMBOL_GPL (nfs4_schedule_session_recovery);
@@ -1549,6 +1552,7 @@ static int nfs4_reset_session(struct nfs status =nfs4_recovery_handle_error (clp, status); goto out; } +clear_bit (NFS4CLNT_SESSION_RESET , &clp->cl_state);/* create_session negotiated new slot table */ clear_bit (NFS4CLNT_RECALL_SLOT , &clp->cl_state);
PATCH 156/165 nfs41: Correct offset for LAYOUTCOMMIT
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 845
Lines: 28
From: Vitaliy Gusev <[email protected]>
commit 4b8ee2b82e8b0b6e17ee33feb74fcdb5c6d8dbdd upstream.
A client sends offset to MDS as it was seen by DS. As result, file size after copy is only half of original file size in case of 2 DS.
--- fs/nfs/pnfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/pnfs.c +1 -1
@@ -1009,7 +1009,7 @@ void pnfs_set_layoutcommit(struct nfs_write_data *wdata) {struct nfs_inode *nfsi =NFS_I (wdata->inode); -loff_t end_pos = wdata->args.offset + wdata->res.count; +loff_t end_pos = wdata->mds_offset + wdata->res.count;bool mark_as_dirty = false;spin_lock (&nfsi->vfs_inode.i_lock);
PATCH 157/165 PCI: Add quirk for setting valid class for TI816X Endpoint
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1561
Lines: 45
From: Hemant Pedanekar <[email protected]>
commit 63c4408074cbcc070ac17fc10e524800eb9bd0b0 upstream.
TI816X (common name for DM816x/C6A816x/AM389x family) devices configured to boot as PCIe Endpoint have class code = 0. This makes kernel PCI bus code to skip allocating BARs to these devices resulting into following type of error when trying to enable them:
"Device 0000:01:00.0 not available because of resource collisions"
The device cannot be operated because of the above issue.
This patch adds a ID specific (TI VENDOR ID and 816X DEVICE ID based) 'early' fixup quirk to replace class code with PCI_CLASS_MULTIMEDIA_VIDEO as class.
--- drivers/pci/quirks.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/pci/quirks.c +10 -0
@@ -2784,6 +2784,16 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INDECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x3c28 , vtd_mask_spec_errors);#endif +static void __devinit fixup_ti816x_class (struct pci_dev * dev) +{ +/* TI 816x devices do not have class code set when in PCIe boot mode */ +if (dev->class ==PCI_CLASS_NOT_DEFINED ) { +dev_info (&dev->dev,"Setting PCI class for 816x PCIe device\n" ); + dev->class =PCI_CLASS_MULTIMEDIA_VIDEO ; + } +} +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_TI ,0xb800 , fixup_ti816x_class); +static void pci_do_fixups (struct pci_dev *dev,struct pci_fixup *f,struct pci_fixup *end) {
PATCH 158/165 xen/p2m: Create entries in the P2M_MFN treess to track 1-1
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
mappings
Content-Length: 2188
Lines: 74
From: Konrad Rzeszutek Wilk <[email protected]>
commit 8c5950881c3b5e6e350e4b0438a8ccc513d90df9 upstream.
.. when applicable. We need to track in the p2m_mfn and p2m_mfn_p the MFNs and pointers, respectivly, for the P2M entries that are allocated for the identity mappings. Without this, a PV domain with an E820 that triggers the 1-1 mapping to kick in, won't be able to be restored as the P2M won't have the identity mappings.
--- arch/x86/xen/p2m.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-)
arch/x86/xen/p2m.c +28 -2
@@ -522,11 +522,20 @@ static bool __init __early_alloc_p2m(uns/* Boundary cross-over for the edges: */ if (idx) {unsigned long *p2m =extend_brk (PAGE_SIZE ,PAGE_SIZE ); +unsigned long *mid_mfn_p;p2m_init (p2m); p2m_top[topidx][mididx] = p2m; +/* For save/restore we need to MFN of the P2M saved */ + + mid_mfn_p = p2m_top_mfn_p[topidx]; +WARN (mid_mfn_p[mididx] !=virt_to_mfn (p2m_missing), +"P2M_TOP_P[%d][%d] != MFN of p2m_missing!\n" , + topidx, mididx); + mid_mfn_p[mididx] =virt_to_mfn (p2m); + }return idx !=0 ; }
@@ -549,12 +558,29 @@ unsigned long __init set_phys_range_iden pfn += P2M_MID_PER_PAGE * P2M_PER_PAGE) {unsigned topidx =p2m_top_index (pfn); -if (p2m_top[topidx] == p2m_mid_missing) { -unsigned long **mid =extend_brk (PAGE_SIZE ,PAGE_SIZE ); +unsigned long *mid_mfn_p; +unsigned long **mid; + + mid = p2m_top[topidx]; + mid_mfn_p = p2m_top_mfn_p[topidx]; +if (mid == p2m_mid_missing) { + mid =extend_brk (PAGE_SIZE ,PAGE_SIZE );p2m_mid_init (mid); p2m_top[topidx] = mid; + +BUG_ON (mid_mfn_p != p2m_mid_missing_mfn); + } +/* And the save/restore P2M tables.. */ +if (mid_mfn_p == p2m_mid_missing_mfn) { + mid_mfn_p =extend_brk (PAGE_SIZE ,PAGE_SIZE ); +p2m_mid_mfn_init (mid_mfn_p); + + p2m_top_mfn_p[topidx] = mid_mfn_p; + p2m_top_mfn[topidx] =virt_to_mfn (mid_mfn_p); +/* Note: we don't set mid_mfn_p[midix] here, +* look in __early_alloc_p2m */ } }
PATCH 159/165 xen/setup: Fix for incorrect xen_extra_mem_start
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
initialization under 32-bit
Content-Length: 1270
Lines: 36
From: Daniel Kiper <[email protected]>
commit 0f16d0dfcdb5aab97d9e368f008b070b5b3ec6d3 upstream.
git commit 24bdb0b62cc82120924762ae6bc85afc8c3f2b26 (xen: do not create the extra e820 region at an addr lower than 4G) does not take into account that ifdef CONFIG_X86_32 instead of e820_end_of_low_ram_pfn() find_low_pfn_range() is called (both calls are from arch/x86/kernel/setup.c). find_low_pfn_range() behaves correctly and does not require change in xen_extra_mem_start initialization. Additionally, if xen_extra_mem_start is initialized in the same way as ifdef CONFIG_X86_64 then memory hotplug support for Xen balloon driver (under development) is broken.
--- arch/x86/xen/setup.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/x86/xen/setup.c +4 -0
@@ -227,7 +227,11 @@ char * __init xen_memory_setup(void)memcpy (map_raw, map,sizeof (map)); e820.nr_map =0 ; +#ifdef CONFIG_X86_32 + xen_extra_mem_start = mem_end; +#else xen_extra_mem_start =max ((1ULL <<32 ), mem_end); +#endif for (i =0 ; i < memmap.nr_entries; i++) {unsigned long long end;
PATCH 160/165 xen/setup: Ignore E820_UNUSABLE when setting 1-1 mappings.
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 922
Lines: 28
From: Konrad Rzeszutek Wilk <[email protected]>
commit 15bfc094517db2ddf38ca7ed47f3a1c0ad24f7c4 upstream.
When we parse the raw E820, the Xen hypervisor can set "E820_RAM" to "E820_UNUSABLE" if the mem=X argument is used. As such we should _not_ consider the E820_UNUSABLE as an 1-1 identity mapping, but instead use the same case as for E820_RAM.
--- arch/x86/xen/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/xen/setup.c +1 -1
@@ -166,7 +166,7 @@ static unsigned long __init xen_set_idenif (last > end)continue ; -if (entry->type ==E820_RAM ) { +if ((entry->type ==E820_RAM ) || (entry->type ==E820_UNUSABLE )) {if (start > start_pci) identity +=set_phys_range_identity (PFN_UP (start_pci),PFN_DOWN (start));
PATCH 161/165 xen mmu: fix a race window causing leave_mm BUG()
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 5171
Lines: 97
From: "Tian, Kevin" <[email protected]>
commit 7899891c7d161752f29abcc9bc0a9c6c3a3af26c upstream.
There's a race window in xen_drop_mm_ref, where remote cpu may exit
dirty bitmap between the check on this cpu and the point where remote
cpu handles drop request. So in drop_other_mm_ref we need check
whether TLB state is still lazy before calling into leave_mm. This
bug is rarely observed in earlier kernel, but exaggerated by the
commit 831d52bc153971b70e64eccfbed2b232394f22f8
("x86, mm: avoid possible bogus tlb entries by clearing prev mm_cpumask after switching mm") which clears bitmap after changing the TLB state. the call trace is as below:
---------------------------------
kernel BUG at arch/x86/mm/tlb.c:61!
invalid opcode: 0000 [#1] SMP
last sysfs file: /sys/devices/system/xen_memory/xen_memory0/info/current_kb CPU 1
Modules linked in: 8021q garp xen_netback xen_blkback blktap blkback_pagemap nbd bridge stp llc autofs4 ipmi_devintf ipmi_si ipmi_msghandler lockd sunrpc bonding ipv6 xenfs dm_multipath video output sbs sbshc parport_pc lp parport ses enclosure snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq snd_seq_device serio_raw bnx2 snd_pcm_oss snd_mixer_oss snd_pcm snd_timer iTCO_wdt snd soundcore snd_page_alloc i2c_i801 iTCO_vendor_support i2c_core pcs pkr pata_acpi ata_generic ata_piix shpchp mptsas mptscsih mptbase [last unloaded: freq_table] Pid: 25581, comm: khelper Not tainted 2.6.32.36fixxen #1 Tecal RH2285 RIP: e030:[<ffffffff8103a3cb>] [<ffffffff8103a3cb>] leave_mm+0x15/0x46 RSP: e02b:ffff88002805be48 EFLAGS: 00010046 RAX: 0000000000000000 RBX: 0000000000000001 RCX: ffff88015f8e2da0 RDX: ffff88002805be78 RSI: 0000000000000000 RDI: 0000000000000001 RBP: ffff88002805be48 R08: ffff88009d662000 R09: dead000000200200 R10: dead000000100100 R11: ffffffff814472b2 R12: ffff88009bfc1880 R13: ffff880028063020 R14: 00000000000004f6 R15: 0000000000000000 FS: 00007f62362d66e0(0000) GS:ffff880028058000(0000) knlGS:0000000000000000 CS: e033 DS: 0000 ES: 0000 CR0: 000000008005003b CR2: 0000003aabc11909 CR3: 000000009b8ca000 CR4: 0000000000002660 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 00000000000000 00 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Process khelper (pid: 25581, threadinfo ffff88007691e000, task ffff88009b92db40) Stack: ffff88002805be68 ffffffff8100e4ae 0000000000000001 ffff88009d733b88 <0> ffff88002805be98 ffffffff81087224 ffff88002805be78 ffff88002805be78 <0> ffff88015f808360 00000000000004f6 ffff88002805bea8 ffffffff81010108 Call Trace: <IRQ> [<ffffffff8100e4ae>] drop_other_mm_ref+0x2a/0x53 [<ffffffff81087224>] generic_smp_call_function_single_interrupt+0xd8/0xfc [<ffffffff81010108>] xen_call_function_single_interrupt+0x13/0x28 [<ffffffff810a936a>] handle_IRQ_event+0x66/0x120 [<ffffffff810aac5b>] handle_percpu_irq+0x41/0x6e [<ffffffff8128c1c0>] __xen_evtchn_do_upcall+0x1ab/0x27d [<ffffffff8128dd11>] xen_evtchn_do_upcall+0x33/0x46 [<ffffffff81013efe>] xen_do_hyper visor_callback+0x1e/0x30 <EOI> [<ffffffff814472b2>] ? _spin_unlock_irqrestore+0x15/0x17 [<ffffffff8100f8cf>] ? xen_restore_fl_direct_end+0x0/0x1 [<ffffffff81113f71>] ? flush_old_exec+0x3ac/0x500 [<ffffffff81150dc5>] ? load_elf_binary+0x0/0x17ef [<ffffffff81150dc5>] ? load_elf_binary+0x0/0x17ef [<ffffffff8115115d>] ? load_elf_binary+0x398/0x17ef [<ffffffff81042fcf>] ? need_resched+0x23/0x2d [<ffffffff811f4648>] ? process_measurement+0xc0/0xd7 [<ffffffff81150dc5>] ? load_elf_binary+0x0/0x17ef [<ffffffff81113094>] ? search_binary_handler+0xc8/0x255 [<ffffffff81114362>] ? do_execve+0x1c3/0x29e [<ffffffff8101155d>] ? sys_execve+0x43/0x5d [<ffffffff8106fc45>] ? __call_usermodehelper+0x0/0x6f [<ffffffff81013e28>] ? kernel_execve+0x68/0xd0 [<ffffffff 8106fc45>] ? __call_usermodehelper+0x0/0x6f [<ffffffff8100f8cf>] ? xen_restore_fl_direct_end+0x0/0x1 [<ffffffff8106fb64>] ? ____call_usermodehelper+0x113/0x11e [<ffffffff81013daa>] ? child_rip+0xa/0x20 [<ffffffff8106fc45>] ? __call_usermodehelper+0x0/0x6f [<ffffffff81012f91>] ? int_ret_from_sys_call+0x7/0x1b [<ffffffff8101371d>] ? retint_restore_args+0x5/0x6 [<ffffffff81013da0>] ? child_rip+0x0/0x20 Code: 41 5e 41 5f c9 c3 55 48 89 e5 0f 1f 44 00 00 e8 17 ff ff ff c9 c3 55 48 89 e5 0f 1f 44 00 00 65 8b 04 25 c8 55 01 00 ff c8 75 04 <0f> 0b eb fe 65 48 8b 34 25 c0 55 01 00 48 81 c6 b8 02 00 00 e8 RIP [<ffffffff8103a3cb>] leave_mm+0x15/0x46 RSP <ffff88002805be48> ---[ end trace ce9cee6832a9c503 ]---
--- arch/x86/xen/mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/xen/mmu.c +1 -1
@@ -1187,7 +1187,7 @@ static void drop_other_mm_ref(void *info active_mm =percpu_read (cpu_tlbstate.active_mm); -if (active_mm == mm) +if (active_mm == mm &&percpu_read (cpu_tlbstate.state) !=TLBSTATE_OK )leave_mm (smp_processor_id ());/* If this cpu still has a stale cr3 reference, then make sure
PATCH 162/165 block: dont block events on excl write for non-optical
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
devices
Content-Length: 4265
Lines: 120
From: Tejun Heo <[email protected]>
commit d4dc210f69bcb0b4bef5a83b1c323817be89bad1 upstream.
Disk event code automatically blocks events on excl write. This is primarily to avoid issuing polling commands while burning is in progress. This behavior doesn't fit other types of devices with removeable media where polling commands don't have adverse side effects and door locking usually doesn't exist.
This patch introduces new genhd flag which controls the auto-blocking behavior and uses it to enable auto-blocking only on optical devices.
Note for stable: 2.6.38 and later only
--- drivers/block/paride/pcd.c | 1 + drivers/cdrom/viocd.c | 3 ++- drivers/ide/ide-cd.c | 3 ++- drivers/scsi/sr.c | 2 +- fs/block_dev.c | 17 ++++++++++------- include/linux/genhd.h | 1 + 6 files changed, 17 insertions(+), 10 deletions(-)
drivers/block/paride/pcd.c +1 -0
@@ -320,6 +320,7 @@ static void pcd_init_units(void) disk->first_minor = unit;strcpy (disk->disk_name, cd->name);/* umm... */ disk->fops = &pcd_bdops; + disk->flags =GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE ; } }
drivers/cdrom/viocd.c +2 -1
@@ -625,7 +625,8 @@ static int viocd_probe(struct vio_dev *vblk_queue_max_hw_sectors (q,4096 /512 ); gendisk->queue = q; gendisk->fops = &viocd_fops; - gendisk->flags =GENHD_FL_CD |GENHD_FL_REMOVABLE ; + gendisk->flags =GENHD_FL_CD |GENHD_FL_REMOVABLE | +GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE ;set_capacity (gendisk,0 ); gendisk->private_data = d; d->viocd_disk = gendisk;
drivers/ide/ide-cd.c +2 -1
@@ -1773,7 +1773,8 @@ static int ide_cd_probe(ide_drive_t *dri g->minors =1 ; g->driverfs_dev = &drive->gendev; - g->flags =GENHD_FL_CD |GENHD_FL_REMOVABLE ; + g->flags =GENHD_FL_CD |GENHD_FL_REMOVABLE | +GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE ;if (ide_cdrom_setup (drive)) {put_device (&info->dev); goto failed;
drivers/scsi/sr.c +1 -1
@@ -636,7 +636,7 @@ static int sr_probe(struct device *dev) disk->first_minor = minor;sprintf (disk->disk_name,"sr%d" , minor); disk->fops = &sr_bdops; - disk->flags =GENHD_FL_CD ; + disk->flags =GENHD_FL_CD |GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE ; disk->events =DISK_EVENT_MEDIA_CHANGE |DISK_EVENT_EJECT_REQUEST ;blk_queue_rq_timeout (sdev->request_queue,SR_TIMEOUT );
fs/block_dev.c +10 -7
@@ -1238,6 +1238,8 @@ int blkdev_get(struct block_device *bdev res =__blkdev_get (bdev, mode,0 );if (whole) { +struct gendisk *disk = whole->bd_disk; +/* finish claiming */ mutex_lock (&bdev->bd_mutex);spin_lock (&bdev_lock);
@@ -1264,15 +1266,16 @@ int blkdev_get(struct block_device *bdevspin_unlock (&bdev_lock);/* -* Block event polling for write claims. Any write -* holder makes the write_holder state stick until all -* are released. This is good enough and tracking -* individual writeable reference is too fragile given -* the way @mode is used in blkdev_get/put(). +* Block event polling for write claims if requested. Any +* write holder makes the write_holder state stick until +* all are released. This is good enough and tracking +* individual writeable reference is too fragile given the +* way @mode is used in blkdev_get/put(). */ -if (!res && (mode &FMODE_WRITE ) && !bdev->bd_write_holder) { +if ((disk->flags &GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE ) && + !res && (mode &FMODE_WRITE ) && !bdev->bd_write_holder) { bdev->bd_write_holder = true; -disk_block_events (bdev->bd_disk); +disk_block_events (disk); }mutex_unlock (&bdev->bd_mutex);
include/linux/genhd.h +1 -0
@@ -127,6 +127,7 @@ struct hd_struct {#define GENHD_FL_SUPPRESS_PARTITION_INFO 32#define GENHD_FL_EXT_DEVT 64/* allow extended devt */ #define GENHD_FL_NATIVE_CAPACITY 128 +#define GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE 256enum {DISK_EVENT_MEDIA_CHANGE =1 <<0 ,/* media changed */
PATCH 163/165 ext4: fix possible use-after-free in
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
ext4_remove_li_request()
Content-Length: 1306
Lines: 43
From: Lukas Czerner <[email protected]>
commit 1bb933fb1fa8e4cb337a0d5dfd2ff4c0dc2073e8 upstream.
We need to take reference to the s_li_request after we take a mutex, because it might be freed since then, hence result in accessing old already freed memory. Also we should protect the whole ext4_remove_li_request() because ext4_li_info might be in the process of being freed in ext4_lazyinit_thread().
--- fs/ext4/super.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
fs/ext4/super.c +6 -4
@@ -2730,14 +2730,16 @@ static void ext4_remove_li_request(strucstatic void ext4_unregister_li_request (struct super_block *sb) { -struct ext4_li_request *elr =EXT4_SB (sb)->s_li_request; - -if (!ext4_li_info) +mutex_lock (&ext4_li_mtx); +if (!ext4_li_info) { +mutex_unlock (&ext4_li_mtx);return ; + }mutex_lock (&ext4_li_info->li_list_mtx); -ext4_remove_li_request (elr); +ext4_remove_li_request (EXT4_SB (sb)->s_li_request);mutex_unlock (&ext4_li_info->li_list_mtx); +mutex_unlock (&ext4_li_mtx); }static struct task_struct *ext4_lazyinit_task;
PATCH 164/165 ext4: Use schedule_timeout_interruptible() for waiting in
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
lazyinit thread
Content-Length: 4444
Lines: 142
From: Lukas Czerner <[email protected]>
commit 4ed5c033c11b33149d993734a6a8de1016e8f03f upstream.
In order to make lazyinit eat approx. 10% of io bandwidth at max, we are sleeping between zeroing each single inode table. For that purpose we are using timer which wakes up thread when it expires. It is set via add_timer() and this may cause troubles in the case that thread has been woken up earlier and in next iteration we call add_timer() on still running timer hence hitting BUG_ON in add_timer(). We could fix that by using mod_timer() instead however we can use schedule_timeout_interruptible() for waiting and hence simplifying things a lot.
This commit exchange the old "waiting mechanism" with simple schedule_timeout_interruptible(), setting the time to sleep. Hence we do not longer need li_wait_daemon waiting queue and others, so get rid of it.
Addresses-Red-Hat-Bugzilla: #699708
--- fs/ext4/ext4.h | 4 ---- fs/ext4/super.c | 31 ++++++------------------------- 2 files changed, 6 insertions(+), 29 deletions(-)
fs/ext4/ext4.h +0 -4
@@ -1590,12 +1590,8 @@ void ext4_get_group_no_and_offset(struct*/ struct ext4_lazy_init {unsigned long li_state; - -wait_queue_head_t li_wait_daemon;wait_queue_head_t li_wait_task; -struct timer_list li_timer;struct task_struct *li_task; -struct list_head li_request_list;struct mutex li_list_mtx; };
fs/ext4/super.c +6 -25
@@ -2659,12 +2659,6 @@ static void print_daily_error_info(unsigmod_timer (&sbi->s_err_report, jiffies +24 *60 *60 *HZ );/* Once a day */ } -static void ext4_lazyinode_timeout (unsigned long data) -{ -struct task_struct *p = (struct task_struct *)data; -wake_up_process (p); -} -/* Find next suitable group and run ext4_init_inode_table */ static int ext4_run_li_request (struct ext4_li_request *elr) {
@@ -2712,7 +2706,7 @@ static int ext4_run_li_request(struct ex/* * Remove lr_request from the list_request and free the -* request tructure. Should be called with li_list_mtx held +* request structure. Should be called with li_list_mtx held */ static void ext4_remove_li_request (struct ext4_li_request *elr) {
@@ -2758,14 +2752,10 @@ static int ext4_lazyinit_thread(void *arstruct ext4_lazy_init *eli = (struct ext4_lazy_init *)arg;struct list_head *pos, *n;struct ext4_li_request *elr; -unsigned long next_wakeup; -DEFINE_WAIT (wait); +unsigned long next_wakeup, cur;BUG_ON (NULL == eli); - eli->li_timer.data = (unsigned long )current; - eli->li_timer.function = ext4_lazyinode_timeout; - eli->li_task = current;wake_up (&eli->li_wait_task);
@@ -2799,19 +2789,15 @@ cont_thread:if (freezing (current))refrigerator (); -if ((time_after_eq (jiffies, next_wakeup)) || + cur = jiffies; +if ((time_after_eq (cur, next_wakeup)) || (MAX_JIFFY_OFFSET == next_wakeup)) {cond_resched ();continue ; } - eli->li_timer.expires = next_wakeup; -add_timer (&eli->li_timer); -prepare_to_wait (&eli->li_wait_daemon, &wait, -TASK_INTERRUPTIBLE ); -if (time_before (jiffies, next_wakeup)) -schedule (); -finish_wait (&eli->li_wait_daemon, &wait); +schedule_timeout_interruptible (next_wakeup - cur); +if (kthread_should_stop ()) {ext4_clear_request_list (); goto exit_thread;
@@ -2835,12 +2821,10 @@ exit_thread: goto cont_thread; }mutex_unlock (&eli->li_list_mtx); -del_timer_sync (&ext4_li_info->li_timer); eli->li_task =NULL ;wake_up (&eli->li_wait_task);kfree (ext4_li_info); - ext4_lazyinit_task =NULL ; ext4_li_info =NULL ;mutex_unlock (&ext4_li_mtx);
@@ -2868,7 +2852,6 @@ static int ext4_run_lazyinit_thread(voidif (IS_ERR (ext4_lazyinit_task)) {int err =PTR_ERR (ext4_lazyinit_task);ext4_clear_request_list (); -del_timer_sync (&ext4_li_info->li_timer);kfree (ext4_li_info); ext4_li_info =NULL ; printk(KERN_CRIT "EXT4: error %d creating inode table "
@@ -2917,9 +2900,7 @@ static int ext4_li_info_new(void)INIT_LIST_HEAD (&eli->li_request_list);mutex_init (&eli->li_list_mtx); -init_waitqueue_head (&eli->li_wait_daemon);init_waitqueue_head (&eli->li_wait_task); -init_timer (&eli->li_timer); eli->li_state |=EXT4_LAZYINIT_QUIT ; ext4_li_info = eli;
PATCH 165/165 AppArmor: fix oops in apparmor_setprocattr
In reply to Greg KH2.6.39-stable review patch. If anyone has any objections, please let us know.
------------------
Content-Length: 1159
Lines: 34
From: Kees Cook <[email protected]>
commit a5b2c5b2ad5853591a6cac6134cd0f599a720865 upstream.
When invalid parameters are passed to apparmor_setprocattr a NULL deref oops occurs when it tries to record an audit message. This is because it is passing NULL for the profile parameter for aa_audit. But aa_audit now requires that the profile passed is not NULL.
Fix this by passing the current profile on the task that is trying to setprocattr.
--- security/apparmor/lsm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
security/apparmor/lsm.c +2 -1
@@ -593,7 +593,8 @@ static int apparmor_setprocattr(struct t sa.aad.op =OP_SETPROCATTR ; sa.aad.info = name; sa.aad.error = -EINVAL ; -return aa_audit (AUDIT_APPARMOR_DENIED ,NULL ,GFP_KERNEL , +return aa_audit (AUDIT_APPARMOR_DENIED , +__aa_current_profile (),GFP_KERNEL , &sa,NULL ); } }else if (strcmp (name,"exec" ) ==0 ) {