3.0.40-stable review
Subsystems (36)
Greg Kroah-Hartman
maintainercover 3.0.40-stable review
From: Greg KH <[email protected]>
This is the start of the stable review cycle for the 3.0.40 release. There are 49 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Aug 9 22:20:25 UTC 2012. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.0.40-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
-------------
Documentation/stable_kernel_rules.txt | 19 ++++++++--- Makefile | 4 +-- arch/arm/mach-omap2/opp.c | 3 +- arch/m68k/include/asm/entry_mm.h | 4 +-- arch/m68k/kernel/sys_m68k.c | 8 +++-- arch/powerpc/include/asm/cputime.h | 6 ++-- arch/powerpc/include/asm/reg.h | 3 +- arch/powerpc/kernel/ftrace.c | 12 +++---- arch/powerpc/kernel/time.c | 10 +++--- drivers/acpi/ac.c | 4 ++- drivers/gpu/drm/radeon/atombios_dp.c | 10 ++++-- drivers/gpu/drm/radeon/radeon_connectors.c | 35 ++++++++++++++----- drivers/gpu/drm/radeon/radeon_cursor.c | 8 ++++- drivers/mmc/host/sdhci-pci.c | 1 + drivers/net/bnx2.c | 6 ++-- drivers/net/caif/caif_serial.c | 3 ++ drivers/net/tun.c | 6 ++-- drivers/net/usb/kaweth.c | 2 +- drivers/scsi/libsas/sas_expander.c | 47 +++++++++---------------- drivers/scsi/scsi_error.c | 14 ++++++++ drivers/scsi/scsi_lib.c | 11 ++++++ drivers/scsi/scsi_scan.c | 3 ++ drivers/scsi/scsi_sysfs.c | 41 ++++++++++++++-------- drivers/usb/core/devio.c | 10 ++++-- drivers/usb/early/ehci-dbgp.c | 2 +- drivers/usb/gadget/u_ether.c | 12 +++---- fs/btrfs/async-thread.c | 9 ++++- fs/ext4/balloc.c | 3 +- fs/ext4/bitmap.c | 8 ++--- fs/ext4/ext4.h | 2 +- fs/ext4/ialloc.c | 3 +- fs/ext4/inode.c | 9 +++++ fs/locks.c | 6 ++-- fs/nfs/file.c | 7 ++-- fs/nfsd/nfs4xdr.c | 2 +- include/linux/cpu.h | 5 +-- kernel/futex.c | 17 ++++++---- kernel/power/hibernate.c | 6 ++++ kernel/power/suspend.c | 3 ++ kernel/workqueue.c | 38 ++++++++++++++++++++- net/caif/caif_dev.c | 2 +- net/core/rtnetlink.c | 8 ++++- net/ipv4/cipso_ipv4.c | 6 ++-- net/ipv4/tcp.c | 5 ++- net/ipv4/tcp_input.c | 4 ++- net/sched/sch_sfb.c | 2 ++ net/sctp/input.c | 7 ++-- net/sctp/socket.c | 12 +++++-- net/sunrpc/sched.c | 2 ++ net/sunrpc/xprtrdma/transport.c | 3 +- net/sunrpc/xprtsock.c | 10 ++++++ net/wanrouter/wanmain.c | 51 +++++++++++++--------------- sound/drivers/mpu401/mpu401_uart.c | 1 + sound/pci/hda/patch_realtek.c | 1 + sound/soc/codecs/wm8962.c | 3 ++ sound/soc/codecs/wm8994.c | 2 +- sound/usb/clock.c | 3 +- 57 files changed, 352 insertions(+), 172 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/49 mmc: sdhci-pci: CaFe has broken card detection
From: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Drake <[email protected]>
commit 55fc05b7414274f17795cd0e8a3b1546f3649d5e upstream.
At http://dev.laptop.org/ticket/11980 we have determined that the Marvell CaFe SDHCI controller reports bad card presence during resume. It reports that no card is present even when it is. This is a regression -- resume worked back around 2.6.37.
Around 400ms after resuming, a "card inserted" interrupt is generated, at which point it starts reporting presence.
Work around this hardware oddity by setting theSDHCI_QUIRK_BROKEN_CARD_DETECTION flag.
Thanks to Chris Ball for helping with diagnosis.
--- drivers/mmc/host/sdhci-pci.c | 1 + 1 file changed, 1 insertion(+)
drivers/mmc/host/sdhci-pci.c +1 -0
@@ -140,6 +140,7 @@ static const struct sdhci_pci_fixes sdhcstatic const struct sdhci_pci_fixes sdhci_cafe = { .quirks =SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER |SDHCI_QUIRK_NO_BUSY_IRQ | +SDHCI_QUIRK_BROKEN_CARD_DETECTION |SDHCI_QUIRK_BROKEN_TIMEOUT_VAL , };
Greg Kroah-Hartman
maintainerPATCH 2/49 powerpc/ftrace: Fix assembly trampoline register usage
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: roger blofeld <[email protected]>
commit fd5a42980e1cf327b7240adf5e7b51ea41c23437 upstream.
Just like the module loader, ftrace needs to be updated to use r12 instead of r11 with newer gcc's.
--- arch/powerpc/kernel/ftrace.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
arch/powerpc/kernel/ftrace.c +6 -6
@@ -245,9 +245,9 @@ __ftrace_make_nop(struct module *mod,/* * On PPC32 the trampoline looks like: -* 0x3d, 0x60, 0x00, 0x00 lis r11,sym@ha -* 0x39, 0x6b, 0x00, 0x00 addi r11,r11,sym@l -* 0x7d, 0x69, 0x03, 0xa6 mtctr r11 +* 0x3d, 0x80, 0x00, 0x00 lis r12,sym@ha +* 0x39, 0x8c, 0x00, 0x00 addi r12,r12,sym@l +* 0x7d, 0x89, 0x03, 0xa6 mtctr r12 * 0x4e, 0x80, 0x04, 0x20 bctr */
@@ -262,9 +262,9 @@ __ftrace_make_nop(struct module *mod,pr_devel (" %08x %08x " , jmp[0 ], jmp[1 ]);/* verify that this is what we expect it to be */ -if (((jmp[0 ] &0xffff0000 ) !=0x3d600000 ) || - ((jmp[1 ] &0xffff0000 ) !=0x396b0000 ) || - (jmp[2 ] !=0x7d6903a6 ) || +if (((jmp[0 ] &0xffff0000 ) !=0x3d800000 ) || + ((jmp[1 ] &0xffff0000 ) !=0x398c0000 ) || + (jmp[2 ] !=0x7d8903a6 ) || (jmp[3 ] !=0x4e800420 )) {printk (KERN_ERR "Not a trampoline\n" );return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 3/49 powerpc: Add "memory" attribute for mfmsr()
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiejun Chen <[email protected]>
commit b416c9a10baae6a177b4f9ee858b8d309542fbef upstream.
Add "memory" attribute in inline assembly language as a compiler barrier to make sure 4.6.x GCC don't reorder mfmsr().
--- arch/powerpc/include/asm/reg.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/include/asm/reg.h +2 -1
@@ -1000,7 +1000,8 @@/* Macros for setting and retrieving special purpose registers */ #ifndef __ASSEMBLY__#define mfmsr () ({unsigned long rval; \ - asm volatile("mfmsr %0" : "=r" (rval)); rval;}) + asm volatile("mfmsr %0" : "=r" (rval) : \ + : "memory"); rval;})#ifdef CONFIG_PPC_BOOK3S_64 #define __mtmsrd (v, l) asm volatile("mtmsrd %0," __stringify(l) \ : : "r" (v) : "memory")
Greg Kroah-Hartman
maintainerPATCH 4/49 powerpc: Fix wrong divisor in usecs_to_cputime
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Schwab <[email protected]>
commit 9f5072d4f63f28d30d343573830ac6c85fc0deff upstream.
Commit d57af9b (taskstats: use real microsecond granularity for CPU times) renamed msecs_to_cputime to usecs_to_cputime, but failed to update all numbers on the way. This causes nonsensical cpu idle/iowait values to be displayed in /proc/stat (the only user of usecs_to_cputime so far).
This also renames __cputime_msec_factor to __cputime_usec_factor, adapting its value and using it directly in cputime_to_usecs instead of doing two multiplications.
--- arch/powerpc/include/asm/cputime.h | 6 +++--- arch/powerpc/kernel/time.c | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-)
arch/powerpc/include/asm/cputime.h +3 -3
@@ -126,11 +126,11 @@ static inline u64 cputime64_to_jiffies64/* * Convert cputime <-> microseconds */ -extern u64 __cputime_msec_factor; +extern u64 __cputime_usec_factor;static inline unsigned long cputime_to_usecs (const cputime_t ct) { -return mulhdu (ct, __cputime_msec_factor) *USEC_PER_MSEC ; +return mulhdu (ct, __cputime_usec_factor); }static inline cputime_t usecs_to_cputime (const unsigned long us)
@@ -143,7 +143,7 @@ static inline cputime_t usecs_to_cputime sec = us /1000000 ;if (ct) { ct *= tb_ticks_per_sec; -do_div (ct,1000 ); +do_div (ct,1000000 ); }if (sec) ct += (cputime_t ) sec * tb_ticks_per_sec;
arch/powerpc/kernel/time.c +5 -5
@@ -168,13 +168,13 @@ EXPORT_SYMBOL_GPL(ppc_tb_freq);#ifdef CONFIG_VIRT_CPU_ACCOUNTING /* * Factors for converting from cputime_t (timebase ticks) to -* jiffies, milliseconds, seconds, and clock_t (1/USER_HZ seconds). +* jiffies, microseconds, seconds, and clock_t (1/USER_HZ seconds). * These are all stored as 0.64 fixed-point binary fractions. */ u64 __cputime_jiffies_factor;EXPORT_SYMBOL (__cputime_jiffies_factor); -u64 __cputime_msec_factor; -EXPORT_SYMBOL (__cputime_msec_factor); +u64 __cputime_usec_factor; +EXPORT_SYMBOL (__cputime_usec_factor);u64 __cputime_sec_factor;EXPORT_SYMBOL (__cputime_sec_factor);u64 __cputime_clockt_factor;
@@ -192,8 +192,8 @@ static void calc_cputime_factors(void)div128_by_32 (HZ ,0 , tb_ticks_per_sec, &res); __cputime_jiffies_factor = res.result_low; -div128_by_32 (1000 ,0 , tb_ticks_per_sec, &res); - __cputime_msec_factor = res.result_low; +div128_by_32 (1000000 ,0 , tb_ticks_per_sec, &res); + __cputime_usec_factor = res.result_low;div128_by_32 (1 ,0 , tb_ticks_per_sec, &res); __cputime_sec_factor = res.result_low;div128_by_32 (USER_HZ ,0 , tb_ticks_per_sec, &res);
Greg Kroah-Hartman
maintainerPATCH 5/49 SCSI: libsas: continue revalidation
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Williams <[email protected]>
commit 26f2f199ff150d8876b2641c41e60d1c92d2fb81 upstream.
Continue running revalidation until no more broadcast devices are discovered. Fixes cases where re-discovery completes too early in a domain with multiple expanders with pending re-discovery events. Servicing BCNs can get backed up behind error recovery.
--- drivers/scsi/libsas/sas_expander.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/libsas/sas_expander.c +4 -4
@@ -1972,9 +1972,7 @@ int sas_ex_revalidate_domain(struct domastruct domain_device *dev =NULL ; res =sas_find_bcast_dev (port_dev, &dev); -if (res) - goto out; -if (dev) { +while (res ==0 && dev) {struct expander_device *ex = &dev->ex_dev;int i =0 , phy_id;
@@ -1986,8 +1984,10 @@ int sas_ex_revalidate_domain(struct doma res =sas_rediscover (dev, phy_id); i = phy_id +1 ; }while (i < ex->num_phys); + + dev =NULL ; + res =sas_find_bcast_dev (port_dev, &dev); } -out:return res; }
Greg Kroah-Hartman
maintainerPATCH 6/49 SCSI: libsas: fix sas_discover_devices return code handling
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Williams <[email protected]>
commit b17caa174a7e1fd2e17b26e210d4ee91c4c28b37 upstream.
commit 198439e4 [SCSI] libsas: do not set res = 0 in sas_ex_discover_dev() commit 19252de6 [SCSI] libsas: fix wide port hotplug issues
The above commits seem to have confused the return value of sas_ex_discover_dev which is non-zero on failure and sas_ex_join_wide_port which just indicates short circuiting discovery on already established ports. The result is random discovery failures depending on configuration.
Calls to sas_ex_join_wide_port are the source of the trouble as its return value is errantly assigned to 'res'. Convert it to bool and stop returning its result up the stack.
--- drivers/scsi/libsas/sas_expander.c | 39 +++++++++++-------------------------- 1 file changed, 12 insertions(+), 27 deletions(-)
drivers/scsi/libsas/sas_expander.c +12 -27
@@ -770,7 +770,7 @@ static struct domain_device *sas_ex_disc }/* See if this phy is part of a wide port */ -static int sas_ex_join_wide_port (struct domain_device *parent,int phy_id) +static bool sas_ex_join_wide_port (struct domain_device *parent,int phy_id) {struct ex_phy *phy = &parent->ex_dev.ex_phy[phy_id];int i;
@@ -786,11 +786,11 @@ static int sas_ex_join_wide_port(structsas_port_add_phy (ephy->port, phy->phy); phy->port = ephy->port; phy->phy_state =PHY_DEVICE_DISCOVERED ; -return 0 ; +return true; } } -return -ENODEV ; +return false; } static struct domain_device *sas_ex_discover_expander(
@@ -928,8 +928,7 @@ static int sas_ex_discover_dev(struct doreturn res; } - res =sas_ex_join_wide_port (dev, phy_id); -if (!res) { +if (sas_ex_join_wide_port (dev, phy_id)) {SAS_DPRINTK ("Attaching ex phy%d to wide port %016llx\n" , phy_id,SAS_ADDR (ex_phy->attached_sas_addr));return res;
@@ -974,8 +973,7 @@ static int sas_ex_discover_dev(struct doif (SAS_ADDR (ex->ex_phy[i].attached_sas_addr) ==SAS_ADDR (child->sas_addr)) { ex->ex_phy[i].phy_state=PHY_DEVICE_DISCOVERED ; - res =sas_ex_join_wide_port (dev, i); -if (!res) +if (sas_ex_join_wide_port (dev, i))SAS_DPRINTK ("Attaching ex phy%d to wide port %016llx\n" , i,SAS_ADDR (ex->ex_phy[i].attached_sas_addr));
@@ -1838,32 +1836,20 @@ static int sas_discover_new(struct domai {struct ex_phy *ex_phy = &dev->ex_dev.ex_phy[phy_id];struct domain_device *child; -bool found = false; -int res, i; +int res;SAS_DPRINTK ("ex %016llx phy%d new device attached\n" ,SAS_ADDR (dev->sas_addr), phy_id); res =sas_ex_phy_discover (dev, phy_id);if (res) - goto out; -/* to support the wide port inserted */ -for (i =0 ; i < dev->ex_dev.num_phys; i++) { -struct ex_phy *ex_phy_temp = &dev->ex_dev.ex_phy[i]; -if (i == phy_id) -continue ; -if (SAS_ADDR (ex_phy_temp->attached_sas_addr) == -SAS_ADDR (ex_phy->attached_sas_addr)) { - found = true; -break ; - } - } -if (found) { -sas_ex_join_wide_port (dev, phy_id); +return res; + +if (sas_ex_join_wide_port (dev, phy_id))return 0 ; - } + res =sas_ex_discover_devices (dev, phy_id); -if (!res) - goto out; +if (res) +return res;list_for_each_entry (child, &dev->ex_dev.children, siblings) {if (SAS_ADDR (child->sas_addr) ==SAS_ADDR (ex_phy->attached_sas_addr)) {
@@ -1873,7 +1859,6 @@ static int sas_discover_new(struct domaibreak ; } } -out:return res; }
Greg Kroah-Hartman
maintainerPATCH 7/49 SCSI: fix eh wakeup (scsi_schedule_eh vs scsi_restart_operations)
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Williams <[email protected]>
commit 57fc2e335fd3c2f898ee73570dc81426c28dc7b4 upstream.
Rapid ata hotplug on a libsas controller results in cases where libsas is waiting indefinitely on eh to perform an ata probe.
A race exists between scsi_schedule_eh() and scsi_restart_operations() in the case when scsi_restart_operations() issues i/o to other devices in the sas domain. When this happens the host state transitions from SHOST_RECOVERY (set by scsi_schedule_eh) back to SHOST_RUNNING and ->host_busy is non-zero so we put the eh thread to sleep even though ->host_eh_scheduled is active.
Before putting the error handler to sleep we need to check if the host_state needs to return to SHOST_RECOVERY for another trip through eh. Since i/o that is released by scsi_restart_operations has been blocked for at least one eh cycle, this implementation allows those i/o's to run before another eh cycle starts to discourage hung task timeouts.
--- drivers/scsi/scsi_error.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/scsi/scsi_error.c +14 -0
@@ -1665,6 +1665,20 @@ static void scsi_restart_operations(stru* requests are started. */ scsi_run_host_queues (shost); + +/* +* if eh is active and host_eh_scheduled is pending we need to re-run +* recovery. we do this check after scsi_run_host_queues() to allow +* everything pent up since the last eh run a chance to make forward +* progress before we sync again. Either we'll immediately re-run +* recovery or scsi_device_unbusy() will wake us again when these +* pending commands complete. +*/ +spin_lock_irqsave (shost->host_lock, flags); +if (shost->host_eh_scheduled) +if (scsi_host_set_state (shost,SHOST_RECOVERY )) +WARN_ON (scsi_host_set_state (shost,SHOST_CANCEL_RECOVERY )); +spin_unlock_irqrestore (shost->host_lock, flags); }/**
Greg Kroah-Hartman
maintainerPATCH 8/49 SCSI: fix hot unplug vs async scan race
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Williams <[email protected]>
commit 3b661a92e869ebe2358de8f4b3230ad84f7fce51 upstream.
The following crash results from cases where the end_device has been removed before scsi_sysfs_add_sdev has had a chance to run.
BUG: unable to handle kernel NULL pointer dereference at 0000000000000098 IP: [<ffffffff8115e100>] sysfs_create_dir+0x32/0xb6 ... Call Trace: [<ffffffff8125e4a8>] kobject_add_internal+0x120/0x1e3 [<ffffffff81075149>] ? trace_hardirqs_on+0xd/0xf [<ffffffff8125e641>] kobject_add_varg+0x41/0x50 [<ffffffff8125e70b>] kobject_add+0x64/0x66 [<ffffffff8131122b>] device_add+0x12d/0x63a [<ffffffff814b65ea>] ? _raw_spin_unlock_irqrestore+0x47/0x56 [<ffffffff8107de15>] ? module_refcount+0x89/0xa0 [<ffffffff8132f348>] scsi_sysfs_add_sdev+0x4e/0x28a [<ffffffff8132dcbb>] do_scan_async+0x9c/0x145
...teach scsi_sysfs_add_devices() to check for deleted devices() before trying to add them, and teach scsi_remove_target() how to remove targets that have not been added via device_add().
--- drivers/scsi/scsi_scan.c | 3 +++ drivers/scsi/scsi_sysfs.c | 41 ++++++++++++++++++++++++++--------------- 2 files changed, 29 insertions(+), 15 deletions(-)
drivers/scsi/scsi_scan.c +3 -0
@@ -1710,6 +1710,9 @@ static void scsi_sysfs_add_devices(struc {struct scsi_device *sdev;shost_for_each_device (sdev, shost) { +/* target removed before the device could be added */ +if (sdev->sdev_state ==SDEV_DEL ) +continue ;if (!scsi_host_scan_allowed (shost) ||scsi_sysfs_add_sdev (sdev) !=0 )__scsi_remove_device (sdev);
drivers/scsi/scsi_sysfs.c +26 -15
61 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 9/49 SCSI: Avoid dangling pointer in scsi_requeue_command()
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit 940f5d47e2f2e1fa00443921a0abf4822335b54d upstream.
When we call scsi_unprep_request() the command associated with the request gets destroyed and therefore drops its reference on the device. If this was the only reference, the device may get released and we end up with a NULL pointer deref when we call blk_requeue_request.
--- drivers/scsi/scsi_lib.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/scsi/scsi_lib.c +11 -0
@@ -481,15 +481,26 @@ void scsi_requeue_run_queue(struct work_*/ static void scsi_requeue_command (struct request_queue *q,struct scsi_cmnd *cmd) { +struct scsi_device *sdev = cmd->device;struct request *req = cmd->request;unsigned long flags; +/* +* We need to hold a reference on the device to avoid the queue being +* killed after the unlock and before scsi_run_queue is invoked which +* may happen because scsi_unprep_request() puts the command which +* releases its reference on the device. +*/ +get_device (&sdev->sdev_gendev); +spin_lock_irqsave (q->queue_lock, flags);scsi_unprep_request (req);blk_requeue_request (q, req);spin_unlock_irqrestore (q->queue_lock, flags);scsi_run_queue (q); + +put_device (&sdev->sdev_gendev); }void scsi_next_command (struct scsi_cmnd *cmd)
Greg Kroah-Hartman
maintainerPATCH 10/49 ARM: OMAP2+: OPP: Fix to ensure check of right oppdef after bad one
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nishanth Menon <[email protected]>
commit b110547e586eb5825bc1d04aa9147bff83b57672 upstream.
Commit 9fa2df6b90786301b175e264f5fa9846aba81a65
(ARM: OMAP2+: OPP: allow OPP enumeration to continue if device is not present) makes the logic:
for (i = 0; i < opp_def_size; i++) {
<snip>
if (!oh || !oh->od) {
<snip>
continue;
}<snip>
opp_def++;
}
In short, the moment we hit a "Bad OPP", we end up looping the list comparing against the bad opp definition pointer for the rest of the iteration count. Instead, increment opp_def in the for loop itself and allow continue to be used in code without much thought so that we check the next set of OPP definition pointers :)
--- arch/arm/mach-omap2/opp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm/mach-omap2/opp.c +1 -2
@@ -53,7 +53,7 @@ int __init omap_init_opp_table(struct om omap_table_init =1 ;/* Lets now register with OPP library */ -for (i =0 ; i < opp_def_size; i++) { +for (i =0 ; i < opp_def_size; i++, opp_def++) {struct omap_hwmod *oh;struct device *dev;
@@ -86,7 +86,6 @@ int __init omap_init_opp_table(struct om __func__, opp_def->freq, opp_def->hwmod_name, i, r); } - opp_def++; }return 0 ;
Greg Kroah-Hartman
maintainerPATCH 11/49 ALSA: hda - Add support for Realtek ALC282
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Henningsson <[email protected]>
commit 4e01ec636e64707d202a1ca21a47bbc6d53085b7 upstream.
This codec has a separate dmic path (separate dmic only ADC), and thus it looks mostly like ALC275.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -20133,6 +20133,7 @@ static const struct hda_codec_preset snd { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, { .id = 0x10ec0276, .name = "ALC276", .patch = patch_alc269 }, { .id = 0x10ec0280, .name = "ALC280", .patch = patch_alc269 }, + { .id = 0x10ec0282, .name = "ALC282", .patch = patch_alc269 }, { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", .patch = patch_alc861 }, { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
Greg Kroah-Hartman
maintainerPATCH 12/49 usbdevfs: Correct amount of data copied to user in processcompl_compat
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit 2102e06a5f2e414694921f23591f072a5ba7db9f upstream.
iso data buffers may have holes in them if some packets were short, so for iso urbs we should always copy the entire buffer, just like the regular processcompl does.
--- drivers/usb/core/devio.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/usb/core/devio.c +7 -3
@@ -1557,10 +1557,14 @@ static int processcompl_compat(struct asvoid __user *addr = as->userurb;unsigned int i; -if (as->userbuffer && urb->actual_length) -if (copy_to_user (as->userbuffer, urb->transfer_buffer, - urb->actual_length)) +if (as->userbuffer && urb->actual_length) { +if (urb->number_of_packets >0 )/* Isochronous */ + i = urb->transfer_buffer_length; +else /* Non-Isoc */ + i = urb->actual_length; +if (copy_to_user (as->userbuffer, urb->transfer_buffer, i))return -EFAULT ; + }if (put_user (as->status, &userurb->status))return -EFAULT ;if (put_user (urb->actual_length, &userurb->actual_length))
Greg Kroah-Hartman
maintainerPATCH 13/49 usb: gadget: Fix g_ether interface link status
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kevin Cernekee <[email protected]>
commit 31bde1ceaa873bcaecd49e829bfabceacc4c512d upstream.
A "usb0" interface that has never been connected to a host has an unknown operstate, and therefore the IFF_RUNNING flag is (incorrectly) asserted when queried by ifconfig, ifplugd, etc. This is a result of calling netif_carrier_off() too early in the probe function; it should be called after register_netdev().
Similar problems have been fixed in many other drivers, e.g.:
e826eafa6 (bonding: Call netif_carrier_off after register_netdevice) 0d672e9f8 (drivers/net: Call netif_carrier_off at the end of the probe) 6a3c869a6 (cxgb4: fix reported state of interfaces without link)
Fix is to move netif_carrier_off() to the end of the function.
--- drivers/usb/gadget/u_ether.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/usb/gadget/u_ether.c +6 -6
@@ -803,12 +803,6 @@ int gether_setup(struct usb_gadget *g, uSET_ETHTOOL_OPS (net, &ops); -/* two kinds of host-initiated state changes: -* - iff DATA transfer is active, carrier is "on" -* - tx queueing enabled if open *and* carrier is "on" -*/ -netif_carrier_off (net); - dev->gadget = g;SET_NETDEV_DEV (net, &g->dev);SET_NETDEV_DEVTYPE (net, &gadget_type);
@@ -822,6 +816,12 @@ int gether_setup(struct usb_gadget *g, uINFO (dev,"HOST MAC %pM\n" , dev->host_mac); the_dev = dev; + +/* two kinds of host-initiated state changes: +* - iff DATA transfer is active, carrier is "on" +* - tx queueing enabled if open *and* carrier is "on" +*/ +netif_carrier_off (net); }return status;
Greg Kroah-Hartman
maintainerPATCH 14/49 locks: fix checking of fcntl_setlease argument
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: "J. Bruce Fields" <[email protected]>
commit 0ec4f431eb56d633da3a55da67d5c4b88886ccc7 upstream.
The only checks of the long argument passed to fcntl(fd,F_SETLEASE,.) are done after converting the long to an int. Thus some illegal values may be let through and cause problems in later code.
[ They actually *don't* cause problems in mainline, as of Dave Jones's
commit 8d657eb3b438 "Remove easily user-triggerable BUG from generic_setlease", but we should fix this anyway. And this patch will be necessary to fix real bugs on earlier kernels. ]
--- fs/locks.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/locks.c +3 -3
@@ -315,7 +315,7 @@ static int flock_make_lock(struct file *return 0 ; } -static int assign_type (struct file_lock *fl,int type) +static int assign_type (struct file_lock *fl,long type) {switch (type) {case F_RDLCK :
@@ -452,7 +452,7 @@ static const struct lock_manager_operati/* * Initialize a lease, use the default lock manager operations */ -static int lease_init (struct file *filp,int type,struct file_lock *fl) +static int lease_init (struct file *filp,long type,struct file_lock *fl) {if (assign_type (fl, type) !=0 )return -EINVAL ;
@@ -470,7 +470,7 @@ static int lease_init(struct file *filp, }/* Allocate a file_lock initialised to this type of lease */ -static struct file_lock *lease_alloc (struct file *filp,int type) +static struct file_lock *lease_alloc (struct file *filp,long type) {struct file_lock *fl =locks_alloc_lock ();int error = -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 15/49 ftrace: Disable function tracing during suspend/resume and hibernation, again
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Srivatsa S. Bhat" <[email protected]>
commit 443772d408a25af62498793f6f805ce3c559309a upstream.
If function tracing is enabled for some of the low-level suspend/resume functions, it leads to triple fault during resume from suspend, ultimately ending up in a reboot instead of a resume (or a total refusal to come out of suspended state, on some machines).
This issue was explained in more detail in commit f42ac38c59e0a03d (ftrace:
disable tracing for suspend to ram). However, the changes made by that commit got reverted by commit cbe2f5a6e84eebb (tracing: allow tracing of suspend/resume & hibernation code again). So, unfortunately since things are not yet robust enough to allow tracing of low-level suspend/resume functions, suspend/resume is still broken when ftrace is enabled.
So fix this by disabling function tracing during suspend/resume & hibernation.
--- kernel/power/hibernate.c | 6 ++++++ kernel/power/suspend.c | 3 +++ 2 files changed, 9 insertions(+)
kernel/power/hibernate.c +6 -0
@@ -344,6 +344,7 @@ int hibernation_snapshot(int platform_mo goto Complete_devices;suspend_console (); +ftrace_stop ();pm_restrict_gfp_mask (); error =dpm_suspend (PMSG_FREEZE );if (error)
@@ -369,6 +370,7 @@ int hibernation_snapshot(int platform_moif (error || !in_suspend)pm_restore_gfp_mask (); +ftrace_start ();resume_console (); Complete_devices:
@@ -471,6 +473,7 @@ int hibernation_restore(int platform_modpm_prepare_console ();suspend_console (); +ftrace_stop ();pm_restrict_gfp_mask (); error =dpm_suspend_start (PMSG_QUIESCE );if (!error) {
@@ -478,6 +481,7 @@ int hibernation_restore(int platform_moddpm_resume_end (PMSG_RECOVER ); }pm_restore_gfp_mask (); +ftrace_start ();resume_console ();pm_restore_console ();return error;
@@ -504,6 +508,7 @@ int hibernation_platform_enter(void) entering_platform_hibernation = true;suspend_console (); +ftrace_stop (); error =dpm_suspend_start (PMSG_HIBERNATE );if (error) {if (hibernation_ops->recover)
@@ -547,6 +552,7 @@ int hibernation_platform_enter(void) Resume_devices: entering_platform_hibernation = false;dpm_resume_end (PMSG_RESTORE ); +ftrace_start ();resume_console (); Close:
kernel/power/suspend.c +3 -0
@@ -23,6 +23,7 @@#include <linux/slab.h> #include <linux/suspend.h> #include <linux/syscore_ops.h> +#include <linux/ftrace.h> #include <trace/events/power.h> #include "power.h"
@@ -210,6 +211,7 @@ int suspend_devices_and_enter(suspend_st goto Close; }suspend_console (); +ftrace_stop ();suspend_test_start (); error =dpm_suspend_start (PMSG_SUSPEND );if (error) {
@@ -226,6 +228,7 @@ int suspend_devices_and_enter(suspend_stsuspend_test_start ();dpm_resume_end (PMSG_RESUME );suspend_test_finish ("resume devices" ); +ftrace_start ();resume_console (); Close:if (suspend_ops->end)
Greg Kroah-Hartman
maintainerPATCH 16/49 stable: update references to older 2.6 versions for 3.x
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Gortmaker <[email protected]>
commit 2584f5212d97b664be250ad5700a2d0fee31a10d upstream.
Also add information on where the respective trees are.
--- Documentation/stable_kernel_rules.txt | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
Documentation/stable_kernel_rules.txt +14 -5
@@ -1,4 +1,4 @@ -Everything you ever wanted to know about Linux 2.6 -stable releases. +Everything you ever wanted to know about Linux -stable releases. Rules on what kind of patches are accepted, and which ones are not, into the "-stable" tree:
@@ -41,10 +41,10 @@ Procedure for submitting patches to the cherry-picked than this can be specified in the following format in the sign-off area: - Cc: <[email protected]> # .32.x: a1f84a3: sched: Check for idle - Cc: <[email protected]> # .32.x: 1b9508f: sched: Rate-limit newidle - Cc: <[email protected]> # .32.x: fd21073: sched: Fix affinity logic - Cc: <[email protected]> # .32.x + Cc: <[email protected]> # 3.3.x: a1f84a3: sched: Check for idle + Cc: <[email protected]> # 3.3.x: 1b9508f: sched: Rate-limit newidle + Cc: <[email protected]> # 3.3.x: fd21073: sched: Fix affinity logic + Cc: <[email protected]> # 3.3.x Signed-off-by: Ingo Molnar <[email protected]> The tag sequence has the meaning of:
@@ -78,6 +78,15 @@ Review cycle: security kernel team, and not go through the normal review cycle. Contact the kernel security team for more details on this procedure. +Trees: + + - The queues of patches, for both completed versions and in progress + versions can be found at: + http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git + - The finalized and tagged releases of all stable kernels can be found + in separate branches per version at: + http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git + Review committee:
Greg Kroah-Hartman
maintainerPATCH 17/49 workqueue: perform cpu down operations from low priority cpu_notifier()
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit 6575820221f7a4dd6eadecf7bf83cdd154335eda upstream.
Currently, all workqueue cpu hotplug operations run off CPU_PRI_WORKQUEUE which is higher than normal notifiers. This is to ensure that workqueue is up and running while bringing up a CPU before other notifiers try to use workqueue on the CPU.
Per-cpu workqueues are supposed to remain working and bound to the CPU for normal CPU_DOWN_PREPARE notifiers. This holds mostly true even with workqueue offlining running with higher priority because workqueue CPU_DOWN_PREPARE only creates a bound trustee thread which runs the per-cpu workqueue without concurrency management without explicitly detaching the existing workers.
However, if the trustee needs to create new workers, it creates unbound workers which may wander off to other CPUs while CPU_DOWN_PREPARE notifiers are in progress. Furthermore, if the CPU down is cancelled, the per-CPU workqueue may end up with workers which aren't bound to the CPU.
While reliably reproducible with a convoluted artificial test-case involving scheduling and flushing CPU burning work items from CPU down notifiers, this isn't very likely to happen in the wild, and, even when it happens, the effects are likely to be hidden by the following successful CPU down.
Fix it by using different priorities for up and down notifiers - high priority for up operations and low priority for down operations.
Workqueue cpu hotplug operations will soon go through further cleanup.
--- include/linux/cpu.h | 5 +++-- kernel/workqueue.c | 38 +++++++++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 3 deletions(-)
include/linux/cpu.h +3 -2
@@ -66,8 +66,9 @@ enum {/* migration should happen before other stuff but after perf */ CPU_PRI_PERF =20 ,CPU_PRI_MIGRATION =10 , -/* prepare workqueues for other notifiers */ - CPU_PRI_WORKQUEUE = 5, +/* bring up workqueues before normal notifiers and down after */ +CPU_PRI_WORKQUEUE_UP =5 , + CPU_PRI_WORKQUEUE_DOWN = -5, };#ifdef CONFIG_SMP
kernel/workqueue.c +37 -1
@@ -3561,6 +3561,41 @@ static int __devinit workqueue_cpu_callbreturn notifier_from_errno (0 ); } +/* +* Workqueues should be brought up before normal priority CPU notifiers. +* This will be registered high priority CPU notifier. +*/ +static int __devinit workqueue_cpu_up_callback (struct notifier_block *nfb, +unsigned long action, +void *hcpu) +{ +switch (action & ~CPU_TASKS_FROZEN ) { +case CPU_UP_PREPARE : +case CPU_UP_CANCELED : +case CPU_DOWN_FAILED : +case CPU_ONLINE : +return workqueue_cpu_callback (nfb, action, hcpu); + } +return NOTIFY_OK ; +} + +/* +* Workqueues should be brought down after normal priority CPU notifiers. +* This will be registered as low priority CPU notifier. +*/ +static int __devinit workqueue_cpu_down_callback (struct notifier_block *nfb, +unsigned long action, +void *hcpu) +{ +switch (action & ~CPU_TASKS_FROZEN ) { +case CPU_DOWN_PREPARE : +case CPU_DYING : +case CPU_POST_DEAD : +return workqueue_cpu_callback (nfb, action, hcpu); + } +return NOTIFY_OK ; +} +#ifdef CONFIG_SMP struct work_for_cpu {
@@ -3754,7 +3789,8 @@ static int __init init_workqueues(void)unsigned int cpu;int i; -cpu_notifier (workqueue_cpu_callback,CPU_PRI_WORKQUEUE ); +cpu_notifier (workqueue_cpu_up_callback,CPU_PRI_WORKQUEUE_UP ); +cpu_notifier (workqueue_cpu_down_callback,CPU_PRI_WORKQUEUE_DOWN );/* initialize gcwqs */ for_each_gcwq_cpu (cpu) {
Greg Kroah-Hartman
maintainerPATCH 18/49 ACPI/AC: prevent OOPS on some boxes due to missing check power_supply_register() return value check
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lan Tianyu <[email protected]>
commit f197ac13f6eeb351b31250b9ab7d0da17434ea36 upstream.
In the ac.c, power_supply_register()'s return value is not checked.
As a result, the driver's add() ops may return success even though the device failed to initialize.
For example, some BIOS may describe two ACADs in the same DSDT. The second ACAD device will fail to register,
but ACPI driver's add() ops returns sucessfully.
The ACPI device will receive ACPI notification and cause OOPS.
https://bugzilla.redhat.com/show_bug.cgi?id=772730
--- drivers/acpi/ac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/acpi/ac.c +3 -1
@@ -292,7 +292,9 @@ static int acpi_ac_add(struct acpi_devic ac->charger.properties = ac_props; ac->charger.num_properties =ARRAY_SIZE (ac_props); ac->charger.get_property = get_ac_property; -power_supply_register (&ac->device->dev, &ac->charger); + result =power_supply_register (&ac->device->dev, &ac->charger); +if (result) + goto end; printk(KERN_INFO PREFIX "%s [%s] (%s)\n", acpi_device_name(device), acpi_device_bid(device),
Greg Kroah-Hartman
maintainerPATCH 19/49 Btrfs: call the ordered free operation without any locks held
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <[email protected]>
commit e9fbcb42201c862fd6ab45c48ead4f47bb2dea9d upstream.
Each ordered operation has a free callback, and this was called with the worker spinlock held. Josef made the free callback also call iput, which we can't do with the spinlock.
This drops the spinlock for the free operation and grabs it again before moving through the rest of the list. We'll circle back around to this and find a cleaner way that doesn't bounce the lock around so much.
--- fs/btrfs/async-thread.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
fs/btrfs/async-thread.c +8 -1
@@ -212,10 +212,17 @@ static noinline int run_ordered_completi work->ordered_func (work); -/* now take the lock again and call the freeing code */ +/* now take the lock again and drop our item from the list */ spin_lock (&workers->order_lock);list_del (&work->order_list); +spin_unlock (&workers->order_lock); + +/* +* we don't want to call the ordered free functions +* with the lock held though +*/ work->ordered_free (work); +spin_lock (&workers->order_lock); }spin_unlock (&workers->order_lock);
Greg Kroah-Hartman
maintainerPATCH 20/49 drm/radeon: Try harder to avoid HW cursor ending on a multiple of 128 columns.
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michel Dänzer <[email protected]>
commit f60ec4c7df043df81e62891ac45383d012afe0da upstream.
This could previously fail if either of the enabled displays was using a horizontal resolution that is a multiple of 128, and only the leftmost column of the cursor was (supposed to be) visible at the right edge of that display.
The solution is to move the cursor one pixel to the left in that case.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=33183
--- drivers/gpu/drm/radeon/radeon_cursor.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_cursor.c +7 -1
@@ -257,8 +257,14 @@ int radeon_crtc_cursor_move(struct drm_cif (!(cursor_end &0x7f )) w--; } -if (w <=0 ) +if (w <=0 ) { w =1 ; + cursor_end = x - xorigin + w; +if (!(cursor_end &0x7f )) { + x--; +WARN_ON_ONCE (x <0 ); + } + } } }
Greg Kroah-Hartman
maintainerPATCH 21/49 drm/radeon: fix non revealent error message
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jerome Glisse <[email protected]>
commit 8d1c702aa0b2c4b22b0742b72a1149d91690674b upstream.
We want to print link status query failed only if it's an unexepected fail. If we query to see if we need link training it might be because there is nothing connected and thus link status query have the right to fail in that case.
To avoid printing failure when it's expected, move the failure message to proper place.
--- drivers/gpu/drm/radeon/atombios_dp.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/radeon/atombios_dp.c +7 -3
@@ -22,6 +22,7 @@* * Authors: Dave Airlie * Alex Deucher +* Jerome Glisse */ #include "drmP.h" #include "radeon_drm.h"
@@ -624,7 +625,6 @@ static bool radeon_dp_get_link_status(st ret =radeon_dp_aux_native_read (radeon_connector,DP_LANE0_1_STATUS , link_status,DP_LINK_STATUS_SIZE ,100 );if (ret <=0 ) { -DRM_ERROR ("displayport link status failed\n" );return false; }
@@ -797,8 +797,10 @@ static int radeon_dp_link_train_cr(strucelse mdelay (dp_info->rd_interval *4 ); -if (!radeon_dp_get_link_status (dp_info->radeon_connector, dp_info->link_status)) +if (!radeon_dp_get_link_status (dp_info->radeon_connector, dp_info->link_status)) { +DRM_ERROR ("displayport link status failed\n" );break ; + }if (dp_clock_recovery_ok (dp_info->link_status, dp_info->dp_lane_count)) { clock_recovery = true;
@@ -860,8 +862,10 @@ static int radeon_dp_link_train_ce(strucelse mdelay (dp_info->rd_interval *4 ); -if (!radeon_dp_get_link_status (dp_info->radeon_connector, dp_info->link_status)) +if (!radeon_dp_get_link_status (dp_info->radeon_connector, dp_info->link_status)) { +DRM_ERROR ("displayport link status failed\n" );break ; + }if (dp_channel_eq_ok (dp_info->link_status, dp_info->dp_lane_count)) { channel_eq = true;
Greg Kroah-Hartman
maintainerPATCH 22/49 drm/radeon: fix hotplug of DP to DVI|HDMI passive adapters (v2)
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jerome Glisse <[email protected]>
commit 266dcba541a1ef7e5d82d9e67c67fde2910636e8 upstream.
No need to retrain the link for passive adapters.
v2: agd5f
- no passive DP to VGA adapters, update comments
- assign radeon_connector_atom_dig after we are sure we have a digital connector as analog connectors have different private data.
- get new sink type before checking for retrain. No need to check if it's no longer a DP connection.
--- drivers/gpu/drm/radeon/radeon_connectors.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-)
drivers/gpu/drm/radeon/radeon_connectors.c +20 -7
@@ -66,14 +66,27 @@ void radeon_connector_hotplug(struct drm/* just deal with DP (not eDP) here. */ if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) { -int saved_dpms = connector->dpms; +struct radeon_connector_atom_dig *dig_connector = + radeon_connector->con_priv; -/* Only turn off the display it it's physically disconnected */ -if (!radeon_hpd_sense (rdev, radeon_connector->hpd.hpd)) -drm_helper_connector_dpms (connector,DRM_MODE_DPMS_OFF ); -else if (radeon_dp_needs_link_train (radeon_connector)) -drm_helper_connector_dpms (connector,DRM_MODE_DPMS_ON ); - connector->dpms = saved_dpms; +/* if existing sink type was not DP no need to retrain */ +if (dig_connector->dp_sink_type !=CONNECTOR_OBJECT_ID_DISPLAYPORT ) +return ; + +/* first get sink type as it may be reset after (un)plug */ + dig_connector->dp_sink_type =radeon_dp_getsinktype (radeon_connector); +/* don't do anything if sink is not display port, i.e., +* passive dp->(dvi|hdmi) adaptor +*/ +if (dig_connector->dp_sink_type ==CONNECTOR_OBJECT_ID_DISPLAYPORT ) { +int saved_dpms = connector->dpms; +/* Only turn off the display if it's physically disconnected */ +if (!radeon_hpd_sense (rdev, radeon_connector->hpd.hpd)) +drm_helper_connector_dpms (connector,DRM_MODE_DPMS_OFF ); +else if (radeon_dp_needs_link_train (radeon_connector)) +drm_helper_connector_dpms (connector,DRM_MODE_DPMS_ON ); + connector->dpms = saved_dpms; + } } }
Greg Kroah-Hartman
maintainerPATCH 23/49 drm/radeon: on hotplug force link training to happen (v2)
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jerome Glisse <[email protected]>
commit ca2ccde5e2f24a792caa4cca919fc5c6f65d1887 upstream.
To have DP behave like VGA/DVI we need to retrain the link on hotplug. For this to happen we need to force link training to happen by setting connector dpms to off before asking it turning it on again.
v2: agd5f
- drop the dp_get_link_status() change in atombios_dp.c for now. We still need the dpms OFF change.
--- drivers/gpu/drm/radeon/radeon_connectors.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_connectors.c +8 -2
@@ -81,10 +81,16 @@ void radeon_connector_hotplug(struct drmif (dig_connector->dp_sink_type ==CONNECTOR_OBJECT_ID_DISPLAYPORT ) {int saved_dpms = connector->dpms;/* Only turn off the display if it's physically disconnected */ -if (!radeon_hpd_sense (rdev, radeon_connector->hpd.hpd)) +if (!radeon_hpd_sense (rdev, radeon_connector->hpd.hpd)) {drm_helper_connector_dpms (connector,DRM_MODE_DPMS_OFF ); -else if (radeon_dp_needs_link_train (radeon_connector)) + }else if (radeon_dp_needs_link_train (radeon_connector)) { +/* set it to OFF so that drm_helper_connector_dpms() +* won't return immediately since the current state +* is ON at this point. +*/ + connector->dpms =DRM_MODE_DPMS_OFF ;drm_helper_connector_dpms (connector,DRM_MODE_DPMS_ON ); + } connector->dpms = saved_dpms; } }
Greg Kroah-Hartman
maintainerPATCH 24/49 nfsd4: our filesystems are normally case sensitive
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: "J. Bruce Fields" <[email protected]>
commit 2930d381d22b9c56f40dd4c63a8fa59719ca2c3c upstream.
Actually, xfs and jfs can optionally be case insensitive; we'll handle that case in later patches.
--- fs/nfsd/nfs4xdr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/nfs4xdr.c +1 -1
@@ -2010,7 +2010,7 @@ out_acl:if (bmval0 &FATTR4_WORD0_CASE_INSENSITIVE ) {if ((buflen -=4 ) <0 ) goto out_resource; -WRITE32 (1 ); +WRITE32 (0 ); }if (bmval0 &FATTR4_WORD0_CASE_PRESERVING ) {if ((buflen -=4 ) <0 )
Greg Kroah-Hartman
maintainerPATCH 25/49 nfs: skip commit in releasepage if were freeing memory for fs-related reasons
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
commit 5cf02d09b50b1ee1c2d536c9cf64af5a7d433f56 upstream.
We've had some reports of a deadlock where rpciod ends up with a stack trace like this:
PID: 2507 TASK: ffff88103691ab40 CPU: 14 COMMAND: "rpciod/14"
#0 [ffff8810343bf2f0] schedule at ffffffff814dabd9
#1 [ffff8810343bf3b8] nfs_wait_bit_killable at ffffffffa038fc04 [nfs]
#2 [ffff8810343bf3c8] __wait_on_bit at ffffffff814dbc2f
#3 [ffff8810343bf418] out_of_line_wait_on_bit at ffffffff814dbcd8
#4 [ffff8810343bf488] nfs_commit_inode at ffffffffa039e0c1 [nfs]
#5 [ffff8810343bf4f8] nfs_release_page at ffffffffa038bef6 [nfs]
#6 [ffff8810343bf528] try_to_release_page at ffffffff8110c670
#7 [ffff8810343bf538] shrink_page_list.clone.0 at ffffffff81126271
#8 [ffff8810343bf668] shrink_inactive_list at ffffffff81126638
#9 [ffff8810343bf818] shrink_zone at ffffffff8112788f
#10 [ffff8810343bf8c8] do_try_to_free_pages at ffffffff81127b1e
#11 [ffff8810343bf958] try_to_free_pages at ffffffff8112812f
#12 [ffff8810343bfa08] __alloc_pages_nodemask at ffffffff8111fdad
#13 [ffff8810343bfb28] kmem_getpages at ffffffff81159942
#14 [ffff8810343bfb58] fallback_alloc at ffffffff8115a55a
#15 [ffff8810343bfbd8] ____cache_alloc_node at ffffffff8115a2d9
#16 [ffff8810343bfc38] kmem_cache_alloc at ffffffff8115b09b
#17 [ffff8810343bfc78] sk_prot_alloc at ffffffff81411808
#18 [ffff8810343bfcb8] sk_alloc at ffffffff8141197c
#19 [ffff8810343bfce8] inet_create at ffffffff81483ba6
#20 [ffff8810343bfd38] __sock_create at ffffffff8140b4a7
#21 [ffff8810343bfd98] xs_create_sock at ffffffffa01f649b [sunrpc]
#22 [ffff8810343bfdd8] xs_tcp_setup_socket at ffffffffa01f6965 [sunrpc]
#23 [ffff8810343bfe38] worker_thread at ffffffff810887d0
#24 [ffff8810343bfee8] kthread at ffffffff8108dd96
#25 [ffff8810343bff48] kernel_thread at ffffffff8100c1carpciod is trying to allocate memory for a new socket to talk to the server. The VM ends up calling ->releasepage to get more memory, and it tries to do a blocking commit. That commit can't succeed however without a connected socket, so we deadlock.
Fix this by setting PF_FSTRANS on the workqueue task prior to doing the socket allocation, and having nfs_release_page check for that flag when deciding whether to do a commit call. Also, set PF_FSTRANS unconditionally in rpc_async_schedule since that function can also do allocations sometimes.
--- fs/nfs/file.c | 7 +++++-- net/sunrpc/sched.c | 2 ++ net/sunrpc/xprtrdma/transport.c | 3 ++- net/sunrpc/xprtsock.c | 10 ++++++++++ 4 files changed, 19 insertions(+), 3 deletions(-)
fs/nfs/file.c +5 -2
@@ -493,8 +493,11 @@ static int nfs_release_page(struct pagedfprintk (PAGECACHE ,"NFS: release_page(%p)\n" , page); -/* Only do I/O if gfp is a superset of GFP_KERNEL */ -if (mapping && (gfp &GFP_KERNEL ) ==GFP_KERNEL ) { +/* Only do I/O if gfp is a superset of GFP_KERNEL, and we're not +* doing this memory reclaim for a fs-related allocation. +*/ +if (mapping && (gfp &GFP_KERNEL ) ==GFP_KERNEL && + !(current->flags &PF_FSTRANS )) {int how =FLUSH_SYNC ;/* Don't let kswapd deadlock waiting for OOM RPC calls */
net/sunrpc/sched.c +2 -0
@@ -713,7 +713,9 @@ void rpc_execute(struct rpc_task *task)static void rpc_async_schedule (struct work_struct *work) { + current->flags |=PF_FSTRANS ; __rpc_execute(container_of(work, struct rpc_task, u.tk_work)); + current->flags &= ~PF_FSTRANS ; }/**
net/sunrpc/xprtrdma/transport.c +2 -1
@@ -200,6 +200,7 @@ xprt_rdma_connect_worker(struct work_strint rc =0 ;if (!xprt->shutdown) { + current->flags |=PF_FSTRANS ;xprt_clear_connected (xprt); dprintk("RPC: %s: %sconnect\n", __func__,
@@ -212,10 +213,10 @@ xprt_rdma_connect_worker(struct work_str out:xprt_wake_pending_tasks (xprt, rc); - out_clear:dprintk ("RPC: %s: exit\n" , __func__);xprt_clear_connecting (xprt); + current->flags &= ~PF_FSTRANS ; }/*
net/sunrpc/xprtsock.c +10 -0
@@ -1882,6 +1882,8 @@ static void xs_local_setup_socket(structif (xprt->shutdown) goto out; + current->flags |=PF_FSTRANS ; +clear_bit (XPRT_CONNECTION_ABORT , &xprt->state); status =__sock_create (xprt->xprt_net,AF_LOCAL ,SOCK_STREAM ,0 , &sock,1 );
@@ -1915,6 +1917,7 @@ static void xs_local_setup_socket(struct out:xprt_clear_connecting (xprt);xprt_wake_pending_tasks (xprt, status); + current->flags &= ~PF_FSTRANS ; }static void xs_udp_finish_connecting (struct rpc_xprt *xprt,struct socket *sock)
@@ -1957,6 +1960,8 @@ static void xs_udp_setup_socket(struct wif (xprt->shutdown) goto out; + current->flags |=PF_FSTRANS ; +/* Start by resetting any existing state */ xs_reset_transport (transport); sock = xs_create_sock(xprt, transport,
@@ -1975,6 +1980,7 @@ static void xs_udp_setup_socket(struct w out:xprt_clear_connecting (xprt);xprt_wake_pending_tasks (xprt, status); + current->flags &= ~PF_FSTRANS ; }/*
@@ -2100,6 +2106,8 @@ static void xs_tcp_setup_socket(struct wif (xprt->shutdown) goto out; + current->flags |=PF_FSTRANS ; +if (!sock) {clear_bit (XPRT_CONNECTION_ABORT , &xprt->state); sock = xs_create_sock(xprt, transport,
@@ -2149,6 +2157,7 @@ static void xs_tcp_setup_socket(struct wcase -EINPROGRESS :case -EALREADY :xprt_clear_connecting (xprt); + current->flags &= ~PF_FSTRANS ;return ;case -EINVAL :/* Happens, for instance, if the user specified a link
@@ -2161,6 +2170,7 @@ out_eagain: out:xprt_clear_connecting (xprt);xprt_wake_pending_tasks (xprt, status); + current->flags &= ~PF_FSTRANS ; }/**
Greg Kroah-Hartman
maintainerPATCH 26/49 ext4: pass a char * to ext4_count_free() instead of a buffer_head ptr
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit f6fb99cadcd44660c68e13f6eab28333653621e6 upstream.
Make it possible for ext4_count_free to operate on buffers and not just data in buffer_heads.
--- fs/ext4/balloc.c | 3 ++- fs/ext4/bitmap.c | 8 +++----- fs/ext4/ext4.h | 2 +- fs/ext4/ialloc.c | 3 ++- 4 files changed, 8 insertions(+), 8 deletions(-)
fs/ext4/balloc.c +2 -1
@@ -514,7 +514,8 @@ ext4_fsblk_t ext4_count_free_blocks(struif (bitmap_bh ==NULL )continue ; - x =ext4_count_free (bitmap_bh, sb->s_blocksize); + x =ext4_count_free (bitmap_bh->b_data, +EXT4_BLOCKS_PER_GROUP (sb) /8 );printk (KERN_DEBUG "group %u: stored = %d, counted = %u\n" , i,ext4_free_blks_count (sb, gdp), x); bitmap_count += x;
fs/ext4/bitmap.c +3 -5
@@ -15,15 +15,13 @@static const int nibblemap[] = {4 ,3 ,3 ,2 ,3 ,2 ,2 ,1 ,3 ,2 ,2 ,1 ,2 ,1 ,1 ,0 }; -unsigned int ext4_count_free (struct buffer_head *map,unsigned int numchars) +unsigned int ext4_count_free (char *bitmap,unsigned int numchars) {unsigned int i, sum =0 ; -if (!map) -return 0 ;for (i =0 ; i < numchars; i++) - sum += nibblemap[map->b_data[i] &0xf ] + - nibblemap[(map->b_data[i] >>4 ) &0xf ]; + sum += nibblemap[bitmap[i] &0xf ] + + nibblemap[(bitmap[i] >>4 ) &0xf ];return sum; }
fs/ext4/ext4.h +1 -1
@@ -1713,7 +1713,7 @@ struct mmpd_data {# define NORET_AND noreturn,/* bitmap.c */ -extern unsigned int ext4_count_free (struct buffer_head *,unsigned ); +extern unsigned int ext4_count_free (char *bitmap,unsigned numchars);/* balloc.c */ extern unsigned int ext4_block_group(struct super_block *sb,
fs/ext4/ialloc.c +2 -1
@@ -1193,7 +1193,8 @@ unsigned long ext4_count_free_inodes(strif (!bitmap_bh)continue ; - x =ext4_count_free (bitmap_bh,EXT4_INODES_PER_GROUP (sb) /8 ); + x =ext4_count_free (bitmap_bh->b_data, +EXT4_INODES_PER_GROUP (sb) /8 );printk (KERN_DEBUG "group %lu: stored = %d, counted = %lu\n" , (unsigned long ) i,ext4_free_inodes_count (sb, gdp), x); bitmap_count += x;
Greg Kroah-Hartman
maintainerPATCH 27/49 ext4: dont let i_reserved_meta_blocks go negative
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Foster <[email protected]>
commit 97795d2a5b8d3c8dc4365d4bd3404191840453ba upstream.
If we hit a condition where we have allocated metadata blocks that were not appropriately reserved, we risk underflow of ei->i_reserved_meta_blocks. In turn, this can throw sbi->s_dirtyclusters_counter significantly out of whack and undermine the nondelalloc fallback logic in ext4_nonda_switch(). Warn if this occurs and set i_allocated_meta_blocks to avoid this problem.
This condition is reproduced by xfstests 270 against ext2 with delalloc enabled:
Mar 28 08:58:02 localhost kernel: [ 171.526344] EXT4-fs (loop1): delayed block allocation failed for inode 14 at logical offset 64486 with max blocks 64 with error -28 Mar 28 08:58:02 localhost kernel: [ 171.526346] EXT4-fs (loop1): This should not happen!! Data will be lost
270 ultimately fails with an inconsistent filesystem and requires an fsck to repair. The cause of the error is an underflow in ext4_da_update_reserve_space() due to an unreserved meta block allocation.
--- fs/ext4/inode.c | 9 +++++++++ 1 file changed, 9 insertions(+)
fs/ext4/inode.c +9 -0
@@ -1134,6 +1134,15 @@ void ext4_da_update_reserve_space(struct used = ei->i_reserved_data_blocks; } +if (unlikely (ei->i_allocated_meta_blocks > ei->i_reserved_meta_blocks)) { +ext4_msg (inode->i_sb,KERN_NOTICE ,"%s: ino %lu, allocated %d " +"with only %d reserved metadata blocks\n" , __func__, + inode->i_ino, ei->i_allocated_meta_blocks, + ei->i_reserved_meta_blocks); +WARN_ON (1 ); + ei->i_allocated_meta_blocks = ei->i_reserved_meta_blocks; + } +/* Update per-inode reservations */ ei->i_reserved_data_blocks -= used; ei->i_reserved_meta_blocks -= ei->i_allocated_meta_blocks;
Greg Kroah-Hartman
maintainerPATCH 28/49 bnx2: Fix bug in bnx2_free_tx_skbs().
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Chan <[email protected]>
[ Upstream commit c1f5163de417dab01fa9daaf09a74bbb19303f3c ]
In rare cases, bnx2x_free_tx_skbs() can unmap the wrong DMA address when it gets to the last entry of the tx ring. We were not using the proper macro to skip the last entry when advancing the tx index.
--- drivers/net/bnx2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/bnx2.c +3 -3
@@ -5310,7 +5310,7 @@ bnx2_free_tx_skbs(struct bnx2 *bp)int k, last;if (skb ==NULL ) { - j++; + j =NEXT_TX_BD (j);continue ; }
@@ -5322,8 +5322,8 @@ bnx2_free_tx_skbs(struct bnx2 *bp) tx_buf->skb =NULL ; last = tx_buf->nr_frags; - j++; -for (k =0 ; k < last; k++, j++) { + j =NEXT_TX_BD (j); +for (k =0 ; k < last; k++, j =NEXT_TX_BD (j)) { tx_buf = &txr->tx_buf_ring[TX_RING_IDX (j)]; dma_unmap_page(&bp->pdev->dev, dma_unmap_addr(tx_buf, mapping),
Greg Kroah-Hartman
maintainerPATCH 29/49 sch_sfb: Fix missing NULL check
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Cox <[email protected]>
[ Upstream commit 7ac2908e4b2edaec60e9090ddb4d9ceb76c05e7d ]
Resolves-bug: https://bugzilla.kernel.org/show_bug.cgi?id=44461
--- net/sched/sch_sfb.c | 2 ++ 1 file changed, 2 insertions(+)
net/sched/sch_sfb.c +2 -0
@@ -556,6 +556,8 @@ static int sfb_dump(struct Qdisc *sch, s sch->qstats.backlog = q->qdisc->qstats.backlog; opts =nla_nest_start (skb,TCA_OPTIONS ); +if (opts ==NULL ) + goto nla_put_failure;NLA_PUT (skb,TCA_SFB_PARMS ,sizeof (opt), &opt);return nla_nest_end (skb, opts);
Greg Kroah-Hartman
maintainerPATCH 30/49 sctp: Fix list corruption resulting from freeing an association on a list
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Neil Horman <[email protected]>
[ Upstream commit 2eebc1e188e9e45886ee00662519849339884d6d ]
A few days ago Dave Jones reported this oops:
[22766.294255] general protection fault: 0000 [#1] PREEMPT SMP [22766.295376] CPU 0 [22766.295384] Modules linked in: [22766.387137] ffffffffa169f292 6b6b6b6b6b6b6b6b ffff880147c03a90 ffff880147c03a74 [22766.387135] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 00000000000 [22766.387136] Process trinity-watchdo (pid: 10896, threadinfo ffff88013e7d2000, [22766.387137] Stack: [22766.387140] ffff880147c03a10 [22766.387140] ffffffffa169f2b6 [22766.387140] ffff88013ed95728 [22766.387143] 0000000000000002 [22766.387143] 0000000000000000 [22766.387143] ffff880003fad062 [22766.387144] ffff88013c120000 [22766.387144] [22766.387145] Call Trace: [22766.387145] <IRQ> [22766.387150] [<ffffffffa169f292>] ? __sctp_lookup_association+0x62/0xd0 [sctp] [22766.387154] [<ffffffffa169f2b6>] __sctp_lookup_association+0x86/0xd0 [sctp] [22766.387157] [<ffffffffa169f597>] sctp_rcv+0x207/0xbb0 [sctp] [22766.387161] [<ffffffff810d4da8>] ? trace_hardirqs_off_caller+0x28/0xd0 [22766.387163] [<ffffffff815827e3>] ? nf_hook_slow+0x133/0x210 [22766.387166] [<ffffffff815902fc>] ? ip_local_deliver_finish+0x4c/0x4c0 [22766.387168] [<ffffffff8159043d>] ip_local_deliver_finish+0x18d/0x4c0 [22766.387169] [<ffffffff815902fc>] ? ip_local_deliver_finish+0x4c/0x4c0 [22766.387171] [<ffffffff81590a07>] ip_local_deliver+0x47/0x80 [22766.387172] [<ffffffff8158fd80>] ip_rcv_finish+0x150/0x680 [22766.387174] [<ffffffff81590c54>] ip_rcv+0x214/0x320 [22766.387176] [<ffffffff81558c07>] __netif_receive_skb+0x7b7/0x910 [22766.387178] [<ffffffff8155856c>] ? __netif_receive_skb+0x11c/0x910 [22766.387180] [<ffffffff810d423e>] ? put_lock_stats.isra.25+0xe/0x40 [22766.387182] [<ffffffff81558f83>] netif_receive_skb+0x23/0x1f0 [22766.387183] [<ffffffff815596a9>] ? dev_gro_receive+0x139/0x440 [22766.387185] [<ffffffff81559280>] napi_skb_finish+0x70/0xa0 [22766.387187] [<ffffffff81559cb5>] napi_gro_receive+0xf5/0x130 [22766.387218] [<ffffffffa01c4679>] e1000_receive_skb+0x59/0x70 [e1000e] [22766.387242] [<ffffffffa01c5aab>] e1000_clean_rx_irq+0x28b/0x460 [e1000e] [22766.387266] [<ffffffffa01c9c18>] e1000e_poll+0x78/0x430 [e1000e] [22766.387268] [<ffffffff81559fea>] net_rx_action+0x1aa/0x3d0 [22766.387270] [<ffffffff810a495f>] ? account_system_vtime+0x10f/0x130 [22766.387273] [<ffffffff810734d0>] __do_softirq+0xe0/0x420 [22766.387275] [<ffffffff8169826c>] call_softirq+0x1c/0x30 [22766.387278] [<ffffffff8101db15>] do_softirq+0xd5/0x110 [22766.387279] [<ffffffff81073bc5>] irq_exit+0xd5/0xe0 [22766.387281] [<ffffffff81698b03>] do_IRQ+0x63/0xd0 [22766.387283] [<ffffffff8168ee2f>] common_interrupt+0x6f/0x6f [22766.387283] <EOI> [22766.387284] [22766.387285] [<ffffffff8168eed9>] ? retint_swapgs+0x13/0x1b [22766.387285] Code: c0 90 5d c3 66 0f 1f 44 00 00 4c 89 c8 5d c3 0f 1f 00 55 48
89 e5 48 83
ec 20 48 89 5d e8 4c 89 65 f0 4c 89 6d f8 66 66 66 66 90 <0f> b7 87 98 00 00 00 48 89 fb
49 89 f5 66 c1 c0 08 66 39 46 02
[22766.387307] [22766.387307] RIP [22766.387311] [<ffffffffa168a2c9>] sctp_assoc_is_match+0x19/0x90 [sctp] [22766.387311] RSP <ffff880147c039b0> [22766.387142] ffffffffa16ab120 [22766.599537] ---[ end trace 3f6dae82e37b17f5 ]--- [22766.601221] Kernel panic - not syncing: Fatal exception in interrupt
It appears from his analysis and some staring at the code that this is likely occuring because an association is getting freed while still on the sctp_assoc_hashtable. As a result, we get a gpf when traversing the hashtable while a freed node corrupts part of the list.
Nominally I would think that an mibalanced refcount was responsible for this, but I can't seem to find any obvious imbalance. What I did note however was that the two places where we create an association using sctp_primitive_ASSOCIATE (__sctp_connect and sctp_sendmsg), have failure paths which free a newly created association after calling sctp_primitive_ASSOCIATE. sctp_primitive_ASSOCIATE brings us into the sctp_sf_do_prm_asoc path, which issues a SCTP_CMD_NEW_ASOC side effect, which in turn adds a new association to the aforementioned hash table. the sctp command interpreter that process side effects has not way to unwind previously processed commands, so freeing the association from the __sctp_connect or sctp_sendmsg error path would lead to a freed association remaining on this hash table.
I've fixed this but modifying sctp_[un]hash_established to use hlist_del_init, which allows us to proerly use hlist_unhashed to check if the node is on a hashlist safely during a delete. That in turn alows us to safely call sctp_unhash_established in the __sctp_connect and sctp_sendmsg error paths before freeing them, regardles of what the associations state is on the hash list.
I noted, while I was doing this, that the __sctp_unhash_endpoint was using hlist_unhsashed in a simmilar fashion, but never nullified any removed nodes pointers to make that function work properly, so I fixed that up in a simmilar fashion.
I attempted to test this using a virtual guest running the SCTP_RR test from netperf in a loop while running the trinity fuzzer, both in a loop. I wasn't able to recreate the problem prior to this fix, nor was I able to trigger the failure after (neither of which I suppose is suprising). Given the trace above however, I think its likely that this is what we hit.
--- net/sctp/input.c | 7 ++----- net/sctp/socket.c | 12 ++++++++++-- 2 files changed, 12 insertions(+), 7 deletions(-)
net/sctp/input.c +2 -5
@@ -737,15 +737,12 @@ static void __sctp_unhash_endpoint(struc epb = &ep->base; -if (hlist_unhashed (&epb->node)) -return ; - epb->hashent =sctp_ep_hashfn (epb->bind_addr.port); head = &sctp_ep_hashtable[epb->hashent];sctp_write_lock (&head->lock); -__hlist_del (&epb->node); +hlist_del_init (&epb->node);sctp_write_unlock (&head->lock); }
@@ -826,7 +823,7 @@ static void __sctp_unhash_established(st head = &sctp_assoc_hashtable[epb->hashent];sctp_write_lock (&head->lock); -__hlist_del (&epb->node); +hlist_del_init (&epb->node);sctp_write_unlock (&head->lock); }
net/sctp/socket.c +10 -2
@@ -1160,8 +1160,14 @@ out_free:SCTP_DEBUG_PRINTK ("About to exit __sctp_connect() free asoc: %p" " kaddrs: %p err: %d\n" , asoc, kaddrs, err); -if (asoc) +if (asoc) { +/* sctp_primitive_ASSOCIATE may have added this association +* To the hash table, try to unhash it, just in case, its a noop +* if it wasn't hashed so we're safe +*/ +sctp_unhash_established (asoc);sctp_association_free (asoc); + }return err; }
@@ -1871,8 +1877,10 @@ SCTP_STATIC int sctp_sendmsg(struct kioc goto out_unlock; out_free: -if (new_asoc) +if (new_asoc) { +sctp_unhash_established (asoc);sctp_association_free (asoc); + } out_unlock:sctp_release_sock (sk);
Greg Kroah-Hartman
maintainerPATCH 31/49 caif: Fix access to freed pernet memory
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sjur Br�ndeland <[email protected]>
[ Upstream commit 96f80d123eff05c3cd4701463786b87952a6c3ac ]
unregister_netdevice_notifier() must be called before unregister_pernet_subsys() to avoid accessing already freed pernet memory. This fixes the following oops when doing rmmod:
Call Trace: [<ffffffffa0f802bd>] caif_device_notify+0x4d/0x5a0 [caif] [<ffffffff81552ba9>] unregister_netdevice_notifier+0xb9/0x100 [<ffffffffa0f86dcc>] caif_device_exit+0x1c/0x250 [caif] [<ffffffff810e7734>] sys_delete_module+0x1a4/0x300 [<ffffffff810da82d>] ? trace_hardirqs_on_caller+0x15d/0x1e0 [<ffffffff813517de>] ? trace_hardirqs_on_thunk+0x3a/0x3 [<ffffffff81696bad>] system_call_fastpath+0x1a/0x1f
RIP
[<ffffffffa0f7f561>] caif_get+0x51/0xb0 [caif]
--- net/caif/caif_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/caif/caif_dev.c +1 -1
@@ -424,9 +424,9 @@ static int __init caif_device_init(void) static void __exit caif_device_exit(void) { -unregister_pernet_subsys (&caif_net_ops);unregister_netdevice_notifier (&caif_device_notifier);dev_remove_pack (&caif_packet_type); +unregister_pernet_subsys (&caif_net_ops); }module_init (caif_device_init);
Greg Kroah-Hartman
maintainerPATCH 32/49 cipso: dont follow a NULL pointer when setsockopt() is called
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Moore <[email protected]>
[ Upstream commit 89d7ae34cdda4195809a5a987f697a517a2a3177 ]
As reported by Alan Cox, and verified by Lin Ming, when a user attempts to add a CIPSO option to a socket using the CIPSO_V4_TAG_LOCAL tag the kernel dies a terrible death when it attempts to follow a NULL pointer (the skb argument to cipso_v4_validate() is NULL when called via the setsockopt() syscall).
This patch fixes this by first checking to ensure that the skb is non-NULL before using it to find the incoming network interface. In the unlikely case where the skb is NULL and the user attempts to add a CIPSO option with the _TAG_LOCAL tag we return an error as this is not something we want to allow.
A simple reproducer, kindly supplied by Lin Ming, although you must have the CIPSO DOI #3 configure on the system first or you will be caught early in cipso_v4_validate():
#include <sys/types.h>
#include <sys/socket.h>
#include <linux/ip.h>
#include <linux/in.h>
#include <string.h>
struct local_tag {
char type;
char length;
char info[4];
};
struct cipso {
char type;
char length;
char doi[4];
struct local_tag local;
};
int main(int argc, char **argv)
{
int sockfd;
struct cipso cipso = {
.type = IPOPT_CIPSO,
.length = sizeof(struct cipso),
.local = {
.type = 128,
.length = sizeof(struct local_tag),
},
};
memset(cipso.doi, 0, 4);
cipso.doi[3] = 3;
sockfd = socket(AF_INET, SOCK_DGRAM, 0);
#define SOL_IP 0
setsockopt(sockfd, SOL_IP, IP_OPTIONS,
&cipso, sizeof(struct cipso));
return 0;
}--- net/ipv4/cipso_ipv4.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/ipv4/cipso_ipv4.c +4 -2
@@ -1725,8 +1725,10 @@ int cipso_v4_validate(const struct sk_bucase CIPSO_V4_TAG_LOCAL :/* This is a non-standard tag that we only allow for * local connections, so if the incoming interface is -* not the loopback device drop the packet. */ -if (!(skb->dev->flags &IFF_LOOPBACK )) { +* not the loopback device drop the packet. Further, +* there is no legitimate reason for setting this from +* userspace so reject it if skb is NULL. */ +if (skb ==NULL || !(skb->dev->flags &IFF_LOOPBACK )) { err_offset = opt_iter; goto validate_return_locked; }
Greg Kroah-Hartman
maintainerPATCH 33/49 caif: fix NULL pointer check
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Cox <[email protected]>
[ Upstream commit c66b9b7d365444b433307ebb18734757cb668a02 ]
Resolves-bug: http://bugzilla.kernel.org/show_bug?44441
--- drivers/net/caif/caif_serial.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/caif/caif_serial.c +3 -0
@@ -325,6 +325,9 @@ static int ldisc_open(struct tty_structsprintf (name,"cf%s" , tty->name); dev =alloc_netdev (sizeof (*ser), name, caifdev_setup); +if (!dev) +return -ENOMEM ; + ser =netdev_priv (dev); ser->tty =tty_kref_get (tty); ser->dev = dev;
Greg Kroah-Hartman
maintainerPATCH 34/49 wanmain: comparing array with NULL
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Cox <[email protected]>
[ Upstream commit 8b72ff6484fe303e01498b58621810a114f3cf09 ]
gcc really should warn about these !
--- net/wanrouter/wanmain.c | 53 +++++++++++++++++++++--------------------------- 1 file changed, 24 insertions(+), 29 deletions(-)
net/wanrouter/wanmain.c +24 -29
@@ -602,36 +602,31 @@ static int wanrouter_device_new_if(struc* successfully, add it to the interface list. */ -if (dev->name ==NULL ) { - err = -EINVAL ; - }else { - -#ifdef WANDEBUG -printk (KERN_INFO "%s: registering interface %s...\n" , - wanrouter_modname, dev->name); -#endif - - err =register_netdev (dev); -if (!err) { -struct net_device *slave =NULL ; -unsigned long smp_flags=0 ; - -lock_adapter_irq (&wandev->lock, &smp_flags); - -if (wandev->dev ==NULL ) { - wandev->dev = dev; - }else { -for (slave=wandev->dev; -DEV_TO_SLAVE (slave); - slave =DEV_TO_SLAVE (slave)) -DEV_TO_SLAVE (slave) = dev; - } - ++wandev->ndev; - -unlock_adapter_irq (&wandev->lock, &smp_flags); - err =0 ;/* done !!! */ - goto out; +#ifdef WANDEBUG +printk (KERN_INFO "%s: registering interface %s...\n" , + wanrouter_modname, dev->name); +#endif + + err =register_netdev (dev); +if (!err) { +struct net_device *slave =NULL ; +unsigned long smp_flags=0 ; + +lock_adapter_irq (&wandev->lock, &smp_flags); + +if (wandev->dev ==NULL ) { + wandev->dev = dev; + }else { +for (slave=wandev->dev; +DEV_TO_SLAVE (slave); + slave =DEV_TO_SLAVE (slave)) +DEV_TO_SLAVE (slave) = dev; } + ++wandev->ndev; + +unlock_adapter_irq (&wandev->lock, &smp_flags); + err =0 ;/* done !!! */ + goto out; }if (wandev->del_if) wandev->del_if (wandev, dev);
Greg Kroah-Hartman
maintainerPATCH 35/49 tcp: Add TCP_USER_TIMEOUT negative value check
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hangbin Liu <[email protected]>
[ Upstream commit 42493570100b91ef663c4c6f0c0fdab238f9d3c2 ]
TCP_USER_TIMEOUT is a TCP level socket option that takes an unsigned int. But patch "tcp: Add TCP_USER_TIMEOUT socket option"(dca43c75) didn't check the negative values. If a user assign -1 to it, the socket will set successfully and wait for 4294967295 miliseconds. This patch add a negative value check to avoid this issue.
--- net/ipv4/tcp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/ipv4/tcp.c +4 -1
@@ -2394,7 +2394,10 @@ static int do_tcp_setsockopt(struct sock/* Cap the max timeout in ms TCP will retry/retrans * before giving up and aborting (ETIMEDOUT) a connection. */ - icsk->icsk_user_timeout =msecs_to_jiffies (val); +if (val <0 ) + err = -EINVAL ; +else + icsk->icsk_user_timeout =msecs_to_jiffies (val);break ;default : err = -ENOPROTOOPT ;
Greg Kroah-Hartman
maintainerPATCH 36/49 USB: kaweth.c: use GFP_ATOMIC under spin_lock
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit e4c7f259c5be99dcfc3d98f913590663b0305bf8 ]
The problem is that we call this with a spin lock held. The call tree is:
kaweth_start_xmit() holds kaweth->device_lock. -> kaweth_async_set_rx_mode() -> kaweth_control() -> kaweth_internal_control_msg()
The kaweth_internal_control_msg() function is only called from kaweth_control() which used GFP_ATOMIC for its allocations.
--- drivers/net/usb/kaweth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/usb/kaweth.c +1 -1
@@ -1308,7 +1308,7 @@ static int kaweth_internal_control_msg(sint retv;int length =0 ;/* shut up GCC */ - urb =usb_alloc_urb (0 ,GFP_NOIO ); + urb =usb_alloc_urb (0 ,GFP_ATOMIC );if (!urb)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 37/49 net: fix rtnetlink IFF_PROMISC and IFF_ALLMULTI handling
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Benc <[email protected]>
[ Upstream commit b1beb681cba5358f62e6187340660ade226a5fcc ]
When device flags are set using rtnetlink, IFF_PROMISC and IFF_ALLMULTI flags are handled specially. Function dev_change_flags sets IFF_PROMISC and IFF_ALLMULTI bits in dev->gflags according to the passed value but do_setlink passes a result of rtnl_dev_combine_flags which takes those bits from dev->flags.
This can be easily trigerred by doing:
tcpdump -i eth0 &
ip l s up eth0
ip sets IFF_UP flag in ifi_flags and ifi_change, which is combined with IFF_PROMISC by rtnl_dev_combine_flags, causing __dev_change_flags to set IFF_PROMISC in gflags.
--- net/core/rtnetlink.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
net/core/rtnetlink.c +7 -1
@@ -647,6 +647,12 @@ static void set_operstate(struct net_dev } } +static unsigned int rtnl_dev_get_flags (const struct net_device *dev) +{ +return (dev->flags & ~(IFF_PROMISC |IFF_ALLMULTI )) | + (dev->gflags & (IFF_PROMISC |IFF_ALLMULTI )); +} +static unsigned int rtnl_dev_combine_flags (const struct net_device *dev,const struct ifinfomsg *ifm) {
@@ -655,7 +661,7 @@ static unsigned int rtnl_dev_combine_fla/* bugwards compatibility: ifi_change == 0 is treated as ~0 */ if (ifm->ifi_change) flags = (flags & ifm->ifi_change) | - (dev->flags & ~ifm->ifi_change); + (rtnl_dev_get_flags (dev) & ~ifm->ifi_change);return flags; }
Greg Kroah-Hartman
maintainerPATCH 38/49 tcp: perform DMA to userspace only if there is a task waiting for it
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Kosina <[email protected]>
[ Upstream commit 59ea33a68a9083ac98515e4861c00e71efdc49a1 ]
Back in 2006, commit 1a2449a87b ("[I/OAT]: TCP recv offload to I/OAT") added support for receive offloading to IOAT dma engine if available.
The code in tcp_rcv_established() tries to perform early DMA copy if applicable. It however does so without checking whether the userspace task is actually expecting the data in the buffer.
This is not a problem under normal circumstances, but there is a corner case where this doesn't work -- and that's when MSG_TRUNC flag to recvmsg() is used.
If the IOAT dma engine is not used, the code properly checks whether there is a valid ucopy.task and the socket is owned by userspace, but misses the check in the dmaengine case.
This problem can be observed in real trivially -- for example 'tbench' is a good reproducer, as it makes a heavy use of MSG_TRUNC. On systems utilizing IOAT, you will soon find tbench waiting indefinitely in sk_wait_data(), as they have been already early-copied in tcp_rcv_established() using dma engine.
This patch introduces the same check we are performing in the simple iovec copy case to the IOAT case as well. It fixes the indefinite recvmsg(MSG_TRUNC) hangs.
--- net/ipv4/tcp_input.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/ipv4/tcp_input.c +3 -1
@@ -5340,7 +5340,9 @@ int tcp_rcv_established(struct sock *sk,if (tp->copied_seq == tp->rcv_nxt && len - tcp_header_len <= tp->ucopy.len) {#ifdef CONFIG_NET_DMA -if (tcp_dma_try_early_copy (sk, skb, tcp_header_len)) { +if (tp->ucopy.task == current && +sock_owned_by_user (sk) && +tcp_dma_try_early_copy (sk, skb, tcp_header_len)) { copied_early =1 ; eaten =1 ; }
Greg Kroah-Hartman
maintainerPATCH 39/49 net/tun: fix ioctl() based info leaks
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Krause <[email protected]>
[ Upstream commits a117dacde0288f3ec60b6e5bcedae8fa37ee0dfc
and 8bbb181308bc348e02bfdbebdedd4e4ec9d452ce ]
The tun module leaks up to 36 bytes of memory by not fully initializing a structure located on the stack that gets copied to user memory by the TUNGETIFF and SIOCGIFHWADDR ioctl()s.
--- drivers/net/tun.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/tun.c +4 -2
@@ -1239,10 +1239,12 @@ static long __tun_chr_ioctl(struct fileint vnet_hdr_sz;int ret; -if (cmd ==TUNSETIFF ||_IOC_TYPE (cmd) ==0x89 ) +if (cmd ==TUNSETIFF ||_IOC_TYPE (cmd) ==0x89 ) {if (copy_from_user (&ifr, argp, ifreq_len))return -EFAULT ; - + }else { +memset (&ifr,0 ,sizeof (ifr)); + }if (cmd ==TUNGETFEATURES ) {/* Currently this just means: "what IFF flags are valid?". * This is needed because we never checked for invalid flags on
Greg Kroah-Hartman
maintainerPATCH 40/49 USB: echi-dbgp: increase the controller wait time to come out of halt.
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
commit f96a4216e85050c0a9d41a41ecb0ae9d8e39b509 upstream.
The default 10 microsecond delay for the controller to come out of halt in dbgp_ehci_startup is too short, so increase it to 1 millisecond.
This is based on emperical testing on various USB debug ports on modern machines such as a Lenovo X220i and an Ivybridge development platform that needed to wait ~450-950 microseconds.
--- drivers/usb/early/ehci-dbgp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/early/ehci-dbgp.c +1 -1
@@ -450,7 +450,7 @@ static int dbgp_ehci_startup(void)writel (FLAG_CF , &ehci_regs->configured_flag);/* Wait until the controller is no longer halted */ - loop =10 ; + loop =1000 ; do { status = readl(&ehci_regs->status); if (!(status & STS_HALT))
Greg Kroah-Hartman
maintainerPATCH 41/49 ALSA: snd-usb: fix clock source validity index
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Mack <[email protected]>
commit aff252a848ce21b431ba822de3dab9c4c94571cb upstream.
uac_clock_source_is_valid() uses the control selector value to access the bmControls bitmap of the clock source unit. This is wrong, as control selector values start from 1, while the bitmap uses all available bits.
In other words, "Clock Validity Control" is stored in D3..2, not D5..4 of the clock selector unit's bmControls.
--- sound/usb/clock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/usb/clock.c +2 -1
@@ -111,7 +111,8 @@ static bool uac_clock_source_is_valid(streturn 0 ;/* If a clock source can't tell us whether it's valid, we assume it is */ -if (!uac2_control_is_readable (cs_desc->bmControls,UAC2_CS_CONTROL_CLOCK_VALID )) +if (!uac2_control_is_readable (cs_desc->bmControls, +UAC2_CS_CONTROL_CLOCK_VALID -1 ))return 1 ; err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR,
Greg Kroah-Hartman
maintainerPATCH 42/49 ALSA: mpu401: Fix missing initialization of irq field
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit bc733d495267a23ef8660220d696c6e549ce30b3 upstream.
The irq field of struct snd_mpu401 is supposed to be initialized to -1. Since it's set to zero as of now, a probing error before the irq installation results in a kernel warning "Trying to free already-free IRQ 0".
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=44821
--- sound/drivers/mpu401/mpu401_uart.c | 1 + 1 file changed, 1 insertion(+)
sound/drivers/mpu401/mpu401_uart.c +1 -0
@@ -554,6 +554,7 @@ int snd_mpu401_uart_new(struct snd_cardspin_lock_init (&mpu->output_lock);spin_lock_init (&mpu->timer_lock); mpu->hardware = hardware; + mpu->irq =-1 ;if (! (info_flags &MPU401_INFO_INTEGRATED )) {int res_size = hardware ==MPU401_HW_PC98II ?4 :2 ; mpu->res =request_region (port, res_size,"MPU401 UART" );
Greg Kroah-Hartman
maintainerPATCH 43/49 ASoC: wm8962: Allow VMID time to fully ramp
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit 9d40e5582c9c4cfb6977ba2a0ca9c2ed82c56f21 upstream.
Required for reliable power up from cold.
--- sound/soc/codecs/wm8962.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/codecs/wm8962.c +3 -0
@@ -2890,6 +2890,9 @@ static int wm8962_set_bias_level(struct/* VMID 2*250k */ snd_soc_update_bits (codec,WM8962_PWR_MGMT_1 ,WM8962_VMID_SEL_MASK ,0x100 ); + +if (codec->dapm.bias_level ==SND_SOC_BIAS_OFF ) +msleep (100 );break ;case SND_SOC_BIAS_OFF :
Greg Kroah-Hartman
maintainerPATCH 44/49 ASoC: wm8994: Ensure there are enough BCLKs for four channels
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit b8edf3e5522735c8ce78b81845f7a1a2d4a08626 upstream.
Otherwise if someone tries to use all four channels on AIF1 with the device in master mode we won't be able to clock out all the data.
--- sound/soc/codecs/wm8994.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm8994.c +1 -1
@@ -2127,7 +2127,7 @@ static int wm8994_hw_params(struct snd_preturn -EINVAL ; } - bclk_rate =params_rate (params) *2 ; + bclk_rate =params_rate (params) *4 ;switch (params_format (params)) {case SNDRV_PCM_FORMAT_S16_LE : bclk_rate *=16 ;
Greg Kroah-Hartman
maintainerPATCH 45/49 m68k: Make sys_atomic_cmpxchg_32 work on classic m68k
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Schwab <[email protected]>
commit 9e2760d18b3cf179534bbc27692c84879c61b97c upstream.
User space access must always go through uaccess accessors, since on classic m68k user space and kernel space are completely separate.
--- arch/m68k/kernel/sys_m68k.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/m68k/kernel/sys_m68k.c +6 -2
@@ -479,9 +479,13 @@ sys_atomic_cmpxchg_32(unsigned long newv goto bad_access; } - mem_value = *mem; +/* +* No need to check for EFAULT; we know that the page is +* present and writable. +*/ +__get_user (mem_value, mem);if (mem_value == oldval) - *mem = newval; +__put_user (newval, mem);pte_unmap_unlock (pte, ptl);up_read (&mm->mmap_sem);
Greg Kroah-Hartman
maintainerPATCH 46/49 m68k: Correct the Atari ALLOWINT definition
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikael Pettersson <[email protected]>
commit c663600584a596b5e66258cc10716fb781a5c2c9 upstream.
Booting a 3.2, 3.3, or 3.4-rc4 kernel on an Atari using the `nfeth' ethernet device triggers a WARN_ONCE() in generic irq handling code on the first irq for that device:
WARNING: at kernel/irq/handle.c:146 handle_irq_event_percpu+0x134/0x142() irq 3 handler nfeth_interrupt+0x0/0x194 enabled interrupts Modules linked in: Call Trace: [<000299b2>] warn_slowpath_common+0x48/0x6a [<000299c0>] warn_slowpath_common+0x56/0x6a [<00029a4c>] warn_slowpath_fmt+0x2a/0x32 [<0005b34c>] handle_irq_event_percpu+0x134/0x142 [<0005b34c>] handle_irq_event_percpu+0x134/0x142 [<0000a584>] nfeth_interrupt+0x0/0x194 [<001ba0a8>] schedule_preempt_disabled+0x0/0xc [<0005b37a>] handle_irq_event+0x20/0x2c [<0005add4>] generic_handle_irq+0x2c/0x3a [<00002ab6>] do_IRQ+0x20/0x32 [<0000289e>] auto_irqhandler_fixup+0x4/0x6 [<00003144>] cpu_idle+0x22/0x2e [<001b8a78>] printk+0x0/0x18 [<0024d112>] start_kernel+0x37a/0x386 [<0003021d>] __do_proc_dointvec+0xb1/0x366 [<0003021d>] __do_proc_dointvec+0xb1/0x366 [<0024c31e>] _sinittext+0x31e/0x9c0
After invoking the irq's handler the kernel sees !irqs_disabled() and concludes that the handler erroneously enabled interrupts.
However, debugging shows that !irqs_disabled() is true even before the handler is invoked, which indicates a problem in the platform code rather than the specific driver.
The warning does not occur in 3.1 or older kernels.
It turns out that the ALLOWINT definition for Atari is incorrect.
The Atari definition of ALLOWINT is ~0x400, the stated purpose of that is to avoid taking HSYNC interrupts. irqs_disabled() returns true if the 3-bit ipl & 4 is non-zero. The nfeth interrupt runs at ipl 3 (it's autovector 3), but 3 & 4 is zero so irqs_disabled() is false, and the warning above is generated.
When interrupts are explicitly disabled, ipl is set to 7. When they are enabled, ipl is masked with ALLOWINT. On Atari this will result in ipl = 3, which blocks interrupts at ipl 3 and below. So how come nfeth interrupts at ipl 3 are received at all? That's because ipl is reset to 2 by Atari-specific code in default_idle(), again with the stated purpose of blocking HSYNC interrupts. This discrepancy means that ipl 3 can remain blocked for longer than intended.
Both default_idle() and falcon_hblhandler() identify HSYNC with ipl 2, and the "Atari ST/.../F030 Hardware Register Listing" agrees, but ALLOWINT is defined as if HSYNC was ipl 3.
[As an experiment I modified default_idle() to reset ipl to 3, and as expected that resulted in all nfeth interrupts being blocked.]
The fix is simple: define ALLOWINT as ~0x500 instead. This makes arch_local_irq_enable() consistent with default_idle(), and prevents the !irqs_disabled() problems for ipl 3 interrupts.
Tested on Atari running in an Aranym VM.
--- arch/m68k/include/asm/entry_mm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/m68k/include/asm/entry_mm.h +2 -2
@@ -35,8 +35,8 @@/* the following macro is used when enabling interrupts */ #if defined(MACH_ATARI_ONLY ) -/* block out HSYNC on the atari */ -#define ALLOWINT (~0x400) +/* block out HSYNC = ipl 2 on the atari */ +#define ALLOWINT (~0x500)#define MAX_NOINT_IPL 3#else /* portable version */
Greg Kroah-Hartman
maintainerPATCH 47/49 futex: Test for pi_mutex on fault in futex_wait_requeue_pi()
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Darren Hart <[email protected]>
commit b6070a8d9853eda010a549fa9a09eb8d7269b929 upstream.
If fixup_pi_state_owner() faults, pi_mutex may be NULL. Test for pi_mutex != NULL before testing the owner against current and possibly unlocking it.
--- kernel/futex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/futex.c +1 -1
@@ -2370,7 +2370,7 @@ static int futex_wait_requeue_pi(u32 __u* fault, unlock the rt_mutex and return the fault to userspace. */ if (ret == -EFAULT ) { -if (rt_mutex_owner (pi_mutex) == current) +if (pi_mutex &&rt_mutex_owner (pi_mutex) == current)rt_mutex_unlock (pi_mutex); }else if (ret == -EINTR ) {/*
Greg Kroah-Hartman
maintainerPATCH 48/49 futex: Fix bug in WARN_ON for NULL q.pi_state
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Darren Hart <[email protected]>
commit f27071cb7fe3e1d37a9dbe6c0dfc5395cd40fa43 upstream.
The WARN_ON in futex_wait_requeue_pi() for a NULL q.pi_state was testing the address (&q.pi_state) of the pointer instead of the value (q.pi_state) of the pointer. Correct it accordingly.
--- kernel/futex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/futex.c +1 -1
@@ -2343,7 +2343,7 @@ static int futex_wait_requeue_pi(u32 __u* signal. futex_unlock_pi() will not destroy the lock_ptr nor * the pi_state. */ -WARN_ON (!&q.pi_state); +WARN_ON (!q.pi_state); pi_mutex = &q.pi_state->pi_mutex; ret =rt_mutex_finish_proxy_lock (pi_mutex, to, &rt_waiter,1 );debug_rt_mutex_free_waiter (&rt_waiter);
Greg Kroah-Hartman
maintainerPATCH 49/49 futex: Forbid uaddr == uaddr2 in futex_wait_requeue_pi()
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Darren Hart <[email protected]>
commit 6f7b0a2a5c0fb03be7c25bd1745baa50582348ef upstream.
If uaddr == uaddr2, then we have broken the rule of only requeueing from a non-pi futex to a pi futex with this call. If we attempt this, as the trinity test suite manages to do, we miss early wakeups as q.key is equal to key2 (because they are the same uaddr). We will then attempt to dereference the pi_mutex (which would exist had the futex_q been properly requeued to a pi futex) and trigger a NULL pointer dereference.
--- kernel/futex.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
kernel/futex.c +8 -5
@@ -2231,11 +2231,11 @@ int handle_early_requeue_pi_wakeup(struc* @uaddr2: the pi futex we will take prior to returning to user-space * * The caller will wait on uaddr and will be requeued by futex_requeue() to -* uaddr2 which must be PI aware. Normal wakeup will wake on uaddr2 and -* complete the acquisition of the rt_mutex prior to returning to userspace. -* This ensures the rt_mutex maintains an owner when it has waiters; without -* one, the pi logic wouldn't know which task to boost/deboost, if there was a -* need to. +* uaddr2 which must be PI aware and unique from uaddr. Normal wakeup will wake +* on uaddr2 and complete the acquisition of the rt_mutex prior to returning to +* userspace. This ensures the rt_mutex maintains an owner when it has waiters; +* without one, the pi logic would not know which task to boost/deboost, if +* there was a need to. * * We call schedule in futex_wait_queue_me() when we enqueue and return there * via the following:
@@ -2272,6 +2272,9 @@ static int futex_wait_requeue_pi(u32 __ustruct futex_q q = futex_q_init;int res, ret; +if (uaddr == uaddr2) +return -EINVAL ; +if (!bitset)return -EINVAL ;