v2.6.34.10 longterm review
Subsystems (93)
PATCH 148/247 arp_notify: unconditionally send gratuitous ARP for NETDEV_NOTIFY_PEERS.
In reply to Paul GortmakerFrom: Ian Campbell <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit d11327ad6695db8117c78d70611e71102ceec2ac upstream.
NETDEV_NOTIFY_PEER is an explicit request by the driver to send a link notification while NETDEV_UP/NETDEV_CHANGEADDR generate link notifications as a sort of side effect.
In the later cases the sysctl option is present because link notification events can have undesired effects e.g. if the link is flapping. I don't think this applies in the case of an explicit request from a driver.
This patch makes NETDEV_NOTIFY_PEER unconditional, if preferred we could add a new sysctl for this case which defaults to on.
This change causes Xen post-migration ARP notifications (which cause switches to relearn their MAC tables etc) to be sent by default.
--- net/ipv4/devinet.c | 30 ++++++++++++++++++++---------- 1 files changed, 20 insertions(+), 10 deletions(-)
net/ipv4/devinet.c +20 -10
@@ -1029,6 +1029,21 @@ static inline bool inetdev_valid_mtu(unsigned mtu)return mtu >=68 ; } +static void inetdev_send_gratuitous_arp (struct net_device *dev, +struct in_device *in_dev) + +{ +struct in_ifaddr *ifa = in_dev->ifa_list; + +if (!ifa) +return ; + +arp_send (ARPOP_REQUEST ,ETH_P_ARP , + ifa->ifa_address, dev, + ifa->ifa_address,NULL , + dev->dev_addr,NULL ); +} +/* Called only under RTNL semaphore */ static int inetdev_event(struct notifier_block *this, unsigned long event,
@@ -1081,18 +1096,13 @@ static int inetdev_event(struct notifier_block *this, unsigned long event, }ip_mc_up (in_dev);/* fall through */ -case NETDEV_NOTIFY_PEERS :case NETDEV_CHANGEADDR : +if (!IN_DEV_ARP_NOTIFY (in_dev)) +break ; +/* fall through */ +case NETDEV_NOTIFY_PEERS :/* Send gratuitous ARP to notify of link change */ -if (IN_DEV_ARP_NOTIFY (in_dev)) { -struct in_ifaddr *ifa = in_dev->ifa_list; - -if (ifa) -arp_send (ARPOP_REQUEST ,ETH_P_ARP , - ifa->ifa_address, dev, - ifa->ifa_address,NULL , - dev->dev_addr,NULL ); - } +inetdev_send_gratuitous_arp (dev, in_dev);break ;case NETDEV_DOWN :ip_mc_down (in_dev);
Signature · 1 line
1.7.4.4
PATCH 149/247 CIFS: Fix oplock break handling (try #2)
In reply to Paul GortmakerFrom: Pavel Shilovsky <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 12fed00de963433128b5366a21a55808fab2f756 upstream.
When we get oplock break notification we should set the appropriate value of OplockLevel field in oplock break acknowledge according to the oplock level held by the client in this time. As we only can have level II oplock or no oplock in the case of oplock break, we should be aware only about clientCanCacheRead field in cifsInodeInfo structure.
Also fix bug connected with wrong interpretation of OplockLevel field during oplock break notification processing.
[PG: above OplockLevel bug only exists via. e66673e39a which didn't appear until v2.6.37-rc2, so cifs/misc.c hunk dropped.]
--- fs/cifs/cifsproto.h | 2 +- fs/cifs/cifssmb.c | 4 +++- fs/cifs/file.c | 21 +++++++++++---------- 3 files changed, 15 insertions(+), 12 deletions(-)
fs/cifs/cifsproto.h +1 -1
@@ -329,7 +329,7 @@ extern int CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, const __u16 netfid, const __u64 len, const __u64 offset, const __u32 numUnlock, const __u32 numLock, const __u8 lockType, - const bool waitFlag); + const bool waitFlag, const __u8 oplock_level); extern int CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, const __u16 smb_file_id, const int get_flag, const __u64 len, struct file_lock *,
fs/cifs/cifssmb.c +3 -1
@@ -1642,7 +1642,8 @@ int CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, const __u16 smb_file_id, const __u64 len, const __u64 offset, const __u32 numUnlock, - const __u32 numLock, const __u8 lockType, const bool waitFlag) + const __u32 numLock, const __u8 lockType, + const bool waitFlag, const __u8 oplock_level) { int rc = 0;LOCK_REQ *pSMB =NULL ;
@@ -1670,6 +1671,7 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, pSMB->NumberOfLocks =cpu_to_le16 (numLock); pSMB->NumberOfUnlocks =cpu_to_le16 (numUnlock); pSMB->LockType = lockType; + pSMB->OplockLevel = oplock_level; pSMB->AndXCommand =0xFF ;/* none */ pSMB->Fid = smb_file_id;/* netfid stays le */
fs/cifs/file.c +11 -10
@@ -828,12 +828,12 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)/* BB we could chain these into one lock request BB */ rc =CIFSSMBLock (xid, tcon, netfid, length, pfLock->fl_start, -0 ,1 , lockType,0 /* wait flag */ ); +0 ,1 , lockType,0 /* wait flag */ ,0 );if (rc ==0 ) { rc =CIFSSMBLock (xid, tcon, netfid, length, pfLock->fl_start,1 /* numUnlock */ ,0 /* numLock */ , lockType, -0 /* wait flag */ ); +0 /* wait flag */ ,0 ); pfLock->fl_type =F_UNLCK ;if (rc !=0 ) cERROR(1, ("Error unlocking previously locked "
@@ -850,13 +850,13 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) rc =CIFSSMBLock (xid, tcon, netfid, length, pfLock->fl_start,0 ,1 , lockType |LOCKING_ANDX_SHARED_LOCK , -0 /* wait flag */ ); +0 /* wait flag */ ,0 );if (rc ==0 ) { rc =CIFSSMBLock (xid, tcon, netfid, length, pfLock->fl_start,1 ,0 , lockType |LOCKING_ANDX_SHARED_LOCK , -0 /* wait flag */ ); +0 /* wait flag */ ,0 ); pfLock->fl_type =F_RDLCK ;if (rc !=0 ) cERROR(1, ("Error unlocking "
@@ -900,8 +900,8 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)if (numLock) { rc =CIFSSMBLock (xid, tcon, netfid, length, - pfLock->fl_start, -0 , numLock, lockType, wait_flag); + pfLock->fl_start,0 , numLock, lockType, + wait_flag,0 );if (rc ==0 ) {/* For Windows locks we must store them. */
@@ -921,9 +921,9 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) (pfLock->fl_start + length) >= (li->offset + li->length)) { stored_rc =CIFSSMBLock (xid, tcon, - netfid, - li->length, li->offset, -1 ,0 , li->type, false); + netfid, li->length, + li->offset,1 ,0 , + li->type, false,0 );if (stored_rc) rc = stored_rc;
@@ -2340,7 +2340,8 @@ cifs_oplock_break(struct slow_work *work)*/ if (!cfile->closePend && !cfile->oplock_break_cancelled) { rc =CIFSSMBLock (0 , cifs_sb->tcon, cfile->netfid,0 ,0 ,0 ,0 , -LOCKING_ANDX_OPLOCK_RELEASE , false); +LOCKING_ANDX_OPLOCK_RELEASE , false, + cinode->clientCanCacheRead ?1 :0 );cFYI (1 , ("Oplock release rc = %d" , rc)); } }
Signature · 1 line
1.7.4.4
PATCH 150/247 cpuset: add a missing unlock in cpuset_write_resmask()
In reply to Paul GortmakerFrom: Li Zefan <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit b75f38d659e6fc747eda64cb72f3920e29dd44a4 upstream.
Don't forget to release cgroup_mutex if alloc_trial_cpuset() fails.
--- kernel/cpuset.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
kernel/cpuset.c +5 -2
@@ -1534,8 +1534,10 @@ static int cpuset_write_resmask(struct cgroup *cgrp, struct cftype *cft,return -ENODEV ; trialcs =alloc_trial_cpuset (cs); -if (!trialcs) -return -ENOMEM ; +if (!trialcs) { + retval = -ENOMEM ; + goto out; + }switch (cft->private) {case FILE_CPULIST :
@@ -1550,6 +1552,7 @@ static int cpuset_write_resmask(struct cgroup *cgrp, struct cftype *cft, }free_trial_cpuset (trialcs); +out:cgroup_unlock ();return retval; }
Signature · 1 line
1.7.4.4
PATCH 151/247 keyboard: integer underflow bug
In reply to Paul GortmakerFrom: Dan Carpenter <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit b652277b09d3d030cb074cc6a98ba80b34244c03 upstream.
The "ct" variable should be an unsigned int. Both struct kbdiacrs ->kb_cnt and struct kbd_data ->accent_table_size are unsigned ints.
Making it signed causes a problem in KBDIACRUC because the user could set the signed bit and cause a buffer overflow.
--- drivers/s390/char/keyboard.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/s390/char/keyboard.c +2 -1
@@ -463,7 +463,8 @@ kbd_ioctl(struct kbd_data *kbd, struct file *file, unsigned int cmd, unsigned long arg) {void __user *argp; -int ct, perm; +unsigned int ct; +int perm; argp = (void __user *)arg;
Signature · 1 line
1.7.4.4
PATCH 152/247 RxRPC: Fix v1 keys
In reply to Paul GortmakerFrom: Anton Blanchard <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit f009918a1c1bbf8607b8aab3959876913a30193a upstream.
commit 339412841d7 (RxRPC: Allow key payloads to be passed in XDR form) broke klog for me. I notice the v1 key struct had a kif_version field added:
-struct rxkad_key {
- u16 security_index; /* RxRPC header security index */ - u16 ticket_len; /* length of ticket[] */ - u32 expiry; /* time at which expires */ - u32 kvno; /* key version number */ - u8 session_key[8]; /* DES session key */ - u8 ticket[0]; /* the encrypted ticket */
-};
+struct rxrpc_key_data_v1 {
+ u32 kif_version; /* 1 */ + u16 security_index; + u16 ticket_length; + u32 expiry; /* time_t */ + u32 kvno; + u8 session_key[8]; + u8 ticket[0];
+};
However the code in rxrpc_instantiate strips it away:
data += sizeof(kver); datalen -= sizeof(kver);
Removing kif_version fixes my problem.
--- include/keys/rxrpc-type.h | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
include/keys/rxrpc-type.h +0 -1
@@ -99,7 +99,6 @@ struct rxrpc_key_token {* structure of raw payloads passed to add_key() or instantiate key */ struct rxrpc_key_data_v1 { -u32 kif_version;/* 1 */ u16 security_index;u16 ticket_length;u32 expiry;/* time_t */
Signature · 1 line
1.7.4.4
PATCH 153/247 ixgbe: fix for 82599 erratum on Header Splitting
In reply to Paul GortmakerFrom: Don Skidmore <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit a124339ad28389093ed15eca990d39c51c5736cc upstream.
We have found a hardware erratum on 82599 hardware that can lead to unpredictable behavior when Header Splitting mode is enabled. So we are no longer enabling this feature on affected hardware.
Please see the 82599 Specification Update for more information.
--- drivers/net/ixgbe/ixgbe_main.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-)
drivers/net/ixgbe/ixgbe_main.c +9 -2
@@ -2250,9 +2250,16 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)int rx_buf_len;/* Decide whether to use packet split mode or not */ +/* On by default */ + adapter->flags |=IXGBE_FLAG_RX_PS_ENABLED ; +/* Do not use packet split if we're in SR-IOV Mode */ -if (!adapter->num_vfs) - adapter->flags |=IXGBE_FLAG_RX_PS_ENABLED ; +if (adapter->num_vfs) + adapter->flags &= ~IXGBE_FLAG_RX_PS_ENABLED ; + +/* Disable packet split due to 82599 erratum #45 */ +if (hw->mac.type == ixgbe_mac_82599EB) + adapter->flags &= ~IXGBE_FLAG_RX_PS_ENABLED ;/* Set the RX buffer length according to the mode */ if (adapter->flags &IXGBE_FLAG_RX_PS_ENABLED ) {
Signature · 1 line
1.7.4.4
PATCH 154/247 mm: fix possible cause of a page_mapped BUG
In reply to Paul GortmakerFrom: Hugh Dickins <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit a3e8cc643d22d2c8ed36b9be7d9c9ca21efcf7f7 upstream.
Robert Swiecki reported a BUG_ON(page_mapped) from a fuzzer, punching a hole with madvise(,, MADV_REMOVE). That path is under mutex, and cannot be explained by lack of serialization in unmap_mapping_range().
Reviewing the code, I found one place where vm_truncate_count handling should have been updated, when I switched at the last minute from one way of managing the restart_addr to another: mremap move changes the virtual addresses, so it ought to adjust the restart_addr.
But rather than exporting the notion of restart_addr from memory.c, or converting to restart_pgoff throughout, simply reset vm_truncate_count to 0 to force a rescan if mremap move races with preempted truncation.
We have no confirmation that this fixes Robert's BUG, but it is a fix that's worth making anyway.
--- mm/mremap.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
mm/mremap.c +1 -3
@@ -91,9 +91,7 @@ static void move_ptes(struct vm_area_struct *vma, pmd_t *old_pmd,*/ mapping = vma->vm_file->f_mapping;spin_lock (&mapping->i_mmap_lock); -if (new_vma->vm_truncate_count && - new_vma->vm_truncate_count != vma->vm_truncate_count) - new_vma->vm_truncate_count =0 ; + new_vma->vm_truncate_count =0 ; }/*
Signature · 1 line
1.7.4.4
PATCH 155/247 powerpc/kdump: CPUs assume the context of the oopsing CPU
In reply to Paul GortmakerFrom: Anton Blanchard <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 0644079410065567e3bb31fcb8e6441f2b7685a9 upstream.
We wrap the crash_shutdown_handles[] calls with longjmp/setjmp, so if any of them fault we can recover. The problem is we add a hook to the debugger fault handler hook which calls longjmp unconditionally.
This first part of kdump is run before we marshall the other CPUs, so there is a very good chance some CPU on the box is going to page fault. And when it does it hits the longjmp code and assumes the context of the oopsing CPU. The machine gets very confused when it has 10 CPUs all with the same stack, all thinking they have the same CPU id. I get even more confused trying to debug it.
The patch below adds crash_shutdown_cpu and uses it to specify which cpu is in the protected region. Since it can only be -1 or the oopsing CPU, we don't need to use memory barriers since it is only valid on the local CPU - no other CPU will ever see a value that matches it's local CPU id.
Eventually we should switch the order and marshall all CPUs before doing the crash_shutdown_handles[] calls, but that is a bigger fix.
--- arch/powerpc/kernel/crash.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
arch/powerpc/kernel/crash.c +5 -1
@@ -347,10 +347,12 @@ int crash_shutdown_unregister(crash_shutdown_t handler)EXPORT_SYMBOL (crash_shutdown_unregister);static unsigned long crash_shutdown_buf[JMP_BUF_LEN ]; +static int crash_shutdown_cpu =-1 ;static int handle_fault (struct pt_regs *regs) { -longjmp (crash_shutdown_buf,1 ); +if (crash_shutdown_cpu ==smp_processor_id ()) +longjmp (crash_shutdown_buf,1 );return 0 ; }
@@ -388,6 +390,7 @@ void default_machine_crash_shutdown(struct pt_regs *regs)*/ old_handler = __debugger_fault_handler; __debugger_fault_handler = handle_fault; + crash_shutdown_cpu =smp_processor_id ();for (i =0 ; crash_shutdown_handles[i]; i++) {if (setjmp (crash_shutdown_buf) ==0 ) {/*
@@ -401,6 +404,7 @@ void default_machine_crash_shutdown(struct pt_regs *regs) asmvolatile ("sync; isync" ); } } + crash_shutdown_cpu =-1 ; __debugger_fault_handler = old_handler;/*
Signature · 1 line
1.7.4.4
PATCH 156/247 powerpc/kdump: Use chip->shutdown to disable IRQs
In reply to Paul GortmakerFrom: Anton Blanchard <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 5d7a87217de48b234b3c8ff8a73059947d822e07 upstream.
I saw this in a kdump kernel:
IOMMU table initialized, virtual merging enabled
Interrupt 155954 (real) is invalid, disabling it.
Interrupt 155953 (real) is invalid, disabling it.
ie we took some spurious interrupts. default_machine_crash_shutdown tries to disable all interrupt sources but uses chip->disable which maps to the default action of:
static void default_disable(unsigned int irq)
{
}
If we use chip->shutdown, then we actually mask the IRQ:
static void default_shutdown(unsigned int irq)
{
struct irq_desc *desc = irq_to_desc(irq);
desc->chip->mask(irq);
desc->status |= IRQ_MASKED;
}Not sure why we don't implement a ->disable action for xics.c, or why default_disable doesn't mask the interrupt.
--- arch/powerpc/kernel/crash.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/powerpc/kernel/crash.c +1 -1
@@ -381,7 +381,7 @@ void default_machine_crash_shutdown(struct pt_regs *regs) desc->chip->eoi (i);if (!(desc->status &IRQ_DISABLED )) - desc->chip->disable (i); + desc->chip->shutdown (i); }/*
Signature · 1 line
1.7.4.4
PATCH 157/247 powerpc: Use more accurate limit for first segment memory allocations
In reply to Paul GortmakerFrom: Anton Blanchard <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 095c7965f4dc870ed2b65143b1e2610de653416c upstream.
Author: Milton Miller <[email protected]>
On large machines we are running out of room below 256MB. In some cases we only need to ensure the allocation is in the first segment, which may be 256MB or 1TB.
Add slb0_limit and use it to specify the upper limit for the irqstack and emergency stacks.
On a large ppc64 box, this fixes a panic at boot when the crashkernel= option is specified (previously we would run out of memory below 256MB).
--- arch/powerpc/kernel/setup_64.c | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-)
arch/powerpc/kernel/setup_64.c +13 -4
@@ -424,9 +424,18 @@ void __init setup_system(void)DBG (" <- setup_system()\n" ); } +static u64 slb0_limit (void ) +{ +if (cpu_has_feature (CPU_FTR_1T_SEGMENT )) { +return 1UL <<SID_SHIFT_1T ; + } +return 1UL <<SID_SHIFT ; +} +#ifdef CONFIG_IRQSTACKS static void __init irqstack_early_init (void ) { +u64 limit =slb0_limit ();unsigned int i;/*
@@ -436,10 +445,10 @@ static void __init irqstack_early_init(void)for_each_possible_cpu (i) { softirq_ctx[i] = (struct thread_info *)__va (lmb_alloc_base (THREAD_SIZE , -THREAD_SIZE ,0x10000000 )); +THREAD_SIZE , limit)); hardirq_ctx[i] = (struct thread_info *)__va (lmb_alloc_base (THREAD_SIZE , -THREAD_SIZE ,0x10000000 )); +THREAD_SIZE , limit)); } }#else
@@ -470,7 +479,7 @@ static void __init exc_lvl_early_init(void)*/ static void __init emergency_stack_init (void ) { -unsigned long limit; +u64 limit;unsigned int i;/*
@@ -482,7 +491,7 @@ static void __init emergency_stack_init(void)* bringup, we need to get at them in real mode. This means they * must also be within the RMO region. */ - limit =min (0x10000000ULL , lmb.rmo_size); + limit =min (slb0_limit (), lmb.rmo_size);for_each_possible_cpu (i) {unsigned long sp;
Signature · 1 line
1.7.4.4
PATCH 158/247 powerpc/pseries: Add hcall to read 4 ptes at a time in real mode
In reply to Paul GortmakerFrom: Michael Neuling <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit f90ece28c1f5b3ec13fe481406857fe92f4bc7d1 upstream.
This adds plpar_pte_read_4_raw() which can be used read 4 PTEs from PHYP at a time, while in real mode.
It also creates a new hcall9 which can be used in real mode. It's the same as plpar_hcall9 but minus the tracing hcall statistics which may require variables outside the RMO.
--- arch/powerpc/include/asm/hvcall.h | 1 + arch/powerpc/platforms/pseries/hvCall.S | 38 +++++++++++++++++++++++ arch/powerpc/platforms/pseries/plpar_wrappers.h | 18 +++++++++++ 3 files changed, 57 insertions(+), 0 deletions(-)
arch/powerpc/include/asm/hvcall.h +1 -0
@@ -281,6 +281,7 @@ long plpar_hcall_raw(unsigned long opcode, unsigned long *retbuf, ...);*/ #define PLPAR_HCALL9_BUFSIZE 9long plpar_hcall9 (unsigned long opcode,unsigned long *retbuf, ...); +long plpar_hcall9_raw (unsigned long opcode,unsigned long *retbuf, ...);/* For hcall instrumentation. One structure per-hcall, per-CPU */ struct hcall_stats {
arch/powerpc/platforms/pseries/hvCall.S +38 -0
@@ -228,3 +228,41 @@ _GLOBAL(plpar_hcall9) mtcrf 0xff,r0 blr /* return r3 = status */ + +/* See plpar_hcall_raw to see why this is needed */ +_GLOBAL(plpar_hcall9_raw) + HMT_MEDIUM + + mfcr r0 + stw r0,8(r1) + + std r4,STK_PARM(r4)(r1) /* Save ret buffer */ + + mr r4,r5 + mr r5,r6 + mr r6,r7 + mr r7,r8 + mr r8,r9 + mr r9,r10 + ld r10,STK_PARM(r11)(r1) /* put arg7 in R10 */ + ld r11,STK_PARM(r12)(r1) /* put arg8 in R11 */ + ld r12,STK_PARM(r13)(r1) /* put arg9 in R12 */ + + HVSC /* invoke the hypervisor */ + + mr r0,r12 + ld r12,STK_PARM(r4)(r1) + std r4, 0(r12) + std r5, 8(r12) + std r6, 16(r12) + std r7, 24(r12) + std r8, 32(r12) + std r9, 40(r12) + std r10,48(r12) + std r11,56(r12) + std r0, 64(r12) + + lwz r0,8(r1) + mtcrf 0xff,r0 + + blr /* return r3 = status */
arch/powerpc/platforms/pseries/plpar_wrappers.h +18 -0
@@ -191,6 +191,24 @@ static inline long plpar_pte_read_raw(unsigned long flags, unsigned long ptex,return rc; } +/* +* plpar_pte_read_4_raw can be called in real mode. +* ptes must be 8*sizeof(unsigned long) +*/ +static inline long plpar_pte_read_4_raw (unsigned long flags,unsigned long ptex, +unsigned long *ptes) + +{ +long rc; +unsigned long retbuf[PLPAR_HCALL9_BUFSIZE ]; + + rc =plpar_hcall9_raw (H_READ , retbuf, flags |H_READ_4 , ptex); + +memcpy (ptes, retbuf,8 *sizeof (unsigned long )); + +return rc; +} +static inline long plpar_pte_protect (unsigned long flags,unsigned long ptex,unsigned long avpn) {
Signature · 1 line
1.7.4.4
PATCH 159/247 powerpc/kexec: Speedup kexec hash PTE tear down
In reply to Paul GortmakerFrom: Michael Neuling <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit d504bed676caad29a3dba3d3727298c560628f5c upstream.
Currently for kexec the PTE tear down on 1TB segment systems normally requires 3 hcalls for each PTE removal. On a machine with 32GB of memory it can take around a minute to remove all the PTEs.
This optimises the path so that we only remove PTEs that are valid. It also uses the read 4 PTEs at once HCALL. For the common case where a PTEs is invalid in a 1TB segment, this turns the 3 HCALLs per PTE down to 1 HCALL per 4 PTEs.
This gives an > 10x speedup in kexec times on PHYP, taking a 32GB machine from around 1 minute down to a few seconds.
--- arch/powerpc/platforms/pseries/lpar.c | 35 +++++++++++++++++++------------- 1 files changed, 21 insertions(+), 14 deletions(-)
arch/powerpc/platforms/pseries/lpar.c +20 -13
@@ -367,21 +367,28 @@ static void pSeries_lpar_hptab_clear(void) {unsigned long size_bytes =1UL << ppc64_pft_size;unsigned long hpte_count = size_bytes >>4 ; -unsigned long dummy1, dummy2, dword0; +struct { +unsigned long pteh; +unsigned long ptel; + } ptes[4 ];long lpar_rc; -int i; +int i, j; -/* TODO: Use bulk call */ -for (i =0 ; i < hpte_count; i++) { -/* dont remove HPTEs with VRMA mappings */ - lpar_rc =plpar_pte_remove_raw (H_ANDCOND , i,HPTE_V_1TB_SEG , - &dummy1, &dummy2); -if (lpar_rc ==H_NOT_FOUND ) { - lpar_rc =plpar_pte_read_raw (0 , i, &dword0, &dummy1); -if (!lpar_rc && ((dword0 &HPTE_V_VRMA_MASK ) - !=HPTE_V_VRMA_MASK )) -/* Can be hpte for 1TB Seg. So remove it */ -plpar_pte_remove_raw (0 , i,0 , &dummy1, &dummy2); +/* Read in batches of 4, +* invalidate only valid entries not in the VRMA +* hpte_count will be a multiple of 4 +*/ +for (i =0 ; i < hpte_count; i +=4 ) { + lpar_rc =plpar_pte_read_4_raw (0 , i, (void *)ptes); +if (lpar_rc !=H_SUCCESS ) +continue ; +for (j =0 ; j <4 ; j++){ +if ((ptes[j].pteh &HPTE_V_VRMA_MASK ) == +HPTE_V_VRMA_MASK ) +continue ; +if (ptes[j].pteh &HPTE_V_VALID ) +plpar_pte_remove_raw (0 , i + j,0 , + &(ptes[j].pteh), &(ptes[j].ptel)); } } }
Signature · 1 line
1.7.4.4
PATCH 160/247 powerpc/crashdump: Do not fail on NULL pointer dereferencing
In reply to Paul GortmakerFrom: Maxim Uvarov <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 426b6cb478e60352a463a0d1ec75c1c9fab30b13 upstream.
--- arch/powerpc/kernel/crash.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
arch/powerpc/kernel/crash.c +3 -0
@@ -377,6 +377,9 @@ void default_machine_crash_shutdown(struct pt_regs *regs)for_each_irq (i) {struct irq_desc *desc =irq_to_desc (i); +if (!desc || !desc->chip || !desc->chip->eoi) +continue ; +if (desc->status &IRQ_INPROGRESS ) desc->chip->eoi (i);
Signature · 1 line
1.7.4.4
PATCH 161/247 powerpc/kexec: Fix orphaned offline CPUs across kexec
In reply to Paul GortmakerFrom: Matt Evans <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit e8e5c2155b0035b6e04f29be67f6444bc914005b upstream.
When CPU hotplug is used, some CPUs may be offline at the time a kexec is performed. The subsequent kernel may expect these CPUs to be already running, and will declare them stuck. On pseries, there's also a soft-offline (cede) state that CPUs may be in; this can also cause problems as the kexeced kernel may ask RTAS if they're online -- and RTAS would say they are. The CPU will either appear stuck, or will cause a crash as we replace its cede loop beneath it.
This patch kicks each present offline CPU awake before the kexec, so that none are forever lost to these assumptions in the subsequent kernel.
Now, the behaviour is that all available CPUs that were offlined are now online & usable after the kexec. This mimics the behaviour of a full reboot (on which all CPUs will be restarted).
--- arch/powerpc/kernel/machine_kexec_64.c | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-)
arch/powerpc/kernel/machine_kexec_64.c +25 -0
@@ -15,6 +15,7 @@#include <linux/thread_info.h> #include <linux/init_task.h> #include <linux/errno.h> +#include <linux/cpu.h> #include <asm/page.h> #include <asm/current.h>
@@ -169,10 +170,34 @@ static void kexec_smp_down(void *arg)/* NOTREACHED */ } +/* +* We need to make sure each present CPU is online. The next kernel will scan +* the device tree and assume primary threads are online and query secondary +* threads via RTAS to online them if required. If we don't online primary +* threads, they will be stuck. However, we also online secondary threads as we +* may be using 'cede offline'. In this case RTAS doesn't see the secondary +* threads as offline -- and again, these CPUs will be stuck. +* +* So, we online all CPUs that should be running, including secondary threads. +*/ +static void wake_offline_cpus (void ) +{ +int cpu =0 ; + +for_each_present_cpu (cpu) { +if (!cpu_online (cpu)) { +printk (KERN_INFO "kexec: Waking offline cpu %d.\n" , + cpu); +cpu_up (cpu); + } + } +} +static void kexec_prepare_cpus (void ) {int my_cpu, i, notified=-1 ; +wake_offline_cpus ();smp_call_function (kexec_smp_down,NULL ,/* wait */ 0 ); my_cpu =get_cpu ();
Signature · 1 line
1.7.4.4
PATCH 162/247 netfilter: nf_log: avoid oops in (un)bind with invalid nfproto values
In reply to Paul GortmakerFrom: Jan Engelhardt <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 9ef0298a8e5730d9a46d640014c727f3b4152870 upstream.
Like many other places, we have to check that the array index is within allowed limits, or otherwise, a kernel oops and other nastiness can ensue when we access memory beyond the end of the array.
[ 5954.115381] BUG: unable to handle kernel paging request at 0000004000000000 [ 5954.120014] IP: __find_logger+0x6f/0xa0 [ 5954.123979] nf_log_bind_pf+0x2b/0x70 [ 5954.123979] nfulnl_recv_config+0xc0/0x4a0 [nfnetlink_log] [ 5954.123979] nfnetlink_rcv_msg+0x12c/0x1b0 [nfnetlink]
...
The problem goes back to v2.6.30-rc1~1372~1342~31 where nf_log_bind was decoupled from nf_log_register.
via irc.freenode.net/#netfilter
--- net/netfilter/nf_log.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
net/netfilter/nf_log.c +4 -0
@@ -83,6 +83,8 @@ EXPORT_SYMBOL(nf_log_unregister);int nf_log_bind_pf (u_int8_t pf,const struct nf_logger *logger) { +if (pf >=ARRAY_SIZE (nf_loggers)) +return -EINVAL ;mutex_lock (&nf_log_mutex);if (__find_logger (pf, logger->name) ==NULL ) {mutex_unlock (&nf_log_mutex);
@@ -96,6 +98,8 @@ EXPORT_SYMBOL(nf_log_bind_pf);void nf_log_unbind_pf (u_int8_t pf) { +if (pf >=ARRAY_SIZE (nf_loggers)) +return ;mutex_lock (&nf_log_mutex);rcu_assign_pointer (nf_loggers[pf],NULL );mutex_unlock (&nf_log_mutex);
Signature · 1 line
1.7.4.4
PATCH 163/247 nfsd: wrong index used in inner loop
In reply to Paul GortmakerFrom: roel <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 3ec07aa9522e3d5e9d5ede7bef946756e623a0a0 upstream.
Index i was already used in the outer loop
--- fs/nfsd/nfs4xdr.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
fs/nfsd/nfs4xdr.c +2 -2
@@ -1107,7 +1107,7 @@ nfsd4_decode_create_session(struct nfsd4_compoundargs *argp,u32 dummy;char *machine_name; -int i; +int i, j;int nr_secflavs;READ_BUF (16 );
@@ -1180,7 +1180,7 @@ nfsd4_decode_create_session(struct nfsd4_compoundargs *argp,READ_BUF (4 );READ32 (dummy);READ_BUF (dummy *4 ); -for (i =0 ; i < dummy; ++i) +for (j =0 ; j < dummy; ++j)READ32 (dummy);break ;case RPC_AUTH_GSS :
Signature · 1 line
1.7.4.4
PATCH 164/247 nfsd: wrong index used in inner loop
In reply to Paul GortmakerFrom: Mi Jinlong <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 5a02ab7c3c4580f94d13c683721039855b67cda6 upstream.
We must not use dummy for index.
After the first index, READ32(dummy) will change dummy!!!!
--- fs/nfsd/nfs4xdr.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)
fs/nfsd/nfs4xdr.c +1 -4
@@ -1107,7 +1107,7 @@ nfsd4_decode_create_session(struct nfsd4_compoundargs *argp,u32 dummy;char *machine_name; -int i, j; +int i;int nr_secflavs;READ_BUF (16 );
@@ -1180,8 +1180,6 @@ nfsd4_decode_create_session(struct nfsd4_compoundargs *argp,READ_BUF (4 );READ32 (dummy);READ_BUF (dummy *4 ); -for (j =0 ; j < dummy; ++j) -READ32 (dummy);break ;case RPC_AUTH_GSS : dprintk("RPC_AUTH_GSS callback secflavor "
@@ -1197,7 +1195,6 @@ nfsd4_decode_create_session(struct nfsd4_compoundargs *argp,READ_BUF (4 );READ32 (dummy);READ_BUF (dummy); - p +=XDR_QUADLEN (dummy);break ;default :dprintk ("Illegal callback secflavor\n" );
Signature · 1 line
1.7.4.4
PATCH 165/247 r8169: use RxFIFO overflow workaround for 8168c chipset.
In reply to Paul GortmakerFrom: Ivan Vecera <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit b5ba6d12bdac21bc0620a5089e0f24e362645efd upstream.
I found that one of the 8168c chipsets (concretely XID 1c4000c0) starts generating RxFIFO overflow errors. The result is an infinite loop in interrupt handler as the RxFIFOOver is handled only for ...MAC_VER_11. With the workaround everything goes fine.
--- drivers/net/r8169.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/r8169.c +4 -2
@@ -3712,7 +3712,8 @@ static void rtl_hw_start_8168(struct net_device *dev)RTL_W16 (IntrMitigate,0x5151 );/* Work around for RxFIFO overflow. */ -if (tp->mac_version ==RTL_GIGA_MAC_VER_11 ) { +if (tp->mac_version ==RTL_GIGA_MAC_VER_11 || + tp->mac_version ==RTL_GIGA_MAC_VER_22 ) { tp->intr_event |= RxFIFOOver | PCSTimeout; tp->intr_event &= ~RxOverflow; }
@@ -4602,7 +4603,8 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance)/* Work around for rx fifo overflow */ if (unlikely (status & RxFIFOOver) && - (tp->mac_version ==RTL_GIGA_MAC_VER_11 )) { + (tp->mac_version ==RTL_GIGA_MAC_VER_11 || + tp->mac_version ==RTL_GIGA_MAC_VER_22 )) {netif_stop_queue (dev);rtl8169_tx_timeout (dev);break ;
Signature · 1 line
1.7.4.4
PATCH 166/247 hwmon/f71882fg: Set platform drvdata to NULL later
In reply to Paul GortmakerFrom: Hans de Goede <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit d9ebaa45472c92704f4814682eec21455edcfa1f upstream.
This avoids a possible race leading to trying to dereference NULL.
--- drivers/hwmon/f71882fg.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/hwmon/f71882fg.c +1 -1
@@ -2031,7 +2031,6 @@ static int f71882fg_remove(struct platform_device *pdev)int nr_fans = (data->type == f71882fg) ?4 :3 ;u8 start_reg =f71882fg_read8 (data,F71882FG_REG_START ); -platform_set_drvdata (pdev,NULL );if (data->hwmon_dev)hwmon_device_unregister (data->hwmon_dev);
@@ -2098,6 +2097,7 @@ static int f71882fg_remove(struct platform_device *pdev) } } +platform_set_drvdata (pdev,NULL );kfree (data);return 0 ;
Signature · 1 line
1.7.4.4
PATCH 167/247 mtd: add "platform:" prefix for platform modalias
In reply to Paul GortmakerFrom: Axel Lin <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit c804c733846572ca85c2bba60c7fe6fa024dff18 upstream.
Since 43cc71eed1250755986da4c0f9898f9a635cb3bf (platform: prefix MODALIAS with "platform:"), the platform modalias is prefixed with "platform:".
--- drivers/mtd/nand/omap2.c | 2 +- drivers/mtd/onenand/generic.c | 2 +- drivers/mtd/onenand/omap2.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/mtd/nand/omap2.c +1 -1
@@ -1073,6 +1073,6 @@ static void __exit omap_nand_exit(void)module_init (omap_nand_init);module_exit (omap_nand_exit); -MODULE_ALIAS (DRIVER_NAME ); +MODULE_ALIAS ("platform:" DRIVER_NAME );MODULE_LICENSE ("GPL" );MODULE_DESCRIPTION ("Glue layer for NAND flash on TI OMAP boards" );
drivers/mtd/onenand/generic.c +1 -1
@@ -131,7 +131,7 @@ static struct platform_driver generic_onenand_driver = { .remove = __devexit_p(generic_onenand_remove), }; -MODULE_ALIAS (DRIVER_NAME ); +MODULE_ALIAS ("platform:" DRIVER_NAME );static int __init generic_onenand_init (void ) {
drivers/mtd/onenand/omap2.c +1 -1
@@ -815,7 +815,7 @@ static void __exit omap2_onenand_exit(void)module_init (omap2_onenand_init);module_exit (omap2_onenand_exit); -MODULE_ALIAS (DRIVER_NAME ); +MODULE_ALIAS ("platform:" DRIVER_NAME );MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Jarkko Lavinen <[email protected]>" );MODULE_DESCRIPTION ("Glue layer for OneNAND flash on OMAP2 / OMAP3" );
Signature · 1 line
1.7.4.4
PATCH 168/247 libata: no special completion processing for EH commands
In reply to Paul GortmakerFrom: Tejun Heo <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit f08dc1ac6b15c681f4643d8da1700e06c3855608 upstream.
ata_qc_complete() contains special handling for certain commands. For example, it schedules EH for device revalidation after certain configurations are changed. These shouldn't be applied to EH commands but they were.
In most cases, it doesn't cause an actual problem because EH doesn't issue any command which would trigger special handling; however, ACPI can issue such commands via _GTF which can cause weird interactions.
Restructure ata_qc_complete() such that EH commands are always passed on to __ata_qc_complete().
stable: Please apply to -stable only after 2.6.38 is released.
--- drivers/ata/libata-core.c | 24 +++++++++++++++--------- 1 files changed, 15 insertions(+), 9 deletions(-)
drivers/ata/libata-core.c +15 -9
@@ -5038,9 +5038,6 @@ static void ata_verify_xfer(struct ata_queued_cmd *qc) {struct ata_device *dev = qc->dev; -if (ata_tag_internal (qc->tag)) -return ; -if (ata_is_nodata (qc->tf.protocol))return ;
@@ -5084,14 +5081,23 @@ void ata_qc_complete(struct ata_queued_cmd *qc)if (unlikely (qc->err_mask)) qc->flags |=ATA_QCFLAG_FAILED ; -if (unlikely (qc->flags &ATA_QCFLAG_FAILED )) { -/* always fill result TF for failed qc */ +/* +* Finish internal commands without any further processing +* and always with the result TF filled. +*/ +if (unlikely (ata_tag_internal (qc->tag))) {fill_result_tf (qc); +__ata_qc_complete (qc); +return ; + } -if (!ata_tag_internal (qc->tag)) -ata_qc_schedule_eh (qc); -else -__ata_qc_complete (qc); +/* +* Non-internal qc has failed. Fill the result TF and +* summon EH. +*/ +if (unlikely (qc->flags &ATA_QCFLAG_FAILED )) { +fill_result_tf (qc); +ata_qc_schedule_eh (qc);return ; }
Signature · 1 line
1.7.4.4
PATCH 169/247 MIPS: MTX-1: Make au1000_eth probe all PHY addresses
In reply to Paul GortmakerFrom: Florian Fainelli <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit bf3a1eb85967dcbaae42f4fcb53c2392cec32677 upstream.
When au1000_eth probes the MII bus for PHY address, if we do not set au1000_eth platform data's phy_search_highest_address, the MII probing logic will exit early and will assume a valid PHY is found at address 0. For MTX-1, the PHY is at address 31, and without this patch, the link detection/speed/duplex would not work correctly.
To: [email protected]
Patchwork: https://patchwork.linux-mips.org/patch/2111/
--- arch/mips/alchemy/mtx-1/platform.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
arch/mips/alchemy/mtx-1/platform.c +9 -0
@@ -28,6 +28,8 @@#include <linux/mtd/physmap.h> #include <mtd/mtd-abi.h> +#include <asm/mach-au1x00/au1xxx_eth.h> +static struct gpio_keys_button mtx1_gpio_button[] = { { .gpio =207 ,
@@ -140,10 +142,17 @@ static struct __initdata platform_device * mtx1_devs[] = { &mtx1_mtd, }; +static struct au1000_eth_platform_data mtx1_au1000_eth0_pdata = { + .phy_search_highest_addr =1 , + .phy1_search_mac0 =1 , +}; +static int __init mtx1_register_devices (void ) {int rc; +au1xxx_override_eth_cfg (0 , &mtx1_au1000_eth0_pdata); + rc =gpio_request (mtx1_gpio_button[0 ].gpio, mtx1_gpio_button[0 ].desc);if (rc <0 ) {
Signature · 1 line
1.7.4.4
PATCH 170/247 x86/mm: Handle mm_fault_error() in kernel space
In reply to Paul GortmakerFrom: Andrey Vagin <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit f86268549f424f83b9eb0963989270e14fbfc3de upstream.
mm_fault_error() should not execute oom-killer, if page fault occurs in kernel space. E.g. in copy_from_user()/copy_to_user().
This would happen if we find ourselves in OOM on a copy_to_user(), or a copy_from_user() which faults.
Without this patch, the kernels hangs up in copy_from_user(), because OOM killer sends SIG_KILL to current process, but it can't handle a signal while in syscall, then the kernel returns to copy_from_user(), reexcute current command and provokes page_fault again.
With this patch the kernel return -EFAULT from copy_from_user().
The code, which checks that page fault occurred in kernel space, has been copied from do_sigbus().
This situation is handled by the same way on powerpc, xtensa, tile, ...
LKML-Reference: <[email protected]>
--- arch/x86/mm/fault.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
arch/x86/mm/fault.c +7 -0
@@ -831,6 +831,13 @@ mm_fault_error(struct pt_regs *regs, unsigned long error_code, unsigned long address, unsigned int fault) {if (fault &VM_FAULT_OOM ) { +/* Kernel mode? Handle exceptions or die: */ +if (!(error_code &PF_USER )) { +up_read (¤t->mm->mmap_sem); +no_context (regs, error_code, address); +return ; + } +out_of_memory (regs, error_code, address); }else {if (fault & (VM_FAULT_SIGBUS |VM_FAULT_HWPOISON ))
Signature · 1 line
1.7.4.4
PATCH 171/247 ftrace: Fix memory leak with function graph and cpu hotplug
In reply to Paul GortmakerFrom: Steven Rostedt <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 868baf07b1a259f5f3803c1dc2777b6c358f83cf upstream.
When the fuction graph tracer starts, it needs to make a special stack for each task to save the real return values of the tasks. All running tasks have this stack created, as well as any new tasks.
On CPU hot plug, the new idle task will allocate a stack as well when init_idle() is called. The problem is that cpu hotplug does not create a new idle_task. Instead it uses the idle task that existed when the cpu went down.
ftrace_graph_init_task() will add a new ret_stack to the task that is given to it. Because a clone will make the task have a stack of its parent it does not check if the task's ret_stack is already NULL or not. When the CPU hotplug code starts a CPU up again, it will allocate a new stack even though one already existed for it.
The solution is to treat the idle_task specially. In fact, the function_graph code already does, just not at init_idle(). Instead of using the ftrace_graph_init_task() for the idle task, which that function expects the task to be a clone, have a separate ftrace_graph_init_idle_task(). Also, we will create a per_cpu ret_stack that is used by the idle task. When we call ftrace_graph_init_idle_task() it will check if the idle task's ret_stack is NULL, if it is, then it will assign it the per_cpu ret_stack.
--- include/linux/ftrace.h | 2 + kernel/sched.c | 2 +- kernel/trace/ftrace.c | 52 +++++++++++++++++++++++++++++++++++++++++------ 3 files changed, 48 insertions(+), 8 deletions(-)
include/linux/ftrace.h +2 -0
@@ -417,6 +417,7 @@ extern void unregister_ftrace_graph(void);extern void ftrace_graph_init_task (struct task_struct *t);extern void ftrace_graph_exit_task (struct task_struct *t); +extern void ftrace_graph_init_idle_task (struct task_struct *t,int cpu);static inline int task_curr_ret_stack (struct task_struct *t) {
@@ -440,6 +441,7 @@ static inline void unpause_graph_tracing(void)static inline void ftrace_graph_init_task (struct task_struct *t) { }static inline void ftrace_graph_exit_task (struct task_struct *t) { } +static inline void ftrace_graph_init_idle_task (struct task_struct *t,int cpu) { }static inline int task_curr_ret_stack (struct task_struct *tsk) {
kernel/sched.c +1 -1
@@ -5252,7 +5252,7 @@ void __cpuinit init_idle(struct task_struct *idle, int cpu)* The idle tasks have their own, simple scheduling class: */ idle->sched_class = &idle_sched_class; -ftrace_graph_init_task (idle); +ftrace_graph_init_idle_task (idle, cpu); }/*
kernel/trace/ftrace.c +45 -7
70 lines not on this page · raw message
Signature · 1 line
1.7.4.4
PATCH 172/247 x86: Fix panic when handling "mem={invalid}" param
In reply to Paul GortmakerFrom: Kamal Mostafa <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 77eed821accf5dd962b1f13bed0680e217e49112 upstream.
Avoid removing all of memory and panicing when "mem={invalid}" is specified, e.g. mem=blahblah, mem=0, or mem=nopentium (on platforms other than x86_32).
LKML-Reference: <[email protected]>
--- arch/x86/kernel/e820.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
arch/x86/kernel/e820.c +3 -0
@@ -989,6 +989,9 @@ static int __init parse_memopt(char *p) userdef =1 ; mem_size =memparse (p, &p); +/* don't remove all of memory when handling "mem={invalid}" param */ +if (mem_size ==0 ) +return -EINVAL ;e820_remove_range (mem_size,ULLONG_MAX - mem_size,E820_RAM ,1 );return 0 ;
Signature · 1 line
1.7.4.4
PATCH 173/247 x86: Emit "mem=nopentium ignored" warning when not supported
In reply to Paul GortmakerFrom: Kamal Mostafa <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 9a6d44b9adb777ca9549e88cd55bd8f2673c52a2 upstream.
Emit warning when "mem=nopentium" is specified on any arch other than x86_32 (the only that arch supports it).
LKML-Reference: <[email protected]>
--- arch/x86/kernel/e820.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
arch/x86/kernel/e820.c +5 -2
@@ -980,12 +980,15 @@ static int __init parse_memopt(char *p)if (!p)return -EINVAL ; -#ifdef CONFIG_X86_32 if (!strcmp (p,"nopentium" )) { +#ifdef CONFIG_X86_32 setup_clear_cpu_cap (X86_FEATURE_PSE );return 0 ; - } +#else +printk (KERN_WARNING "mem=nopentium ignored! (only supported on x86_32)\n" ); +return -EINVAL ;#endif + } userdef =1 ; mem_size =memparse (p, &p);
Signature · 1 line
1.7.4.4
PATCH 174/247 ahci: AHCI and RAID mode SATA patch for Intel Patsburg DeviceIDs
In reply to Paul GortmakerFrom: Seth Heasley <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 992b3fb9b5391bc4de5b42bb810dc6dd583a6c4a upstream.
This patch adds the Intel Patsburg (PCH) SATA AHCI and RAID Controller DeviceIDs.
--- drivers/ata/ahci.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/ata/ahci.c +3 -0
@@ -596,6 +596,9 @@ static const struct pci_device_id ahci_pci_tbl[] = { { PCI_VDEVICE(INTEL, 0x1c05), board_ahci }, /* CPT RAID */ { PCI_VDEVICE(INTEL, 0x1c06), board_ahci }, /* CPT RAID */ { PCI_VDEVICE(INTEL, 0x1c07), board_ahci }, /* CPT RAID */ + { PCI_VDEVICE(INTEL, 0x1d02), board_ahci }, /* PBG AHCI */ + { PCI_VDEVICE(INTEL, 0x1d04), board_ahci }, /* PBG RAID */ + { PCI_VDEVICE(INTEL, 0x1d06), board_ahci }, /* PBG RAID *//* JMicron 360/1/3/5/6, match class to avoid IDE function */ { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
Signature · 1 line
1.7.4.4
PATCH 175/247 ahci: AHCI mode SATA patch for Intel DH89xxCC DeviceIDs
In reply to Paul GortmakerFrom: Seth Heasley <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit a4a461a6df6c0481d5a3d61660ed97f5b539cf16 upstream.
This patch adds the AHCI-mode SATA DeviceID for the Intel DH89xxCC PCH.
--- drivers/ata/ahci.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/ata/ahci.c +1 -0
@@ -599,6 +599,7 @@ static const struct pci_device_id ahci_pci_tbl[] = { { PCI_VDEVICE(INTEL, 0x1d02), board_ahci }, /* PBG AHCI */ { PCI_VDEVICE(INTEL, 0x1d04), board_ahci }, /* PBG RAID */ { PCI_VDEVICE(INTEL, 0x1d06), board_ahci }, /* PBG RAID */ + { PCI_VDEVICE(INTEL, 0x2323), board_ahci }, /* DH89xxCC AHCI *//* JMicron 360/1/3/5/6, match class to avoid IDE function */ { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
Signature · 1 line
1.7.4.4
PATCH 176/247 ahci: AHCI mode SATA patch for Intel Patsburg SATA RAID controller
In reply to Paul GortmakerFrom: Seth Heasley <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 64a3903d0885879ba8706a8bcf71c5e3e7664db2 upstream.
This patch adds an updated SATA RAID DeviceID for the Intel Patsburg PCH.
--- drivers/ata/ahci.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/ata/ahci.c +1 -0
@@ -599,6 +599,7 @@ static const struct pci_device_id ahci_pci_tbl[] = { { PCI_VDEVICE(INTEL, 0x1d02), board_ahci }, /* PBG AHCI */ { PCI_VDEVICE(INTEL, 0x1d04), board_ahci }, /* PBG RAID */ { PCI_VDEVICE(INTEL, 0x1d06), board_ahci }, /* PBG RAID */ + { PCI_VDEVICE(INTEL, 0x2826), board_ahci }, /* PBG RAID */ { PCI_VDEVICE(INTEL, 0x2323), board_ahci }, /* DH89xxCC AHCI */ /* JMicron 360/1/3/5/6, match class to avoid IDE function */
Signature · 1 line
1.7.4.4
PATCH 177/247 RDMA/cma: Fix crash in request handlers
In reply to Paul GortmakerFrom: Sean Hefty <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 25ae21a10112875763c18b385624df713a288a05 upstream.
Doug Ledford and Red Hat reported a crash when running the rdma_cm on a real-time OS. The crash has the following call trace:
cm_process_work
cma_req_handler
cma_disable_callback
rdma_create_id
kzalloc
init_completion
cma_get_net_info
cma_save_net_info
cma_any_addr
cma_zero_addr
rdma_translate_ip
rdma_copy_addr
cma_acquire_dev
rdma_addr_get_sgid
ib_find_cached_gid
cma_attach_to_dev
ucma_event_handler
kzalloc
ib_copy_ah_attr_to_user
cma_comp
[ preempted ]
cma_write
copy_from_user
ucma_destroy_id
copy_from_user
_ucma_find_context
ucma_put_ctx
ucma_free_ctx
rdma_destroy_id
cma_exch
cma_cancel_operation
rdma_node_get_transport
rt_mutex_slowunlock
bad_area_nosemaphore
oops_enter
They were able to reproduce the crash multiple times with the following details:
Crash seems to always happen on the:
mutex_unlock(&conn_id->handler_mutex);
as conn_id looks to have been freed during this code path.
An examination of the code shows that a race exists in the request handlers. When a new connection request is received, the rdma_cm allocates a new connection identifier. This identifier has a single reference count on it. If a user calls rdma_destroy_id() from another thread after receiving a callback, rdma_destroy_id will proceed to destroy the id and free the associated memory. However, the request handlers may still be in the process of running. When control returns to the request handlers, they can attempt to access the newly created identifiers.
Fix this by holding a reference on the newly created rdma_cm_id until the request handler is through accessing it.
--- drivers/infiniband/core/cma.c | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-)
drivers/infiniband/core/cma.c +15 -0
@@ -1137,6 +1137,11 @@ static int cma_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event) cm_id->context = conn_id; cm_id->cm_handler = cma_ib_handler; +/* +* Protect against the user destroying conn_id from another thread +* until we're done accessing it. +*/ +atomic_inc (&conn_id->refcount); ret = conn_id->id.event_handler (&conn_id->id, &event);if (!ret) {/*
@@ -1149,8 +1154,10 @@ static int cma_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event)ib_send_cm_mra (cm_id,CMA_CM_MRA_SETTING ,NULL ,0 );mutex_unlock (&lock);mutex_unlock (&conn_id->handler_mutex); +cma_deref_id (conn_id); goto out; } +cma_deref_id (conn_id);/* Destroy the CM ID by returning a non-zero value. */ conn_id->cm_id.ib =NULL ;
@@ -1352,17 +1359,25 @@ static int iw_conn_req_handler(struct iw_cm_id *cm_id, event.param.conn.private_data_len = iw_event->private_data_len; event.param.conn.initiator_depth = attr.max_qp_init_rd_atom; event.param.conn.responder_resources = attr.max_qp_rd_atom; + +/* +* Protect against the user destroying conn_id from another thread +* until we're done accessing it. +*/ +atomic_inc (&conn_id->refcount); ret = conn_id->id.event_handler (&conn_id->id, &event);if (ret) {/* User wants to destroy the CM ID */ conn_id->cm_id.iw =NULL ;cma_exch (conn_id,CMA_DESTROYING );mutex_unlock (&conn_id->handler_mutex); +cma_deref_id (conn_id);rdma_destroy_id (&conn_id->id); goto out; }mutex_unlock (&conn_id->handler_mutex); +cma_deref_id (conn_id); out:if (dev)
Signature · 1 line
1.7.4.4
PATCH 178/247 IB/cm: Bump reference count on cm_id before invoking callback
In reply to Paul GortmakerFrom: Sean Hefty <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 29963437a48475036353b95ab142bf199adb909e upstream.
When processing a SIDR REQ, the ib_cm allocates a new cm_id. The refcount of the cm_id is initialized to 1. However, cm_process_work will decrement the refcount after invoking all callbacks. The result is that the cm_id will end up with refcount set to 0 by the end of the sidr req handler.
If a user tries to destroy the cm_id, the destruction will proceed, under the incorrect assumption that no other threads are referencing the cm_id. This can lead to a crash when the cm callback thread tries to access the cm_id.
This problem was noticed as part of a larger investigation with kernel crashes in the rdma_cm when running on a real time OS.
--- drivers/infiniband/core/cm.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/infiniband/core/cm.c +1 -0
@@ -2987,6 +2987,7 @@ static int cm_sidr_req_handler(struct cm_work *work) goto out;/* No match. */ }atomic_inc (&cur_cm_id_priv->refcount); +atomic_inc (&cm_id_priv->refcount);spin_unlock_irq (&cm.lock); cm_id_priv->id.cm_handler = cur_cm_id_priv->id.cm_handler;
Signature · 1 line
1.7.4.4
PATCH 179/247 x86, quirk: Fix SB600 revision check
In reply to Paul GortmakerFrom: Andreas Herrmann <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 1d3e09a304e6c4e004ca06356578b171e8735d3c upstream.
Commit 7f74f8f28a2bd9db9404f7d364e2097a0c42cc12
(x86 quirk: Fix polarity for IRQ0 pin2 override on SB800 systems) introduced a regression. It removed some SB600 specific code to determine the revision ID without adapting a corresponding revision ID check for SB600.
See this mail thread:
http://marc.info/?l=linux-kernel&m=129980296006380&w=2
This patch adapts the corresponding check to cover all SB600 revisions.
LKML-Reference: <[email protected]>
--- arch/x86/kernel/early-quirks.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
arch/x86/kernel/early-quirks.c +6 -1
@@ -161,7 +161,12 @@ static void __init ati_bugs_contd(int num, int slot, int func)if (rev >=0x40 ) acpi_fix_pin2_polarity =1 ; -if (rev >0x13 ) +/* +* SB600: revisions 0x11, 0x12, 0x13, 0x14, ... +* SB700: revisions 0x39, 0x3a, ... +* SB800: revisions 0x40, 0x41, ... +*/ +if (rev >=0x39 )return ;if (acpi_use_timer_override)
Signature · 1 line
1.7.4.4
PATCH 180/247 ath9k_hw: Fix incorrect macversion and macrev checks
In reply to Paul GortmakerFrom: Senthil Balasubramanian <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit ac45c12dfb3f727a5a7a3332ed9c11b4a5ab287e upstream.
There are few places where we are checking for macversion and revsions before RTC is powered ON. However we are reading the macversion and revisions only after RTC is powered ON and so both macversion and revisions are actully zero and this leads to incorrect srev checks
Incorrect srev checks can cause registers to be configured wrongly and can cause unexpected behavior. Fixing this seems to address the ASPM issue that we have observed. The laptop becomes very slow and hangs mostly with ASPM L1 enabled without this fix.
fix this by reading the macversion and revisisons even before we start using them. There is no reason why should we delay reading this info until RTC is powered on as this is just a register information.
--- drivers/net/wireless/ath/ath9k/hw.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/hw.c +2 -2
@@ -850,6 +850,8 @@ int ath9k_hw_init(struct ath_hw *ah)ath9k_hw_init_defaults (ah);ath9k_hw_init_config (ah); +ath9k_hw_read_revisions (ah); +if (!ath9k_hw_set_reset_reg (ah,ATH9K_RESET_POWER_ON )) {ath_print (common,ATH_DBG_FATAL ,"Couldn't reset chip\n" );
@@ -1770,8 +1772,6 @@ static bool ath9k_hw_set_reset_power_on(struct ath_hw *ah)return false; } -ath9k_hw_read_revisions (ah); -return ath9k_hw_set_reset (ah,ATH9K_RESET_WARM ); }
Signature · 1 line
1.7.4.4
PATCH 181/247 USB: serial/kobil_sct, fix potential tty NULL dereference
In reply to Paul GortmakerFrom: Jiri Slaby <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 6960f40a954619857e7095a6179eef896f297077 upstream.
Make sure that we check the return value of tty_port_tty_get. Sometimes it may return NULL and we later dereference that.
The only place here is in kobil_read_int_callback, so fix it.
--- drivers/usb/serial/kobil_sct.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/usb/serial/kobil_sct.c +1 -1
@@ -372,7 +372,7 @@ static void kobil_read_int_callback(struct urb *urb) } tty =tty_port_tty_get (&port->port); -if (urb->actual_length) { +if (tty && urb->actual_length) {/* BEGIN DEBUG */ /*
Signature · 1 line
1.7.4.4
PATCH 182/247 USB: serial: ch341: add new id
In reply to Paul GortmakerFrom: wangyanqing <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit d0781383038e983a63843a9a6a067ed781db89c1 upstream.
I picked up a new DAK-780EX(professional digitl reverb/mix system), which use CH341T chipset to communication with computer on 3/2011 and the CH341T's vendor code is 1a86
Looking up the CH341T's vendor and product id's I see:
1a86 QinHeng Electronics
5523 CH341 in serial mode, usb to serial port converter
CH341T,CH341 are the products of the same company, maybe have some common hardware, and I test the ch341.c works well with CH341T
--- drivers/usb/serial/ch341.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/usb/serial/ch341.c +1 -0
@@ -75,6 +75,7 @@ static int debug;static const struct usb_device_id id_table[] = { {USB_DEVICE (0x4348 ,0x5523 ) }, {USB_DEVICE (0x1a86 ,0x7523 ) }, + {USB_DEVICE (0x1a86 ,0x5523 ) }, { }, };MODULE_DEVICE_TABLE (usb, id_table);
Signature · 1 line
1.7.4.4
PATCH 183/247 xhci: Fix cycle bit calculation during stall handling.
In reply to Paul GortmakerFrom: Sarah Sharp <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 01a1fdb9a7afa5e3c14c9316d6f380732750b4e4 upstream.
When an endpoint stalls, we need to update the xHCI host's internal dequeue pointer to move it past the stalled transfer. This includes updating the cycle bit (TRB ownership bit) if we have moved the dequeue pointer past a link TRB with the toggle cycle bit set.
When we're trying to find the new dequeue segment, find_trb_seg() is supposed to keep track of whether we've passed any link TRBs with the toggle cycle bit set. However, this while loop's body
while (cur_seg->trbs > trb ||
&cur_seg->trbs[TRBS_PER_SEGMENT - 1] < trb) {Will never get executed if the ring only contains one segment. find_trb_seg() will return immediately, without updating the new cycle bit. Since find_trb_seg() has no idea where in the segment the TD that stalled was, make the caller, xhci_find_new_dequeue_state(), check for this special case and update the cycle bit accordingly.
This patch should be queued to kernels all the way back to 2.6.31.
--- drivers/usb/host/xhci-ring.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-)
drivers/usb/host/xhci-ring.c +14 -0
@@ -418,6 +418,20 @@ void xhci_find_new_dequeue_state(struct xhci_hcd *xhci, state->new_cycle_state = ~(state->new_cycle_state) &0x1 ;next_trb (xhci, ep_ring, &state->new_deq_seg, &state->new_deq_ptr); +/* +* If there is only one segment in a ring, find_trb_seg()'s while loop +* will not run, and it will return before it has a chance to see if it +* needs to toggle the cycle bit. It can't tell if the stalled transfer +* ended just before the link TRB on a one-segment ring, or if the TD +* wrapped around the top of the ring, because it doesn't have the TD in +* question. Look for the one-segment case where stalled TRB's address +* is greater than the new dequeue pointer address. +*/ +if (ep_ring->first_seg == ep_ring->first_seg->next && + state->new_deq_ptr < dev->eps[ep_index].stopped_trb) + state->new_cycle_state ^=0x1 ; +xhci_dbg (xhci,"Cycle state = 0x%x\n" , state->new_cycle_state); +/* Don't update the ring cycle state for the producer (us). */ xhci_dbg (xhci,"New dequeue segment = %p (virtual)\n" , state->new_deq_seg);
Signature · 1 line
1.7.4.4
PATCH 184/247 ALSA: hda - fix digital mic selection in mixer on 92HD8X codecs
In reply to Paul GortmakerFrom: Vitaliy Kulikov <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 094a42452abd5564429045e210281c6d22e67fca upstream.
When the mux for digital mic is different from the mux for other mics, the current auto-parser doesn't handle them in a right way but provides only one mic. This patch fixes the issue.
--- sound/pci/hda/patch_sigmatel.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-)
sound/pci/hda/patch_sigmatel.c +8 -3
@@ -735,7 +735,7 @@ static int stac92xx_mux_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_estruct sigmatel_spec *spec = codec->spec;unsigned int adc_idx =snd_ctl_get_ioffidx (kcontrol, &ucontrol->id);const struct hda_input_mux *imux = spec->input_mux; -unsigned int idx, prev_idx; +unsigned int idx, prev_idx, didx; idx = ucontrol->value.enumerated.item[0 ];if (idx >= imux->num_items)
@@ -747,7 +747,8 @@ static int stac92xx_mux_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_esnd_hda_codec_write_cache (codec, spec->mux_nids[adc_idx],0 ,AC_VERB_SET_CONNECT_SEL , imux->items[idx].index); -if (prev_idx >= spec->num_analog_muxes) { +if (prev_idx >= spec->num_analog_muxes && + spec->mux_nids[adc_idx] != spec->dmux_nids[adc_idx]) { imux = spec->dinput_mux;/* 0 = analog */ snd_hda_codec_write_cache(codec,
@@ -757,9 +758,13 @@ static int stac92xx_mux_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e } }else { imux = spec->dinput_mux; +/* first dimux item is hardcoded to select analog imux, +* so lets skip it +*/ + didx = idx - spec->num_analog_muxes +1 ;snd_hda_codec_write_cache (codec, spec->dmux_nids[adc_idx],0 ,AC_VERB_SET_CONNECT_SEL , - imux->items[idx -1 ].index); + imux->items[didx].index); } spec->cur_mux[adc_idx] = idx;return 1 ;
Signature · 1 line
1.7.4.4
PATCH 185/247 PCI: remove quirk for pre-production systems
In reply to Paul GortmakerFrom: Brandeburg, Jesse <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit b99af4b002e4908d1a5cdaf424529bdf1dc69768 upstream.
Revert commit 7eb93b175d4de9438a4b0af3a94a112cb5266944
Author: Yu Zhao <[email protected]> Date: Fri Apr 3 15:18:11 2009 +0800
PCI: SR-IOV quirk for Intel 82576 NIC
If BIOS doesn't allocate resources for the SR-IOV BARs, zero the Flash BAR and program the SR-IOV BARs to use the old Flash Memory Space.
Please refer to Intel 82576 Gigabit Ethernet Controller Datasheet section 7.9.2.14.2 for details.
http://download.intel.com/design/network/datashts/82576_Datasheet.pdf
This quirk was added before SR-IOV was in production and now all machines that originally had this issue alreayd have bios updates to correct the issue. The quirk itself is no longer needed and in fact causes bugs if run. Remove it.
--- drivers/pci/quirks.c | 52 -------------------------------------------------- 1 files changed, 0 insertions(+), 52 deletions(-)
drivers/pci/quirks.c +0 -52
@@ -2529,58 +2529,6 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4375,#endif /* CONFIG_PCI_MSI */ -#ifdef CONFIG_PCI_IOV - -/* -* For Intel 82576 SR-IOV NIC, if BIOS doesn't allocate resources for the -* SR-IOV BARs, zero the Flash BAR and program the SR-IOV BARs to use the -* old Flash Memory Space. -*/ -static void __devinit quirk_i82576_sriov (struct pci_dev *dev) -{ -int pos, flags; -u32 bar, start, size; - -if (PAGE_SIZE >0x10000 ) -return ; - - flags =pci_resource_flags (dev,0 ); -if ((flags &PCI_BASE_ADDRESS_SPACE ) != -PCI_BASE_ADDRESS_SPACE_MEMORY || - (flags &PCI_BASE_ADDRESS_MEM_TYPE_MASK ) != -PCI_BASE_ADDRESS_MEM_TYPE_32 ) -return ; - - pos =pci_find_ext_capability (dev,PCI_EXT_CAP_ID_SRIOV ); -if (!pos) -return ; - -pci_read_config_dword (dev, pos +PCI_SRIOV_BAR , &bar); -if (bar &PCI_BASE_ADDRESS_MEM_MASK ) -return ; - - start =pci_resource_start (dev,1 ); - size =pci_resource_len (dev,1 ); -if (!start || size !=0x400000 || start & (size -1 )) -return ; - -pci_resource_flags (dev,1 ) =0 ; -pci_write_config_dword (dev,PCI_BASE_ADDRESS_1 ,0 ); -pci_write_config_dword (dev, pos +PCI_SRIOV_BAR , start); -pci_write_config_dword (dev, pos +PCI_SRIOV_BAR +12 , start + size /2 ); - -dev_info (&dev->dev,"use Flash Memory Space for SR-IOV BARs\n" ); -} -DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x10c9 , quirk_i82576_sriov); -DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x10e6 , quirk_i82576_sriov); -DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x10e7 , quirk_i82576_sriov); -DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x10e8 , quirk_i82576_sriov); -DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x150a , quirk_i82576_sriov); -DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x150d , quirk_i82576_sriov); -DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x1518 , quirk_i82576_sriov); - -#endif /* CONFIG_PCI_IOV */ -/* * This is a quirk for the Ricoh MMC controller found as a part of * some mulifunction chips.
Signature · 1 line
1.7.4.4
PATCH 186/247 PCI: add more checking to ICH region quirks
In reply to Paul GortmakerFrom: Jiri Slaby <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit cdb9755849fbaf2bb9c0a009ba5baa817a0f152d upstream.
Per ICH4 and ICH6 specs, ACPI and GPIO regions are valid iff ACPI_EN and GPIO_EN bits are set to 1. Add checks for these bits into the quirks prior to the region creation.
While at it, name the constants by macros.
--- drivers/pci/quirks.c | 45 +++++++++++++++++++++++++++++++++++++-------- 1 files changed, 37 insertions(+), 8 deletions(-)
drivers/pci/quirks.c +37 -8
@@ -519,6 +519,17 @@ static void __devinit quirk_piix4_acpi(struct pci_dev *dev)DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_82371AB_3 , quirk_piix4_acpi);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_82443MX_3 , quirk_piix4_acpi); +#define ICH_PMBASE 0x40 +#define ICH_ACPI_CNTL 0x44 +#define ICH4_ACPI_EN 0x10 +#define ICH6_ACPI_EN 0x80 +#define ICH4_GPIOBASE 0x58 +#define ICH4_GPIO_CNTL 0x5c +#define ICH4_GPIO_EN 0x10 +#define ICH6_GPIOBASE 0x48 +#define ICH6_GPIO_CNTL 0x4c +#define ICH6_GPIO_EN 0x10 +/* * ICH4, ICH4-M, ICH5, ICH5-M ACPI: Three IO regions pointed to by longwords at * 0x40 (128 bytes of ACPI, GPIO & TCO registers)
@@ -527,12 +538,21 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443MX_3, quistatic void __devinit quirk_ich4_lpc_acpi (struct pci_dev *dev) {u32 region; +u8 enable; -pci_read_config_dword (dev,0x40 , ®ion); -quirk_io_region (dev, region,128 ,PCI_BRIDGE_RESOURCES ,"ICH4 ACPI/GPIO/TCO" ); +pci_read_config_byte (dev,ICH_ACPI_CNTL , &enable); +if (enable &ICH4_ACPI_EN ) { +pci_read_config_dword (dev,ICH_PMBASE , ®ion); +quirk_io_region (dev, region,128 ,PCI_BRIDGE_RESOURCES , +"ICH4 ACPI/GPIO/TCO" ); + } -pci_read_config_dword (dev,0x58 , ®ion); -quirk_io_region (dev, region,64 ,PCI_BRIDGE_RESOURCES +1 ,"ICH4 GPIO" ); +pci_read_config_byte (dev,ICH4_GPIO_CNTL , &enable); +if (enable &ICH4_GPIO_EN ) { +pci_read_config_dword (dev,ICH4_GPIOBASE , ®ion); +quirk_io_region (dev, region,64 ,PCI_BRIDGE_RESOURCES +1 , +"ICH4 GPIO" ); + } }DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_82801AA_0 , quirk_ich4_lpc_acpi);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_82801AB_0 , quirk_ich4_lpc_acpi);
@@ -548,12 +568,21 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_1, quistatic void __devinit ich6_lpc_acpi_gpio (struct pci_dev *dev) {u32 region; +u8 enable; -pci_read_config_dword (dev,0x40 , ®ion); -quirk_io_region (dev, region,128 ,PCI_BRIDGE_RESOURCES ,"ICH6 ACPI/GPIO/TCO" ); +pci_read_config_byte (dev,ICH_ACPI_CNTL , &enable); +if (enable &ICH6_ACPI_EN ) { +pci_read_config_dword (dev,ICH_PMBASE , ®ion); +quirk_io_region (dev, region,128 ,PCI_BRIDGE_RESOURCES , +"ICH6 ACPI/GPIO/TCO" ); + } -pci_read_config_dword (dev,0x48 , ®ion); -quirk_io_region (dev, region,64 ,PCI_BRIDGE_RESOURCES +1 ,"ICH6 GPIO" ); +pci_read_config_byte (dev,ICH6_GPIO_CNTL , &enable); +if (enable &ICH4_GPIO_EN ) { +pci_read_config_dword (dev,ICH6_GPIOBASE , ®ion); +quirk_io_region (dev, region,64 ,PCI_BRIDGE_RESOURCES +1 , +"ICH6 GPIO" ); + } }static void __devinit ich6_lpc_generic_decode (struct pci_dev *dev,unsigned reg,const char *name,int dynsize)
Signature · 1 line
1.7.4.4
PATCH 187/247 PCI: do not create quirk I/O regions below PCIBIOS_MIN_IO for ICH
In reply to Paul GortmakerFrom: Jiri Slaby <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 87e3dc3855430bd254370afc79f2ed92250f5b7c upstream.
Some broken BIOSes on ICH4 chipset report an ACPI region which is in conflict with legacy IDE ports when ACPI is disabled. Even though the regions overlap, IDE ports are working correctly (we cannot find out the decoding rules on chipsets).
So the only problem is the reported region itself, if we don't reserve the region in the quirk everything works as expected.
This patch avoids reserving any quirk regions below PCIBIOS_MIN_IO which is 0x1000. Some regions might be (and are by a fast google query) below this border, but the only difference is that they won't be reserved anymore. They should still work though the same as before.
The conflicts look like (1f.0 is bridge, 1f.1 is IDE ctrl):
pci 0000:00:1f.1: address space collision: [io 0x0170-0x0177] conflicts with 0000:00:1f.0 [io 0x0100-0x017f]
At 0x0100 a 128 bytes long ACPI region is reported in the quirk for ICH4. ata_piix then fails to find disks because the IDE legacy ports are zeroed:ata_piix 0000:00:1f.1: device not available (can't reserve [io 0x0000-0x0007])
References: https://bugzilla.novell.com/show_bug.cgi?id=558740
--- drivers/pci/quirks.c | 32 ++++++++++++++++++++++++-------- 1 files changed, 24 insertions(+), 8 deletions(-)
drivers/pci/quirks.c +24 -8
@@ -540,18 +540,30 @@ static void __devinit quirk_ich4_lpc_acpi(struct pci_dev *dev)u32 region;u8 enable; +/* +* The check for PCIBIOS_MIN_IO is to ensure we won't create a conflict +* with low legacy (and fixed) ports. We don't know the decoding +* priority and can't tell whether the legacy device or the one created +* here is really at that address. This happens on boards with broken +* BIOSes. +*/ +pci_read_config_byte (dev,ICH_ACPI_CNTL , &enable);if (enable &ICH4_ACPI_EN ) {pci_read_config_dword (dev,ICH_PMBASE , ®ion); -quirk_io_region (dev, region,128 ,PCI_BRIDGE_RESOURCES , -"ICH4 ACPI/GPIO/TCO" ); + region &=PCI_BASE_ADDRESS_IO_MASK ; +if (region >=PCIBIOS_MIN_IO ) +quirk_io_region (dev, region,128 ,PCI_BRIDGE_RESOURCES , +"ICH4 ACPI/GPIO/TCO" ); }pci_read_config_byte (dev,ICH4_GPIO_CNTL , &enable);if (enable &ICH4_GPIO_EN ) {pci_read_config_dword (dev,ICH4_GPIOBASE , ®ion); -quirk_io_region (dev, region,64 ,PCI_BRIDGE_RESOURCES +1 , -"ICH4 GPIO" ); + region &=PCI_BASE_ADDRESS_IO_MASK ; +if (region >=PCIBIOS_MIN_IO ) +quirk_io_region (dev, region,64 , +PCI_BRIDGE_RESOURCES +1 ,"ICH4 GPIO" ); } }DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_82801AA_0 , quirk_ich4_lpc_acpi);
@@ -573,15 +585,19 @@ static void __devinit ich6_lpc_acpi_gpio(struct pci_dev *dev)pci_read_config_byte (dev,ICH_ACPI_CNTL , &enable);if (enable &ICH6_ACPI_EN ) {pci_read_config_dword (dev,ICH_PMBASE , ®ion); -quirk_io_region (dev, region,128 ,PCI_BRIDGE_RESOURCES , -"ICH6 ACPI/GPIO/TCO" ); + region &=PCI_BASE_ADDRESS_IO_MASK ; +if (region >=PCIBIOS_MIN_IO ) +quirk_io_region (dev, region,128 ,PCI_BRIDGE_RESOURCES , +"ICH6 ACPI/GPIO/TCO" ); }pci_read_config_byte (dev,ICH6_GPIO_CNTL , &enable);if (enable &ICH4_GPIO_EN ) {pci_read_config_dword (dev,ICH6_GPIOBASE , ®ion); -quirk_io_region (dev, region,64 ,PCI_BRIDGE_RESOURCES +1 , -"ICH6 GPIO" ); + region &=PCI_BASE_ADDRESS_IO_MASK ; +if (region >=PCIBIOS_MIN_IO ) +quirk_io_region (dev, region,64 , +PCI_BRIDGE_RESOURCES +1 ,"ICH6 GPIO" ); } }
Signature · 1 line
1.7.4.4
PATCH 188/247 PCI: sysfs: Fix failure path for addition of "vpd" attribute
In reply to Paul GortmakerFrom: Ben Hutchings <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 0f12a4e29368a9476076515881d9ef4e5876c6e2 upstream.
Commit 280c73d ("PCI: centralize the capabilities code in pci-sysfs.c") changed the initialisation of the "rom" and "vpd" attributes, and made the failure path for the "vpd" attribute incorrect. We must free the new attribute structure (attr), but instead we currently free dev->vpd->attr. That will normally be NULL, resulting in a memory leak, but it might be a stale pointer, resulting in a double-free.
Found by inspection; compile-tested only.
--- drivers/pci/pci-sysfs.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/pci/pci-sysfs.c +1 -1
@@ -995,7 +995,7 @@ static int pci_create_capabilities_sysfs(struct pci_dev *dev) attr->write = write_vpd_attr; retval =sysfs_create_bin_file (&dev->dev.kobj, attr);if (retval) { -kfree (dev->vpd->attr); +kfree (attr);return retval; } dev->vpd->attr = attr;
Signature · 1 line
1.7.4.4
PATCH 189/247 ALSA: ctxfi - Fix incorrect SPDIF status bit mask
In reply to Paul GortmakerFrom: Przemyslaw Bruski <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 4c1847e884efddcc3ede371f7839e5e65b25c34d upstream.
SPDIF status mask creation was incorrect.
--- sound/pci/ctxfi/ctatc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
sound/pci/ctxfi/ctatc.c +1 -1
@@ -869,7 +869,7 @@ spdif_passthru_playback_setup(struct ct_atc *atc, struct ct_atc_pcm *apcm)mutex_lock (&atc->atc_mutex); dao->ops->get_spos (dao, &status);if (((status >>24 ) &IEC958_AES3_CON_FS ) != iec958_con_fs) { - status &= ((~IEC958_AES3_CON_FS ) <<24 ); + status &= ~(IEC958_AES3_CON_FS <<24 ); status |= (iec958_con_fs <<24 ); dao->ops->set_spos (dao, status); dao->ops->commit_write (dao);
Signature · 1 line
1.7.4.4
PATCH 190/247 ALSA: ctxfi - Fix SPDIF status retrieval
In reply to Paul GortmakerFrom: Przemyslaw Bruski <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit f164753a263bfd2daaf3e0273b179de7e099c57d upstream.
SDPIF status retrieval always returned the default settings instead of the actual ones.
--- sound/pci/ctxfi/ctmixer.c | 19 +++++-------------- 1 files changed, 5 insertions(+), 14 deletions(-)
sound/pci/ctxfi/ctmixer.c +5 -14
@@ -566,19 +566,6 @@ static int ct_spdif_get_mask(struct snd_kcontrol *kcontrol,return 0 ; } -static int ct_spdif_default_get (struct snd_kcontrol *kcontrol, -struct snd_ctl_elem_value *ucontrol) -{ -unsigned int status =SNDRV_PCM_DEFAULT_CON_SPDIF ; - - ucontrol->value.iec958.status[0 ] = (status >>0 ) &0xff ; - ucontrol->value.iec958.status[1 ] = (status >>8 ) &0xff ; - ucontrol->value.iec958.status[2 ] = (status >>16 ) &0xff ; - ucontrol->value.iec958.status[3 ] = (status >>24 ) &0xff ; - -return 0 ; -} -static int ct_spdif_get (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol) {
@@ -586,6 +573,10 @@ static int ct_spdif_get(struct snd_kcontrol *kcontrol,unsigned int status; atc->spdif_out_get_status (atc, &status); + +if (status ==0 ) + status =SNDRV_PCM_DEFAULT_CON_SPDIF ; + ucontrol->value.iec958.status[0 ] = (status >>0 ) &0xff ; ucontrol->value.iec958.status[1 ] = (status >>8 ) &0xff ; ucontrol->value.iec958.status[2 ] = (status >>16 ) &0xff ;
@@ -629,7 +620,7 @@ static struct snd_kcontrol_new iec958_default_ctl = { .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, DEFAULT), .count = 1, .info = ct_spdif_info, - .get = ct_spdif_default_get, + .get = ct_spdif_get, .put = ct_spdif_put, .private_value = MIXER_IEC958_DEFAULT };
Signature · 1 line
1.7.4.4
PATCH 191/247 ALSA: ctxfi - Clear input settings before initialization
In reply to Paul GortmakerFrom: Przemyslaw Bruski <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit efed5f26664f93991c929d5bb343e65f900d72bc upstream.
Clear input settings before initialization.
--- sound/pci/ctxfi/ctdaio.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
sound/pci/ctxfi/ctdaio.c +2 -0
@@ -176,6 +176,7 @@ static int dao_set_left_input(struct dao *dao, struct rsc *input)if (!entry)return -ENOMEM ; + dao->ops->clear_left_input (dao);/* Program master and conjugate resources */ input->ops->master (input); daio->rscl.ops->master (&daio->rscl);
@@ -204,6 +205,7 @@ static int dao_set_right_input(struct dao *dao, struct rsc *input)if (!entry)return -ENOMEM ; + dao->ops->clear_right_input (dao);/* Program master and conjugate resources */ input->ops->master (input); daio->rscr.ops->master (&daio->rscr);
Signature · 1 line
1.7.4.4
PATCH 192/247 SUNRPC: Ensure we always run the tk_callback before tk_action
In reply to Paul GortmakerFrom: Trond Myklebust <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit e020c6800c9621a77223bf2c1ff68180e41e8ebf upstream.
This fixes a race in which the task->tk_callback() puts the rpc_task to sleep, setting a new callback. Under certain circumstances, the current code may end up executing the task->tk_action before it gets round to the callback.
--- net/sunrpc/sched.c | 14 ++++++-------- 1 files changed, 6 insertions(+), 8 deletions(-)
net/sunrpc/sched.c +6 -8
@@ -642,14 +642,12 @@ static void __rpc_execute(struct rpc_task *task) save_callback = task->tk_callback; task->tk_callback =NULL ;save_callback (task); - } - -/* -* Perform the next FSM step. -* tk_action may be NULL when the task has been killed -* by someone else. -*/ -if (!RPC_IS_QUEUED (task)) { + }else { +/* +* Perform the next FSM step. +* tk_action may be NULL when the task has been killed +* by someone else. +*/ if (task->tk_action ==NULL )break ; task->tk_action (task);
Signature · 1 line
1.7.4.4
PATCH 193/247 perf, powerpc: Handle events that raise an exception without overflowing
In reply to Paul GortmakerFrom: Anton Blanchard <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 0837e3242c73566fc1c0196b4ec61779c25ffc93 upstream.
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.
LKML-Reference: <20110309143842.6c22845e@kryten>
--- arch/powerpc/include/asm/reg.h | 1 + arch/powerpc/kernel/perf_event.c | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletions(-)
arch/powerpc/include/asm/reg.h +1 -0
@@ -864,6 +864,7 @@#define PV_970 0x0039#define PV_POWER5 0x003A#define PV_POWER5p 0x003B +#define PV_POWER7 0x003F#define PV_970FX 0x003C#define PV_630 0x0040#define PV_630p 0x0041
arch/powerpc/kernel/perf_event.c +23 -1
@@ -1220,6 +1220,28 @@ unsigned long perf_instruction_pointer(struct pt_regs *regs)return ip; } +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; +} +/* * Performance monitor interrupt stuff */
@@ -1267,7 +1289,7 @@ static void perf_event_interrupt(struct pt_regs *regs)if (is_limited_pmc (i +1 ))continue ; val =read_pmc (i +1 ); -if ((int )val <0 ) +if (pmc_overflow (val))write_pmc (i +1 ,0 ); } }
Signature · 1 line
1.7.4.4
PATCH 194/247 ext3: Always set dx_node's fake_dirent explicitly.
In reply to Paul GortmakerFrom: Eric Sandeen <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit d7433142b63d727b5a217c37b1a1468b116a9771 upstream.
(crossport of 1f7bebb9e911d870fa8f997ddff838e82b5715ea by Andreas Schlick <[email protected]>)
When ext3_dx_add_entry() has to split an index node, it has to ensure that name_len of dx_node's fake_dirent is also zero, because otherwise e2fsck won't recognise it as an intermediate htree node and consider the htree to be corrupted.
--- fs/ext3/namei.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
fs/ext3/namei.c +1 -1
@@ -1550,8 +1550,8 @@ static int ext3_dx_add_entry(handle_t *handle, struct dentry *dentry, goto cleanup; node2 = (struct dx_node *)(bh2->b_data); entries2 = node2->entries; +memset (&node2->fake,0 ,sizeof (struct fake_dirent )); node2->fake.rec_len =ext3_rec_len_to_disk (sb->s_blocksize); - node2->fake.inode =0 ;BUFFER_TRACE (frame->bh,"get_write_access" ); err =ext3_journal_get_write_access (handle, frame->bh);if (err)
Signature · 1 line
1.7.4.4
PATCH 195/247 call_function_many: fix list delete vs add race
In reply to Paul GortmakerFrom: Milton Miller <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit e6cd1e07a185d5f9b0aa75e020df02d3c1c44940 upstream.
Peter pointed out there was nothing preventing the list_del_rcu in smp_call_function_interrupt from running before the list_add_rcu in smp_call_function_many.
Fix this by not setting refs until we have gotten the lock for the list. Take advantage of the wmb in list_add_rcu to save an explicit additional one.
I tried to force this race with a udelay before the lock & list_add and by mixing all 64 online cpus with just 3 random cpus in the mask, but was unsuccessful. Still, inspection shows a valid race, and the fix is a extension of the existing protection window in the current code.
--- kernel/smp.c | 20 +++++++++++++------- 1 files changed, 13 insertions(+), 7 deletions(-)
kernel/smp.c +13 -7
@@ -470,14 +470,15 @@ void smp_call_function_many(const struct cpumask *mask,cpumask_clear_cpu (this_cpu, data->cpumask);/* -* To ensure the interrupt handler gets an complete view -* we order the cpumask and refs writes and order the read -* of them in the interrupt handler. In addition we may -* only clear our own cpu bit from the mask. +* We reuse the call function data without waiting for any grace +* period after some other cpu removes it from the global queue. +* This means a cpu might find our data block as it is writen. +* The interrupt handler waits until it sees refs filled out +* while its cpu mask bit is set; here we may only clear our +* own cpu mask bit, and must wait to set refs until we are sure +* previous writes are complete and we have obtained the lock to +* add the element to the queue. */ -smp_wmb (); - -atomic_set (&data->refs,cpumask_weight (data->cpumask));raw_spin_lock_irqsave (&call_function.lock, flags);/*
@@ -486,6 +487,11 @@ void smp_call_function_many(const struct cpumask *mask,* will not miss any other list entries: */ list_add_rcu (&data->csd.list, &call_function.queue); +/* +* We rely on the wmb() in list_add_rcu to order the writes +* to func, data, and cpumask before this write to refs. +*/ +atomic_set (&data->refs,cpumask_weight (data->cpumask));raw_spin_unlock_irqrestore (&call_function.lock, flags);/*
Signature · 1 line
1.7.4.4
PATCH 196/247 call_function_many: add missing ordering
In reply to Paul GortmakerFrom: Milton Miller <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 45a5791920ae643eafc02e2eedef1a58e341b736 upstream.
Paul McKenney's review pointed out two problems with the barriers in the 2.6.38 update to the smp call function many code.
First, a barrier that would force the func and info members of data to be visible before their consumption in the interrupt handler was missing. This can be solved by adding a smp_wmb between setting the func and info members and setting setting the cpumask; this will pair with the existing and required smp_rmb ordering the cpumask read before the read of refs. This placement avoids the need a second smp_rmb in the interrupt handler which would be executed on each of the N cpus executing the call request. (I was thinking this barrier was present but was not).
Second, the previous write to refs (establishing the zero that we the interrupt handler was testing from all cpus) was performed by a third party cpu. This would invoke transitivity which, as a recient or concurrent addition to memory-barriers.txt now explicitly states, would require a full smp_mb().
However, we know the cpumask will only be set by one cpu (the data owner) and any preivous iteration of the mask would have cleared by the reading cpu. By redundantly writing refs to 0 on the owning cpu before the smp_wmb, the write to refs will follow the same path as the writes that set the cpumask, which in turn allows us to keep the barrier in the interrupt handler a smp_rmb instead of promoting it to a smp_mb (which will be be executed by N cpus for each of the possible M elements on the list).
I moved and expanded the comment about our (ab)use of the rcu list primitives for the concurrent walk earlier into this function. I considered moving the first two paragraphs to the queue list head and lock, but felt it would have been too disconected from the code.
--- kernel/smp.c | 46 +++++++++++++++++++++++++++++++++------------- 1 files changed, 33 insertions(+), 13 deletions(-)
kernel/smp.c +33 -13
@@ -462,23 +462,42 @@ void smp_call_function_many(const struct cpumask *mask, data = &__get_cpu_var (cfd_data);csd_lock (&data->csd); -BUG_ON (atomic_read (&data->refs) || !cpumask_empty (data->cpumask)); - data->csd.func = func; - data->csd.info = info; -cpumask_and (data->cpumask, mask, cpu_online_mask); -cpumask_clear_cpu (this_cpu, data->cpumask); +/* This BUG_ON verifies our reuse assertions and can be removed */ +BUG_ON (atomic_read (&data->refs) || !cpumask_empty (data->cpumask));/* +* The global call function queue list add and delete are protected +* by a lock, but the list is traversed without any lock, relying +* on the rcu list add and delete to allow safe concurrent traversal. * We reuse the call function data without waiting for any grace * period after some other cpu removes it from the global queue. -* This means a cpu might find our data block as it is writen. -* The interrupt handler waits until it sees refs filled out -* while its cpu mask bit is set; here we may only clear our -* own cpu mask bit, and must wait to set refs until we are sure -* previous writes are complete and we have obtained the lock to -* add the element to the queue. +* This means a cpu might find our data block as it is being +* filled out. +* +* We hold off the interrupt handler on the other cpu by +* ordering our writes to the cpu mask vs our setting of the +* refs counter. We assert only the cpu owning the data block +* will set a bit in cpumask, and each bit will only be cleared +* by the subject cpu. Each cpu must first find its bit is +* set and then check that refs is set indicating the element is +* ready to be processed, otherwise it must skip the entry. +* +* On the previous iteration refs was set to 0 by another cpu. +* To avoid the use of transitivity, set the counter to 0 here +* so the wmb will pair with the rmb in the interrupt handler. */ +atomic_set (&data->refs,0 );/* convert 3rd to 1st party write */ + + data->csd.func = func; + data->csd.info = info; + +/* Ensure 0 refs is visible before mask. Also orders func and info */ +smp_wmb (); + +/* We rely on the "and" being processed before the store */ +cpumask_and (data->cpumask, mask, cpu_online_mask); +cpumask_clear_cpu (this_cpu, data->cpumask);raw_spin_lock_irqsave (&call_function.lock, flags);/*
@@ -488,8 +507,9 @@ void smp_call_function_many(const struct cpumask *mask,*/ list_add_rcu (&data->csd.list, &call_function.queue);/* -* We rely on the wmb() in list_add_rcu to order the writes -* to func, data, and cpumask before this write to refs. +* We rely on the wmb() in list_add_rcu to complete our writes +* to the cpumask before this write to refs, which indicates +* data is on the list and is ready to be processed. */ atomic_set (&data->refs,cpumask_weight (data->cpumask));raw_spin_unlock_irqrestore (&call_function.lock, flags);
Signature · 1 line
1.7.4.4
PATCH 197/247 x86: Flush TLB if PGD entry is changed in i386 PAE mode
In reply to Paul GortmakerFrom: Shaohua Li <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 4981d01eada5354d81c8929d5b2836829ba3df7b upstream.
According to intel CPU manual, every time PGD entry is changed in i386 PAE mode, we need do a full TLB flush. Current code follows this and there is comment for this too in the code.
But current code misses the multi-threaded case. A changed page table might be used by several CPUs, every such CPU should flush TLB. Usually this isn't a problem, because we prepopulate all PGD entries at process fork. But when the process does munmap and follows new mmap, this issue will be triggered.
When it happens, some CPUs keep doing page faults:
http://marc.info/?l=linux-kernel&m=129915020508238&w=2
LKML-Reference: <1300246649.2337.95.camel@sli10-conroe>
--- arch/x86/include/asm/pgtable-3level.h | 11 +++-------- arch/x86/mm/pgtable.c | 3 +-- 2 files changed, 4 insertions(+), 10 deletions(-)
arch/x86/include/asm/pgtable-3level.h +3 -8
@@ -69,8 +69,6 @@ static inline void native_pmd_clear(pmd_t *pmd)static inline void pud_clear (pud_t *pudp) { -unsigned long pgd; -set_pud (pudp,__pud (0 ));/*
@@ -79,13 +77,10 @@ static inline void pud_clear(pud_t *pudp)* section 8.1: in PAE mode we explicitly have to flush the * TLB via cr3 if the top-level pgd is changed... * -* Make sure the pud entry we're updating is within the -* current pgd to avoid unnecessary TLB flushes. +* Currently all places where pud_clear() is called either have +* flush_tlb_mm() followed or don't need TLB flush (x86_64 code or +* pud_clear_bad()), so we don't need TLB flush here. */ - pgd =read_cr3 (); -if (__pa (pudp) >= pgd &&__pa (pudp) < - (pgd +sizeof (pgd_t)*PTRS_PER_PGD )) -write_cr3 (pgd); }#ifdef CONFIG_SMP
arch/x86/mm/pgtable.c +1 -2
@@ -160,8 +160,7 @@ void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmd)* section 8.1: in PAE mode we explicitly have to flush the * TLB via cr3 if the top-level pgd is changed... */ -if (mm == current->active_mm) - write_cr3(read_cr3()); + flush_tlb_mm(mm); }#else /* !CONFIG_X86_PAE */
Signature · 1 line
1.7.4.4
PATCH 198/247 isdn: avoid calling tty_ldisc_flush() in atomic context
In reply to Paul GortmakerFrom: Tilman Schmidt <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit bc10f96757bd6ab3721510df8defa8f21c32f974 upstream.
Remove the call to tty_ldisc_flush() from the RESULT_NO_CARRIER branch of isdn_tty_modem_result(), as already proposed in commit 00409bb045887ec5e7b9e351bc080c38ab6bfd33.
This avoids a "sleeping function called from invalid context" BUG when the hardware driver calls the statcallb() callback with command==ISDN_STAT_DHUP in atomic context, which in turn calls isdn_tty_modem_result(RESULT_NO_CARRIER, ~), and from there, tty_ldisc_flush() which may sleep.
--- drivers/isdn/i4l/isdn_tty.c | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-)
drivers/isdn/i4l/isdn_tty.c +0 -6
@@ -2636,12 +2636,6 @@ isdn_tty_modem_result(int code, modem_info * info)if ((info->flags &ISDN_ASYNC_CLOSING ) || (!info->tty)) {return ; } -#ifdef CONFIG_ISDN_AUDIO -if ( !info->vonline ) -tty_ldisc_flush (info->tty); -#else -tty_ldisc_flush (info->tty); -#endif if ((info->flags &ISDN_ASYNC_CHECK_CD ) && (!((info->flags &ISDN_ASYNC_CALLOUT_ACTIVE ) && (info->flags &ISDN_ASYNC_CALLOUT_NOHUP )))) {
Signature · 1 line
1.7.4.4
PATCH 199/247 smp_call_function_many: handle concurrent clearing of mask
In reply to Paul GortmakerFrom: Milton Miller <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 723aae25d5cdb09962901d36d526b44d4be1051c upstream.
Mike Galbraith reported finding a lockup ("perma-spin bug") where the cpumask passed to smp_call_function_many was cleared by other cpu(s) while a cpu was preparing its call_data block, resulting in no cpu to clear the last ref and unlock the block.
Having cpus clear their bit asynchronously could be useful on a mask of cpus that might have a translation context, or cpus that need a push to complete an rcu window.
Instead of adding a BUG_ON and requiring yet another cpumask copy, just detect the race and handle it.
Note: arch_send_call_function_ipi_mask must still handle an empty cpumask because the data block is globally visible before the that arch callback is made. And (obviously) there are no guarantees to which cpus are notified if the mask is changed during the call; only cpus that were online and had their mask bit set during the whole call are guaranteed to be called.
--- kernel/smp.c | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-)
kernel/smp.c +10 -3
@@ -429,7 +429,7 @@ void smp_call_function_many(const struct cpumask *mask, {struct call_function_data *data;unsigned long flags; -int cpu, next_cpu, this_cpu =smp_processor_id (); +int refs, cpu, next_cpu, this_cpu =smp_processor_id ();/* * Can deadlock when called with interrupts disabled.
@@ -440,7 +440,7 @@ void smp_call_function_many(const struct cpumask *mask,WARN_ON_ONCE (cpu_online (this_cpu) &&irqs_disabled () && !oops_in_progress); -/* So, what's a CPU they want? Ignoring this one. */ +/* Try to fastpath. So, what's a CPU they want? Ignoring this one. */ cpu =cpumask_first_and (mask, cpu_online_mask);if (cpu == this_cpu) cpu =cpumask_next_and (cpu, mask, cpu_online_mask);
@@ -498,6 +498,13 @@ void smp_call_function_many(const struct cpumask *mask,/* We rely on the "and" being processed before the store */ cpumask_and (data->cpumask, mask, cpu_online_mask);cpumask_clear_cpu (this_cpu, data->cpumask); + refs =cpumask_weight (data->cpumask); + +/* Some callers race with other cpus changing the passed mask */ +if (unlikely (!refs)) { +csd_unlock (&data->csd); +return ; + }raw_spin_lock_irqsave (&call_function.lock, flags);/*
@@ -511,7 +518,7 @@ void smp_call_function_many(const struct cpumask *mask,* to the cpumask before this write to refs, which indicates * data is on the list and is ready to be processed. */ -atomic_set (&data->refs,cpumask_weight (data->cpumask)); +atomic_set (&data->refs, refs);raw_spin_unlock_irqrestore (&call_function.lock, flags);/*
Signature · 1 line
1.7.4.4
PATCH 200/247 fix per-cpu flag problem in the cpu affinity checkers
In reply to Paul GortmakerFrom: Thomas Gleixner <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 9804c9eaeacfe78651052c5ddff31099f60ef78c upstream.
The CHECK_IRQ_PER_CPU is wrong, it should be checking irq_to_desc(irq)->status not just irq.
--- arch/parisc/kernel/irq.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/parisc/kernel/irq.c +1 -1
@@ -117,7 +117,7 @@ int cpu_check_affinity(unsigned int irq, const struct cpumask *dest)int cpu_dest;/* timer and ipi have to always be received on all CPUs */ -if (CHECK_IRQ_PER_CPU (irq)) { +if (CHECK_IRQ_PER_CPU (irq_to_desc (irq)->status)) {/* Bad linux design decision. The mask has already * been set; we must reset it */ cpumask_setall (irq_desc[irq].affinity);
Signature · 1 line
1.7.4.4
PATCH 201/247 i2c: Fix typo in instantiating-devices document
In reply to Paul GortmakerFrom: Roman Fietze <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 6ced9e6b3901af4ab6ac0a11231402c888286ea6 upstream.
The struct i2c_board_info member holding the name is "type", not "name".
--- Documentation/i2c/instantiating-devices | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Documentation/i2c/instantiating-devices +1 -1
@@ -100,7 +100,7 @@ static int __devinit usb_hcd_pnx4008_probe(struct platform_device *pdev) (...) i2c_adap = i2c_get_adapter(2); memset(&i2c_info, 0, sizeof(struct i2c_board_info)); - strlcpy(i2c_info.name, "isp1301_pnx", I2C_NAME_SIZE); + strlcpy(i2c_info.type, "isp1301_pnx", I2C_NAME_SIZE); isp1301_i2c_client = i2c_new_probed_device(i2c_adap, &i2c_info, normal_i2c); i2c_put_adapter(i2c_adap);
Signature · 1 line
1.7.4.4
PATCH 202/247 mmc: sdio: remember new card RCA when redetecting card
In reply to Paul GortmakerFrom: Stefan Nilsson XK <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 0aab3995485b8a994bf29a995a008c9ea4a28054 upstream.
During redetection of a SDIO card, a request for a new card RCA was submitted to the card, but was then overwritten by the old RCA. This caused the card to be deselected instead of selected when using the incorrect RCA. This bug's been present since the "oldcard" handling was introduced in 2.6.32.
--- drivers/mmc/core/sdio.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/mmc/core/sdio.c +8 -0
@@ -303,6 +303,14 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,if (err) goto remove; +/* +* Update oldcard with the new RCA received from the SDIO +* device -- we're doing this so that it's updated in the +* "card" struct when oldcard overwrites that later. +*/ +if (oldcard) + oldcard->rca = card->rca; +mmc_set_bus_mode (host,MMC_BUSMODE_PUSHPULL ); }
Signature · 1 line
1.7.4.4
PATCH 203/247 powerpc/kexec: Fix race in kexec shutdown
In reply to Paul GortmakerFrom: Michael Neuling <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 1fc711f7ffb01089efc58042cfdbac8573d1b59a upstream.
In kexec_prepare_cpus, the primary CPU IPIs the secondary CPUs to kexec_smp_down(). kexec_smp_down() calls kexec_smp_wait() which sets the hw_cpu_id() to -1. The primary does this while leaving IRQs on which means the primary can take a timer interrupt which can lead to the IPIing one of the secondary CPUs (say, for a scheduler re-balance) but since the secondary CPU now has a hw_cpu_id = -1, we IPI CPU -1... Kaboom!
We are hitting this case regularly on POWER7 machines.
There is also a second race, where the primary will tear down the MMU mappings before knowing the secondaries have entered real mode.
Also, the secondaries are clearing out any pending IPIs before guaranteeing that no more will be received.
This changes kexec_prepare_cpus() so that we turn off IRQs in the primary CPU much earlier. It adds a paca flag to say that the secondaries have entered the kexec_smp_down() IPI and turned off IRQs, rather than overloading hw_cpu_id with -1. This new paca flag is again used to in indicate when the secondaries has entered real mode.
It also ensures that all CPUs have their IRQs off before we clear out any pending IPI requests (in kexec_cpu_down()) to ensure there are no trailing IPIs left unacknowledged.
--- arch/powerpc/include/asm/kexec.h | 4 ++ arch/powerpc/include/asm/paca.h | 1 + arch/powerpc/kernel/asm-offsets.c | 1 + arch/powerpc/kernel/machine_kexec_64.c | 48 ++++++++++++++++++++++--------- arch/powerpc/kernel/misc_64.S | 8 +++-- arch/powerpc/kernel/paca.c | 2 + 6 files changed, 47 insertions(+), 17 deletions(-)
arch/powerpc/include/asm/kexec.h +4 -0
@@ -31,6 +31,10 @@#define KEXEC_ARCH KEXEC_ARCH_PPC#endif +#define KEXEC_STATE_NONE 0 +#define KEXEC_STATE_IRQS_OFF 1 +#define KEXEC_STATE_REAL_MODE 2 +#ifndef __ASSEMBLY__#include <linux/cpumask.h> #include <asm/reg.h>
arch/powerpc/include/asm/paca.h +1 -0
@@ -82,6 +82,7 @@ struct paca_struct {s16 hw_cpu_id;/* Physical processor number */ u8 cpu_start;/* At startup, processor spins until */ /* this becomes non-zero. */ +u8 kexec_state;/* set when kexec down has irqs off */ #ifdef CONFIG_PPC_STD_MMU_64 struct slb_shadow *slb_shadow_ptr;
arch/powerpc/kernel/asm-offsets.c +1 -0
@@ -183,6 +183,7 @@ int main(void)#endif /* CONFIG_PPC_STD_MMU_64 */ DEFINE (PACAEMERGSP , offsetof(struct paca_struct , emergency_sp));DEFINE (PACAHWCPUID , offsetof(struct paca_struct , hw_cpu_id)); +DEFINE (PACAKEXECSTATE , offsetof(struct paca_struct , kexec_state));DEFINE (PACA_STARTPURR , offsetof(struct paca_struct , startpurr));DEFINE (PACA_STARTSPURR , offsetof(struct paca_struct , startspurr));DEFINE (PACA_USER_TIME , offsetof(struct paca_struct , user_time));
arch/powerpc/kernel/machine_kexec_64.c +34 -14
90 lines not on this page · raw message
arch/powerpc/kernel/misc_64.S +5 -3
@@ -24,6 +24,7 @@ #include <asm/asm-offsets.h> #include <asm/cputable.h> #include <asm/thread_info.h> +#include <asm/kexec.h> .text
@@ -471,6 +472,10 @@ _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)
@@ -494,14 +499,11 @@ kexec_flag: * note: this is a terminal routine, it does not save lr * * get phys id from paca - * set paca id to -1 to say we got here * switch to real mode * join other cpus in kexec_wait(phys_id) */ _GLOBAL(kexec_smp_wait) lhz r3,PACAHWCPUID(r13) - li r4,-1 - sth r4,PACAHWCPUID(r13) /* let others know we left */ bl real_mode b .kexec_wait
arch/powerpc/kernel/paca.c +2 -0
@@ -18,6 +18,7 @@#include <asm/pgtable.h> #include <asm/iseries/lpar_map.h> #include <asm/iseries/hv_types.h> +#include <asm/kexec.h> /* This symbol is provided by the linker - let it fill in the paca * field correctly */
@@ -97,6 +98,7 @@ void __init initialise_paca(struct paca_struct *new_paca, int cpu) new_paca->kernelbase = (unsigned long ) _stext; new_paca->kernel_msr =MSR_KERNEL ; new_paca->hw_cpu_id =0xffff ; + new_paca->kexec_state =KEXEC_STATE_NONE ; new_paca->__current = &init_task;#ifdef CONFIG_PPC_STD_MMU_64 new_paca->slb_shadow_ptr = &slb_shadow[cpu];
Signature · 1 line
1.7.4.4
PATCH 204/247 powerpc/kdump: Fix race in kdump shutdown
In reply to Paul GortmakerFrom: Michael Neuling <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 60adec6226bbcf061d4c2d10944fced209d1847d upstream.
When we are crashing, the crashing/primary CPU IPIs the secondaries to turn off IRQs, go into real mode and wait in kexec_wait. While this is happening, the primary tears down all the MMU maps. Unfortunately the primary doesn't check to make sure the secondaries have entered real mode before doing this.
On PHYP machines, the secondaries can take a long time shutting down the IRQ controller as RTAS calls are need. These RTAS calls need to be serialised which resilts in the secondaries contending in lock_rtas() and hence taking a long time to shut down.
We've hit this on large POWER7 machines, where some secondaries are still waiting in lock_rtas(), when the primary tears down the HPTEs.
This patch makes sure all secondaries are in real mode before the primary tears down the MMU. It uses the new kexec_state entry in the paca. It times out if the secondaries don't reach real mode after 10sec.
--- arch/powerpc/kernel/crash.c | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-)
arch/powerpc/kernel/crash.c +27 -0
@@ -162,6 +162,32 @@ static void crash_kexec_prepare_cpus(int cpu)/* Leave the IPI callback set */ } +/* wait for all the CPUs to hit real mode but timeout if they don't come in */ +static void crash_kexec_wait_realmode (int cpu) +{ +unsigned int msecs; +int i; + + msecs =10000 ; +for (i=0 ; i <NR_CPUS && msecs >0 ; i++) { +if (i == cpu) +continue ; + +while (paca[i].kexec_state <KEXEC_STATE_REAL_MODE ) { +barrier (); +if (!cpu_possible (i)) { +break ; + } +if (!cpu_online (i)) { +break ; + } + msecs--; +mdelay (1 ); + } + } +mb (); +} +/* * This function will be called by secondary cpus or by kexec cpu * if soft-reset is activated to stop some CPUs.
@@ -419,6 +445,7 @@ void default_machine_crash_shutdown(struct pt_regs *regs)crash_kexec_prepare_cpus (crashing_cpu);cpu_set (crashing_cpu, cpus_in_crash);crash_kexec_stop_spus (); +crash_kexec_wait_realmode (crashing_cpu);if (ppc_md.kexec_cpu_down) ppc_md.kexec_cpu_down (1 ,0 ); }
Signature · 1 line
1.7.4.4
PATCH 205/247 powerpc: Fix default_machine_crash_shutdown #ifdef botch
In reply to Paul GortmakerFrom: Paul E. McKenney <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit c2be05481f6125254c45b78f334d4dd09c701c82 upstream.
crash_kexec_wait_realmode() is defined only if CONFIG_PPC_STD_MMU_64 and CONFIG_SMP, but is called if CONFIG_PPC_STD_MMU_64 even if !CONFIG_SMP. Fix the conditional compilation around the invocation.
[PG: commit b3df895aebe091b1657 "powerpc/kexec: Add support for FSL-BookE"
introduced the PPC_STD_MMU_64 check this refers to, but we don't want to cherry pick that whole addition to stable just for one #ifdef line.]
--- arch/powerpc/kernel/crash.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
arch/powerpc/kernel/crash.c +4 -0
@@ -163,6 +163,7 @@ static void crash_kexec_prepare_cpus(int cpu) }/* wait for all the CPUs to hit real mode but timeout if they don't come in */ +#if defined(CONFIG_PPC_STD_MMU_64 ) && defined(CONFIG_SMP )static void crash_kexec_wait_realmode (int cpu) {unsigned int msecs;
@@ -187,6 +188,7 @@ static void crash_kexec_wait_realmode(int cpu) }mb (); } +#endif /* * This function will be called by secondary cpus or by kexec cpu
@@ -445,7 +447,9 @@ void default_machine_crash_shutdown(struct pt_regs *regs)crash_kexec_prepare_cpus (crashing_cpu);cpu_set (crashing_cpu, cpus_in_crash);crash_kexec_stop_spus (); +#if defined(CONFIG_PPC_STD_MMU_64 ) && defined(CONFIG_SMP )crash_kexec_wait_realmode (crashing_cpu); +#endif if (ppc_md.kexec_cpu_down) ppc_md.kexec_cpu_down (1 ,0 ); }
Signature · 1 line
1.7.4.4
PATCH 206/247 powerpc: rtas_flash needs to use rtas_data_buf
In reply to Paul GortmakerFrom: Milton Miller <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit bd2b64a12bf55bec0d1b949e3dca3f8863409646 upstream.
When trying to flash a machine via the update_flash command, Anton received the following error:
Restarting system.
FLASH: kernel bug...flash list header addr above 4GB
The code in question has a comment that the flash list should be in the kernel data and therefore under 4GB:
/* NOTE: the "first" block list is a global var with no data
* blocks in the kernel data segment. We do this because
* we want to ensure this block_list addr is under 4GB. */
Unfortunately the Kconfig option is marked tristate which means the variable may not be in the kernel data and could be above 4GB.
Instead of relying on the data segment being below 4GB, use the static data buffer allocated by the kernel for use by rtas. Since we don't use the header struct directly anymore, convert it to a simple pointer.
--- arch/powerpc/kernel/rtas_flash.c | 39 ++++++++++++++++++++----------------- 1 files changed, 21 insertions(+), 18 deletions(-)
arch/powerpc/kernel/rtas_flash.c +21 -18
@@ -94,12 +94,8 @@ struct flash_block_list {struct flash_block_list *next;struct flash_block blocks[FLASH_BLOCKS_PER_NODE ]; }; -struct flash_block_list_header {/* just the header of flash_block_list */ -unsigned long num_blocks; -struct flash_block_list *next; -}; -static struct flash_block_list_header rtas_firmware_flash_list = {0 ,NULL }; +static struct flash_block_list *rtas_firmware_flash_list;/* Use slab cache to guarantee 4k alignment */ static struct kmem_cache *flash_block_cache =NULL ;
@@ -108,13 +104,14 @@ static struct kmem_cache *flash_block_cache = NULL;/* Local copy of the flash block list. * We only allow one open of the flash proc file and create this -* list as we go. This list will be put in the -* rtas_firmware_flash_list var once it is fully read. +* list as we go. The rtas_firmware_flash_list varable will be +* set once the data is fully read. * * For convenience as we build the list we use virtual addrs, * we do not fill in the version number, and the length field * is treated as the number of entries currently in the block -* (i.e. not a byte count). This is all fixed on release. +* (i.e. not a byte count). This is all fixed when calling +* the flash routine. */ /* Status int must be first member of struct */
@@ -201,16 +198,16 @@ static int rtas_flash_release(struct inode *inode, struct file *file)if (uf->flist) {/* File was opened in write mode for a new flash attempt */ /* Clear saved list */ -if (rtas_firmware_flash_list.next) { -free_flash_list (rtas_firmware_flash_list.next); - rtas_firmware_flash_list.next =NULL ; +if (rtas_firmware_flash_list) { +free_flash_list (rtas_firmware_flash_list); + rtas_firmware_flash_list =NULL ; }if (uf->status !=FLASH_AUTH ) uf->status =flash_list_valid (uf->flist);if (uf->status ==FLASH_IMG_READY ) - rtas_firmware_flash_list.next = uf->flist; + rtas_firmware_flash_list = uf->flist;else free_flash_list (uf->flist);
@@ -593,7 +590,7 @@ static void rtas_flash_firmware(int reboot_type)unsigned long rtas_block_list;int i, status, update_token; -if (rtas_firmware_flash_list.next ==NULL ) +if (rtas_firmware_flash_list ==NULL )return ;/* nothing to do */ if (reboot_type !=SYS_RESTART ) {
@@ -610,20 +607,25 @@ static void rtas_flash_firmware(int reboot_type)return ; } -/* NOTE: the "first" block list is a global var with no data -* blocks in the kernel data segment. We do this because -* we want to ensure this block_list addr is under 4GB. +/* +* NOTE: the "first" block must be under 4GB, so we create +* an entry with no data blocks in the reserved buffer in +* the kernel data segment. */ - rtas_firmware_flash_list.num_blocks =0 ; - flist = (struct flash_block_list *)&rtas_firmware_flash_list; +spin_lock (&rtas_data_buf_lock); + flist = (struct flash_block_list *)&rtas_data_buf[0 ]; + flist->num_blocks =0 ; + flist->next = rtas_firmware_flash_list; rtas_block_list =virt_to_abs (flist);if (rtas_block_list >=4UL *1024 *1024 *1024 ) {printk (KERN_ALERT "FLASH: kernel bug...flash list header addr above 4GB\n" ); +spin_unlock (&rtas_data_buf_lock);return ; }printk (KERN_ALERT "FLASH: preparing saved firmware image for flash\n" );/* Update the block_list in place. */ + rtas_firmware_flash_list =NULL ;/* too hard to backout on error */ image_size =0 ;for (f = flist; f; f = next) {/* Translate data addrs to absolute */
@@ -664,6 +666,7 @@ static void rtas_flash_firmware(int reboot_type)printk (KERN_ALERT "FLASH: unknown flash return code %d\n" , status);break ; } +spin_unlock (&rtas_data_buf_lock); }static void remove_flash_pde (struct proc_dir_entry *dp)
Signature · 1 line
1.7.4.4
PATCH 207/247 x86, binutils, xen: Fix another wrong size directive
In reply to Paul GortmakerFrom: Alexander van Heukelum <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 371c394af27ab7d1e58a66bc19d9f1f3ac1f67b4 upstream.
The latest binutils (2.21.0.20110302/Ubuntu) breaks the build yet another time, under CONFIG_XEN=y due to a .size directive that refers to a slightly differently named (hence, to the now very strict and unforgiving assembler, non-existent) symbol.
[ mingo:
This unnecessary build breakage caused by new binutils version 2.21 gets escallated back several kernel releases spanning several years of Linux history, affecting over 130,000 upstream kernel commits (!), on CONFIG_XEN=y 64-bit kernels (i.e. essentially affecting all major Linux distro kernel configs).
Git annotate tells us that this slight debug symbol code mismatch bug has been introduced in 2008 in commit 3d75e1b8:
3d75e1b8 (Jeremy Fitzhardinge 2008-07-08 15:06:49 -0700 1231) ENTRY(xen_do_hypervisor_callback) # do_hypervisor_callback(struct *pt_regs)
The 'bug' is just a slight assymetry in ENTRY()/END() debug-symbols sequences, with lots of assembly code between the ENTRY() and the END():
ENTRY(xen_do_hypervisor_callback) # do_hypervisor_callback(struct *pt_regs)
...
END(do_hypervisor_callback)
Human reviewers almost never catch such small mismatches, and binutils never even warned about it either.
This new binutils version thus breaks the Xen build on all upstream kernels since v2.6.27, out of the blue.
This makes a straightforward Git bisection of all 64-bit Xen-enabled kernels impossible on such binutils, for a bisection window of over hundred thousand historic commits. (!)
This is a major fail on the side of binutils and binutils needs to turn this show-stopper build failure into a warning ASAP. ]
LKML-Reference: <[email protected]>
--- arch/x86/kernel/entry_64.S | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kernel/entry_64.S +1 -1
@@ -1268,7 +1268,7 @@ ENTRY(xen_do_hypervisor_callback) # do_hypervisor_callback(struct *pt_regs) decl PER_CPU_VAR(irq_count) jmp error_exit CFI_ENDPROC -END(do_hypervisor_callback) +END(xen_do_hypervisor_callback) /* * Hypervisor uses this for application faults while it executes.
Signature · 1 line
1.7.4.4
PATCH 208/247 hwmon: (sht15) Fix integer overflow in humidity calculation
In reply to Paul GortmakerFrom: Vivien Didelot <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit ccd32e735de7a941906e093f8dca924bb05c5794 upstream.
An integer overflow occurs in the calculation of RHlinear when the relative humidity is greater than around 30%. The consequence is a subtle (but noticeable) error in the resulting humidity measurement.
--- drivers/hwmon/sht15.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/hwmon/sht15.c +2 -2
@@ -333,11 +333,11 @@ static inline int sht15_calc_humid(struct sht15_data *data)const int c1 =-4 ;const int c2 =40500 ;/* x 10 ^ -6 */ -const int c3 =-2800 ;/* x10 ^ -9 */ +const int c3 =-28 ;/* x 10 ^ -7 */ RHlinear = c1*1000 + c2 * data->val_humid/1000 - + (data->val_humid * data->val_humid * c3)/1000000 ; + + (data->val_humid * data->val_humid * c3) /10000 ;return (temp -25000 ) * (10000 +80 * data->val_humid) /1000000 + RHlinear; }
Signature · 1 line
1.7.4.4
PATCH 209/247 SUNRPC: Never reuse the socket port after an xs_close()
In reply to Paul GortmakerFrom: Trond Myklebust <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 246408dcd5dfeef2df437ccb0ef4d6ee87805f58 upstream.
If we call xs_close(), we're in one of two situations:
- Autoclose, which means we don't expect to resend a request
- bind+connect failed, which probably means the port is in use
--- net/sunrpc/xprtsock.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
net/sunrpc/xprtsock.c +2 -0
@@ -724,6 +724,8 @@ static void xs_reset_transport(struct sock_xprt *transport)if (sk ==NULL )return ; + transport->srcport =0 ; +write_lock_bh (&sk->sk_callback_lock); transport->inet =NULL ; transport->sock =NULL ;
Signature · 1 line
1.7.4.4
PATCH 210/247 Input: xen-kbdfront - advertise either absolute or relative coordinates
In reply to Paul GortmakerFrom: Olaf Hering <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 8c3c283e6bf463ab498d6e7823aff6c4762314b6 upstream.
A virtualized display device is usually viewed with the vncviewer application, either by 'xm vnc domU' or with vncviewer localhost:port. vncviewer and the RFB protocol provides absolute coordinates to the virtual display. These coordinates are either passed through to a PV guest or converted to relative coordinates for a HVM guest.
A PV guest receives these coordinates and passes them to the kernels evdev driver. There it can be picked up by applications such as the xorg-input drivers. Using absolute coordinates avoids issues such as guest mouse pointer not tracking host mouse pointer due to wrong mouse acceleration settings in the guests X display.
Advertise either absolute or relative coordinates to the input system and the evdev driver, depending on what dom0 provides. The xorg-input driver prefers relative coordinates even if a devices provides both.
--- drivers/input/xen-kbdfront.c | 45 ++++++++++++++++++++++------------------- 1 files changed, 24 insertions(+), 21 deletions(-)
drivers/input/xen-kbdfront.c +24 -21
@@ -109,7 +109,7 @@ static irqreturn_t input_handler(int rq, void *dev_id)static int __devinit xenkbd_probe (struct xenbus_device *dev,const struct xenbus_device_id *id) { -int ret, i; +int ret, i, abs;struct xenkbd_info *info;struct input_dev *kbd, *ptr;
@@ -127,6 +127,11 @@ static int __devinit xenkbd_probe(struct xenbus_device *dev,if (!info->page) goto error_nomem; +if (xenbus_scanf (XBT_NIL , dev->otherend,"feature-abs-pointer" ,"%d" , &abs) <0 ) + abs =0 ; +if (abs) +xenbus_printf (XBT_NIL , dev->nodename,"request-abs-pointer" ,"1" ); +/* keyboard */ kbd =input_allocate_device ();if (!kbd)
@@ -136,11 +141,12 @@ static int __devinit xenkbd_probe(struct xenbus_device *dev, kbd->id.bustype =BUS_PCI ; kbd->id.vendor =0x5853 ; kbd->id.product =0xffff ; - kbd->evbit[0 ] =BIT (EV_KEY ); + +__set_bit (EV_KEY , kbd->evbit);for (i =KEY_ESC ; i <KEY_UNKNOWN ; i++) -set_bit (i, kbd->keybit); +__set_bit (i, kbd->keybit);for (i =KEY_OK ; i <KEY_MAX ; i++) -set_bit (i, kbd->keybit); +__set_bit (i, kbd->keybit); ret =input_register_device (kbd);if (ret) {
@@ -159,12 +165,20 @@ static int __devinit xenkbd_probe(struct xenbus_device *dev, ptr->id.bustype =BUS_PCI ; ptr->id.vendor =0x5853 ; ptr->id.product =0xfffe ; - ptr->evbit[0 ] =BIT (EV_KEY ) |BIT (EV_REL ) |BIT (EV_ABS ); + +if (abs) { +__set_bit (EV_ABS , ptr->evbit); +input_set_abs_params (ptr,ABS_X ,0 ,XENFB_WIDTH ,0 ,0 ); +input_set_abs_params (ptr,ABS_Y ,0 ,XENFB_HEIGHT ,0 ,0 ); + }else { +input_set_capability (ptr,EV_REL ,REL_X ); +input_set_capability (ptr,EV_REL ,REL_Y ); + } +input_set_capability (ptr,EV_REL ,REL_WHEEL ); + +__set_bit (EV_KEY , ptr->evbit);for (i =BTN_LEFT ; i <=BTN_TASK ; i++) -set_bit (i, ptr->keybit); - ptr->relbit[0 ] =BIT (REL_X ) |BIT (REL_Y ) |BIT (REL_WHEEL ); -input_set_abs_params (ptr,ABS_X ,0 ,XENFB_WIDTH ,0 ,0 ); -input_set_abs_params (ptr,ABS_Y ,0 ,XENFB_HEIGHT ,0 ,0 ); +__set_bit (i, ptr->keybit); ret =input_register_device (ptr);if (ret) {
@@ -271,7 +285,7 @@ static void xenkbd_backend_changed(struct xenbus_device *dev, enum xenbus_state backend_state) {struct xenkbd_info *info =dev_get_drvdata (&dev->dev); -int ret, val; +int val;switch (backend_state) {case XenbusStateInitialising:
@@ -282,17 +296,6 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,case XenbusStateInitWait: InitWait: - ret =xenbus_scanf (XBT_NIL , info->xbdev->otherend, -"feature-abs-pointer" ,"%d" , &val); -if (ret <0 ) - val =0 ; -if (val) { - ret =xenbus_printf (XBT_NIL , info->xbdev->nodename, -"request-abs-pointer" ,"1" ); -if (ret) -printk (KERN_WARNING -"xenkbd: can't request abs-pointer" ); - }xenbus_switch_state (dev, XenbusStateConnected);break ;
Signature · 1 line
1.7.4.4
Re: [34-longterm 210/247] Input: xen-kbdfront - advertise either absolute or relative coordinates
Quoted 8 lines · Paul Gortmaker
From: Olaf Hering <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------commit
8c3c283e6bf463ab498d6e7823aff6c4762314b6upstream.
This one will introduce a regression, which will be fixed by upstream commit c36b58e8a9112017c2bcc322cc98e71241814303
Input: xen-kbdfront - fix mouse getting stuck after save/restore
Olaf
Re: [34-longterm 210/247] Input: xen-kbdfront - advertise either absolute or relative coordinates
Quoted 9 lines · Olaf Hering
Quoted 7 lines · Paul Gortmaker
From: Olaf Hering <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
Quoted 8 lines
Quoted 1 line
commit
8c3c283e6bf463ab498d6e7823aff6c4762314b6upstream.This one will introduce a regression, which will be fixed by upstream commit
c36b58e8a9112017c2bcc322cc98e71241814303Input: xen-kbdfront - fix mouse getting stuck after save/restore
Olaf
Thanks Olaf, it will appear here shortly.
http://git.kernel.org/?p=linux/kernel/git/longterm/longterm-queue-2.6.34.git;a=summary
[PS: Dmitry - the mail.ru address you've been using in SOB lines always bounces]
Paul.
Quoted 6 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Dmitry Torokhov
maintainerRe: [34-longterm 210/247] Input: xen-kbdfront - advertise either absolute or relative coordinates
Quoted 17 lines · Paul Gortmaker
Quoted 16 lines · Olaf Hering
Quoted 8 lines · Paul Gortmaker
From: Olaf Hering <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------commit
8c3c283e6bf463ab498d6e7823aff6c4762314b6upstream.This one will introduce a regression, which will be fixed by upstream commit
c36b58e8a9112017c2bcc322cc98e71241814303Input: xen-kbdfront - fix mouse getting stuck after save/restore
Quoted 7 lines
Quoted 1 line
Olaf
Thanks Olaf, it will appear here shortly.
http://git.kernel.org/?p=linux/kernel/git/longterm/longterm-queue-2.6.34.git;a=summary
[PS: Dmitry - the mail.ru address you've been using in SOB lines always bounces]
Hmm, that is wierd. I am getting mail to that address, in fact I just reseived a letter from Jarod Wilson there...
I am not sure why they don't like your mails but that is the reason I am keeping both mail.ru and gmail.com addresses.
Thanks.
Signature · 1 line
Dmitry
PATCH 211/247 USB: cdc-acm: fix potential null-pointer dereference on disconnect
In reply to Paul GortmakerFrom: Johan Hovold <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 7e7797e7f6f7bfab73fca02c65e40eaa5bb9000c upstream.
Fix potential null-pointer exception on disconnect introduced by commit 11ea859d64b69a747d6b060b9ed1520eab1161fe (USB: additional power savings for cdc-acm devices that support remote wakeup).
Only access acm->dev after making sure it is non-null in control urb completion handler.
--- drivers/usb/class/cdc-acm.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/usb/class/cdc-acm.c +2 -1
@@ -297,6 +297,8 @@ static void acm_ctrl_irq(struct urb *urb)if (!ACM_READY (acm)) goto exit; +usb_mark_last_busy (acm->dev); + data = (unsigned char *)(dr +1 );switch (dr->bNotificationType) {case USB_CDC_NOTIFY_NETWORK_CONNECTION :
@@ -336,7 +338,6 @@ static void acm_ctrl_irq(struct urb *urb)break ; } exit: -usb_mark_last_busy (acm->dev); retval =usb_submit_urb (urb,GFP_ATOMIC );if (retval) dev_err(&urb->dev->dev, "%s - usb_submit_urb failed with "
Signature · 1 line
1.7.4.4
PATCH 212/247 USB: cdc-acm: fix potential null-pointer dereference
In reply to Paul GortmakerFrom: Johan Hovold <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 15e5bee33ffc11d0e5c6f819a65e7881c5c407be upstream.
Must check return value of tty_port_tty_get.
--- drivers/usb/class/cdc-acm.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/usb/class/cdc-acm.c +2 -0
@@ -534,6 +534,8 @@ static void acm_softint(struct work_struct *work)if (!ACM_READY (acm))return ; tty =tty_port_tty_get (&acm->port); +if (!tty) +return ;tty_wakeup (tty);tty_kref_put (tty); }
Signature · 1 line
1.7.4.4
PATCH 213/247 USB: cdc-acm: fix memory corruption / panic
In reply to Paul GortmakerFrom: Johan Hovold <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 23b80550e2aa61d0ba3af98b831b9195be0db9ee upstream.
Prevent read urbs from being resubmitted from tasklet after port close.
The receive tasklet was not disabled on port close, which could lead to corruption of receive lists on consecutive port open. In particular, read urbs could be re-submitted before port open, added to free list in open, and then added a second time to the free list in the completion handler.
cdc-acm.c: Entering acm_tty_open.cdc-acm.c: acm_control_msg: rq: 0x22 val: 0x3 len: 0x0 result: 0 cdc-acm.c: Entering acm_rx_taskletcdc-acm.c: acm_rx_tasklet: sending urb 0xf50da280, rcv 0xf57fbc24, buf 0xf57fbd64 cdc-acm.c: set line: 115200 0 0 8cdc-acm.c: acm_control_msg: rq: 0x20 val: 0x0 len: 0x7 result: 7 cdc-acm.c: acm_tty_closecdc-acm.c: acm_port_downcdc-acm.c: acm_control_msg: rq: 0x22 val: 0x0 len: 0x0 result: 0 cdc-acm.c: acm_ctrl_irq - urb shutting down with status: -2 cdc-acm.c: acm_rx_tasklet: sending urb 0xf50da300, rcv 0xf57fbc10, buf 0xf57fbd50 cdc-acm.c: Entering acm_read_bulk with status -2cdc_acm 4-1:1.1: Aborting, acm not readycdc-acm.c: Entering acm_read_bulk with status -2cdc_acm 4-1:1.1: Aborting, acm not readycdc-acm.c: acm_rx_tasklet: sending urb 0xf50da380, rcv 0xf57fbbfc, buf 0xf57fbd3c cdc-acm.c: acm_rx_tasklet: sending urb 0xf50da400, rcv 0xf57fbbe8, buf 0xf57fbd28 cdc-acm.c: acm_rx_tasklet: sending urb 0xf50da480, rcv 0xf57fbbd4, buf 0xf57fbd14 cdc-acm.c: acm_rx_tasklet: sending urb 0xf50da900, rcv 0xf57fbbc0, buf 0xf57fbd00 cdc-acm.c: acm_rx_tasklet: sending urb 0xf50da980, rcv 0xf57fbbac, buf 0xf57fbcec cdc-acm.c: acm_rx_tasklet: sending urb 0xf50daa00, rcv 0xf57fbb98, buf 0xf57fbcd8 cdc-acm.c: acm_rx_tasklet: sending urb 0xf50daa80, rcv 0xf57fbb84, buf 0xf57fbcc4 cdc-acm.c: acm_rx_tasklet: sending urb 0xf50dab00, rcv 0xf57fbb70, buf 0xf57fbcb0 cdc-acm.c: acm_rx_tasklet: sending urb 0xf50dab80, rcv 0xf57fbb5c, buf 0xf57fbc9c cdc-acm.c: acm_rx_tasklet: sending urb 0xf50dac00, rcv 0xf57fbb48, buf 0xf57fbc88 cdc-acm.c: acm_rx_tasklet: sending urb 0xf50dac80, rcv 0xf57fbb34, buf 0xf57fbc74 cdc-acm.c: acm_rx_tasklet: sending urb 0xf50dad00, rcv 0xf57fbb20, buf 0xf57fbc60 cdc-acm.c: acm_rx_tasklet: sending urb 0xf50dad80, rcv 0xf57fbb0c, buf 0xf57fbc4c cdc-acm.c: acm_rx_tasklet: sending urb 0xf50da880, rcv 0xf57fbaf8, buf 0xf57fbc38 cdc-acm.c: Entering acm_tty_open.cdc-acm.c: acm_control_msg: rq: 0x22 val: 0x3 len: 0x0 result: 0 cdc-acm.c: Entering acm_rx_taskletcdc-acm.c: acm_rx_tasklet: sending urb 0xf50da280, rcv 0xf57fbc24, buf 0xf57fbd64 cdc-acm.c: Entering acm_tty_write to write 3 bytes,cdc-acm.c: Get 3 bytes...cdc-acm.c: acm_write_start susp_count: 0cdc-acm.c: Entering acm_read_bulk with status 0
------------[ cut here ]------------ WARNING: at /home/johan/src/linux/linux-2.6/lib/list_debug.c:57 list_del+0x10c/0x120() Hardware name: Vostro 1520 list_del corruption. next->prev should be f57fbc10, but was f57fbaf8 Modules linked in: cdc_acm Pid: 3, comm: ksoftirqd/0 Not tainted 2.6.37+ #39 Call Trace: [<c103c7e2>] warn_slowpath_common+0x72/0xa0 [<c11dd8ac>] ? list_del+0x10c/0x120 [<c11dd8ac>] ? list_del+0x10c/0x120 [<c103c8b3>] warn_slowpath_fmt+0x33/0x40 [<c11dd8ac>] list_del+0x10c/0x120 [<f8051dbf>] acm_rx_tasklet+0xef/0x3e0 [cdc_acm] [<c135465d>] ? net_rps_action_and_irq_enable+0x6d/0x80 [<c1042bb6>] tasklet_action+0xe6/0x140 [<c104342f>] __do_softirq+0xaf/0x210 [<c1043380>] ? __do_softirq+0x0/0x210 <IRQ> [<c1042c9a>] ? run_ksoftirqd+0x8a/0x1c0 [<c1042c10>] ? run_ksoftirqd+0x0/0x1c0 [<c105ac24>] ? kthread+0x74/0x80 [<c105abb0>] ? kthread+0x0/0x80 [<c100337a>] ? kernel_thread_helper+0x6/0x10 ---[ end trace efd9a11434f0082e ]--- ------------[ cut here ]------------ WARNING: at /home/johan/src/linux/linux-2.6/lib/list_debug.c:57 list_del+0x10c/0x120() Hardware name: Vostro 1520 list_del corruption. next->prev should be f57fbd50, but was f57fbdb0 Modules linked in: cdc_acm Pid: 3, comm: ksoftirqd/0 Tainted: G W 2.6.37+ #39 Call Trace: [<c103c7e2>] warn_slowpath_common+0x72/0xa0 [<c11dd8ac>] ? list_del+0x10c/0x120 [<c11dd8ac>] ? list_del+0x10c/0x120 [<c103c8b3>] warn_slowpath_fmt+0x33/0x40 [<c11dd8ac>] list_del+0x10c/0x120 [<f8051dd6>] acm_rx_tasklet+0x106/0x3e0 [cdc_acm] [<c135465d>] ? net_rps_action_and_irq_enable+0x6d/0x80 [<c1042bb6>] tasklet_action+0xe6/0x140 [<c104342f>] __do_softirq+0xaf/0x210 [<c1043380>] ? __do_softirq+0x0/0x210 <IRQ> [<c1042c9a>] ? run_ksoftirqd+0x8a/0x1c0 [<c1042c10>] ? run_ksoftirqd+0x0/0x1c0 [<c105ac24>] ? kthread+0x74/0x80 [<c105abb0>] ? kthread+0x0/0x80 [<c100337a>] ? kernel_thread_helper+0x6/0x10 ---[ end trace efd9a11434f0082f ]---
cdc-acm.c: acm_rx_tasklet: sending urb 0xf50da300, rcv 0xf57fbc10, buf 0xf57fbd50 cdc-acm.c: disconnected from networkcdc-acm.c: acm_rx_tasklet: sending urb 0xf50da380, rcv 0xf57fbbfc, buf 0xf57fbd3c cdc-acm.c: Entering acm_rx_tasklet
------------[ cut here ]------------ WARNING: at /home/johan/src/linux/linux-2.6/lib/list_debug.c:48 list_del+0xd5/0x120() Hardware name: Vostro 1520 list_del corruption, next is LIST_POISON1 (00100100) Modules linked in: cdc_acm Pid: 3, comm: ksoftirqd/0 Tainted: G W 2.6.37+ #39 Call Trace: [<c103c7e2>] warn_slowpath_common+0x72/0xa0 [<c11dd875>] ? list_del+0xd5/0x120 [<c11dd875>] ? list_del+0xd5/0x120 [<c103c8b3>] warn_slowpath_fmt+0x33/0x40 [<c11dd875>] list_del+0xd5/0x120 [<f8051fac>] acm_rx_tasklet+0x2dc/0x3e0 [cdc_acm] [<c106dbab>] ? trace_hardirqs_on+0xb/0x10 [<c1042b30>] ? tasklet_action+0x60/0x140 [<c1042bb6>] tasklet_action+0xe6/0x140 [<c104342f>] __do_softirq+0xaf/0x210 [<c1043380>] ? __do_softirq+0x0/0x210 <IRQ> [<c1042c9a>] ? run_ksoftirqd+0x8a/0x1c0 [<c1042c10>] ? run_ksoftirqd+0x0/0x1c0 [<c105ac24>] ? kthread+0x74/0x80 [<c105abb0>] ? kthread+0x0/0x80 [<c100337a>] ? kernel_thread_helper+0x6/0x10 ---[ end trace efd9a11434f00830 ]--- BUG: unable to handle kernel paging request at 00200200 IP: [<c11dd7bd>] list_del+0x1d/0x120 *pde = 00000000 Oops: 0000 [#1] PREEMPT SMP last sysfs file: /sys/devices/pci0000:00/0000:00:1a.1/usb4/4-1/4-1:1.0/tty/ttyACM0/uevent Modules linked in: cdc_acm
Pid: 3, comm: ksoftirqd/0 Tainted: G W 2.6.37+ #39 0T816J/Vostro 1520
EIP: 0060:[<c11dd7bd>] EFLAGS: 00010046 CPU: 0
EIP is at list_del+0x1d/0x120
EAX: f57fbd3c EBX: f57fb800 ECX: ffff8000 EDX: 00200200
ESI: f57fbe90 EDI: f57fbd3c EBP: f600bf54 ESP: f600bf3c
DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
Process ksoftirqd/0 (pid: 3, ti=f600a000 task=f60791c0 task.ti=f6082000)
Stack: c1527e84 00000030 c1527e54 00100100 f57fb800 f57fbd3c f600bf98 f8051fac f8053104 f8052b94 f600bf6c c106dbab f600bf80 00000286 f60791c0 c1042b30 f57fbda8 f57f5800 f57fbdb0 f57fbd80 f57fbe7c c1656b04 00000000 f600bfb0 Call Trace: [<f8051fac>] ? acm_rx_tasklet+0x2dc/0x3e0 [cdc_acm] [<c106dbab>] ? trace_hardirqs_on+0xb/0x10 [<c1042b30>] ? tasklet_action+0x60/0x140 [<c1042bb6>] ? tasklet_action+0xe6/0x140 [<c104342f>] ? __do_softirq+0xaf/0x210 [<c1043380>] ? __do_softirq+0x0/0x210 <IRQ> [<c1042c9a>] ? run_ksoftirqd+0x8a/0x1c0 [<c1042c10>] ? run_ksoftirqd+0x0/0x1c0 [<c105ac24>] ? kthread+0x74/0x80 [<c105abb0>] ? kthread+0x0/0x80 [<c100337a>] ? kernel_thread_helper+0x6/0x10 Code: ff 48 14 e9 57 ff ff ff 90 90 90 90 90 90 55 89 e5 83 ec 18 81 38 00 01 10 00 0f 84 9c 00 00 00 8b 50 04 81 fa 00 02 20 00 74 33 <8b> 12 39 d0 75 5c 8b 10 8b 4a 04 39 c8 0f 85 b5 00 00 00 8b 48 EIP: [<c11dd7bd>] list_del+0x1d/0x120 SS:ESP 0068:f600bf3c CR2: 0000000000200200 ---[ end trace efd9a11434f00831 ]--- Kernel panic - not syncing: Fatal exception in interrupt Pid: 3, comm: ksoftirqd/0 Tainted: G D W 2.6.37+ #39 Call Trace: [<c13fede1>] ? printk+0x1d/0x24 [<c13fecce>] panic+0x66/0x15c [<c10067df>] oops_end+0x8f/0x90 [<c1025476>] no_context+0xc6/0x160 [<c10255a8>] __bad_area_nosemaphore+0x98/0x140 [<c103cf68>] ? release_console_sem+0x1d8/0x210 [<c1025667>] bad_area_nosemaphore+0x17/0x20 [<c1025a49>] do_page_fault+0x279/0x420 [<c1006a8f>] ? show_trace+0x1f/0x30 [<c13fede1>] ? printk+0x1d/0x24 [<c10257d0>] ? do_page_fault+0x0/0x420 [<c140333b>] error_code+0x5f/0x64 [<c103007b>] ? select_task_rq_fair+0x37b/0x6a0 [<c10257d0>] ? do_page_fault+0x0/0x420 [<c11dd7bd>] ? list_del+0x1d/0x120 [<f8051fac>] acm_rx_tasklet+0x2dc/0x3e0 [cdc_acm] [<c106dbab>] ? trace_hardirqs_on+0xb/0x10 [<c1042b30>] ? tasklet_action+0x60/0x140 [<c1042bb6>] tasklet_action+0xe6/0x140 [<c104342f>] __do_softirq+0xaf/0x210 [<c1043380>] ? __do_softirq+0x0/0x210 <IRQ> [<c1042c9a>] ? run_ksoftirqd+0x8a/0x1c0 [<c1042c10>] ? run_ksoftirqd+0x0/0x1c0 [<c105ac24>] ? kthread+0x74/0x80 [<c105abb0>] ? kthread+0x0/0x80 [<c100337a>] ? kernel_thread_helper+0x6/0x10 panic occurred, switching back to text console ------------[ cut here ]------------
--- drivers/usb/class/cdc-acm.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/usb/class/cdc-acm.c +2 -0
@@ -655,8 +655,10 @@ static void acm_port_down(struct acm *acm, int drain)usb_kill_urb (acm->ctrlurb);for (i =0 ; i <ACM_NW ; i++)usb_kill_urb (acm->wb[i].urb); +tasklet_disable (&acm->urb_task);for (i =0 ; i < nr; i++)usb_kill_urb (acm->ru[i].urb); +tasklet_enable (&acm->urb_task); acm->control->needs_remote_wakeup =0 ;usb_autopm_put_interface (acm->control); }
Signature · 1 line
1.7.4.4
PATCH 214/247 USB: uss720 fixup refcount position
In reply to Paul GortmakerFrom: Peter Holik <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit adaa3c6342b249548ea830fe8e02aa5b45be8688 upstream.
My testprog do a lot of bitbang - after hours i got following warning and my machine lockups:
WARNING: at /build/buildd/linux-2.6.38/lib/kref.c:34
After debugging uss720 driver i discovered that the completion callback was called before usb_submit_urb returns. The callback frees the request structure that is krefed on return by usb_submit_urb.
--- drivers/usb/misc/uss720.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
drivers/usb/misc/uss720.c +3 -4
@@ -177,12 +177,11 @@ static struct uss720_async_request *submit_async_request(struct parport_uss720_pspin_lock_irqsave (&priv->asynclock, flags);list_add_tail (&rq->asynclist, &priv->asynclist);spin_unlock_irqrestore (&priv->asynclock, flags); +kref_get (&rq->ref_count); ret =usb_submit_urb (rq->urb, mem_flags); -if (!ret) { -kref_get (&rq->ref_count); +if (!ret)return rq; - } -kref_put (&rq->ref_count, destroy_async); +destroy_async (&rq->ref_count);err ("submit_async_request submit_urb failed with %d" , ret);return NULL ; }
Signature · 1 line
1.7.4.4
PATCH 215/247 ehci-hcd: Bug fix: don't set a QH's Halt bit
In reply to Paul GortmakerFrom: Alan Stern <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit b5a3b3d985493c173925907adfebf3edab236fe7 upstream.
This patch (as1453) fixes a long-standing bug in the ehci-hcd driver.
There is no need to set the Halt bit in the overlay region for an unlinked or blocked QH. Contrary to what the comment says, setting the Halt bit does not cause the QH to be patched later; that decision (made in qh_refresh()) depends only on whether the QH is currently pointing to a valid qTD. Likewise, setting the Halt bit does not prevent completions from activating the QH while it is "stopped"; they are prevented by the fact that qh_completions() temporarily changes qh->qh_state to QH_STATE_COMPLETING.
On the other hand, there are circumstances in which the QH will be reactivated _without_ being patched; this happens after an URB beyond the head of the queue is unlinked. Setting the Halt bit will then cause the hardware to see the QH with both the Active and Halt bits set, an invalid combination that will prevent the queue from advancing and may even crash some controllers.
Apparently the only reason this hasn't been reported before is that unlinking URBs from the middle of a running queue is quite uncommon. However Test 17, recently added to the usbtest driver, does exactly this, and it confirms the presence of the bug.
In short, there is no reason to set the Halt bit for an unlinked or blocked QH, and there is a very good reason not to set it. Therefore the code that sets it is removed.
--- drivers/usb/host/ehci-q.c | 12 ------------ 1 files changed, 0 insertions(+), 12 deletions(-)
drivers/usb/host/ehci-q.c +0 -12
@@ -315,7 +315,6 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)int stopped;unsigned count =0 ;u8 state; -const __le32 halt =HALT_BIT (ehci);struct ehci_qh_hw *hw = qh->hw;if (unlikely (list_empty (&qh->qtd_list)))
@@ -422,7 +421,6 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh) && !(qtd->hw_alt_next & EHCI_LIST_END(ehci))) { stopped =1 ; - goto halt; }/* stop scanning when we reach qtds the hc is using */
@@ -456,16 +454,6 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)*/ ehci_clear_tt_buffer (ehci, qh, urb, token); } - -/* force halt for unlinked or blocked qh, so we'll -* patch the qh later and so that completions can't -* activate it while we "know" it's stopped. -*/ -if ((halt & hw->hw_token) ==0 ) { -halt: - hw->hw_token |= halt; -wmb (); - } }/* unless we already know the urb's status, collect qtd status
Signature · 1 line
1.7.4.4
PATCH 216/247 uvcvideo: Fix uvc_fixup_video_ctrl() format search
In reply to Paul GortmakerFrom: Stephan Lachowsky <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 38a66824d96de8aeeb915e6f46f0d3fe55828eb1 upstream.
The scheme used to index format in uvc_fixup_video_ctrl() is not robust:
format index is based on descriptor ordering, which does not necessarily match bFormatIndex ordering. Searching for first matching format will prevent uvc_fixup_video_ctrl() from using the wrong format/frame to make adjustments.
--- drivers/media/video/uvc/uvc_video.c | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-)
drivers/media/video/uvc/uvc_video.c +9 -5
@@ -65,15 +65,19 @@ int uvc_query_ctrl(struct uvc_device *dev, __u8 query, __u8 unit,static void uvc_fixup_video_ctrl (struct uvc_streaming *stream,struct uvc_streaming_control *ctrl) { -struct uvc_format *format; +struct uvc_format *format =NULL ;struct uvc_frame *frame =NULL ;unsigned int i; -if (ctrl->bFormatIndex <=0 || - ctrl->bFormatIndex > stream->nformats) -return ; +for (i =0 ; i < stream->nformats; ++i) { +if (stream->format[i].index == ctrl->bFormatIndex) { + format = &stream->format[i]; +break ; + } + } - format = &stream->format[ctrl->bFormatIndex -1 ]; +if (format ==NULL ) +return ;for (i =0 ; i < format->nframes; ++i) {if (format->frame[i].bFrameIndex == ctrl->bFrameIndex) {
Signature · 1 line
1.7.4.4
PATCH 217/247 nfsd41: modify the members value of nfsd4_op_flags
In reply to Paul GortmakerFrom: Mi Jinlong <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 5ece3cafbd88d4da5c734e1810c4a2e6474b57b2 upstream.
The members of nfsd4_op_flags, (ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS) equals to ALLOWED_AS_FIRST_OP, maybe that's not what we want.
OP_PUTROOTFH with op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS, can't appears as the first operation with out SEQUENCE ops.
This patch modify the wrong value of ALLOWED_WITHOUT_FH etc which was introduced by f9bb94c4.
--- fs/nfsd/nfs4proc.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
fs/nfsd/nfs4proc.c +2 -2
@@ -954,8 +954,8 @@ typedef __be32(*nfsd4op_func)(struct svc_rqst *, struct nfsd4_compound_state *, void *);enum nfsd4_op_flags {ALLOWED_WITHOUT_FH =1 <<0 ,/* No current filehandle required */ -ALLOWED_ON_ABSENT_FS =2 <<0 ,/* ops processed on absent fs */ -ALLOWED_AS_FIRST_OP =3 <<0 ,/* ops reqired first in compound */ +ALLOWED_ON_ABSENT_FS =1 <<1 ,/* ops processed on absent fs */ +ALLOWED_AS_FIRST_OP =1 <<2 ,/* ops reqired first in compound */ };struct nfsd4_operation {
Signature · 1 line
1.7.4.4
PATCH 218/247 fbcon: Bugfix soft cursor detection in Tile Blitting
In reply to Paul GortmakerFrom: Henry Nestler <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit d6244bc0ed0c52a795e6f4dcab3886daf3e74fac upstream.
Use mask 0x10 for "soft cursor" detection on in function tile_cursor. (Tile Blitting Operation in framebuffer console).
The old mask 0x01 for vc_cursor_type detects CUR_NONE, CUR_LOWER_THIRD and every second mode value as "software cursor". This hides the cursor for these modes (cursor.mode = 0). But, only CUR_NONE or "software cursor" should hide the cursor.
See also 0x10 in functions add_softcursor, bit_cursor and cw_cursor.
--- drivers/video/console/tileblit.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/console/tileblit.c +1 -1
@@ -83,7 +83,7 @@ static void tile_cursor(struct vc_data *vc, struct fb_info *info, int mode, int softback_lines, int fg, int bg) { struct fb_tilecursor cursor; -int use_sw = (vc->vc_cursor_type &0x01 ); +int use_sw = (vc->vc_cursor_type &0x10 ); cursor.sx = vc->vc_x; cursor.sy = vc->vc_y;
Signature · 1 line
1.7.4.4
PATCH 219/247 proc: protect mm start_code/end_code in /proc/pid/stat
In reply to Paul GortmakerFrom: Kees Cook <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 5883f57ca0008ffc93e09cbb9847a1928e50c6f3 upstream.
While mm->start_stack was protected from cross-uid viewing (commit f83ce3e6b02d5 ("proc: avoid information leaks to non-privileged processes")), the start_code and end_code values were not. This would allow the text location of a PIE binary to leak, defeating ASLR.
Note that the value "1" is used instead of "0" for a protected value since "ps", "killall", and likely other readers of /proc/pid/stat, take start_code of "0" to mean a kernel thread and will misbehave. Thanks to Brad Spengler for pointing this out.
Addresses CVE-2011-0726
--- fs/proc/array.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
fs/proc/array.c +2 -2
@@ -489,8 +489,8 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns, vsize, mm ?get_mm_rss (mm) :0 , rsslim, - mm ? mm->start_code :0 , - mm ? mm->end_code :0 , + mm ? (permitted ? mm->start_code :1 ) :0 , + mm ? (permitted ? mm->end_code :1 ) :0 , (permitted && mm) ? mm->start_stack :0 , esp, eip,
Signature · 1 line
1.7.4.4
PATCH 220/247 procfs: fix /proc/<pid>/maps heap check
In reply to Paul GortmakerFrom: Aaro Koskinen <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 0db0c01b53a1a421513f91573241aabafb87802a upstream.
The current code fails to print the "[heap]" marking if the heap is split into multiple mappings.
Fix the check so that the marking is displayed in all possible cases:
1. vma matches exactly the heap
2. the heap vma is merged e.g. with bss
3. the heap vma is splitted e.g. due to locked pages
Test cases. In all cases, the process should have mapping(s) with [heap] marking:
(1) vma matches exactly the heap
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
int main (void)
{
if (sbrk(4096) != (void *)-1) {
printf("check /proc/%d/maps\n", (int)getpid());
while (1)
sleep(1);
}
return 0;
}
# ./test1
check /proc/553/maps
[1] + Stopped ./test1
# cat /proc/553/maps | head -4
00008000-00009000 r-xp 00000000 01:00 3113640 /test1
00010000-00011000 rw-p 00000000 01:00 3113640 /test1
00011000-00012000 rw-p 00000000 00:00 0 [heap]
4006f000-40070000 rw-p 00000000 00:00 0
(2) the heap vma is merged
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
char foo[4096] = "foo";
char bar[4096];
int main (void)
{
if (sbrk(4096) != (void *)-1) {
printf("check /proc/%d/maps\n", (int)getpid());
while (1)
sleep(1);
}
return 0;
}
# ./test2
check /proc/556/maps
[2] + Stopped ./test2
# cat /proc/556/maps | head -4
00008000-00009000 r-xp 00000000 01:00 3116312 /test2
00010000-00012000 rw-p 00000000 01:00 3116312 /test2
00012000-00014000 rw-p 00000000 00:00 0 [heap]
4004a000-4004b000 rw-p 00000000 00:00 0
(3) the heap vma is splitted (this fails without the patch)
#include <stdio.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/types.h>
int main (void)
{
if ((sbrk(4096) != (void *)-1) && !mlockall(MCL_FUTURE) &&
(sbrk(4096) != (void *)-1)) {
printf("check /proc/%d/maps\n", (int)getpid());
while (1)
sleep(1);
}
return 0;
}
# ./test3
check /proc/559/maps
[1] + Stopped ./test3
# cat /proc/559/maps|head -4
00008000-00009000 r-xp 00000000 01:00 3119108 /test3
00010000-00011000 rw-p 00000000 01:00 3119108 /test3
00011000-00012000 rw-p 00000000 00:00 0 [heap]
00012000-00013000 rw-p 00000000 00:00 0 [heap]It looks like the bug has been there forever, and since it only results in some information missing from a procfile, it does not fulfil the -stable "critical issue" criteria.
--- fs/proc/task_mmu.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
fs/proc/task_mmu.c +2 -2
@@ -248,8 +248,8 @@ static void show_map_vma(struct seq_file *m, struct vm_area_struct *vma)const char *name =arch_vma_name (vma);if (!name) {if (mm) { -if (vma->vm_start <= mm->start_brk && - vma->vm_end >= mm->brk) { +if (vma->vm_start <= mm->brk && + vma->vm_end >= mm->start_brk) { name ="[heap]" ; }else if (vma->vm_start <= mm->start_stack && vma->vm_end >= mm->start_stack) {
Signature · 1 line
1.7.4.4
PATCH 221/247 ext3: skip orphan cleanup on rocompat fs
In reply to Paul GortmakerFrom: Amir Goldstein <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit ce654b37f87980d95f339080e4c3bdb2370bdf22 upstream.
Orphan cleanup is currently executed even if the file system has some number of unknown ROCOMPAT features, which deletes inodes and frees blocks, which could be very bad for some RO_COMPAT features.
This patch skips the orphan cleanup if it contains readonly compatible features not known by this ext3 implementation, which would prevent the fs from being mounted (or remounted) readwrite.
--- fs/ext3/super.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
fs/ext3/super.c +7 -0
@@ -1441,6 +1441,13 @@ static void ext3_orphan_cleanup (struct super_block * sb,return ; } +/* Check if feature set allows readwrite operations */ +if (EXT3_HAS_RO_COMPAT_FEATURE (sb, ~EXT3_FEATURE_RO_COMPAT_SUPP )) { +ext3_msg (sb,KERN_INFO ,"Skipping orphan cleanup due to " +"unknown ROCOMPAT features" ); +return ; + } +if (EXT3_SB (sb)->s_mount_state &EXT3_ERROR_FS ) {if (es->s_last_orphan) jbd_debug(1, "Errors on filesystem, "
Signature · 1 line
1.7.4.4
PATCH 222/247 PCI: return correct value when writing to the "reset" attribute
In reply to Paul GortmakerFrom: Michal Schmidt <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 447c5dd7338638f526e9bcf7dcf69b4da5835c7d upstream.
A successful write() to the "reset" sysfs attribute should return the number of bytes written, not 0. Otherwise userspace (bash) retries the write over and over again.
--- drivers/pci/pci-sysfs.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
drivers/pci/pci-sysfs.c +6 -1
@@ -971,7 +971,12 @@ static ssize_t reset_store(struct device *dev,if (val !=1 )return -EINVAL ; -return pci_reset_function (pdev); + + result =pci_reset_function (pdev); +if (result <0 ) +return result; + +return count; }static struct device_attribute reset_attr =__ATTR (reset,0200 ,NULL , reset_store);
Signature · 1 line
1.7.4.4
PATCH 223/247 mpt2sas: prevent heap overflows and unchecked reads
In reply to Paul GortmakerFrom: Dan Rosenberg <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit a1f74ae82d133ebb2aabb19d181944b4e83e9960 upstream.
At two points in handling device ioctls via /dev/mpt2ctl, user-supplied length values are used to copy data from userspace into heap buffers without bounds checking, allowing controllable heap corruption and subsequently privilege escalation.
Additionally, user-supplied values are used to determine the size of a copy_to_user() as well as the offset into the buffer to be read, with no bounds checking, allowing users to read arbitrary kernel memory.
--- drivers/scsi/mpt2sas/mpt2sas_ctl.c | 23 +++++++++++++++++++++-- 1 files changed, 21 insertions(+), 2 deletions(-)
drivers/scsi/mpt2sas/mpt2sas_ctl.c +21 -2
@@ -636,6 +636,13 @@ _ctl_do_mpt_command(struct MPT2SAS_ADAPTER *ioc, data_out_sz = karg.data_out_size; data_in_sz = karg.data_in_size; +/* Check for overflow and wraparound */ +if (karg.data_sge_offset *4 > ioc->request_sz || + karg.data_sge_offset > (UINT_MAX /4 )) { + ret = -EINVAL ; + goto out; + } +/* copy in request message frame from user */ if (copy_from_user (mpi_request, mf, karg.data_sge_offset*4 )) { printk(KERN_ERR "failure at %s:%d/%s()!\n", __FILE__, __LINE__,
@@ -1877,7 +1884,7 @@ _ctl_diag_read_buffer(void __user *arg, enum block_state state)Mpi2DiagBufferPostReply_t *mpi_reply;int rc, i;u8 buffer_type; -unsigned long timeleft; +unsigned long timeleft, request_size, copy_size;u16 smid;u16 ioc_status;u8 issue_reset =0 ;
@@ -1913,6 +1920,8 @@ _ctl_diag_read_buffer(void __user *arg, enum block_state state)return -ENOMEM ; } + request_size = ioc->diag_buffer_sz[buffer_type]; +if ((karg.starting_offset %4 ) || (karg.bytes_to_read %4 )) { printk(MPT2SAS_ERR_FMT "%s: either the starting_offset " "or bytes_to_read are not 4 byte aligned\n", ioc->name,
@@ -1920,13 +1929,23 @@ _ctl_diag_read_buffer(void __user *arg, enum block_state state)return -EINVAL ; } +if (karg.starting_offset > request_size) +return -EINVAL ; + diag_data = (void *)(request_data + karg.starting_offset);dctlprintk (ioc,printk (MPT2SAS_DEBUG_FMT "%s: diag_buffer(%p), " "offset(%d), sz(%d)\n" , ioc->name, __func__, diag_data, karg.starting_offset, karg.bytes_to_read)); +/* Truncate data on requests that are too large */ +if ((diag_data + karg.bytes_to_read < diag_data) || + (diag_data + karg.bytes_to_read > request_data + request_size)) + copy_size = request_size - karg.starting_offset; +else + copy_size = karg.bytes_to_read; +if (copy_to_user ((void __user *)uarg->diagnostic_data, - diag_data, karg.bytes_to_read)) { + diag_data, copy_size)) {printk (MPT2SAS_ERR_FMT "%s: Unable to write " "mpt_diag_read_buffer_t data @ %p\n" , ioc->name, __func__, diag_data);
Signature · 1 line
1.7.4.4
PATCH 224/247 fs/partitions/ldm.c: fix oops caused by corrupted partition table
In reply to Paul GortmakerFrom: Timo Warns <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit c340b1d640001c8c9ecff74f68fd90422ae2448a upstream.
The kernel automatically evaluates partition tables of storage devices. The code for evaluating LDM partitions (in fs/partitions/ldm.c) contains a bug that causes a kernel oops on certain corrupted LDM partitions. A kernel subsystem seems to crash, because, after the oops, the kernel no longer recognizes newly connected storage devices.
The patch validates the value of vblk_size.
--- fs/partitions/ldm.c | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-)
fs/partitions/ldm.c +12 -4
@@ -1299,6 +1299,11 @@ static bool ldm_frag_add (const u8 *data, int size, struct list_head *frags)BUG_ON (!data || !frags); +if (size <2 *VBLK_SIZE_HEAD ) { +ldm_error ("Value of size is to small." ); +return false; + } + group =get_unaligned_be32 (data +0x08 ); rec =get_unaligned_be16 (data +0x0C ); num =get_unaligned_be16 (data +0x0E );
@@ -1306,6 +1311,10 @@ static bool ldm_frag_add (const u8 *data, int size, struct list_head *frags)ldm_error ("A VBLK claims to have %d parts." , num);return false; } +if (rec >= num) { +ldm_error ("REC value (%d) exceeds NUM value (%d)" , rec, num); +return false; + } list_for_each (item, frags) { f = list_entry (item, struct frag, list);
@@ -1334,10 +1343,9 @@ found: f->map |= (1 << rec); -if (num >0 ) { - data +=VBLK_SIZE_HEAD ; - size -=VBLK_SIZE_HEAD ; - } + data +=VBLK_SIZE_HEAD ; + size -=VBLK_SIZE_HEAD ; +memcpy (f->data+rec*(size-VBLK_SIZE_HEAD )+VBLK_SIZE_HEAD , data, size);return true;
Signature · 1 line
1.7.4.4
Re: [Stable-review] [34-longterm 224/247] fs/partitions/ldm.c: fix oops caused by corrupted partition table
Quoted 9 lines · Paul Gortmaker
From: Timo Warns <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------commit
c340b1d640001c8c9ecff74f68fd90422ae2448aupstream.
Quoted 7 lines
The kernel automatically evaluates partition tables of storage devices. The code for evaluating LDM partitions (in
fs/partitions/ldm.c) contains a bug that causes a kernel oops on certain corrupted LDM partitions. A kernel subsystem seems to crash, because, after the oops, the kernel no longer recognizes newly connected storage devices.The patch validates the value of
vblk_size.
[...]
This doesn't completely fix the possibility of a buffer overflow. You also need commit cae13fe4cc3f24820ffb990c09110626837e85d4.
Ben.
Signature · 2 lines
Ben Hutchings The two most common things in the universe are hydrogen and stupidity.
Re: [Stable-review] [34-longterm 224/247] fs/partitions/ldm.c: fix oops caused by corrupted partition table
Quoted 16 lines · Ben Hutchings
Quoted 15 lines · Paul Gortmaker
From: Timo Warns <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------commit
c340b1d640001c8c9ecff74f68fd90422ae2448aupstream.The kernel automatically evaluates partition tables of storage devices. The code for evaluating LDM partitions (in
fs/partitions/ldm.c) contains a bug that causes a kernel oops on certain corrupted LDM partitions. A kernel subsystem seems to crash, because, after the oops, the kernel no longer recognizes newly connected storage devices.
Quoted 5 lines
Quoted 1 line
The patch validates the value of
vblk_size.[...]
This doesn't completely fix the possibility of a buffer overflow. You also need commit
cae13fe4cc3f24820ffb990c09110626837e85d4.
Thanks Ben, I will queue that up this morning.
Paul.
Quoted 3 lines
Ben.
PATCH 225/247 agp: fix arbitrary kernel memory writes
In reply to Paul GortmakerFrom: Vasiliy Kulikov <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 194b3da873fd334ef183806db751473512af29ce upstream.
pg_start is copied from userspace on AGPIOC_BIND and AGPIOC_UNBIND ioctl cmds of agp_ioctl() and passed to agpioc_bind_wrap(). As said in the comment, (pg_start + mem->page_count) may wrap in case of AGPIOC_BIND, and it is not checked at all in case of AGPIOC_UNBIND. As a result, user with sufficient privileges (usually "video" group) may generate either local DoS or privilege escalation.
--- drivers/char/agp/generic.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-)
drivers/char/agp/generic.c +8 -3
@@ -1124,8 +1124,8 @@ int agp_generic_insert_memory(struct agp_memory * mem, off_t pg_start, int type)return -EINVAL ; } -/* AK: could wrap */ -if ((pg_start + mem->page_count) > num_entries) +if (((pg_start + mem->page_count) > num_entries) || + ((pg_start + mem->page_count) < pg_start))return -EINVAL ; j = pg_start;
@@ -1159,7 +1159,7 @@ int agp_generic_remove_memory(struct agp_memory *mem, off_t pg_start, int type) {size_t i;struct agp_bridge_data *bridge; -int mask_type; +int mask_type, num_entries; bridge = mem->bridge;if (!bridge)
@@ -1171,6 +1171,11 @@ int agp_generic_remove_memory(struct agp_memory *mem, off_t pg_start, int type)if (type != mem->type)return -EINVAL ; + num_entries =agp_num_entries (); +if (((pg_start + mem->page_count) > num_entries) || + ((pg_start + mem->page_count) < pg_start)) +return -EINVAL ; + mask_type = bridge->driver->agp_type_to_mask_type (bridge, type);if (mask_type !=0 ) {/* The generic routines know nothing of memory types */
Signature · 1 line
1.7.4.4
PATCH 226/247 agp: fix OOM and buffer overflow
In reply to Paul GortmakerFrom: Vasiliy Kulikov <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit b522f02184b413955f3bc952e3776ce41edc6355 upstream.
page_count is copied from userspace. agp_allocate_memory() tries to check whether this number is too big, but doesn't take into account the wrap case. Also agp_create_user_memory() doesn't check whether alloc_size is calculated from num_agp_pages variable without overflow. This may lead to allocation of too small buffer with following buffer overflow.
Another problem in agp code is not addressed in the patch - kernel memory exhaustion (AGPIOC_RESERVE and AGPIOC_ALLOCATE ioctls). It is not checked whether requested pid is a pid of the caller (no check in agpioc_reserve_wrap()). Each allocation is limited to 16KB, though, there is no per-process limit. This might lead to OOM situation, which is not even solved in case of the caller death by OOM killer - the memory is allocated for another (faked) process.
--- drivers/char/agp/generic.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
drivers/char/agp/generic.c +7 -1
@@ -124,6 +124,9 @@ static struct agp_memory *agp_create_user_memory(unsigned long num_agp_pages)struct agp_memory *new;unsigned long alloc_size = num_agp_pages*sizeof (struct page *); +if (INT_MAX /sizeof (struct page *) < num_agp_pages) +return NULL ; + new =kzalloc (sizeof (struct agp_memory ),GFP_KERNEL );if (new ==NULL )return NULL ;
@@ -243,11 +246,14 @@ struct agp_memory *agp_allocate_memory(struct agp_bridge_data *bridge,int scratch_pages;struct agp_memory *new;size_t i; +int cur_memory;if (!bridge)return NULL ; -if ((atomic_read (&bridge->current_memory_agp) + page_count) > bridge->max_memory_agp) + cur_memory =atomic_read (&bridge->current_memory_agp); +if ((cur_memory + page_count > bridge->max_memory_agp) || + (cur_memory + page_count < page_count))return NULL ;if (type >=AGP_USER_TYPES ) {
Signature · 1 line
1.7.4.4
PATCH 227/247 udp: Fix bogus UFO packet generation
In reply to Paul GortmakerFrom: Herbert Xu <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 26cde9f7e2747b6d254b704594eed87ab959afa5 upstream.
It has been reported that the new UFO software fallback path fails under certain conditions with NFS. I tracked the problem down to the generation of UFO packets that are smaller than the MTU. The software fallback path simply discards these packets.
This patch fixes the problem by not generating such packets on the UFO path.
--- net/ipv4/ip_output.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)
net/ipv4/ip_output.c +6 -3
@@ -871,8 +871,10 @@ int ip_append_data(struct sock *sk, !exthdrlen) csummode =CHECKSUM_PARTIAL ; + skb =skb_peek_tail (&sk->sk_write_queue); + inet->cork.length += length; -if (((length> mtu) || !skb_queue_empty (&sk->sk_write_queue)) && +if (((length > mtu) || (skb &&skb_is_gso (skb))) && (sk->sk_protocol ==IPPROTO_UDP ) && (rt->u.dst.dev->features &NETIF_F_UFO )) { err = ip_ufo_append_data(sk, getfrag, from, length, hh_len,
@@ -890,7 +892,7 @@ int ip_append_data(struct sock *sk,* adding appropriate IP header. */ -if ((skb =skb_peek_tail (&sk->sk_write_queue)) ==NULL ) +if (!skb) goto alloc_new_skb;while (length >0 ) {
@@ -1119,7 +1121,8 @@ ssize_t ip_append_page(struct sock *sk, struct page *page,return -EINVAL ; inet->cork.length += size; -if ((sk->sk_protocol ==IPPROTO_UDP ) && +if ((size + skb->len > mtu) && + (sk->sk_protocol ==IPPROTO_UDP ) && (rt->u.dst.dev->features &NETIF_F_UFO )) {skb_shinfo (skb)->gso_size = mtu - fragheaderlen;skb_shinfo (skb)->gso_type =SKB_GSO_UDP ;
Signature · 1 line
1.7.4.4
PATCH 228/247 arch/x86/oprofile/op_model_amd.c: Perform initialisation on a single CPU
In reply to Paul GortmakerFrom: Robert Richter <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit c7c25802b39c443b3745cfa973dc49a97a3491f8 upstream.
Disable preemption in init_ibs(). The function only checks the ibs capabilities and sets up pci devices (if necessary). It runs only on one cpu but operates with the local APIC and some MSRs, thus it is better to disable preemption.
[ 7.034377] BUG: using smp_processor_id() in preemptible [00000000] code: modprobe/483 [ 7.034385] caller is setup_APIC_eilvt+0x155/0x180 [ 7.034389] Pid: 483, comm: modprobe Not tainted 2.6.37-rc1-20101110+ #1 [ 7.034392] Call Trace: [ 7.034400] [<ffffffff812a2b72>] debug_smp_processor_id+0xd2/0xf0 [ 7.034404] [<ffffffff8101e985>] setup_APIC_eilvt+0x155/0x180
[ ... ]
Addresses https://bugzilla.kernel.org/show_bug.cgi?id=22812
LKML-Reference: <[email protected]>
--- arch/x86/oprofile/op_model_amd.c | 24 ++++++++++++++++-------- 1 files changed, 16 insertions(+), 8 deletions(-)
arch/x86/oprofile/op_model_amd.c +16 -8
@@ -497,21 +497,29 @@ static void clear_ibs_nmi(void)on_each_cpu (apic_clear_ibs_nmi_per_cpu,NULL ,1 ); } -/* initialize the APIC for the IBS interrupts if available */ +/* +* 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 ibs_init (void ) { - ibs_caps =get_ibs_caps (); +preempt_disable (); + ibs_caps =get_ibs_caps ();if (!ibs_caps) -return ; + goto out; -if (init_ibs_nmi ()) { +if (init_ibs_nmi () <0 ) ibs_caps =0 ; -return ; - } +else +printk (KERN_INFO "oprofile: AMD IBS detected (0x%08x)\n" , ibs_caps); -printk (KERN_INFO "oprofile: AMD IBS detected (0x%08x)\n" , - (unsigned )ibs_caps); +out: +preempt_enable (); }static void ibs_exit (void )
Signature · 1 line
1.7.4.4
Re: [34-longterm 228/247] arch/x86/oprofile/op_model_amd.c: Perform initialisation on a single CPU
Quoted 32 lines · Paul Gortmaker
From: Robert Richter <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------commit
c7c25802b39c443b3745cfa973dc49a97a3491f8upstream.Disable preemption in
init_ibs(). The function only checks the ibs capabilities and sets up pci devices (if necessary). It runs only on one cpu but operates with the local APIC and some MSRs, thus it is better to disable preemption.[ 7.034377] BUG: using smp_processor_id() in preemptible [00000000] code: modprobe/483 [ 7.034385] caller is setup_APIC_eilvt+0x155/0x180 [ 7.034389] Pid: 483, comm: modprobe Not tainted 2.6.37-rc1-20101110+ #1 [ 7.034392] Call Trace: [ 7.034400] [<ffffffff812a2b72>] debug_smp_processor_id+0xd2/0xf0 [ 7.034404] [<ffffffff8101e985>] setup_APIC_eilvt+0x155/0x180[ ... ]
Addresses https://bugzilla.kernel.org/show_bug.cgi?id=22812
Reported-by <[email protected]>Signed-off-by Robert Richter <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Frederic Weisbecker <[email protected]>Cc Rafael J. Wysocki <[email protected]>Cc Dan Carpenter <[email protected]>Cc Andrew Morton <[email protected]>
Quoted 7 lines
LKML-Reference: <[email protected]>
[ small cleanups ]Signed-off-by Ingo Molnar <[email protected]>Signed-off-by Paul Gortmaker <[email protected]>--- arch/x86/oprofile/op_model_amd.c | 24 ++++++++++++++++-------- 1 files changed, 16 insertions(+), 8 deletions(-)
This patch introduces a sleeping-while-atomic bug. There is another upstream fix on top, see:
commit 3d2606f42984613d324ad3047cf503bcddc3880a
Author: Robert Richter <[email protected]> Date: Fri May 20 09:46:54 2011 +0200
oprofile, x86: Enable preemption during pci device setup in IBS init
This fix should be applied too (or instead).
-Robert
Signature · 2 lines
Advanced Micro Devices, Inc. Operating System Research Center
Re: [34-longterm 228/247] arch/x86/oprofile/op_model_amd.c: Perform initialisation on a single CPU
Quoted 44 lines · Robert Richter
Quoted 32 lines · Paul Gortmaker
From: Robert Richter <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------commit
c7c25802b39c443b3745cfa973dc49a97a3491f8upstream.Disable preemption in
init_ibs(). The function only checks the ibs capabilities and sets up pci devices (if necessary). It runs only on one cpu but operates with the local APIC and some MSRs, thus it is better to disable preemption.[ 7.034377] BUG: using smp_processor_id() in preemptible [00000000] code: modprobe/483 [ 7.034385] caller is setup_APIC_eilvt+0x155/0x180 [ 7.034389] Pid: 483, comm: modprobe Not tainted 2.6.37-rc1-20101110+ #1 [ 7.034392] Call Trace: [ 7.034400] [<ffffffff812a2b72>] debug_smp_processor_id+0xd2/0xf0 [ 7.034404] [<ffffffff8101e985>] setup_APIC_eilvt+0x155/0x180[ ... ]
Addresses https://bugzilla.kernel.org/show_bug.cgi?id=22812
Reported-by <[email protected]>Signed-off-by Robert Richter <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Frederic Weisbecker <[email protected]>Cc Rafael J. Wysocki <[email protected]>Cc Dan Carpenter <[email protected]>Cc Andrew Morton <[email protected]>Quoted 7 lines
LKML-Reference: <[email protected]>
[ small cleanups ]Signed-off-by Ingo Molnar <[email protected]>Signed-off-by Paul Gortmaker <[email protected]>--- arch/x86/oprofile/op_model_amd.c | 24 ++++++++++++++++-------- 1 files changed, 16 insertions(+), 8 deletions(-)This patch introduces a sleeping-while-atomic bug. There is another upstream fix on top, see:
Quoted 7 lines
commit
3d2606f42984613d324ad3047cf503bcddc3880aAuthor: Robert Richter <[email protected]> Date: Fri May 20 09:46:54 2011 +0200oprofile, x86: Enable preemption during pci device setup in IBS init
This fix should be applied too (or instead).
Thanks Robert. I guess I'll end up dropping c7c25802b39c then. I just did a quick test and it appears the 2.6.34 code base is too old for me to be able to apply 3d2606f4298 in anything close to resembling its original form.
Paul.
Quoted 3 lines
-Robert
Re: [34-longterm 228/247] arch/x86/oprofile/op_model_amd.c: Perform initialisation on a single CPU
Quoted 49 lines · Paul Gortmaker
Quoted 48 lines · Robert Richter
Quoted 32 lines · Paul Gortmaker
From: Robert Richter <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------commit
c7c25802b39c443b3745cfa973dc49a97a3491f8upstream.Disable preemption in
init_ibs(). The function only checks the ibs capabilities and sets up pci devices (if necessary). It runs only on one cpu but operates with the local APIC and some MSRs, thus it is better to disable preemption.[ 7.034377] BUG: using smp_processor_id() in preemptible [00000000] code: modprobe/483 [ 7.034385] caller is setup_APIC_eilvt+0x155/0x180 [ 7.034389] Pid: 483, comm: modprobe Not tainted 2.6.37-rc1-20101110+ #1 [ 7.034392] Call Trace: [ 7.034400] [<ffffffff812a2b72>] debug_smp_processor_id+0xd2/0xf0 [ 7.034404] [<ffffffff8101e985>] setup_APIC_eilvt+0x155/0x180[ ... ]
Addresses https://bugzilla.kernel.org/show_bug.cgi?id=22812
Reported-by <[email protected]>Signed-off-by Robert Richter <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Frederic Weisbecker <[email protected]>Cc Rafael J. Wysocki <[email protected]>Cc Dan Carpenter <[email protected]>Cc Andrew Morton <[email protected]>Quoted 7 lines
LKML-Reference: <[email protected]>
[ small cleanups ]Signed-off-by Ingo Molnar <[email protected]>Signed-off-by Paul Gortmaker <[email protected]>--- arch/x86/oprofile/op_model_amd.c | 24 ++++++++++++++++-------- 1 files changed, 16 insertions(+), 8 deletions(-)This patch introduces a sleeping-while-atomic bug. There is another upstream fix on top, see:
commit
3d2606f42984613d324ad3047cf503bcddc3880aAuthor: Robert Richter <[email protected]> Date: Fri May 20 09:46:54 2011 +0200
Quoted 8 lines
Quoted 3 lines
oprofile, x86: Enable preemption during pci device setup in IBS init
This fix should be applied too (or instead).
Thanks Robert. I guess I'll end up dropping
c7c25802b39cthen. I just did a quick test and it appears the 2.6.34 code base is too old for me to be able to apply3d2606f4298in anything close to resembling its original form.
This would be ok. Current upstream code is a reimplementation very different from .34.
Thanks,
-Robert
Signature · 2 lines
Advanced Micro Devices, Inc. Operating System Research Center
PATCH 229/247 epoll: convert max_user_watches to long
In reply to Paul GortmakerFrom: Robin Holt <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 52bd19f7691b2ea6433aef0ef94c08c57efd7e79 upstream.
On a 16TB machine, max_user_watches has an integer overflow. Convert it to use a long and handle the associated fallout.
--- fs/eventpoll.c | 20 ++++++++++++-------- include/linux/sched.h | 2 +- 2 files changed, 13 insertions(+), 9 deletions(-)
fs/eventpoll.c +12 -8
@@ -227,7 +227,7 @@ struct ep_send_events_data {* Configuration options available inside /proc/sys/fs/epoll/ */ /* Maximum number of epoll watched descriptors, per user */ -static int max_user_watches__read_mostly ; +static long max_user_watches__read_mostly ;/* * This mutex is used to serialize ep_free() and eventpoll_release_file().
@@ -253,16 +253,18 @@ static struct kmem_cache *pwq_cache __read_mostly;#include <linux/sysctl.h> -static int zero; +static long zero; +static long long_max =LONG_MAX ;ctl_table epoll_table[] = { { .procname ="max_user_watches" , .data = &max_user_watches, - .maxlen =sizeof (int ), + .maxlen =sizeof (max_user_watches), .mode =0644 , - .proc_handler = proc_dointvec_minmax, + .proc_handler = proc_doulongvec_minmax, .extra1 = &zero, + .extra2 = &long_max, }, { } };
@@ -574,7 +576,7 @@ static int ep_remove(struct eventpoll *ep, struct epitem *epi)/* At this point it is safe to free the eventpoll item */ kmem_cache_free (epi_cache, epi); -atomic_dec (&ep->user->epoll_watches); +atomic_long_dec (&ep->user->epoll_watches);return 0 ; }
@@ -910,11 +912,12 @@ static int ep_insert(struct eventpoll *ep, struct epoll_event *event, {int error, revents, pwake =0 ;unsigned long flags; +long user_watches;struct epitem *epi;struct ep_pqueue epq; -if (unlikely (atomic_read (&ep->user->epoll_watches) >= - max_user_watches)) + user_watches =atomic_long_read (&ep->user->epoll_watches); +if (unlikely (user_watches >= max_user_watches))return -ENOSPC ;if (!(epi =kmem_cache_alloc (epi_cache,GFP_KERNEL )))return -ENOMEM ;
@@ -978,7 +981,7 @@ static int ep_insert(struct eventpoll *ep, struct epoll_event *event,spin_unlock_irqrestore (&ep->lock, flags); -atomic_inc (&ep->user->epoll_watches); +atomic_long_inc (&ep->user->epoll_watches);/* We have to call this outside the lock */ if (pwake)
@@ -1512,6 +1515,7 @@ static int __init eventpoll_init(void)*/ max_user_watches = (((si.totalram - si.totalhigh) /25 ) <<PAGE_SHIFT ) /EP_ITEM_COST ; +BUG_ON (max_user_watches <0 );/* * Initialize the structure used to perform epoll file descriptor
include/linux/sched.h +1 -1
@@ -672,7 +672,7 @@ struct user_struct {atomic_t inotify_devs;/* How many inotify devs does this user have opened? */ #endif #ifdef CONFIG_EPOLL -atomic_t epoll_watches;/* The number of file descriptors currently watched */ +atomic_long_t epoll_watches;/* The number of file descriptors currently watched */ #endif #ifdef CONFIG_POSIX_MQUEUE /* protected by mq_lock */
Signature · 1 line
1.7.4.4
PATCH 230/247 fs: call security_d_instantiate in d_obtain_alias V2
In reply to Paul GortmakerFrom: Josef Bacik <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 24ff6663ccfdaf088dfa7acae489cb11ed4f43c4 upstream
While trying to track down some NFS problems with BTRFS, I kept noticing I was getting -EACCESS for no apparent reason. Eric Paris and printk() helped me figure out that it was SELinux that was giving me grief, with the following denial
type=AVC msg=audit(1290013638.413:95): avc: denied { 0x800000 } for pid=1772 comm="nfsd" name="" dev=sda1 ino=256 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:unlabeled_t:s0 tclass=file
Turns out this is because in d_obtain_alias if we can't find an alias we create one and do all the normal instantiation stuff, but we don't do the security_d_instantiate.
Usually we are protected from getting a hashed dentry that hasn't yet run security_d_instantiate() by the parent's i_mutex, but obviously this isn't an option there, so in order to deal with the case that a second thread comes in and finds our new dentry before we get to run security_d_instantiate(), we go ahead and call it if we find a dentry already. Eric assures me that this is ok as the code checks to see if the dentry has been initialized already so calling security_d_instantiate() against the same dentry multiple times is ok. With this patch I'm no longer getting errant -EACCESS values.
--- fs/dcache.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
fs/dcache.c +3 -0
@@ -1187,9 +1187,12 @@ struct dentry *d_obtain_alias(struct inode *inode)spin_unlock (&tmp->d_lock);spin_unlock (&dcache_lock); +security_d_instantiate (tmp, inode);return tmp; out_iput: +if (res && !IS_ERR (res)) +security_d_instantiate (res, inode);iput (inode);return res; }
Signature · 1 line
1.7.4.4
PATCH 231/247 dcdbas: force SMI to happen when expected
In reply to Paul GortmakerFrom: Stuart Hayes <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit dd65c736d1b5312c80c88a64bf521db4959eded5 upstream.
The dcdbas driver can do an I/O write to cause a SMI to occur. The SMI handler looks at certain registers and memory locations, so the SMI needs to happen immediately. On some systems I/O writes are posted, though, causing the SMI to happen well after the "outb" occurred, which causes random failures. Following the "outb" with an "inb" forces the write to go through even if it is posted.
--- drivers/firmware/dcdbas.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/firmware/dcdbas.c +3 -1
@@ -268,8 +268,10 @@ int dcdbas_smi_request(struct smi_cmd *smi_cmd) }/* generate SMI */ +/* inb to force posted write through and make SMI happen now */ asm volatile ( - "outb %b0,%w1" + "outb %b0,%w1\n" + "inb %w1" : /* no output args */ : "a" (smi_cmd->command_code), "d" (smi_cmd->command_address),
Signature · 1 line
1.7.4.4
PATCH 232/247 net: ax25: fix information leak to userland
In reply to Paul GortmakerFrom: Vasiliy Kulikov <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit fe10ae53384e48c51996941b7720ee16995cbcb7 upstream.
Sometimes ax25_getname() doesn't initialize all members of fsa_digipeater field of fsa struct, also the struct has padding bytes between sax25_call and sax25_ndigis fields. This structure is then copied to userland. It leads to leaking of contents of kernel stack memory.
--- net/ax25/af_ax25.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/ax25/af_ax25.c +1 -1
@@ -1392,6 +1392,7 @@ static int ax25_getname(struct socket *sock, struct sockaddr *uaddr,ax25_cb *ax25;int err =0 ; +memset (fsa,0 ,sizeof (fsa));lock_sock (sk); ax25 =ax25_sk (sk);
@@ -1403,7 +1404,6 @@ static int ax25_getname(struct socket *sock, struct sockaddr *uaddr, fsa->fsa_ax25.sax25_family =AF_AX25 ; fsa->fsa_ax25.sax25_call = ax25->dest_addr; - fsa->fsa_ax25.sax25_ndigis =0 ;if (ax25->digipeat !=NULL ) { ndigi = ax25->digipeat->ndigi;
Signature · 1 line
1.7.4.4
PATCH 233/247 net: tipc: fix information leak to userland
In reply to Paul GortmakerFrom: Kulikov Vasiliy <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 88f8a5e3e7defccd3925cabb1ee4d3994e5cdb52 upstream.
Structure sockaddr_tipc is copied to userland with padding bytes after "id" field in union field "name" unitialized. It leads to leaking of contents of kernel stack memory. We have to initialize them to zero.
--- net/tipc/socket.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
net/tipc/socket.c +1 -0
@@ -395,6 +395,7 @@ static int get_name(struct socket *sock, struct sockaddr *uaddr,struct sockaddr_tipc *addr = (struct sockaddr_tipc *)uaddr;struct tipc_sock *tsock =tipc_sk (sock->sk); +memset (addr,0 ,sizeof (*addr));if (peer) {if ((sock->state !=SS_CONNECTED ) && ((peer !=2 ) || (sock->state !=SS_DISCONNECTING )))
Signature · 1 line
1.7.4.4
PATCH 234/247 inet_diag: Make sure we actually run the same bytecode we audited.
In reply to Paul GortmakerFrom: Nelson Elhage <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 22e76c849d505d87c5ecf3d3e6742a65f0ff4860 upstream.
We were using nlmsg_find_attr() to look up the bytecode by attribute when auditing, but then just using the first attribute when actually running bytecode. So, if we received a message with two attribute elements, where only the second had type INET_DIAG_REQ_BYTECODE, we would validate and run different bytecode strings.
Fix this by consistently using nlmsg_find_attr everywhere.
--- net/ipv4/inet_diag.c | 27 ++++++++++++++++----------- 1 files changed, 16 insertions(+), 11 deletions(-)
net/ipv4/inet_diag.c +16 -11
@@ -490,9 +490,11 @@ static int inet_csk_diag_dump(struct sock *sk, {struct inet_diag_req *r =NLMSG_DATA (cb->nlh); -if (cb->nlh->nlmsg_len >4 +NLMSG_SPACE (sizeof (*r))) { +if (nlmsg_attrlen (cb->nlh,sizeof (*r))) {struct inet_diag_entry entry; -struct rtattr *bc = (struct rtattr *)(r +1 ); +const struct nlattr *bc =nlmsg_find_attr (cb->nlh, +sizeof (*r), +INET_DIAG_REQ_BYTECODE );struct inet_sock *inet =inet_sk (sk); entry.family = sk->sk_family;
@@ -512,7 +514,7 @@ static int inet_csk_diag_dump(struct sock *sk, entry.dport =ntohs (inet->inet_dport); entry.userlocks = sk->sk_userlocks; -if (!inet_diag_bc_run (RTA_DATA (bc),RTA_PAYLOAD (bc), &entry)) +if (!inet_diag_bc_run (nla_data (bc),nla_len (bc), &entry))return 0 ; }
@@ -527,9 +529,11 @@ static int inet_twsk_diag_dump(struct inet_timewait_sock *tw, {struct inet_diag_req *r =NLMSG_DATA (cb->nlh); -if (cb->nlh->nlmsg_len >4 +NLMSG_SPACE (sizeof (*r))) { +if (nlmsg_attrlen (cb->nlh,sizeof (*r))) {struct inet_diag_entry entry; -struct rtattr *bc = (struct rtattr *)(r +1 ); +const struct nlattr *bc =nlmsg_find_attr (cb->nlh, +sizeof (*r), +INET_DIAG_REQ_BYTECODE ); entry.family = tw->tw_family;#if defined(CONFIG_IPV6 ) || defined (CONFIG_IPV6_MODULE )
@@ -548,7 +552,7 @@ static int inet_twsk_diag_dump(struct inet_timewait_sock *tw, entry.dport =ntohs (tw->tw_dport); entry.userlocks =0 ; -if (!inet_diag_bc_run (RTA_DATA (bc),RTA_PAYLOAD (bc), &entry)) +if (!inet_diag_bc_run (nla_data (bc),nla_len (bc), &entry))return 0 ; }
@@ -618,7 +622,7 @@ static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk,struct inet_diag_req *r =NLMSG_DATA (cb->nlh);struct inet_connection_sock *icsk =inet_csk (sk);struct listen_sock *lopt; -struct rtattr *bc =NULL ; +const struct nlattr *bc =NULL ;struct inet_sock *inet =inet_sk (sk);int j, s_j;int reqnum, s_reqnum;
@@ -638,8 +642,9 @@ static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk,if (!lopt || !lopt->qlen) goto out; -if (cb->nlh->nlmsg_len >4 +NLMSG_SPACE (sizeof (*r))) { - bc = (struct rtattr *)(r +1 ); +if (nlmsg_attrlen (cb->nlh,sizeof (*r))) { + bc =nlmsg_find_attr (cb->nlh,sizeof (*r), +INET_DIAG_REQ_BYTECODE ); entry.sport = inet->inet_num; entry.userlocks = sk->sk_userlocks; }
@@ -672,8 +677,8 @@ static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk, &ireq->rmt_addr; entry.dport =ntohs (ireq->rmt_port); -if (!inet_diag_bc_run (RTA_DATA (bc), -RTA_PAYLOAD (bc), &entry)) +if (!inet_diag_bc_run (nla_data (bc), +nla_len (bc), &entry))continue ; }
Signature · 1 line
1.7.4.4
PATCH 235/247 netlink: Make nlmsg_find_attr take a const nlmsghdr*.
In reply to Paul GortmakerFrom: Nelson Elhage <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 6b8c92ba07287578718335ce409de8e8d7217e40 upstream.
This will let us use it on a nlmsghdr stored inside a netlink_callback.
--- include/net/netlink.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/net/netlink.h +1 -1
@@ -384,7 +384,7 @@ static inline int nlmsg_parse(const struct nlmsghdr *nlh, int hdrlen,* * Returns the first attribute which matches the specified type. */ -static inline struct nlattr *nlmsg_find_attr (struct nlmsghdr *nlh, +static inline struct nlattr *nlmsg_find_attr (const struct nlmsghdr *nlh,int hdrlen,int attrtype) { return nla_find(nlmsg_attrdata(nlh, hdrlen),
Signature · 1 line
1.7.4.4
PATCH 236/247 irda: prevent integer underflow in IRLMP_ENUMDEVICES
In reply to Paul GortmakerFrom: Dan Rosenberg <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit fdac1e0697356ac212259f2147aa60c72e334861 upstream.
If the user-provided len is less than the expected offset, the IRLMP_ENUMDEVICES getsockopt will do a copy_to_user() with a very large size value. While this isn't be a security issue on x86 because it will get caught by the access_ok() check, it may leak large amounts of kernel heap on other architectures. In any event, this patch fixes it.
--- net/irda/af_irda.c | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-)
net/irda/af_irda.c +9 -7
@@ -2278,6 +2278,14 @@ static int __irda_getsockopt(struct socket *sock, int level, int optname,switch (optname) {case IRLMP_ENUMDEVICES : + +/* Offset to first device entry */ + offset =sizeof (struct irda_device_list ) - +sizeof (struct irda_device_info ); + +if (len < offset) +return -EINVAL ; +/* Ask lmp for the current discovery log */ discoveries =irlmp_get_discoveries (&list.len, self->mask.word, self->nslots);
@@ -2287,15 +2295,9 @@ static int __irda_getsockopt(struct socket *sock, int level, int optname, err =0 ;/* Write total list length back to client */ -if (copy_to_user (optval, &list, -sizeof (struct irda_device_list ) - -sizeof (struct irda_device_info ))) +if (copy_to_user (optval, &list, offset)) err = -EFAULT ; -/* Offset to first device entry */ - offset =sizeof (struct irda_device_list ) - -sizeof (struct irda_device_info ); -/* Copy the list itself - watch for overflow */ if (list.len >2048 ) {
Signature · 1 line
1.7.4.4
PATCH 237/247 CAN: Use inode instead of kernel address for /proc file
In reply to Paul GortmakerFrom: Dan Rosenberg <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 9f260e0efa4766e56d0ac14f1aeea6ee5eb8fe83 upstream.
Since the socket address is just being used as a unique identifier, its inode number is an alternative that does not leak potentially sensitive information.
CC-ing stable because MITRE has assigned CVE-2010-4565 to the issue.
--- net/can/bcm.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
net/can/bcm.c +2 -2
@@ -125,7 +125,7 @@ struct bcm_sock {struct list_head tx_ops;unsigned long dropped_usr_msgs;struct proc_dir_entry *bcm_proc_read; -char procname [20 ];/* pointer printed in ASCII with \0 */ +char procname [32 ];/* inode number in decimal with \0 */ };static inline struct bcm_sock *bcm_sk (const struct sock *sk)
@@ -1523,7 +1523,7 @@ static int bcm_connect(struct socket *sock, struct sockaddr *uaddr, int len,if (proc_dir) {/* unique socket address as filename */ -sprintf (bo->procname,"%p" , sock); +sprintf (bo->procname,"%lu" ,sock_i_ino (sk)); bo->bcm_proc_read =proc_create_data (bo->procname,0644 , proc_dir, &bcm_proc_fops, sk);
Signature · 1 line
1.7.4.4
PATCH 238/247 xfs: prevent leaking uninitialized stack memory in FSGEOMETRY_V1
In reply to Paul GortmakerFrom: Dan Rosenberg <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 3a3675b7f23f83ca8c67c9c2b6edf707fd28d1ba upstream.
The FSGEOMETRY_V1 ioctl (and its compat equivalent) calls out to xfs_fs_geometry() with a version number of 3. This code path does not fill in the logsunit member of the passed xfs_fsop_geom_t, leading to the leaking of four bytes of uninitialized stack data to potentially unprivileged callers.
v2 switches to memset() to avoid future issues if structure members change, on suggestion of Dave Chinner.
--- fs/xfs/xfs_fsops.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
fs/xfs/xfs_fsops.c +3 -0
@@ -57,6 +57,9 @@ xfs_fs_geometry(xfs_fsop_geom_t *geo, int new_version) { + + memset(geo, 0, sizeof(*geo)); + geo->blocksize = mp->m_sb.sb_blocksize; geo->rtextsize = mp->m_sb.sb_rextsize; geo->agblocks = mp->m_sb.sb_agblocks;
Signature · 1 line
1.7.4.4
Re: [34-longterm 238/247] xfs: prevent leaking uninitialized stack memory in FSGEOMETRY_V1
Quoted 42 lines · Paul Gortmaker
From: Dan Rosenberg <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------commit
3a3675b7f23f83ca8c67c9c2b6edf707fd28d1baupstream.The
FSGEOMETRY_V1ioctl (and its compat equivalent) calls out toxfs_fs_geometry()with a version number of 3. This code path does not fill in the logsunit member of the passedxfs_fsop_geom_t, leading to the leaking of four bytes of uninitialized stack data to potentially unprivileged callers.v2 switches to
memset()to avoid future issues if structure members change, on suggestion of Dave Chinner.Signed-off-by Dan Rosenberg <[email protected]>Reviewed-by Eugene Teo <[email protected]>Signed-off-by Alex Elder <[email protected]>Signed-off-by Paul Gortmaker <[email protected]>--- fs/xfs/xfs_fsops.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)fs/xfs/xfs_fsops.c +3
-0@@ -57,6 +57,9 @@ xfs_fs_geometry(xfs_fsop_geom_t *geo, int new_version) { + + memset(geo, 0, sizeof(*geo)); + geo->blocksize = mp->m_sb.sb_blocksize; geo->rtextsize = mp->m_sb.sb_rextsize; geo->agblocks = mp->m_sb.sb_agblocks;Signature · 1 line
1.7.4.4
This introduced a regression which was fixed by commit af24ee9ea8d532e16883251a6684dfa1be8eec29.
-Dan
Re: [34-longterm 238/247] xfs: prevent leaking uninitialized stack memory in FSGEOMETRY_V1
Quoted 38 lines · Dan Rosenberg
Quoted 37 lines · Paul Gortmaker
From: Dan Rosenberg <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------commit
3a3675b7f23f83ca8c67c9c2b6edf707fd28d1baupstream.The
FSGEOMETRY_V1ioctl (and its compat equivalent) calls out toxfs_fs_geometry()with a version number of 3. This code path does not fill in the logsunit member of the passedxfs_fsop_geom_t, leading to the leaking of four bytes of uninitialized stack data to potentially unprivileged callers.v2 switches to
memset()to avoid future issues if structure members change, on suggestion of Dave Chinner.Signed-off-by Dan Rosenberg <[email protected]>Reviewed-by Eugene Teo <[email protected]>Signed-off-by Alex Elder <[email protected]>Signed-off-by Paul Gortmaker <[email protected]>---
fs/xfs/xfs_fsops.c | 3 +++1 files changed, 3 insertions(+), 0 deletions(-)fs/xfs/xfs_fsops.c +3
-0@@ -57,6 +57,9 @@ xfs_fs_geometry( xfs_fsop_geom_t *geo, int new_version) { + + memset(geo, 0, sizeof(*geo)); +
Quoted 8 lines
Quoted 5 lines
fs/xfs/xfs_fsops.c +0
-1geo->blocksize = mp->m_sb.sb_blocksize; geo->rtextsize = mp->m_sb.sb_rextsize; geo->agblocks = mp->m_sb.sb_agblocks; --1.7.4.4
This introduced a regression which was fixed by commit
af24ee9ea8d532e16883251a6684dfa1be8eec29.
Thanks Dan,
Fix queued and will appear shortly here.
http://git.kernel.org/?p=linux/kernel/git/longterm/longterm-queue-2.6.34.git;a=summary
Paul.
Quoted 9 lines
-Dan
--
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 239/247 Bluetooth: sco: fix information leak to userspace
In reply to Paul GortmakerFrom: Vasiliy Kulikov <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit c4c896e1471aec3b004a693c689f60be3b17ac86 upstream.
struct sco_conninfo has one padding byte in the end. Local variable cinfo of type sco_conninfo is copied to userspace with this uninizialized one byte, leading to old stack contents leak.
--- net/bluetooth/sco.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
net/bluetooth/sco.c +1 -0
@@ -704,6 +704,7 @@ static int sco_sock_getsockopt_old(struct socket *sock, int optname, char __userbreak ; } +memset (&cinfo,0 ,sizeof (cinfo)); cinfo.hci_handle =sco_pi (sk)->conn->hcon->handle;memcpy (cinfo.dev_class,sco_pi (sk)->conn->hcon->dev_class,3 );
Signature · 1 line
1.7.4.4
PATCH 240/247 Bluetooth: bnep: fix buffer overflow
In reply to Paul GortmakerFrom: Vasiliy Kulikov <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 43629f8f5ea32a998d06d1bb41eefa0e821ff573 upstream.
Struct ca is copied from userspace. It is not checked whether the "device" field is NULL terminated. This potentially leads to BUG() inside of alloc_netdev_mqs() and/or information leak by creating a device with a name made of contents of kernel stack.
--- net/bluetooth/bnep/sock.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
net/bluetooth/bnep/sock.c +1 -0
@@ -88,6 +88,7 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned longsockfd_put (nsock);return -EBADFD ; } + ca.device[sizeof (ca.device)-1 ] =0 ; err =bnep_add_connection (&ca, nsock);if (!err) {
Signature · 1 line
1.7.4.4
PATCH 241/247 bridge: netfilter: fix information leak
In reply to Paul GortmakerFrom: Vasiliy Kulikov <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit d846f71195d57b0bbb143382647c2c6638b04c5a upstream.
Struct tmp is copied from userspace. It is not checked whether the "name" field is NULL terminated. This may lead to buffer overflow and passing contents of kernel stack as a module name to try_then_request_module() and, consequently, to modprobe commandline. It would be seen by all userspace processes.
--- net/bridge/netfilter/ebtables.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
net/bridge/netfilter/ebtables.c +2 -0
@@ -1112,6 +1112,8 @@ static int do_replace(struct net *net, const void __user *user,if (tmp.num_counters >=INT_MAX /sizeof (struct ebt_counter ))return -ENOMEM ; + tmp.name[sizeof (tmp.name) -1 ] =0 ; + countersize =COUNTER_OFFSET (tmp.nentries) * nr_cpu_ids; newinfo =vmalloc (sizeof (*newinfo) + countersize);if (!newinfo)
Signature · 1 line
1.7.4.4
PATCH 242/247 netfilter: arp_tables: fix infoleak to userspace
In reply to Paul GortmakerFrom: Vasiliy Kulikov <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 42eab94fff18cb1091d3501cd284d6bd6cc9c143 upstream.
Structures ipt_replace, compat_ipt_replace, and xt_get_revision are copied from userspace. Fields of these structs that are zero-terminated strings are not checked. When they are used as argument to a format string containing "%s" in request_module(), some sensitive information is leaked to userspace via argument of spawned modprobe process.
The first bug was introduced before the git epoch; the second is introduced by 6b7d31fc (v2.6.15-rc1); the third is introduced by 6b7d31fc (v2.6.15-rc1). To trigger the bug one should have CAP_NET_ADMIN.
--- net/ipv4/netfilter/arp_tables.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
net/ipv4/netfilter/arp_tables.c +3 -0
@@ -1085,6 +1085,7 @@ static int do_replace(struct net *net, const void __user *user,/* overflow check */ if (tmp.num_counters >=INT_MAX /sizeof (struct xt_counters ))return -ENOMEM ; + tmp.name[sizeof (tmp.name)-1 ] =0 ; newinfo =xt_alloc_table_info (tmp.size);if (!newinfo)
@@ -1505,6 +1506,7 @@ static int compat_do_replace(struct net *net, void __user *user,return -ENOMEM ;if (tmp.num_counters >=INT_MAX /sizeof (struct xt_counters ))return -ENOMEM ; + tmp.name[sizeof (tmp.name)-1 ] =0 ; newinfo =xt_alloc_table_info (tmp.size);if (!newinfo)
@@ -1757,6 +1759,7 @@ static int do_arpt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len ret = -EFAULT ;break ; } + rev.name[sizeof (rev.name)-1 ] =0 ; try_then_request_module(xt_find_revision(NFPROTO_ARP, rev.name, rev.revision, 1, &ret),
Signature · 1 line
1.7.4.4
PATCH 243/247 netfilter: ip_tables: fix infoleak to userspace
In reply to Paul GortmakerFrom: Vasiliy Kulikov <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 78b79876761b86653df89c48a7010b5cbd41a84a upstream.
Structures ipt_replace, compat_ipt_replace, and xt_get_revision are copied from userspace. Fields of these structs that are zero-terminated strings are not checked. When they are used as argument to a format string containing "%s" in request_module(), some sensitive information is leaked to userspace via argument of spawned modprobe process.
The first and the third bugs were introduced before the git epoch; the second was introduced in 2722971c (v2.6.17-rc1). To trigger the bug one should have CAP_NET_ADMIN.
--- net/ipv4/netfilter/ip_tables.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
net/ipv4/netfilter/ip_tables.c +3 -0
@@ -1294,6 +1294,7 @@ do_replace(struct net *net, const void __user *user, unsigned int len)/* overflow check */ if (tmp.num_counters >=INT_MAX /sizeof (struct xt_counters ))return -ENOMEM ; + tmp.name[sizeof (tmp.name)-1 ] =0 ; newinfo =xt_alloc_table_info (tmp.size);if (!newinfo)
@@ -1838,6 +1839,7 @@ compat_do_replace(struct net *net, void __user *user, unsigned int len)return -ENOMEM ;if (tmp.num_counters >=INT_MAX /sizeof (struct xt_counters ))return -ENOMEM ; + tmp.name[sizeof (tmp.name)-1 ] =0 ; newinfo =xt_alloc_table_info (tmp.size);if (!newinfo)
@@ -2067,6 +2069,7 @@ do_ipt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len) ret = -EFAULT ;break ; } + rev.name[sizeof (rev.name)-1 ] =0 ;if (cmd ==IPT_SO_GET_REVISION_TARGET ) target =1 ;
Signature · 1 line
1.7.4.4
PATCH 244/247 ipv6: netfilter: ip6_tables: fix infoleak to userspace
In reply to Paul GortmakerFrom: Vasiliy Kulikov <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 6a8ab060779779de8aea92ce3337ca348f973f54 upstream.
Structures ip6t_replace, compat_ip6t_replace, and xt_get_revision are copied from userspace. Fields of these structs that are zero-terminated strings are not checked. When they are used as argument to a format string containing "%s" in request_module(), some sensitive information is leaked to userspace via argument of spawned modprobe process.
The first bug was introduced before the git epoch; the second was introduced in 3bc3fe5e (v2.6.25-rc1); the third is introduced by 6b7d31fc (v2.6.15-rc1). To trigger the bug one should have CAP_NET_ADMIN.
--- net/ipv6/netfilter/ip6_tables.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
net/ipv6/netfilter/ip6_tables.c +3 -0
@@ -1325,6 +1325,7 @@ do_replace(struct net *net, const void __user *user, unsigned int len)/* overflow check */ if (tmp.num_counters >=INT_MAX /sizeof (struct xt_counters ))return -ENOMEM ; + tmp.name[sizeof (tmp.name)-1 ] =0 ; newinfo =xt_alloc_table_info (tmp.size);if (!newinfo)
@@ -1871,6 +1872,7 @@ compat_do_replace(struct net *net, void __user *user, unsigned int len)return -ENOMEM ;if (tmp.num_counters >=INT_MAX /sizeof (struct xt_counters ))return -ENOMEM ; + tmp.name[sizeof (tmp.name)-1 ] =0 ; newinfo =xt_alloc_table_info (tmp.size);if (!newinfo)
@@ -2100,6 +2102,7 @@ do_ip6t_get_ctl(struct sock *sk, int cmd, void __user *user, int *len) ret = -EFAULT ;break ; } + rev.name[sizeof (rev.name)-1 ] =0 ;if (cmd ==IP6T_SO_GET_REVISION_TARGET ) target =1 ;
Signature · 1 line
1.7.4.4
PATCH 245/247 econet: 4 byte infoleak to the network
In reply to Paul GortmakerFrom: Vasiliy Kulikov <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 67c5c6cb8129c595f21e88254a3fc6b3b841ae8e upstream.
struct aunhdr has 4 padding bytes between 'pad' and 'handle' fields on x86_64. These bytes are not initialized in the variable 'ah' before sending 'ah' to the network. This leads to 4 bytes kernel stack infoleak.
This bug was introduced before the git epoch.
--- net/econet/af_econet.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/econet/af_econet.c +1 -1
@@ -435,10 +435,10 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, udpdest.sin_addr.s_addr =htonl (network | addr.station); } +memset (&ah,0 ,sizeof (ah)); ah.port = port; ah.cb = cb &0x7f ; ah.code =2 ;/* magic */ - ah.pad =0 ;/* tack our header on the front of the iovec */ size =sizeof (struct aunhdr );
Signature · 1 line
1.7.4.4
PATCH 246/247 net: fix rds_iovec page count overflow
In reply to Paul GortmakerFrom: Linus Torvalds <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit 1b1f693d7ad6d193862dcb1118540a030c5e761f upstream.
As reported by Thomas Pollet, the rdma page counting can overflow. We get the rdma sizes in 64-bit unsigned entities, but then limit it to UINT_MAX bytes and shift them down to pages (so with a possible "+1" for an unaligned address).
So each individual page count fits comfortably in an 'unsigned int' (not even close to overflowing into signed), but as they are added up, they might end up resulting in a signed return value. Which would be wrong.
Catch the case of tot_pages turning negative, and return the appropriate error code.
[PG: In 34, var names are slightly different, 1b1f6's tot_pages is
34's nr_pages, and 1b1f6's nr_pages is 34's nr; so map accordingly.]
--- net/rds/rdma.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
net/rds/rdma.c +9 -0
@@ -498,6 +498,15 @@ static struct rds_rdma_op *rds_rdma_prepare(struct rds_sock *rs, max_pages =max (nr, max_pages); nr_pages += nr; + +/* +* nr for one entry is limited to (UINT_MAX>>PAGE_SHIFT)+1, +* so nr_pages cannot overflow without first going negative. +*/ +if ((int )nr_pages <0 ) { + ret = -EINVAL ; + goto out; + } } pages =kcalloc (max_pages,sizeof (struct page *),GFP_KERNEL );
Signature · 1 line
1.7.4.4
PATCH 247/247 MIPS: secure_computing, syscall audit: syscall number should in r2, not r0.
In reply to Paul GortmakerFrom: Al Viro <[email protected]>
-------------------
This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment.
-------------------
commit e5b377a8fb7b05f27647698ac739a0504cb2bf80 upstream.
As it is, audit_syscall_entry() and secure_computing() get the bogus value (0, in fact)
Patchwork: https://patchwork.linux-mips.org/patch/1697/
--- arch/mips/kernel/ptrace.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/mips/kernel/ptrace.c +2 -2
@@ -536,7 +536,7 @@ asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit) {/* do the secure computing check first */ if (!entryexit) -secure_computing (regs->regs[0 ]); +secure_computing (regs->regs[2 ]);if (unlikely (current->audit_context) && entryexit) audit_syscall_exit(AUDITSC_RESULT(regs->regs[2]),
@@ -565,7 +565,7 @@ asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit) out:if (unlikely (current->audit_context) && !entryexit) -audit_syscall_entry (audit_arch (), regs->regs[0 ], +audit_syscall_entry (audit_arch (), regs->regs[2 ], regs->regs[4 ], regs->regs[5 ], regs->regs[6 ], regs->regs[7 ]); }
Signature · 1 line
1.7.4.4