--- /dev/null
+From d4f1e48bd11e3df6a26811f7a1f06c4225d92f7d Mon Sep 17 00:00:00 2001
+From: Omair Mohammed Abdullah <omair.m.abdullah@linux.intel.com>
+Date: Sat, 29 Sep 2012 12:24:05 +0530
+Subject: ALSA: aloop - add locking to timer access
+
+From: Omair Mohammed Abdullah <omair.m.abdullah@linux.intel.com>
+
+commit d4f1e48bd11e3df6a26811f7a1f06c4225d92f7d upstream.
+
+When the loopback timer handler is running, calling del_timer() (for STOP
+trigger) will not wait for the handler to complete before deactivating the
+timer. The timer gets rescheduled in the handler as usual. Then a subsequent
+START trigger will try to start the timer using add_timer() with a timer pending
+leading to a kernel panic.
+
+Serialize the calls to add_timer() and del_timer() using a spin lock to avoid
+this.
+
+Signed-off-by: Omair Mohammed Abdullah <omair.m.abdullah@linux.intel.com>
+Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/drivers/aloop.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/sound/drivers/aloop.c
++++ b/sound/drivers/aloop.c
+@@ -120,6 +120,7 @@ struct loopback_pcm {
+ unsigned int last_drift;
+ unsigned long last_jiffies;
+ struct timer_list timer;
++ spinlock_t timer_lock;
+ };
+
+ static struct platform_device *devices[SNDRV_CARDS];
+@@ -170,6 +171,7 @@ static void loopback_timer_start(struct
+ unsigned long tick;
+ unsigned int rate_shift = get_rate_shift(dpcm);
+
++ spin_lock(&dpcm->timer_lock);
+ if (rate_shift != dpcm->pcm_rate_shift) {
+ dpcm->pcm_rate_shift = rate_shift;
+ dpcm->period_size_frac = frac_pos(dpcm, dpcm->pcm_period_size);
+@@ -182,12 +184,15 @@ static void loopback_timer_start(struct
+ tick = (tick + dpcm->pcm_bps - 1) / dpcm->pcm_bps;
+ dpcm->timer.expires = jiffies + tick;
+ add_timer(&dpcm->timer);
++ spin_unlock(&dpcm->timer_lock);
+ }
+
+ static inline void loopback_timer_stop(struct loopback_pcm *dpcm)
+ {
++ spin_lock(&dpcm->timer_lock);
+ del_timer(&dpcm->timer);
+ dpcm->timer.expires = 0;
++ spin_unlock(&dpcm->timer_lock);
+ }
+
+ #define CABLE_VALID_PLAYBACK (1 << SNDRV_PCM_STREAM_PLAYBACK)
+@@ -667,6 +672,7 @@ static int loopback_open(struct snd_pcm_
+ dpcm->substream = substream;
+ setup_timer(&dpcm->timer, loopback_timer_function,
+ (unsigned long)dpcm);
++ spin_lock_init(&dpcm->timer_lock);
+
+ cable = loopback->cables[substream->number][dev];
+ if (!cable) {
--- /dev/null
+From e4db0952e542090c605fd41d31d761f1b4624f4a Mon Sep 17 00:00:00 2001
+From: Felix Kaechele <felix@fetzig.org>
+Date: Wed, 26 Sep 2012 01:20:44 +0200
+Subject: ALSA: hda - Add inverted internal mic quirk for Lenovo IdeaPad U310
+
+From: Felix Kaechele <felix@fetzig.org>
+
+commit e4db0952e542090c605fd41d31d761f1b4624f4a upstream.
+
+The Lenovo IdeaPad U310 has an internal mic where the right channel
+is phase inverted.
+
+Signed-off-by: Felix Kaechele <felix@fetzig.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/patch_conexant.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/sound/pci/hda/patch_conexant.c
++++ b/sound/pci/hda/patch_conexant.c
+@@ -4467,6 +4467,7 @@ static const struct snd_pci_quirk cxt506
+ SND_PCI_QUIRK(0x17aa, 0x21ce, "Lenovo T420", CXT_PINCFG_LENOVO_TP410),
+ SND_PCI_QUIRK(0x17aa, 0x21cf, "Lenovo T520", CXT_PINCFG_LENOVO_TP410),
+ SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC),
++ SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_FIXUP_STEREO_DMIC),
+ SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC),
+ {}
+ };
--- /dev/null
+From 4b527b6516ab1f0af8aaedd02dbf71ee2c1180f4 Mon Sep 17 00:00:00 2001
+From: David Henningsson <david.henningsson@canonical.com>
+Date: Tue, 18 Sep 2012 14:26:59 +0200
+Subject: ALSA: hda - limit internal mic boost for Asus X202E
+
+From: David Henningsson <david.henningsson@canonical.com>
+
+commit 4b527b6516ab1f0af8aaedd02dbf71ee2c1180f4 upstream.
+
+When the input gain for the internal mic is set to its maximum level,
+the background noise becomes so high - and any relevant signal clipped -
+that the setting becomes unusable. It is better to limit the amplification.
+
+BugLink: https://bugs.launchpad.net/bugs/1052460
+Signed-off-by: David Henningsson <david.henningsson@canonical.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/patch_via.c | 29 +++++++++++++++++++++++++++++
+ 1 file changed, 29 insertions(+)
+
+--- a/sound/pci/hda/patch_via.c
++++ b/sound/pci/hda/patch_via.c
+@@ -3661,6 +3661,32 @@ static void set_widgets_power_state_vt20
+ update_power_state(codec, 0x21, AC_PWRST_D3);
+ }
+
++/*
++ * pin fix-up
++ */
++enum {
++ VIA_FIXUP_INTMIC_BOOST,
++};
++
++static void via_fixup_intmic_boost(struct hda_codec *codec,
++ const struct hda_fixup *fix, int action)
++{
++ if (action == HDA_FIXUP_ACT_PRE_PROBE)
++ override_mic_boost(codec, 0x30, 0, 2, 40);
++}
++
++static const struct hda_fixup via_fixups[] = {
++ [VIA_FIXUP_INTMIC_BOOST] = {
++ .type = HDA_FIXUP_FUNC,
++ .v.func = via_fixup_intmic_boost,
++ },
++};
++
++static const struct snd_pci_quirk vt2002p_fixups[] = {
++ SND_PCI_QUIRK(0x1043, 0x8532, "Asus X202E", VIA_FIXUP_INTMIC_BOOST),
++ {}
++};
++
+ /* patch for vt2002P */
+ static int patch_vt2002P(struct hda_codec *codec)
+ {
+@@ -3677,6 +3703,9 @@ static int patch_vt2002P(struct hda_code
+ override_mic_boost(codec, 0x29, 0, 3, 40);
+ add_secret_dac_path(codec);
+
++ snd_hda_pick_fixup(codec, NULL, vt2002p_fixups, via_fixups);
++ snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
++
+ /* automatic parse from the BIOS config */
+ err = via_parse_auto_config(codec);
+ if (err < 0) {
--- /dev/null
+From 9f720bb9409ea5923361fbd3fdbc505ca36cf012 Mon Sep 17 00:00:00 2001
+From: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
+Date: Thu, 27 Sep 2012 10:38:14 -0300
+Subject: ALSA: hda/realtek - Fix detection of ALC271X codec
+
+From: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
+
+commit 9f720bb9409ea5923361fbd3fdbc505ca36cf012 upstream.
+
+In commit af741c1 ("ALSA: hda/realtek - Call alc_auto_parse_customize_define()
+always after fixup"), alc_auto_parse_customize_define was moved after
+detection of ALC271X.
+
+The problem is that detection of ALC271X relies on spec->cdefine.platform_type,
+and it's set on alc_auto_parse_customize_define.
+
+Move the alc_auto_parse_customize_define and its required fixup setup
+before the block doing the ALC271X and other codec setup.
+
+BugLink: https://bugs.launchpad.net/bugs/1006690
+Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
+Reviewed-by: David Henningsson <david.henningsson@canonical.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/patch_realtek.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -6145,6 +6145,12 @@ static int patch_alc269(struct hda_codec
+
+ spec = codec->spec;
+
++ alc_pick_fixup(codec, alc269_fixup_models,
++ alc269_fixup_tbl, alc269_fixups);
++ alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
++
++ alc_auto_parse_customize_define(codec);
++
+ if (codec->vendor_id == 0x10ec0269) {
+ spec->codec_variant = ALC269_TYPE_ALC269VA;
+ switch (alc_get_coef0(codec) & 0x00f0) {
+@@ -6172,12 +6178,6 @@ static int patch_alc269(struct hda_codec
+ alc269_fill_coef(codec);
+ }
+
+- alc_pick_fixup(codec, alc269_fixup_models,
+- alc269_fixup_tbl, alc269_fixups);
+- alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
+-
+- alc_auto_parse_customize_define(codec);
+-
+ /* automatic parse from the BIOS config */
+ err = alc269_parse_auto_config(codec);
+ if (err < 0)
--- /dev/null
+From c10514394ef9e8de93a4ad8c8904d71dcd82c122 Mon Sep 17 00:00:00 2001
+From: David Henningsson <david.henningsson@canonical.com>
+Date: Thu, 20 Sep 2012 10:20:41 +0200
+Subject: ALSA: usb - disable broken hw volume for Tenx TP6911
+
+From: David Henningsson <david.henningsson@canonical.com>
+
+commit c10514394ef9e8de93a4ad8c8904d71dcd82c122 upstream.
+
+While going through Ubuntu bugs, I discovered this patch being
+posted and a confirmation that the patch works as expected.
+
+Finding out how the hw volume really works would be preferrable
+to just disabling the broken one, but this would be better than
+nothing.
+
+Credit: sndfnsdfin (qawsnews)
+BugLink: https://bugs.launchpad.net/bugs/559939
+Signed-off-by: David Henningsson <david.henningsson@canonical.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/usb/mixer.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+--- a/sound/usb/mixer.c
++++ b/sound/usb/mixer.c
+@@ -1267,6 +1267,13 @@ static int parse_audio_feature_unit(stru
+ /* disable non-functional volume control */
+ master_bits &= ~UAC_CONTROL_BIT(UAC_FU_VOLUME);
+ break;
++ case USB_ID(0x1130, 0xf211):
++ snd_printk(KERN_INFO
++ "usbmixer: volume control quirk for Tenx TP6911 Audio Headset\n");
++ /* disable non-functional volume control */
++ channels = 0;
++ break;
++
+ }
+ if (channels > 0)
+ first_ch_bits = snd_usb_combine_bytes(bmaControls + csize, csize);
--- /dev/null
+From c05fce586d4da2dfe0309bef3795a8586e967bc3 Mon Sep 17 00:00:00 2001
+From: Marko Friedemann <mfr@bmx-chemnitz.de>
+Date: Mon, 3 Sep 2012 10:12:40 +0200
+Subject: ALSA: USB: Support for (original) Xbox Communicator
+
+From: Marko Friedemann <mfr@bmx-chemnitz.de>
+
+commit c05fce586d4da2dfe0309bef3795a8586e967bc3 upstream.
+
+Added support for Xbox Communicator to USB quirks.
+
+Signed-off-by: Marko Friedemann <mfr@bmx-chemnitz.de>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/usb/quirks-table.h | 53 +++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 53 insertions(+)
+
+--- a/sound/usb/quirks-table.h
++++ b/sound/usb/quirks-table.h
+@@ -2781,6 +2781,59 @@ YAMAHA_DEVICE(0x7010, "UB99"),
+ }
+ },
+
++/* Microsoft XboxLive Headset/Xbox Communicator */
++{
++ USB_DEVICE(0x045e, 0x0283),
++ .bInterfaceClass = USB_CLASS_PER_INTERFACE,
++ .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
++ .vendor_name = "Microsoft",
++ .product_name = "XboxLive Headset/Xbox Communicator",
++ .ifnum = QUIRK_ANY_INTERFACE,
++ .type = QUIRK_COMPOSITE,
++ .data = &(const struct snd_usb_audio_quirk[]) {
++ {
++ /* playback */
++ .ifnum = 0,
++ .type = QUIRK_AUDIO_FIXED_ENDPOINT,
++ .data = &(const struct audioformat) {
++ .formats = SNDRV_PCM_FMTBIT_S16_LE,
++ .channels = 1,
++ .iface = 0,
++ .altsetting = 0,
++ .altset_idx = 0,
++ .attributes = 0,
++ .endpoint = 0x04,
++ .ep_attr = 0x05,
++ .rates = SNDRV_PCM_RATE_CONTINUOUS,
++ .rate_min = 22050,
++ .rate_max = 22050
++ }
++ },
++ {
++ /* capture */
++ .ifnum = 1,
++ .type = QUIRK_AUDIO_FIXED_ENDPOINT,
++ .data = &(const struct audioformat) {
++ .formats = SNDRV_PCM_FMTBIT_S16_LE,
++ .channels = 1,
++ .iface = 1,
++ .altsetting = 0,
++ .altset_idx = 0,
++ .attributes = 0,
++ .endpoint = 0x85,
++ .ep_attr = 0x05,
++ .rates = SNDRV_PCM_RATE_CONTINUOUS,
++ .rate_min = 16000,
++ .rate_max = 16000
++ }
++ },
++ {
++ .ifnum = -1
++ }
++ }
++ }
++},
++
+ {
+ /*
+ * Some USB MIDI devices don't have an audio control interface,
--- /dev/null
+From 689185b78ba6fbe0042f662a468b5565909dff7a Mon Sep 17 00:00:00 2001
+From: Mark Brown <broonie@opensource.wolfsonmicro.com>
+Date: Tue, 31 Jul 2012 18:37:29 +0100
+Subject: ASoC: wm9712: Fix name of Capture Switch
+
+From: Mark Brown <broonie@opensource.wolfsonmicro.com>
+
+commit 689185b78ba6fbe0042f662a468b5565909dff7a upstream.
+
+Help UIs associate it with the matching gain control.
+
+Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/soc/codecs/wm9712.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/sound/soc/codecs/wm9712.c
++++ b/sound/soc/codecs/wm9712.c
+@@ -146,7 +146,7 @@ SOC_SINGLE("Playback Attenuate (-6dB) Sw
+ SOC_SINGLE("Bass Volume", AC97_MASTER_TONE, 8, 15, 1),
+ SOC_SINGLE("Treble Volume", AC97_MASTER_TONE, 0, 15, 1),
+
+-SOC_SINGLE("Capture ADC Switch", AC97_REC_GAIN, 15, 1, 1),
++SOC_SINGLE("Capture Switch", AC97_REC_GAIN, 15, 1, 1),
+ SOC_ENUM("Capture Volume Steps", wm9712_enum[6]),
+ SOC_DOUBLE("Capture Volume", AC97_REC_GAIN, 8, 0, 63, 1),
+ SOC_SINGLE("Capture ZC Switch", AC97_REC_GAIN, 7, 1, 0),
--- /dev/null
+From eb4d5fc1f0ce89e3d5b072c594a1e213a0e05881 Mon Sep 17 00:00:00 2001
+From: Mark Brown <broonie@opensource.wolfsonmicro.com>
+Date: Thu, 27 Sep 2012 18:35:24 +0100
+Subject: ASoC: wm_hubs: Ensure volume updates are handled during class W startup
+
+From: Mark Brown <broonie@opensource.wolfsonmicro.com>
+
+commit eb4d5fc1f0ce89e3d5b072c594a1e213a0e05881 upstream.
+
+In some circumstances we may need to flush volume updates to the device
+after switching to class W mode. Do this unconditionally to ensure that
+these situations are handled.
+
+Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/soc/codecs/wm_hubs.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/sound/soc/codecs/wm_hubs.c
++++ b/sound/soc/codecs/wm_hubs.c
+@@ -634,6 +634,11 @@ void wm_hubs_update_class_w(struct snd_s
+
+ snd_soc_update_bits(codec, WM8993_CLASS_W_0,
+ WM8993_CP_DYN_V | WM8993_CP_DYN_FREQ, enable);
++
++ snd_soc_write(codec, WM8993_LEFT_OUTPUT_VOLUME,
++ snd_soc_read(codec, WM8993_LEFT_OUTPUT_VOLUME));
++ snd_soc_write(codec, WM8993_RIGHT_OUTPUT_VOLUME,
++ snd_soc_read(codec, WM8993_RIGHT_OUTPUT_VOLUME));
+ }
+ EXPORT_SYMBOL_GPL(wm_hubs_update_class_w);
+
--- /dev/null
+From ab3951eb74e7c33a2f5b7b64d72e82f1eea61571 Mon Sep 17 00:00:00 2001
+From: Eugeni Dodonov <eugeni.dodonov@intel.com>
+Date: Mon, 18 Jun 2012 19:03:38 -0300
+Subject: drm/i915: prevent possible pin leak on error path
+
+From: Eugeni Dodonov <eugeni.dodonov@intel.com>
+
+commit ab3951eb74e7c33a2f5b7b64d72e82f1eea61571 upstream.
+
+We should not hit this under any sane conditions, but still, this does not
+looks right.
+
+Reported-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
+CC: Chris Wilson <chris@chris-wilson.co.uk>
+CC: Daniel Vetter <daniel.vetter@ffwll.ch>
+Reviewed-by: Chris Wlison <chris@chris-wilson.co.uk>
+Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
+Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/i915/intel_display.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/i915/intel_display.c
++++ b/drivers/gpu/drm/i915/intel_display.c
+@@ -6167,7 +6167,7 @@ static int intel_gen7_queue_flip(struct
+ default:
+ WARN_ONCE(1, "unknown plane in flip command\n");
+ ret = -ENODEV;
+- goto err;
++ goto err_unpin;
+ }
+
+ ret = intel_ring_begin(ring, 4);
--- /dev/null
+From 36e4f20af833d1ce196e6a4ade05dc26c44652d1 Mon Sep 17 00:00:00 2001
+From: Michal Hocko <mhocko@suse.cz>
+Date: Mon, 8 Oct 2012 16:33:31 -0700
+Subject: hugetlb: do not use vma_hugecache_offset() for vma_prio_tree_foreach
+
+From: Michal Hocko <mhocko@suse.cz>
+
+commit 36e4f20af833d1ce196e6a4ade05dc26c44652d1 upstream.
+
+Commit 0c176d52b0b2 ("mm: hugetlb: fix pgoff computation when unmapping
+page from vma") fixed pgoff calculation but it has replaced it by
+vma_hugecache_offset() which is not approapriate for offsets used for
+vma_prio_tree_foreach() because that one expects index in page units
+rather than in huge_page_shift.
+
+Johannes said:
+
+: The resulting index may not be too big, but it can be too small: assume
+: hpage size of 2M and the address to unmap to be 0x200000. This is regular
+: page index 512 and hpage index 1. If you have a VMA that maps the file
+: only starting at the second huge page, that VMAs vm_pgoff will be 512 but
+: you ask for offset 1 and miss it even though it does map the page of
+: interest. hugetlb_cow() will try to unmap, miss the vma, and retry the
+: cow until the allocation succeeds or the skipped vma(s) go away.
+
+Signed-off-by: Michal Hocko <mhocko@suse.cz>
+Acked-by: Hillf Danton <dhillf@gmail.com>
+Cc: Mel Gorman <mel@csn.ul.ie>
+Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
+Cc: Andrea Arcangeli <aarcange@redhat.com>
+Cc: David Rientjes <rientjes@google.com>
+Acked-by: Johannes Weiner <hannes@cmpxchg.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ mm/hugetlb.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/mm/hugetlb.c
++++ b/mm/hugetlb.c
+@@ -2432,7 +2432,8 @@ static int unmap_ref_private(struct mm_s
+ * from page cache lookup which is in HPAGE_SIZE units.
+ */
+ address = address & huge_page_mask(h);
+- pgoff = vma_hugecache_offset(h, vma, address);
++ pgoff = ((address - vma->vm_start) >> PAGE_SHIFT) +
++ vma->vm_pgoff;
+ mapping = vma->vm_file->f_dentry->d_inode->i_mapping;
+
+ /*
--- /dev/null
+From 7a71932d5676b7410ab64d149bad8bde6b0d8632 Mon Sep 17 00:00:00 2001
+From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
+Date: Mon, 8 Oct 2012 16:33:47 -0700
+Subject: kpageflags: fix wrong KPF_THP on non-huge compound pages
+
+From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
+
+commit 7a71932d5676b7410ab64d149bad8bde6b0d8632 upstream.
+
+KPF_THP can be set on non-huge compound pages (like slab pages or pages
+allocated by drivers with __GFP_COMP) because PageTransCompound only
+checks PG_head and PG_tail. Obviously this is a bug and breaks user space
+applications which look for thp via /proc/kpageflags.
+
+This patch rules out setting KPF_THP wrongly by additionally checking
+PageLRU on the head pages.
+
+Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
+Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
+Acked-by: David Rientjes <rientjes@google.com>
+Reviewed-by: Fengguang Wu <fengguang.wu@intel.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/proc/page.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+--- a/fs/proc/page.c
++++ b/fs/proc/page.c
+@@ -115,7 +115,13 @@ u64 stable_page_flags(struct page *page)
+ u |= 1 << KPF_COMPOUND_TAIL;
+ if (PageHuge(page))
+ u |= 1 << KPF_HUGE;
+- else if (PageTransCompound(page))
++ /*
++ * PageTransCompound can be true for non-huge compound pages (slab
++ * pages or pages allocated by drivers with __GFP_COMP) because it
++ * just checks PG_head/PG_tail, so we need to check PageLRU to make
++ * sure a given page is a thp, not a non-huge compound page.
++ */
++ else if (PageTransCompound(page) && PageLRU(compound_trans_head(page)))
+ u |= 1 << KPF_THP;
+
+ /*
--- /dev/null
+From 65fc7f9957c52ad4fdf4ee5dfe3a75aa0a633d39 Mon Sep 17 00:00:00 2001
+From: Gabor Juhos <juhosg@openwrt.org>
+Date: Sat, 1 Sep 2012 18:46:00 +0200
+Subject: MIPS: ath79: use correct fractional dividers for {CPU,DDR}_PLL on AR934x
+
+From: Gabor Juhos <juhosg@openwrt.org>
+
+commit 65fc7f9957c52ad4fdf4ee5dfe3a75aa0a633d39 upstream.
+
+The current dividers in the code are wrong and this
+leads to broken CPU frequency calculation on boards
+where the fractional part is used.
+
+For example, if the SoC is running from a 40MHz
+reference clock, refdiv=1, nint=14, outdiv=0 and
+nfrac=31 the real frequency is 579.375MHz but the
+current code calculates 569.687MHz instead.
+
+Because the system time is indirectly related to
+the CPU frequency the broken computation causes
+drift in the system time.
+
+The correct divider is 2^6 for the CPU PLL and 2^10
+for the DDR PLL. Use the correct values to fix the
+issue.
+
+Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
+Cc: linux-mips@linux-mips.org
+Patchwork: https://patchwork.linux-mips.org/patch/4305/
+Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/mips/ath79/clock.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/arch/mips/ath79/clock.c
++++ b/arch/mips/ath79/clock.c
+@@ -189,7 +189,7 @@ static void __init ar934x_clocks_init(vo
+ AR934X_PLL_CPU_CONFIG_NFRAC_MASK;
+
+ cpu_pll = nint * ath79_ref_clk.rate / ref_div;
+- cpu_pll += frac * ath79_ref_clk.rate / (ref_div * (2 << 6));
++ cpu_pll += frac * ath79_ref_clk.rate / (ref_div * (1 << 6));
+ cpu_pll /= (1 << out_div);
+
+ pll = ath79_pll_rr(AR934X_PLL_DDR_CONFIG_REG);
+@@ -203,7 +203,7 @@ static void __init ar934x_clocks_init(vo
+ AR934X_PLL_DDR_CONFIG_NFRAC_MASK;
+
+ ddr_pll = nint * ath79_ref_clk.rate / ref_div;
+- ddr_pll += frac * ath79_ref_clk.rate / (ref_div * (2 << 10));
++ ddr_pll += frac * ath79_ref_clk.rate / (ref_div * (1 << 10));
+ ddr_pll /= (1 << out_div);
+
+ clk_ctrl = ath79_pll_rr(AR934X_PLL_CPU_DDR_CLK_CTRL_REG);
--- /dev/null
+From ec4d9f626d5908b6052c2973f37992f1db52e967 Mon Sep 17 00:00:00 2001
+From: Hugh Dickins <hughd@google.com>
+Date: Mon, 8 Oct 2012 16:33:14 -0700
+Subject: mm: fix invalidate_complete_page2() lock ordering
+
+From: Hugh Dickins <hughd@google.com>
+
+commit ec4d9f626d5908b6052c2973f37992f1db52e967 upstream.
+
+In fuzzing with trinity, lockdep protested "possible irq lock inversion
+dependency detected" when isolate_lru_page() reenabled interrupts while
+still holding the supposedly irq-safe tree_lock:
+
+invalidate_inode_pages2
+ invalidate_complete_page2
+ spin_lock_irq(&mapping->tree_lock)
+ clear_page_mlock
+ isolate_lru_page
+ spin_unlock_irq(&zone->lru_lock)
+
+isolate_lru_page() is correct to enable interrupts unconditionally:
+invalidate_complete_page2() is incorrect to call clear_page_mlock() while
+holding tree_lock, which is supposed to nest inside lru_lock.
+
+Both truncate_complete_page() and invalidate_complete_page() call
+clear_page_mlock() before taking tree_lock to remove page from radix_tree.
+ I guess invalidate_complete_page2() preferred to test PageDirty (again)
+under tree_lock before committing to the munlock; but since the page has
+already been unmapped, its state is already somewhat inconsistent, and no
+worse if clear_page_mlock() moved up.
+
+Reported-by: Sasha Levin <levinsasha928@gmail.com>
+Deciphered-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Hugh Dickins <hughd@google.com>
+Acked-by: Mel Gorman <mel@csn.ul.ie>
+Cc: Rik van Riel <riel@redhat.com>
+Cc: Johannes Weiner <hannes@cmpxchg.org>
+Cc: Michel Lespinasse <walken@google.com>
+Cc: Ying Han <yinghan@google.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ mm/truncate.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/mm/truncate.c
++++ b/mm/truncate.c
+@@ -394,11 +394,12 @@ invalidate_complete_page2(struct address
+ if (page_has_private(page) && !try_to_release_page(page, GFP_KERNEL))
+ return 0;
+
++ clear_page_mlock(page);
++
+ spin_lock_irq(&mapping->tree_lock);
+ if (PageDirty(page))
+ goto failed;
+
+- clear_page_mlock(page);
+ BUG_ON(page_has_private(page));
+ __delete_from_page_cache(page);
+ spin_unlock_irq(&mapping->tree_lock);
--- /dev/null
+From 027ef6c87853b0a9df53175063028edb4950d476 Mon Sep 17 00:00:00 2001
+From: Andrea Arcangeli <aarcange@redhat.com>
+Date: Mon, 8 Oct 2012 16:33:27 -0700
+Subject: mm: thp: fix pmd_present for split_huge_page and PROT_NONE with THP
+
+From: Andrea Arcangeli <aarcange@redhat.com>
+
+commit 027ef6c87853b0a9df53175063028edb4950d476 upstream.
+
+In many places !pmd_present has been converted to pmd_none. For pmds
+that's equivalent and pmd_none is quicker so using pmd_none is better.
+
+However (unless we delete pmd_present) we should provide an accurate
+pmd_present too. This will avoid the risk of code thinking the pmd is non
+present because it's under __split_huge_page_map, see the pmd_mknotpresent
+there and the comment above it.
+
+If the page has been mprotected as PROT_NONE, it would also lead to a
+pmd_present false negative in the same way as the race with
+split_huge_page.
+
+Because the PSE bit stays on at all times (both during split_huge_page and
+when the _PAGE_PROTNONE bit get set), we could only check for the PSE bit,
+but checking the PROTNONE bit too is still good to remember pmd_present
+must always keep PROT_NONE into account.
+
+This explains a not reproducible BUG_ON that was seldom reported on the
+lists.
+
+The same issue is in pmd_large, it would go wrong with both PROT_NONE and
+if it races with split_huge_page.
+
+Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
+Acked-by: Rik van Riel <riel@redhat.com>
+Cc: Johannes Weiner <jweiner@redhat.com>
+Cc: Hugh Dickins <hughd@google.com>
+Cc: Mel Gorman <mgorman@suse.de>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/include/asm/pgtable.h | 11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+--- a/arch/x86/include/asm/pgtable.h
++++ b/arch/x86/include/asm/pgtable.h
+@@ -146,8 +146,7 @@ static inline unsigned long pmd_pfn(pmd_
+
+ static inline int pmd_large(pmd_t pte)
+ {
+- return (pmd_flags(pte) & (_PAGE_PSE | _PAGE_PRESENT)) ==
+- (_PAGE_PSE | _PAGE_PRESENT);
++ return pmd_flags(pte) & _PAGE_PSE;
+ }
+
+ #ifdef CONFIG_TRANSPARENT_HUGEPAGE
+@@ -415,7 +414,13 @@ static inline int pte_hidden(pte_t pte)
+
+ static inline int pmd_present(pmd_t pmd)
+ {
+- return pmd_flags(pmd) & _PAGE_PRESENT;
++ /*
++ * Checking for _PAGE_PSE is needed too because
++ * split_huge_page will temporarily clear the present bit (but
++ * the _PAGE_PSE flag will remain set at all times while the
++ * _PAGE_PRESENT bit is clear).
++ */
++ return pmd_flags(pmd) & (_PAGE_PRESENT | _PAGE_PROTNONE | _PAGE_PSE);
+ }
+
+ static inline int pmd_none(pmd_t pmd)
ext4-always-set-i_op-in-ext4_mknod.patch
ext4-fix-fdatasync-for-files-with-only-i_size-changes.patch
xfrm_user-ensure-user-supplied-esn-replay-window-is-valid.patch
+asoc-wm_hubs-ensure-volume-updates-are-handled-during-class-w-startup.patch
+asoc-wm9712-fix-name-of-capture-switch.patch
+kpageflags-fix-wrong-kpf_thp-on-non-huge-compound-pages.patch
+hugetlb-do-not-use-vma_hugecache_offset-for-vma_prio_tree_foreach.patch
+mm-fix-invalidate_complete_page2-lock-ordering.patch
+mm-thp-fix-pmd_present-for-split_huge_page-and-prot_none-with-thp.patch
+mips-ath79-use-correct-fractional-dividers-for-cpu-ddr-_pll-on-ar934x.patch
+drm-i915-prevent-possible-pin-leak-on-error-path.patch
+alsa-hda-add-inverted-internal-mic-quirk-for-lenovo-ideapad-u310.patch
+alsa-aloop-add-locking-to-timer-access.patch
+alsa-hda-realtek-fix-detection-of-alc271x-codec.patch
+alsa-hda-limit-internal-mic-boost-for-asus-x202e.patch
+alsa-usb-disable-broken-hw-volume-for-tenx-tp6911.patch
+alsa-usb-support-for-original-xbox-communicator.patch