3.4.5-stable review
Subsystems (109)
Greg Kroah-Hartman
maintainerPATCH 168/187 ath9k: fix panic caused by returning a descriptor we have queued for reuse
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tom Hughes <[email protected]>
commit 6bb51c70cabaadddc54a6454844eceba91a56083 upstream.
Commit 3a2923e83c introduced a bug when a corrupt descriptor is encountered - although the following descriptor is discarded and returned to the queue for reuse the associated frame is also returned for processing. This leads to a panic:
BUG: unable to handle kernel NULL pointer dereference at 000000000000003a IP: [<ffffffffa02599a5>] ath_rx_tasklet+0x165/0x1b00 [ath9k] Call Trace: <IRQ> [<ffffffff812d7fa0>] ? map_single+0x60/0x60 [<ffffffffa028f044>] ? ath9k_ioread32+0x34/0x90 [ath9k] [<ffffffffa0292eec>] athk9k_tasklet+0xdc/0x160 [ath9k] [<ffffffff8105e133>] tasklet_action+0x63/0xd0 [<ffffffff8105dbc0>] __do_softirq+0xc0/0x1e0 [<ffffffff8101a873>] ? native_sched_clock+0x13/0x80 [<ffffffff815f9d5c>] call_softirq+0x1c/0x30 [<ffffffff810151f5>] do_softirq+0x75/0xb0 [<ffffffff8105df95>] irq_exit+0xb5/0xc0 [<ffffffff815fa5b3>] do_IRQ+0x63/0xe0 [<ffffffff815f0cea>] common_interrupt+0x6a/0x6a <EOI> [<ffffffff8131840a>] ? intel_idle+0xea/0x150 [<ffffffff813183eb>] ? intel_idle+0xcb/0x150 [<ffffffff814a1db9>] cpuidle_enter+0x19/0x20 [<ffffffff814a23d9>] cpuidle_idle_call+0xa9/0x240 [<ffffffff8101c4bf>] cpu_idle+0xaf/0x120 [<ffffffff815cda8e>] rest_init+0x72/0x74 [<ffffffff81cf4c1a>] start_kernel+0x3b7/0x3c4 [<ffffffff81cf4662>] ? repair_env_string+0x5e/0x5e [<ffffffff81cf4346>] x86_64_start_reservations+0x131/0x135 [<ffffffff81cf444a>] x86_64_start_kernel+0x100/0x10f
Making sure bf is cleared to NULL in this case restores the old behaviour.
--- drivers/net/wireless/ath/ath9k/recv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/recv.c +2 -2
@@ -695,9 +695,9 @@ static bool ath_edma_get_buffers(struct__skb_unlink (skb, &rx_edma->rx_fifo);list_add_tail (&bf->list, &sc->rx.rxbuf);ath_rx_edma_buf_link (sc, qtype); - }else { - bf =NULL ; } + + bf =NULL ; } *dest = bf;
Greg Kroah-Hartman
maintainerPATCH 169/187 mm: pmd_read_atomic: fix 32bit PAE pmd walk vs pmd_populate SMP race condition
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Arcangeli <[email protected]>
commit 26c191788f18129af0eb32a358cdaea0c7479626 upstream.
When holding the mmap_sem for reading, pmd_offset_map_lock should only run on a pmd_t that has been read atomically from the pmdp pointer, otherwise we may read only half of it leading to this crash.
PID: 11679 TASK: f06e8000 CPU: 3 COMMAND: "do_race_2_panic"
#0 [f06a9dd8] crash_kexec at c049b5ec
#1 [f06a9e2c] oops_end at c083d1c2
#2 [f06a9e40] no_context at c0433ded
#3 [f06a9e64] bad_area_nosemaphore at c043401a #4 [f06a9e6c] __do_page_fault at c0434493
#5 [f06a9eec] do_page_fault at c083eb45
#6 [f06a9f04] error_code (via page_fault) at c083c5d5
EAX: 01fb470c EBX: fff35000 ECX: 00000003 EDX: 00000100 EBP:
00000000
DS: 007b ESI: 9e201000 ES: 007b EDI: 01fb4700 GS: 00e0
CS: 0060 EIP: c083bc14 ERR: ffffffff EFLAGS: 00010246
#7 [f06a9f38] _spin_lock at c083bc14
#8 [f06a9f44] sys_mincore at c0507b7d
#9 [f06a9fb0] system_call at c083becd
start len
EAX: ffffffda EBX: 9e200000 ECX: 00001000 EDX: 6228537f
DS: 007b ESI: 00000000 ES: 007b EDI: 003d0f00
SS: 007b ESP: 62285354 EBP: 62285388 GS: 0033
CS: 0073 EIP: 00291416 ERR: 000000da EFLAGS: 00000286This should be a longstanding bug affecting x86 32bit PAE without THP. Only archs with 64bit large pmd_t and 32bit unsigned long should be affected.
With THP enabled the barrier() in pmd_none_or_trans_huge_or_clear_bad() would partly hide the bug when the pmd transition from none to stable, by forcing a re-read of the *pmd in pmd_offset_map_lock, but when THP is enabled a new set of problem arises by the fact could then transition freely in any of the none, pmd_trans_huge or pmd_trans_stable states. So making the barrier in pmd_none_or_trans_huge_or_clear_bad() unconditional isn't good idea and it would be a flakey solution.
This should be fully fixed by introducing a pmd_read_atomic that reads the pmd in order with THP disabled, or by reading the pmd atomically with cmpxchg8b with THP enabled.
Luckily this new race condition only triggers in the places that must already be covered by pmd_none_or_trans_huge_or_clear_bad() so the fix is localized there but this bug is not related to THP.
NOTE: this can trigger on x86 32bit systems with PAE enabled with more than 4G of ram, otherwise the high part of the pmd will never risk to be truncated because it would be zero at all times, in turn so hiding the SMP race.
This bug was discovered and fully debugged by Ulrich, quote:
----
[..]pmd_none_or_trans_huge_or_clear_bad() loads the content of edx and eax.
496 static inline int pmd_none_or_trans_huge_or_clear_bad(pmd_t
*pmd)
497 {
498 /* depend on compiler for an atomic pmd read */
499 pmd_t pmdval = *pmd;
// edi = pmd pointer
0xc0507a74 <sys_mincore+548>: mov 0x8(%esp),%edi
...
// edx = PTE page table high address
0xc0507a84 <sys_mincore+564>: mov 0x4(%edi),%edx
...
// eax = PTE page table low address0xc0507a8e <sys_mincore+574>: mov (%edi),%eax
[..]
Please note that the PMD is not read atomically. These are two "mov" instructions where the high order bits of the PMD entry are fetched first. Hence, the above machine code is prone to the following race.
- The PMD entry {high|low} is 0x0000000000000000. The "mov" at 0xc0507a84 loads 0x00000000 into edx.
- A page fault (on another CPU) sneaks in between the two "mov" instructions and instantiates the PMD.
- The PMD entry {high|low} is now 0x00000003fda38067. The "mov" at 0xc0507a8e loads 0xfda38067 into eax.
----
--- arch/x86/include/asm/pgtable-3level.h | 50 ++++++++++++++++++++++++++++++++++ include/asm-generic/pgtable.h | 22 +++++++++++++- 2 files changed, 70 insertions(+), 2 deletions(-)
arch/x86/include/asm/pgtable-3level.h +50 -0
@@ -31,6 +31,56 @@ static inline void native_set_pte(pte_t ptep->pte_low = pte.pte_low; } +#define pmd_read_atomic pmd_read_atomic +/* +* pte_offset_map_lock on 32bit PAE kernels was reading the pmd_t with +* a "*pmdp" dereference done by gcc. Problem is, in certain places +* where pte_offset_map_lock is called, concurrent page faults are +* allowed, if the mmap_sem is hold for reading. An example is mincore +* vs page faults vs MADV_DONTNEED. On the page fault side +* pmd_populate rightfully does a set_64bit, but if we're reading the +* pmd_t with a "*pmdp" on the mincore side, a SMP race can happen +* because gcc will not read the 64bit of the pmd atomically. To fix +* this all places running pmd_offset_map_lock() while holding the +* mmap_sem in read mode, shall read the pmdp pointer using this +* function to know if the pmd is null nor not, and in turn to know if +* they can run pmd_offset_map_lock or pmd_trans_huge or other pmd +* operations. +* +* Without THP if the mmap_sem is hold for reading, the +* pmd can only transition from null to not null while pmd_read_atomic runs. +* So there's no need of literally reading it atomically. +* +* With THP if the mmap_sem is hold for reading, the pmd can become +* THP or null or point to a pte (and in turn become "stable") at any +* time under pmd_read_atomic, so it's mandatory to read it atomically +* with cmpxchg8b. +*/ +#ifndef CONFIG_TRANSPARENT_HUGEPAGE +static inline pmd_t pmd_read_atomic (pmd_t *pmdp) +{ +pmdval_t ret; +u32 *tmp = (u32 *)pmdp; + + ret = (pmdval_t) (*tmp); +if (ret) { +/* +* If the low part is null, we must not read the high part +* or we can end up with a partial pmd. +*/ +smp_rmb (); + ret |= ((pmdval_t)*(tmp +1 )) <<32 ; + } + +return (pmd_t ) { ret }; +} +#else /* CONFIG_TRANSPARENT_HUGEPAGE */ +static inline pmd_t pmd_read_atomic (pmd_t *pmdp) +{ +return (pmd_t ) {atomic64_read ((atomic64_t *)pmdp) }; +} +#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ +static inline void native_set_pte_atomic (pte_t *ptep,pte_t pte) {set_64bit ((unsigned long long *)(ptep),native_pte_val (pte));
include/asm-generic/pgtable.h +20 -2
@@ -446,6 +446,18 @@ static inline int pmd_write(pmd_t pmd)#endif /* __HAVE_ARCH_PMD_WRITE */ #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ +#ifndef pmd_read_atomic +static inline pmd_t pmd_read_atomic (pmd_t *pmdp) +{ +/* +* Depend on compiler for an atomic pmd read. NOTE: this is +* only going to work, if the pmdval_t isn't larger than +* an unsigned long. +*/ +return *pmdp; +} +#endif +/* * This function is meant to be used by sites walking pagetables with * the mmap_sem hold in read mode to protect against MADV_DONTNEED and
@@ -459,11 +471,17 @@ static inline int pmd_write(pmd_t pmd)* undefined so behaving like if the pmd was none is safe (because it * can return none anyway). The compiler level barrier() is critically * important to compute the two checks atomically on the same pmdval. +* +* For 32bit kernels with a 64bit large pmd_t this automatically takes +* care of reading the pmd atomically to avoid SMP race conditions +* against pmd_populate() when the mmap_sem is hold for reading by the +* caller (a special atomic read not done by "gcc" as in the generic +* version above, is also needed when THP is disabled because the page +* fault can populate the pmd from under us). */ static inline int pmd_none_or_trans_huge_or_clear_bad (pmd_t *pmd) { -/* depend on compiler for an atomic pmd read */ -pmd_t pmdval = *pmd; +pmd_t pmdval =pmd_read_atomic (pmd);/* * The barrier will stabilize the pmdval in a register or on * the stack so that it will stop changing under the code.
Greg Kroah-Hartman
maintainerPATCH 170/187 thp: avoid atomic64_read in pmd_read_atomic for 32bit PAE
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Arcangeli <[email protected]>
commit e4eed03fd06578571c01d4f1478c874bb432c815 upstream.
In the x86 32bit PAE CONFIG_TRANSPARENT_HUGEPAGE=y case while holding the mmap_sem for reading, cmpxchg8b cannot be used to read pmd contents under Xen.
So instead of dealing only with "consistent" pmdvals in pmd_none_or_trans_huge_or_clear_bad() (which would be conceptually simpler) we let pmd_none_or_trans_huge_or_clear_bad() deal with pmdvals where the low 32bit and high 32bit could be inconsistent (to avoid having to use cmpxchg8b).
The only guarantee we get from pmd_read_atomic is that if the low part of the pmd was found null, the high part will be null too (so the pmd will be considered unstable). And if the low part of the pmd is found "stable" later, then it means the whole pmd was read atomically (because after a pmd is stable, neither MADV_DONTNEED nor page faults can alter it anymore, and we read the high part after the low part).
In the 32bit PAE x86 case, it is enough to read the low part of the pmdval atomically to declare the pmd as "stable" and that's true for THP and no THP, furthermore in the THP case we also have a barrier() that will prevent any inconsistent pmdvals to be cached by a later re-read of the *pmd.
--- arch/x86/include/asm/pgtable-3level.h | 30 +++++++++++++++++------------- include/asm-generic/pgtable.h | 10 ++++++++++ 2 files changed, 27 insertions(+), 13 deletions(-)
arch/x86/include/asm/pgtable-3level.h +17 -13
@@ -47,16 +47,26 @@ static inline void native_set_pte(pte_t* they can run pmd_offset_map_lock or pmd_trans_huge or other pmd * operations. * -* Without THP if the mmap_sem is hold for reading, the -* pmd can only transition from null to not null while pmd_read_atomic runs. -* So there's no need of literally reading it atomically. +* Without THP if the mmap_sem is hold for reading, the pmd can only +* transition from null to not null while pmd_read_atomic runs. So +* we can always return atomic pmd values with this function. * * With THP if the mmap_sem is hold for reading, the pmd can become -* THP or null or point to a pte (and in turn become "stable") at any -* time under pmd_read_atomic, so it's mandatory to read it atomically -* with cmpxchg8b. +* trans_huge or none or point to a pte (and in turn become "stable") +* at any time under pmd_read_atomic. We could read it really +* atomically here with a atomic64_read for the THP enabled case (and +* it would be a whole lot simpler), but to avoid using cmpxchg8b we +* only return an atomic pmdval if the low part of the pmdval is later +* found stable (i.e. pointing to a pte). And we're returning a none +* pmdval if the low part of the pmd is none. In some cases the high +* and low part of the pmdval returned may not be consistent if THP is +* enabled (the low part may point to previously mapped hugepage, +* while the high part may point to a more recently mapped hugepage), +* but pmd_none_or_trans_huge_or_clear_bad() only needs the low part +* of the pmd to be read atomically to decide if the pmd is unstable +* or not, with the only exception of when the low part of the pmd is +* zero in which case we return a none pmd. */ -#ifndef CONFIG_TRANSPARENT_HUGEPAGE static inline pmd_t pmd_read_atomic (pmd_t *pmdp) {pmdval_t ret;
@@ -74,12 +84,6 @@ static inline pmd_t pmd_read_atomic(pmd_return (pmd_t ) { ret }; } -#else /* CONFIG_TRANSPARENT_HUGEPAGE */ -static inline pmd_t pmd_read_atomic (pmd_t *pmdp) -{ -return (pmd_t ) {atomic64_read ((atomic64_t *)pmdp) }; -} -#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ static inline void native_set_pte_atomic (pte_t *ptep,pte_t pte) {
include/asm-generic/pgtable.h +10 -0
@@ -485,6 +485,16 @@ static inline int pmd_none_or_trans_huge/* * The barrier will stabilize the pmdval in a register or on * the stack so that it will stop changing under the code. +* +* When CONFIG_TRANSPARENT_HUGEPAGE=y on x86 32bit PAE, +* pmd_read_atomic is allowed to return a not atomic pmdval +* (for example pointing to an hugepage that has never been +* mapped in the pmd). The below checks will only care about +* the low part of the pmd with 32bit PAE x86 anyway, with the +* exception of pmd_none(). So the important thing is that if +* the low part of the pmd is found null, the high part will +* be also null or the pmd_none() check below would be +* confused. */ #ifdef CONFIG_TRANSPARENT_HUGEPAGE barrier ();
Greg Kroah-Hartman
maintainerPATCH 171/187 rtl8187: ->brightness_set can not sleep
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislaw Gruszka <[email protected]>
commit 0fde0a8cfd0ede7f310d6a681c8e5a7cb3e32406 upstream.
Fix:
BUG: sleeping function called from invalid context at kernel/workqueue.c:2547
in_atomic(): 1, irqs_disabled(): 0, pid: 629, name: wpa_supplicant
2 locks held by wpa_supplicant/629:
#0: (rtnl_mutex){+.+.+.}, at: [<c08b2b84>] rtnl_lock+0x14/0x20
#1: (&trigger->leddev_list_lock){.+.?..}, at: [<c0867f41>] led_trigger_event+0x21/0x80
Pid: 629, comm: wpa_supplicant Not tainted 3.3.0-0.rc3.git5.1.fc17.i686
Call Trace: [<c046a9f6>] __might_sleep+0x126/0x1d0 [<c0457d6c>] wait_on_work+0x2c/0x1d0 [<c045a09a>] __cancel_work_timer+0x6a/0x120 [<c045a160>] cancel_delayed_work_sync+0x10/0x20 [<f7dd3c22>] rtl8187_led_brightness_set+0x82/0xf0 [rtl8187] [<c0867f7c>] led_trigger_event+0x5c/0x80 [<f7ff5e6d>] ieee80211_led_radio+0x1d/0x40 [mac80211] [<f7ff3583>] ieee80211_stop_device+0x13/0x230 [mac80211]
Removing _sync is ok, because if led_on work is currently running it will be finished before led_off work start to perform, since they are always queued on the same mac80211 local->workqueue.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=795176
--- drivers/net/wireless/rtl818x/rtl8187/leds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/rtl818x/rtl8187/leds.c +1 -1
@@ -117,7 +117,7 @@ static void rtl8187_led_brightness_set(s radio_on = true; }else if (radio_on) { radio_on = false; -cancel_delayed_work_sync (&priv->led_on); +cancel_delayed_work (&priv->led_on);ieee80211_queue_delayed_work (hw, &priv->led_off,0 ); } }else if (radio_on) {
Greg Kroah-Hartman
maintainerPATCH 172/187 macvtap: zerocopy: validate vectors before building skb
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Wang <[email protected]>
commit b92946e2919134ebe2a4083e4302236295ea2a73 upstream.
There're several reasons that the vectors need to be validated:
- Return error when caller provides vectors whose num is greater than UIO_MAXIOV.
- Linearize part of skb when userspace provides vectors grater than MAX_SKB_FRAGS.
- Return error when userspace provides vectors whose total length may exceed
- MAX_SKB_FRAGS * PAGE_SIZE.
--- drivers/net/macvtap.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-)
drivers/net/macvtap.c +21 -4
@@ -528,9 +528,10 @@ static int zerocopy_sg_from_iovec(struct } base = (unsigned long )from->iov_base + offset1; size = ((base & ~PAGE_MASK ) + len + ~PAGE_MASK ) >>PAGE_SHIFT ; +if (i + size >MAX_SKB_FRAGS ) +return -EMSGSIZE ; num_pages =get_user_pages_fast (base, size,0 , &page[i]); -if ((num_pages != size) || - (num_pages >MAX_SKB_FRAGS -skb_shinfo (skb)->nr_frags)) +if (num_pages != size)/* put_page is in skb free */ return -EFAULT ; skb->data_len += len;
@@ -647,7 +648,7 @@ static ssize_t macvtap_get_user(struct mint err;struct virtio_net_hdr vnet_hdr = {0 };int vnet_hdr_len =0 ; -int copylen; +int copylen =0 ;bool zerocopy = false;if (q->flags &IFF_VNET_HDR ) {
@@ -676,15 +677,31 @@ static ssize_t macvtap_get_user(struct mif (unlikely (len <ETH_HLEN )) goto err; + err = -EMSGSIZE ; +if (unlikely (count >UIO_MAXIOV )) + goto err; +if (m && m->msg_control &&sock_flag (&q->sk,SOCK_ZEROCOPY )) zerocopy = true;if (zerocopy) { +/* Userspace may produce vectors with count greater than +* MAX_SKB_FRAGS, so we need to linearize parts of the skb +* to let the rest of data to be fit in the frags. +*/ +if (count >MAX_SKB_FRAGS ) { + copylen =iov_length (iv, count -MAX_SKB_FRAGS ); +if (copylen < vnet_hdr_len) + copylen =0 ; +else + copylen -= vnet_hdr_len; + }/* There are 256 bytes to be copied in skb, so there is enough * room for skb expand head in case it is used. * The rest buffer is mapped from userspace. */ - copylen = vnet_hdr.hdr_len; +if (copylen < vnet_hdr.hdr_len) + copylen = vnet_hdr.hdr_len;if (!copylen) copylen =GOODCOPY_LEN ; }else
Greg Kroah-Hartman
maintainerPATCH 173/187 net/wireless: ipw2x00: add supported cipher suites to wiphy initialization
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislav Yakovlev <[email protected]>
commit a141e6a0097118bb35024485f1faffc0d9042f5c upstream.
Driver doesn't report its supported cipher suites through cfg80211 interface. It still uses wext interface and probably will not work through nl80211, but will at least correctly advertise supported features.
Bug was reported by Omar Siam.
https://bugzilla.kernel.org/show_bug.cgi?id=43049
--- drivers/net/wireless/ipw2x00/ipw.h | 23 +++++++++++++++++++++++ drivers/net/wireless/ipw2x00/ipw2100.c | 4 ++++ drivers/net/wireless/ipw2x00/ipw2200.c | 4 ++++ 3 files changed, 31 insertions(+)
drivers/net/wireless/ipw2x00/ipw.h new file +23 -0
@@ -0,0 +1,23 @@ +/* +* Intel Pro/Wireless 2100, 2200BG, 2915ABG network connection driver +* +* Copyright 2012 Stanislav Yakovlev <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef __IPW_H__ +#define __IPW_H__ + +#include <linux/ieee80211.h> + +static const u32 ipw_cipher_suites[] = { +WLAN_CIPHER_SUITE_WEP40 , +WLAN_CIPHER_SUITE_WEP104 , +WLAN_CIPHER_SUITE_TKIP , +WLAN_CIPHER_SUITE_CCMP , +}; + +#endif
drivers/net/wireless/ipw2x00/ipw2100.c +4 -0
@@ -166,6 +166,7 @@ that only one external action is invoked#include <net/lib80211.h> #include "ipw2100.h" +#include "ipw.h" #define IPW2100_VERSION "git-1.2.2"
@@ -1946,6 +1947,9 @@ static int ipw2100_wdev_init(struct net_ wdev->wiphy->bands[IEEE80211_BAND_2GHZ ] = bg_band; } + wdev->wiphy->cipher_suites = ipw_cipher_suites; + wdev->wiphy->n_cipher_suites =ARRAY_SIZE (ipw_cipher_suites); +set_wiphy_dev (wdev->wiphy, &priv->pci_dev->dev);if (wiphy_register (wdev->wiphy)) {ipw2100_down (priv);
drivers/net/wireless/ipw2x00/ipw2200.c +4 -0
@@ -34,6 +34,7 @@#include <linux/slab.h> #include <net/cfg80211-wext.h> #include "ipw2200.h" +#include "ipw.h" #ifndef KBUILD_EXTMOD
@@ -11544,6 +11545,9 @@ static int ipw_wdev_init(struct net_devi wdev->wiphy->bands[IEEE80211_BAND_5GHZ ] = a_band; } + wdev->wiphy->cipher_suites = ipw_cipher_suites; + wdev->wiphy->n_cipher_suites =ARRAY_SIZE (ipw_cipher_suites); +set_wiphy_dev (wdev->wiphy, &priv->pci_dev->dev);/* With that information in place, we can now register the wiphy... */
Greg Kroah-Hartman
maintainerPATCH 174/187 splice: fix racy pipe->buffers uses
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 047fe3605235888f3ebcda0c728cb31937eadfe6 upstream.
Dave Jones reported a kernel BUG at mm/slub.c:3474! triggered by splice_shrink_spd() called from vmsplice_to_pipe()
commit 35f3d14dbbc5 (pipe: add support for shrinking and growing pipes) added capability to adjust pipe->buffers.
Problem is some paths don't hold pipe mutex and assume pipe->buffers doesn't change for their duration.
Fix this by adding nr_pages_max field in struct splice_pipe_desc, and use it in place of pipe->buffers where appropriate.
splice_shrink_spd() loses its struct pipe_inode_info argument.
[bwh: Backported to 3.2:
- Adjust context in vmsplice_to_pipe()
- Update one more call to splice_shrink_spd(), from skb_splice_bits()]
--- fs/splice.c | 35 ++++++++++++++++++++--------------- include/linux/splice.h | 8 ++++---- kernel/relay.c | 5 +++-- kernel/trace/trace.c | 6 ++++-- mm/shmem.c | 3 ++- net/core/skbuff.c | 3 ++- 6 files changed, 35 insertions(+), 25 deletions(-)
fs/splice.c +20 -15
@@ -273,13 +273,16 @@ void spd_release_page(struct splice_pipe* Check if we need to grow the arrays holding pages and partial page * descriptions. */ -int splice_grow_spd (struct pipe_inode_info *pipe,struct splice_pipe_desc *spd) +int splice_grow_spd (const struct pipe_inode_info *pipe,struct splice_pipe_desc *spd) { -if (pipe->buffers <=PIPE_DEF_BUFFERS ) +unsigned int buffers =ACCESS_ONCE (pipe->buffers); + + spd->nr_pages_max = buffers; +if (buffers <=PIPE_DEF_BUFFERS )return 0 ; - spd->pages =kmalloc (pipe->buffers *sizeof (struct page *),GFP_KERNEL ); - spd->partial =kmalloc (pipe->buffers *sizeof (struct partial_page ),GFP_KERNEL ); + spd->pages =kmalloc (buffers *sizeof (struct page *),GFP_KERNEL ); + spd->partial =kmalloc (buffers *sizeof (struct partial_page ),GFP_KERNEL );if (spd->pages && spd->partial)return 0 ;
@@ -289,10 +292,9 @@ int splice_grow_spd(struct pipe_inode_inreturn -ENOMEM ; } -void splice_shrink_spd (struct pipe_inode_info *pipe, -struct splice_pipe_desc *spd) +void splice_shrink_spd (struct splice_pipe_desc *spd) { -if (pipe->buffers <=PIPE_DEF_BUFFERS ) +if (spd->nr_pages_max <=PIPE_DEF_BUFFERS )return ;kfree (spd->pages);
@@ -315,6 +317,7 @@ __generic_file_splice_read(struct file *struct splice_pipe_desc spd = { .pages = pages, .partial = partial, + .nr_pages_max =PIPE_DEF_BUFFERS , .flags = flags, .ops = &page_cache_pipe_buf_ops, .spd_release = spd_release_page,
@@ -326,7 +329,7 @@ __generic_file_splice_read(struct file * index = *ppos >>PAGE_CACHE_SHIFT ; loff = *ppos & ~PAGE_CACHE_MASK ; req_pages = (len + loff +PAGE_CACHE_SIZE -1 ) >>PAGE_CACHE_SHIFT ; - nr_pages =min (req_pages, pipe->buffers); + nr_pages =min (req_pages, spd.nr_pages_max);/* * Lookup the (hopefully) full range of pages we need.
@@ -497,7 +500,7 @@ fill_it:if (spd.nr_pages) error =splice_to_pipe (pipe, &spd); -splice_shrink_spd (pipe, &spd); +splice_shrink_spd (&spd);return error; }
@@ -598,6 +601,7 @@ ssize_t default_file_splice_read(structstruct splice_pipe_desc spd = { .pages = pages, .partial = partial, + .nr_pages_max =PIPE_DEF_BUFFERS , .flags = flags, .ops = &default_pipe_buf_ops, .spd_release = spd_release_page,
@@ -608,8 +612,8 @@ ssize_t default_file_splice_read(struct res = -ENOMEM ; vec = __vec; -if (pipe->buffers >PIPE_DEF_BUFFERS ) { - vec =kmalloc (pipe->buffers *sizeof (struct iovec ),GFP_KERNEL ); +if (spd.nr_pages_max >PIPE_DEF_BUFFERS ) { + vec =kmalloc (spd.nr_pages_max *sizeof (struct iovec ),GFP_KERNEL );if (!vec) goto shrink_ret; }
@@ -617,7 +621,7 @@ ssize_t default_file_splice_read(struct offset = *ppos & ~PAGE_CACHE_MASK ; nr_pages = (len + offset +PAGE_CACHE_SIZE -1 ) >>PAGE_CACHE_SHIFT ; -for (i =0 ; i < nr_pages && i < pipe->buffers && len; i++) { +for (i =0 ; i < nr_pages && i < spd.nr_pages_max && len; i++) {struct page *page; page =alloc_page (GFP_USER );
@@ -665,7 +669,7 @@ ssize_t default_file_splice_read(struct shrink_ret:if (vec != __vec)kfree (vec); -splice_shrink_spd (pipe, &spd); +splice_shrink_spd (&spd);return res; err:
@@ -1612,6 +1616,7 @@ static long vmsplice_to_pipe(struct filestruct splice_pipe_desc spd = { .pages = pages, .partial = partial, + .nr_pages_max =PIPE_DEF_BUFFERS , .flags = flags, .ops = &user_page_pipe_buf_ops, .spd_release = spd_release_page,
@@ -1627,13 +1632,13 @@ static long vmsplice_to_pipe(struct file spd.nr_pages =get_iovec_page_array (iov, nr_segs, spd.pages, spd.partial, flags &SPLICE_F_GIFT , - pipe->buffers); + spd.nr_pages_max);if (spd.nr_pages <=0 ) ret = spd.nr_pages;else ret =splice_to_pipe (pipe, &spd); -splice_shrink_spd (pipe, &spd); +splice_shrink_spd (&spd);return ret; }
include/linux/splice.h +4 -4
@@ -51,7 +51,8 @@ struct partial_page {struct splice_pipe_desc {struct page **pages;/* page map */ struct partial_page *partial;/* pages[] may not be contig */ -int nr_pages;/* number of pages in map */ +int nr_pages;/* number of populated pages in map */ +unsigned int nr_pages_max;/* pages[] & partial[] arrays size */ unsigned int flags;/* splice flags */ const struct pipe_buf_operations *ops;/* ops associated with output pipe */ void (*spd_release)(struct splice_pipe_desc *,unsigned int );
@@ -85,9 +86,8 @@ extern ssize_t splice_direct_to_actor(st/* * for dynamic pipe sizing */ -extern int splice_grow_spd (struct pipe_inode_info *,struct splice_pipe_desc *); -extern void splice_shrink_spd (struct pipe_inode_info *, -struct splice_pipe_desc *); +extern int splice_grow_spd (const struct pipe_inode_info *,struct splice_pipe_desc *); +extern void splice_shrink_spd (struct splice_pipe_desc *);extern void spd_release_page (struct splice_pipe_desc *,unsigned int );extern const struct pipe_buf_operations page_cache_pipe_buf_ops;
kernel/relay.c +3 -2
@@ -1235,6 +1235,7 @@ static ssize_t subbuf_splice_actor(strucstruct splice_pipe_desc spd = { .pages = pages, .nr_pages =0 , + .nr_pages_max =PIPE_DEF_BUFFERS , .partial = partial, .flags = flags, .ops = &relay_pipe_buf_ops,
@@ -1302,8 +1303,8 @@ static ssize_t subbuf_splice_actor(struc ret += padding; out: -splice_shrink_spd (pipe, &spd); -return ret; +splice_shrink_spd (&spd); +return ret; } static ssize_t relay_file_splice_read(struct file *in,
kernel/trace/trace.c +4 -2
@@ -3565,6 +3565,7 @@ static ssize_t tracing_splice_read_pipe( .pages = pages_def, .partial = partial_def, .nr_pages = 0, /* This gets updated below. */ + .nr_pages_max = PIPE_DEF_BUFFERS, .flags = flags, .ops = &tracing_pipe_buf_ops, .spd_release = tracing_spd_release_pipe,
@@ -3636,7 +3637,7 @@ static ssize_t tracing_splice_read_pipe( ret =splice_to_pipe (pipe, &spd); out: -splice_shrink_spd (pipe, &spd); +splice_shrink_spd (&spd);return ret; out_err:
@@ -4126,6 +4127,7 @@ tracing_buffers_splice_read(struct filestruct splice_pipe_desc spd = { .pages = pages_def, .partial = partial_def, + .nr_pages_max =PIPE_DEF_BUFFERS , .flags = flags, .ops = &buffer_pipe_buf_ops, .spd_release = buffer_spd_release,
@@ -4213,7 +4215,7 @@ tracing_buffers_splice_read(struct file } ret =splice_to_pipe (pipe, &spd); -splice_shrink_spd (pipe, &spd); +splice_shrink_spd (&spd); out:return ret; }
mm/shmem.c +2 -1
@@ -1365,6 +1365,7 @@ static ssize_t shmem_file_splice_read(ststruct splice_pipe_desc spd = { .pages = pages, .partial = partial, + .nr_pages_max =PIPE_DEF_BUFFERS , .flags = flags, .ops = &page_cache_pipe_buf_ops, .spd_release = spd_release_page,
@@ -1453,7 +1454,7 @@ static ssize_t shmem_file_splice_read(stif (spd.nr_pages) error =splice_to_pipe (pipe, &spd); -splice_shrink_spd (pipe, &spd); +splice_shrink_spd (&spd);if (error >0 ) { *ppos += error;
net/core/skbuff.c +2 -1
@@ -1712,6 +1712,7 @@ int skb_splice_bits(struct sk_buff *skb,struct splice_pipe_desc spd = { .pages = pages, .partial = partial, + .nr_pages_max =MAX_SKB_FRAGS , .flags = flags, .ops = &sock_pipe_buf_ops, .spd_release = sock_spd_release,
@@ -1758,7 +1759,7 @@ done:lock_sock (sk); } -splice_shrink_spd (pipe, &spd); +splice_shrink_spd (&spd);return ret; }
Greg Kroah-Hartman
maintainerPATCH 175/187 drm/i915: Refactor the deferred PM_IIR handling into a single function
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Wilson <[email protected]>
commit fc6826d1dcd65f3d1e9a5377678882e4e08f02be upstream.
This function, along with the registers and deferred work hander, are all shared with SandyBridge, IvyBridge and their variants. So remove the duplicate code into a single function.
--- drivers/gpu/drm/i915/i915_irq.c | 58 ++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 29 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +29 -29
@@ -424,6 +424,31 @@ static void gen6_pm_rps_work(struct workmutex_unlock (&dev_priv->dev->struct_mutex); } +static void gen6_queue_rps_work (struct drm_i915_private *dev_priv, +u32 pm_iir) +{ +unsigned long flags; + +/* +* IIR bits should never already be set because IMR should +* prevent an interrupt from being shown in IIR. The warning +* displays a case where we've unsafely cleared +* dev_priv->pm_iir. Although missing an interrupt of the same +* type is not a problem, it displays a problem in the logic. +* +* The mask bit in IMR is cleared by rps_work. +*/ + +spin_lock_irqsave (&dev_priv->rps_lock, flags); +WARN (dev_priv->pm_iir & pm_iir,"Missed a PM interrupt\n" ); + dev_priv->pm_iir |= pm_iir; +I915_WRITE (GEN6_PMIMR , dev_priv->pm_iir); +POSTING_READ (GEN6_PMIMR ); +spin_unlock_irqrestore (&dev_priv->rps_lock, flags); + +queue_work (dev_priv->wq, &dev_priv->rps_work); +} +static void pch_irq_handler (struct drm_device *dev,u32 pch_iir) {drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
@@ -529,16 +554,8 @@ static irqreturn_t ivybridge_irq_handlerpch_irq_handler (dev, pch_iir); } -if (pm_iir &GEN6_PM_DEFERRED_EVENTS ) { -unsigned long flags; -spin_lock_irqsave (&dev_priv->rps_lock, flags); -WARN (dev_priv->pm_iir & pm_iir,"Missed a PM interrupt\n" ); - dev_priv->pm_iir |= pm_iir; -I915_WRITE (GEN6_PMIMR , dev_priv->pm_iir); -POSTING_READ (GEN6_PMIMR ); -spin_unlock_irqrestore (&dev_priv->rps_lock, flags); -queue_work (dev_priv->wq, &dev_priv->rps_work); - } +if (pm_iir &GEN6_PM_DEFERRED_EVENTS ) +gen6_queue_rps_work (dev_priv, pm_iir);/* should clear PCH hotplug event before clear CPU irq */ I915_WRITE (SDEIIR , pch_iir);
@@ -634,25 +651,8 @@ static irqreturn_t ironlake_irq_handler(i915_handle_rps_change (dev); } -if (IS_GEN6 (dev) && pm_iir &GEN6_PM_DEFERRED_EVENTS ) { -/* -* IIR bits should never already be set because IMR should -* prevent an interrupt from being shown in IIR. The warning -* displays a case where we've unsafely cleared -* dev_priv->pm_iir. Although missing an interrupt of the same -* type is not a problem, it displays a problem in the logic. -* -* The mask bit in IMR is cleared by rps_work. -*/ -unsigned long flags; -spin_lock_irqsave (&dev_priv->rps_lock, flags); -WARN (dev_priv->pm_iir & pm_iir,"Missed a PM interrupt\n" ); - dev_priv->pm_iir |= pm_iir; -I915_WRITE (GEN6_PMIMR , dev_priv->pm_iir); -POSTING_READ (GEN6_PMIMR ); -spin_unlock_irqrestore (&dev_priv->rps_lock, flags); -queue_work (dev_priv->wq, &dev_priv->rps_work); - } +if (IS_GEN6 (dev) && pm_iir &GEN6_PM_DEFERRED_EVENTS ) +gen6_queue_rps_work (dev_priv, pm_iir);/* should clear PCH hotplug event before clear CPU irq */ I915_WRITE (SDEIIR , pch_iir);
Greg Kroah-Hartman
maintainerPATCH 176/187 drm/i915: rip out the PM_IIR WARN
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Vetter <[email protected]>
commit 58bf8062d0b293b8e1028e5b0342082002886bd4 upstream.
After banging my head against this for the past few months, I still don't see how this could possible race under the premise that once an irq bit is masked in PM_IMR and reset in PM_IIR it won't show up again until we unmask it in PM_IMR.
Still, we have reports of this being seen in the wild. Now Bspec has this little bit of lovely language in the PMIIR register:
Public SNB Docs, Vol3Part2, 2.5.14 "PMIIR":
"For each bit, the IIR can store a second pending interrupt if two or more of the same interrupt conditions occur before the first condition is cleared. Upon clearing the interrupt, the IIR bit will momentarily go low, then return high to indicate there is another interrupt pending."
Now if we presume that PMIMR only prevent new interrupts from being queued, we could easily end up masking an interrupt and clearing it, but the 2nd pending interrupt setting the bit in PMIIR right away again. Which leads, the next time the irq handler runs, to hitting the WARN.
Also, no bad side effects of this have ever been reported. And we've tracked down our issues with the gpu turbo getting stuck to bogus interrupt generation limits in th RPLIMIT register.
So let's just rip out this WARN as bogus and call it a day. The only shallow thing here is that this 2-deep irq queue in the hw makes you wonder how racy the windows irq handler is ...
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=42907
--- drivers/gpu/drm/i915/i915_irq.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/i915/i915_irq.c +0 -1
@@ -440,7 +440,6 @@ static void gen6_queue_rps_work(struct d*/ spin_lock_irqsave (&dev_priv->rps_lock, flags); -WARN (dev_priv->pm_iir & pm_iir,"Missed a PM interrupt\n" ); dev_priv->pm_iir |= pm_iir;I915_WRITE (GEN6_PMIMR , dev_priv->pm_iir);POSTING_READ (GEN6_PMIMR );
Greg Kroah-Hartman
maintainerPATCH 177/187 mm: Hold a file reference in madvise_remove
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit 9ab4233dd08036fe34a89c7dc6f47a8bf2eb29eb upstream.
Otherwise the code races with munmap (causing a use-after-free of the vma) or with close (causing a use-after-free of the struct file).
The bug was introduced by commit 90ed52ebe481 ("[PATCH] holepunch: fix mmap_sem i_mutex deadlock")
Greg Kroah-Hartman
maintainerPATCH 178/187 md/raid5: Do not add data_offset before call to is_badblock
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: majianpeng <[email protected]>
commit 6c0544e255dd6582a9899572e120fb55d9f672a4 upstream.
In chunk_aligned_read() we are adding data_offset before calling is_badblock. But is_badblock also adds data_offset, so that is bad.
So move the addition of data_offset to after the call to is_badblock.
This bug was introduced by commit 31c176ecdf3563140e639
md/raid5: avoid reading from known bad blocks.
which first appeared in 3.0. So that patch is suitable for any -stable kernel from 3.0.y onwards. However it will need minor revision for most of those (as the comment didn't appear until recently).
--- drivers/md/raid5.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/md/raid5.c +3 -1
@@ -3850,7 +3850,6 @@ static int chunk_aligned_read(struct mdd raid_bio->bi_next = (void *)rdev; align_bi->bi_bdev = rdev->bdev; align_bi->bi_flags &= ~(1 <<BIO_SEG_VALID ); - align_bi->bi_sector += rdev->data_offset;if (!bio_fits_rdev (align_bi) || is_badblock(rdev, align_bi->bi_sector, align_bi->bi_size>>9,
@@ -3861,6 +3860,9 @@ static int chunk_aligned_read(struct mddreturn 0 ; } +/* No reshape active, so we can trust rdev->data_offset */ + align_bi->bi_sector += rdev->data_offset; +spin_lock_irq (&conf->device_lock); wait_event_lock_irq(conf->wait_for_stripe, conf->quiesce == 0,
Greg Kroah-Hartman
maintainerPATCH 179/187 staging:iio:ad7606: Re-add missing scale attribute
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lars-Peter Clausen <[email protected]>
commit 279bf2e57c30c9a4482b2b6ede11b31c41e35e78 upstream.
Commit 50ac23be ("staging:iio:adc:ad7606 add local define for chan_spec structures.") accidentally removed the scale info_mask flag. This patch adds it back again.
--- drivers/staging/iio/adc/ad7606_core.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/iio/adc/ad7606_core.c +1 -0
@@ -235,6 +235,7 @@ static const struct attribute_group ad76 .indexed = 1, \ .channel = num, \ .address = num, \ + .info_mask = IIO_CHAN_INFO_SCALE_SHARED_BIT, \ .scan_index = num, \ .scan_type = IIO_ST('s', 16, 16, 0), \ }
Greg Kroah-Hartman
maintainerPATCH 180/187 memory hotplug: fix invalid memory access caused by stale kswapd pointer
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiang Liu <[email protected]>
commit d8adde17e5f858427504725218c56aef90e90fc7 upstream.
kswapd_stop() is called to destroy the kswapd work thread when all memory of a NUMA node has been offlined. But kswapd_stop() only terminates the work thread without resetting NODE_DATA(nid)->kswapd to NULL. The stale pointer will prevent kswapd_run() from creating a new work thread when adding memory to the memory-less NUMA node again. Eventually the stale pointer may cause invalid memory access.
An example stack dump as below. It's reproduced with 2.6.32, but latest kernel has the same issue.
BUG: unable to handle kernel NULL pointer dereference at (null)
IP: [<ffffffff81051a94>] exit_creds+0x12/0x78
PGD 0
Oops: 0000 [#1] SMP
last sysfs file: /sys/devices/system/memory/memory391/state
CPU 11
Modules linked in: cpufreq_conservative cpufreq_userspace cpufreq_powersave acpi_cpufreq microcode fuse loop dm_mod tpm_tis rtc_cmos i2c_i801 rtc_core tpm serio_raw pcspkr sg tpm_bios igb i2c_core iTCO_wdt rtc_lib mptctl iTCO_vendor_support button dca bnx2 usbhid hid uhci_hcd ehci_hcd usbcore sd_mod crc_t10dif edd ext3 mbcache jbd fan ide_pci_generic ide_core ata_generic ata_piix libata thermal processor thermal_sys hwmon mptsas mptscsih mptbase scsi_transport_sas scsi_mod
Pid: 7949, comm: sh Not tainted 2.6.32.12-qiuxishi-5-default #92 Tecal RH2285
RIP: 0010:exit_creds+0x12/0x78
RSP: 0018:ffff8806044f1d78 EFLAGS: 00010202
RAX: 0000000000000000 RBX: ffff880604f22140 RCX: 0000000000019502
RDX: 0000000000000000 RSI: 0000000000000202 RDI: 0000000000000000
RBP: ffff880604f22150 R08: 0000000000000000 R09: ffffffff81a4dc10
R10: 00000000000032a0 R11: ffff880006202500 R12: 0000000000000000
R13: 0000000000c40000 R14: 0000000000008000 R15: 0000000000000001
FS: 00007fbc03d066f0(0000) GS:ffff8800282e0000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 0000000000000000 CR3: 000000060f029000 CR4: 00000000000006e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process sh (pid: 7949, threadinfo ffff8806044f0000, task ffff880603d7c600)
Stack:
ffff880604f22140 ffffffff8103aac5 ffff880604f22140 ffffffff8104d21e
ffff880006202500 0000000000008000 0000000000c38000 ffffffff810bd5b1
0000000000000000 ffff880603d7c600 00000000ffffdd29 0000000000000003
Call Trace:
__put_task_struct+0x5d/0x97
kthread_stop+0x50/0x58
offline_pages+0x324/0x3da
memory_block_change_state+0x179/0x1db
store_mem_state+0x9e/0xbb
sysfs_write_file+0xd0/0x107
vfs_write+0xad/0x169
sys_write+0x45/0x6e
system_call_fastpath+0x16/0x1b
Code: ff 4d 00 0f 94 c0 84 c0 74 08 48 89 ef e8 1f fd ff ff 5b 5d 31 c0 41 5c c3 53 48 8b 87 20 06 00 00 48 89 fb 48 8b bf 18 06 00 00 <8b> 00 48 c7 83 18 06 00 00 00 00 00 00 f0 ff 0f 0f 94 c0 84 c0
RIP exit_creds+0x12/0x78
RSP <ffff8806044f1d78>
CR2: 0000000000000000--- include/linux/mmzone.h | 2 +- mm/vmscan.c | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-)
include/linux/mmzone.h +1 -1
@@ -663,7 +663,7 @@ typedef struct pglist_data {range, including holes */ int node_id;wait_queue_head_t kswapd_wait; -struct task_struct *kswapd; +struct task_struct *kswapd;/* Protected by lock_memory_hotplug() */ int kswapd_max_order;enum zone_type classzone_idx; } pg_data_t;
mm/vmscan.c +5 -2
@@ -3279,14 +3279,17 @@ int kswapd_run(int nid) }/* -* Called by memory hotplug when all memory in a node is offlined. +* Called by memory hotplug when all memory in a node is offlined. Caller must +* hold lock_memory_hotplug(). */ void kswapd_stop (int nid) {struct task_struct *kswapd =NODE_DATA (nid)->kswapd; -if (kswapd) +if (kswapd) {kthread_stop (kswapd); +NODE_DATA (nid)->kswapd =NULL ; + } }static int __init kswapd_init (void )
Greg Kroah-Hartman
maintainerPATCH 181/187 drivers/rtc/rtc-spear.c: fix use-after-free in spear_rtc_remove()
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Devendra Naga <[email protected]>
commit 2a643893e50fde71d7ba84b5592ec61b467b9ab6 upstream.
`config' is freed and is then used in the rtc_device_unregister() call, causing a kernel panic.
--- drivers/rtc/rtc-spear.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-spear.c +1 -1
@@ -457,12 +457,12 @@ static int __devexit spear_rtc_remove(stclk_disable (config->clk);clk_put (config->clk);iounmap (config->ioaddr); -kfree (config); res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );if (res)release_mem_region (res->start,resource_size (res));platform_set_drvdata (pdev,NULL );rtc_device_unregister (config->rtc); +kfree (config);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 182/187 drivers/rtc/rtc-ab8500.c: use IRQF_ONESHOT when requesting a threaded IRQ
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lee Jones <[email protected]>
commit 3cfd16a551dc0c188160e1765168a04baf2d3198 upstream.
This driver's IRQ registration is failing because the kernel now forces IRQs to be ONESHOT if no IRQ handler is passed.
--- drivers/rtc/rtc-ab8500.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-ab8500.c +1 -1
@@ -422,7 +422,7 @@ static int __devinit ab8500_rtc_probe(st } err =request_threaded_irq (irq,NULL , rtc_alarm_handler, -IRQF_NO_SUSPEND ,"ab8500-rtc" , rtc); +IRQF_NO_SUSPEND |IRQF_ONESHOT ,"ab8500-rtc" , rtc);if (err <0 ) {rtc_device_unregister (rtc);return err;
Greg Kroah-Hartman
maintainerPATCH 184/187 mm, thp: abort compaction if migration page cannot be charged to memcg
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Rientjes <[email protected]>
commit 4bf2bba3750f10aa9e62e6949bc7e8329990f01b upstream.
If page migration cannot charge the temporary page to the memcg, migrate_pages() will return -ENOMEM. This isn't considered in memory compaction however, and the loop continues to iterate over all pageblocks trying to isolate and migrate pages. If a small number of very large memcgs happen to be oom, however, these attempts will mostly be futile leading to an enormous amout of cpu consumption due to the page migration failures.
This patch will short circuit and fail memory compaction if migrate_pages() returns -ENOMEM. COMPACT_PARTIAL is returned in case some migrations were successful so that the page allocator will retry.
--- mm/compaction.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
mm/compaction.c +4 -1
@@ -594,8 +594,11 @@ static int compact_zone(struct zone *zonif (err) {putback_lru_pages (&cc->migratepages); cc->nr_migratepages =0 ; +if (err == -ENOMEM ) { + ret =COMPACT_PARTIAL ; + goto out; + } } - } out:
Greg Kroah-Hartman
maintainerPATCH 185/187 fs: ramfs: file-nommu: add SetPageUptodate()
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bob Liu <[email protected]>
commit fea9f718b3d68147f162ed2d870183ce5e0ad8d8 upstream.
There is a bug in the below scenario for !CONFIG_MMU:
1. create a new file
2. mmap the file and write to it
3. read the file can't get the correct value
Because
sys_read() -> generic_file_aio_read() -> simple_readpage() -> clear_page()
which causes the page to be zeroed.
Add SetPageUptodate() to ramfs_nommu_expand_for_mapping() so that generic_file_aio_read() do not call simple_readpage().
--- fs/ramfs/file-nommu.c | 1 + 1 file changed, 1 insertion(+)
fs/ramfs/file-nommu.c +1 -0
@@ -110,6 +110,7 @@ int ramfs_nommu_expand_for_mapping(struc/* prevent the page from being discarded on memory pressure */ SetPageDirty (page); +SetPageUptodate (page);unlock_page (page);put_page (page);
Greg Kroah-Hartman
maintainerPATCH 186/187 memblock: free allocated memblock_reserved_regions later
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yinghai Lu <[email protected]>
commit 29f6738609e40227dabcc63bfb3b84b3726a75bd upstream.
memblock_free_reserved_regions() calls memblock_free(), but memblock_free() would double reserved.regions too, so we could free the old range for reserved.regions.
Also tj said there is another bug which could be related to this.
| I don't think we're saving any noticeable | amount by doing this "free - give it to page allocator - reserve | again" dancing. We should just allocate regions aligned to page | boundaries and free them later when memblock is no longer in use.
in that case, when DEBUG_PAGEALLOC, will get panic:
memblock_free: [0x0000102febc080-0x0000102febf080] memblock_free_reserved_regions+0x37/0x39 BUG: unable to handle kernel paging request at ffff88102febd948 IP: [<ffffffff836a5774>] __next_free_mem_range+0x9b/0x155 PGD 4826063 PUD cf67a067 PMD cf7fa067 PTE 800000102febd160 Oops: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC CPU 0 Pid: 0, comm: swapper Not tainted 3.5.0-rc2-next-20120614-sasha #447 RIP: 0010:[<ffffffff836a5774>] [<ffffffff836a5774>] __next_free_mem_range+0x9b/0x155
See the discussion at https://lkml.org/lkml/2012/6/13/469
So try to allocate with PAGE_SIZE alignment and free it later.
--- include/linux/memblock.h | 4 --- mm/memblock.c | 51 +++++++++++++++++++++-------------------------- mm/nobootmem.c | 36 ++++++++++++++++++++------------- 3 files changed, 46 insertions(+), 45 deletions(-)
include/linux/memblock.h +1 -3
@@ -50,9 +50,7 @@ phys_addr_t memblock_find_in_range_node( phys_addr_t size, phys_addr_t align, int nid);phys_addr_t memblock_find_in_range (phys_addr_t start,phys_addr_t end,phys_addr_t size,phys_addr_t align); -int memblock_free_reserved_regions (void ); -int memblock_reserve_reserved_regions (void ); - +phys_addr_t get_allocated_memblock_reserved_regions_info (phys_addr_t *addr);void memblock_allow_resize (void );int memblock_add_node (phys_addr_t base,phys_addr_t size,int nid);int memblock_add (phys_addr_t base,phys_addr_t size);
mm/memblock.c +23 -28
95 lines not on this page · raw message
mm/nobootmem.c +22 -14
@@ -105,27 +105,35 @@ static void __init __free_pages_memory(u__free_pages_bootmem (pfn_to_page (i),0 ); } +static unsigned long __init __free_memory_core (phys_addr_t start, +phys_addr_t end) +{ +unsigned long start_pfn =PFN_UP (start); + unsigned long end_pfn = min_t(unsigned long, +PFN_DOWN (end), max_low_pfn); + +if (start_pfn > end_pfn) +return 0 ; + +__free_pages_memory (start_pfn, end_pfn); + +return end_pfn - start_pfn; +} +unsigned long __init free_low_memory_core_early (int nodeid) {unsigned long count =0 ; -phys_addr_t start, end; +phys_addr_t start, end, size;u64 i; -/* free reserved array temporarily so that it's treated as free area */ -memblock_free_reserved_regions (); +for_each_free_mem_range (i,MAX_NUMNODES , &start, &end,NULL ) + count +=__free_memory_core (start, end); -for_each_free_mem_range (i,MAX_NUMNODES , &start, &end,NULL ) { -unsigned long start_pfn =PFN_UP (start); - unsigned long end_pfn = min_t(unsigned long, -PFN_DOWN (end), max_low_pfn); -if (start_pfn < end_pfn) { -__free_pages_memory (start_pfn, end_pfn); - count += end_pfn - start_pfn; - } - } +/* free range that is used for reserved array if we allocate it */ + size =get_allocated_memblock_reserved_regions_info (&start); +if (size) + count +=__free_memory_core (start, start + size); -/* put region array back? */ -memblock_reserve_reserved_regions ();return count; }
Greg Kroah-Hartman
maintainerPATCH 187/187 ocfs2: fix NULL pointer dereference in __ocfs2_change_file_space()
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luis Henriques <[email protected]>
commit a4e08d001f2e50bb8b3c4eebadcf08e5535f02ee upstream.
As ocfs2_fallocate() will invoke __ocfs2_change_file_space() with a NULL as the first parameter (file), it may trigger a NULL pointer dereferrence due to a missing check.
Addresses http://bugs.launchpad.net/bugs/1006012
--- fs/ocfs2/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/file.c +1 -1
@@ -1950,7 +1950,7 @@ static int __ocfs2_change_file_space(strif (ret <0 )mlog_errno (ret); -if (file->f_flags &O_SYNC ) +if (file && (file->f_flags &O_SYNC )) handle->h_sync =1 ;ocfs2_commit_trans (osb, handle);
Quoted 4 lines · Greg KH
This is the start of the stable review cycle for the 3.4.5 release. There are 187 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
As has been noted already, some of the patches are actually missing.
Quoted 2 lines
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.4.5-rc1.gz
Seems it's not there?
Cheers,
Sven
Greg KH
maintainerQuoted 7 lines · Sven Joachim
Quoted 4 lines · Greg KH
This is the start of the stable review cycle for the 3.4.5 release. There are 187 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 6 lines
As has been noted already, some of the patches are actually missing.
Quoted 2 lines
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.4.5-rc1.gzSeems it's not there?
Ugh, I messed everything up on this one, sorry about that. It should now be there after the mirrors kick in, give it a few minutes.
greg k-h
Quoted 8 lines · Sven Joachim
Quoted 4 lines · Greg KH
This is the start of the stable review cycle for the 3.4.5 release. There are 187 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
As has been noted already, some of the patches are actually missing.
Yes, the same ones as on 3.0.37 submission:
[ 064/187] ath9k_hw: avoid possible infinite loop in ar9003_get_pll_sqsum_dvc [ 155/187] PCI: EHCI: fix crash during suspend on ASUS computers [ 163/187] tracing: change CPU ring buffer state from tracing_cpumask [ 177/187] mm: Hold a file reference in madvise_remove
Also I couldn't find anywhere in the submission the email for the patch:
"cifs: when server doesn't set CAP_LARGE_READ_X, cap default rsize at MaxBufferSize" I noted the patch count was off by one, and comparing to the queue git repo, this one I can't find.
Other thing I had a problem with, is when saving the patches to apply for testing, some of them were with "charset=y", so I had to fix up manually, otherwise git am complained.
Quoted 13 lines
Quoted 3 lines
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.4.5-rc1.gzSeems it's not there?
Cheers,
Sven
--
To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
[]'s Herton
Greg KH
maintainerQuoted 16 lines · Herton Ronaldo Krzesinski
Quoted 8 lines · Sven Joachim
Quoted 4 lines · Greg KH
This is the start of the stable review cycle for the 3.4.5 release. There are 187 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
As has been noted already, some of the patches are actually missing.
Yes, the same ones as on 3.0.37 submission:
[ 064/187]ath9k_hw: avoid possible infinite loop inar9003_get_pll_sqsum_dvc[ 155/187] PCI: EHCI: fix crash during suspend on ASUS computers [ 163/187] tracing: change CPU ring buffer state fromtracing_cpumask[ 177/187] mm: Hold a file reference inmadvise_remove
Quoted 8 lines
Also I couldn't find anywhere in the submission the email for the patch:
"cifs: when server doesn't setCAP_LARGE_READ_X, cap default rsize at MaxBufferSize" I noted the patch count was off by one, and comparing to the queue git repo, this one I can't find.Other thing I had a problem with, is when saving the patches to apply for testing, some of them were with "charset=y", so I had to fix up manually, otherwise git am complained.
The patches in the git tree are "good", quilt went bonkers when it hit odd-char-sets in the From: lines of some of the patches (normally I edit them by hand and fix them up, this time I thought that quilt could handle it.) I'll fix them up by hand again and make sure this doesn't happen in the future, sorry about that.
greg k-h