--- /dev/null
+From 83f72151352791836a1b9c1542614cc9bf71ac61 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Mon, 9 Sep 2013 10:20:48 +0200
+Subject: ALSA: hda - Add Toshiba Satellite C870 to MSI blacklist
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit 83f72151352791836a1b9c1542614cc9bf71ac61 upstream.
+
+Toshiba Satellite C870 shows interrupt problems occasionally when
+certain mixer controls like "Mic Switch" is toggled. This seems
+worked around by not using MSI.
+
+Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=833585
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/hda_intel.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/sound/pci/hda/hda_intel.c
++++ b/sound/pci/hda/hda_intel.c
+@@ -3335,6 +3335,7 @@ static struct snd_pci_quirk msi_black_li
+ SND_PCI_QUIRK(0x1043, 0x81f2, "ASUS", 0), /* Athlon64 X2 + nvidia */
+ SND_PCI_QUIRK(0x1043, 0x81f6, "ASUS", 0), /* nvidia */
+ SND_PCI_QUIRK(0x1043, 0x822d, "ASUS", 0), /* Athlon64 X2 + nvidia MCP55 */
++ SND_PCI_QUIRK(0x1179, 0xfb44, "Toshiba Satellite C870", 0), /* AMD Hudson */
+ SND_PCI_QUIRK(0x1849, 0x0888, "ASRock", 0), /* Athlon64 X2 + nvidia */
+ SND_PCI_QUIRK(0xa0a0, 0x0575, "Aopen MZ915-M", 0), /* ICH6 */
+ {}
--- /dev/null
+From 18e391862cceaf43ddb8eb5cca05e1a83abdebaa Mon Sep 17 00:00:00 2001
+From: Anssi Hannula <anssi.hannula@iki.fi>
+Date: Sun, 1 Sep 2013 14:36:47 +0300
+Subject: ALSA: hda - hdmi: Fallback to ALSA allocation when selecting CA
+
+From: Anssi Hannula <anssi.hannula@iki.fi>
+
+commit 18e391862cceaf43ddb8eb5cca05e1a83abdebaa upstream.
+
+hdmi_channel_allocation() tries to find a HDMI channel allocation that
+matches the number channels in the playback stream and contains only
+speakers that the HDMI sink has reported as available via EDID. If no
+such allocation is found, 0 (stereo audio) is used.
+
+Using CA 0 causes the audio causes the sink to discard everything except
+the first two channels (front left and front right).
+
+However, the sink may be capable of receiving more channels than it has
+speakers (and then perform downmix or discard the extra channels), in
+which case it is preferable to use a CA that contains extra channels
+than to use CA 0 which discards all the non-stereo channels.
+
+Additionally, it seems that HBR (HD) passthrough output does not work on
+Intel HDMI codecs when CA is set to 0 (possibly the codec zeroes
+channels not present in CA). This happens with all receivers that report
+a 5.1 speaker mask since a HBR stream is carried on 8 channels to the
+codec.
+
+Add a fallback in the CA selection so that the CA channel count at least
+matches the stream channel count, even if the stream contains channels
+not present in the sink speaker descriptor.
+
+Thanks to GrimGriefer at OpenELEC forums for discovering that changing
+the sink speaker mask allowed HBR output.
+
+Reported-by: GrimGriefer
+Reported-by: Ashecrow
+Reported-by: Frank Zafka <kafkaesque1978@gmail.com>
+Reported-by: Peter Frühberger <fritsch@xbmc.org>
+Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/patch_hdmi.c | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+--- a/sound/pci/hda/patch_hdmi.c
++++ b/sound/pci/hda/patch_hdmi.c
+@@ -553,6 +553,17 @@ static int hdmi_channel_allocation(struc
+ }
+ }
+
++ if (!ca) {
++ /* if there was no match, select the regular ALSA channel
++ * allocation with the matching number of channels */
++ for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) {
++ if (channels == channel_allocations[i].channels) {
++ ca = channel_allocations[i].ca_index;
++ break;
++ }
++ }
++ }
++
+ snd_print_channel_allocation(eld->info.spk_alloc, buf, sizeof(buf));
+ snd_printdd("HDMI: select CA 0x%x for %d-channel allocation: %s\n",
+ ca, channels, buf);
--- /dev/null
+From b054087dbacee30a9dddaef2c9a96312146be04e Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Mon, 2 Sep 2013 12:33:02 +0200
+Subject: ALSA: hda - Re-setup HDMI pin and audio infoframe on stream switches
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit b054087dbacee30a9dddaef2c9a96312146be04e upstream.
+
+When the transcoder:port mapping on Haswell HDMI/DP audio is changed
+during the stream playback, the sound gets lost. Typically this
+problem is seen when the user switches the graphics mode from eDP+DP
+to DP-only configuration, where CRTC 1 is used for DP in the former
+while CRTC 0 is used for the latter.
+
+The graphics controller notifies the change via the normal ELD update
+procedure, so we get the intrinsic event. For enabling the sound
+again, the HDMI audio driver needs to reset the pin and set up the
+audio infoframe again.
+
+This patch achieves it by:
+- keep the current status of channels and info frame setup in per_pin
+ struct,
+- check the reconnection in the intrinsic event handler,
+- reset the pin and the re-invoke hdmi_setup_audio_infoframe()
+ accordingly.
+
+The hdmi_setup_audio_infoframe() function has been changed, too, so
+that it can be invoked without passing the substream instance.
+
+The patch is mostly based on the work by Mengdong Lin.
+
+Cc: Mengdong Lin <mengdong.lin@intel.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/patch_hdmi.c | 41 +++++++++++++++++++++++++++++++----------
+ 1 file changed, 31 insertions(+), 10 deletions(-)
+
+--- a/sound/pci/hda/patch_hdmi.c
++++ b/sound/pci/hda/patch_hdmi.c
+@@ -67,6 +67,8 @@ struct hdmi_spec_per_pin {
+ struct delayed_work work;
+ struct snd_kcontrol *eld_ctl;
+ int repoll_count;
++ bool setup; /* the stream has been set up by prepare callback */
++ int channels; /* current number of channels */
+ bool non_pcm;
+ bool chmap_set; /* channel-map override by ALSA API? */
+ unsigned char chmap[8]; /* ALSA API channel-map */
+@@ -868,18 +870,19 @@ static bool hdmi_infoframe_uptodate(stru
+ return true;
+ }
+
+-static void hdmi_setup_audio_infoframe(struct hda_codec *codec, int pin_idx,
+- bool non_pcm,
+- struct snd_pcm_substream *substream)
++static void hdmi_setup_audio_infoframe(struct hda_codec *codec,
++ struct hdmi_spec_per_pin *per_pin,
++ bool non_pcm)
+ {
+- struct hdmi_spec *spec = codec->spec;
+- struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx);
+ hda_nid_t pin_nid = per_pin->pin_nid;
+- int channels = substream->runtime->channels;
++ int channels = per_pin->channels;
+ struct hdmi_eld *eld;
+ int ca;
+ union audio_infoframe ai;
+
++ if (!channels)
++ return;
++
+ eld = &per_pin->sink_eld;
+ if (!eld->monitor_present)
+ return;
+@@ -1263,6 +1266,7 @@ static void hdmi_present_sense(struct hd
+ eld_changed = true;
+ }
+ if (update_eld) {
++ bool old_eld_valid = pin_eld->eld_valid;
+ pin_eld->eld_valid = eld->eld_valid;
+ eld_changed = pin_eld->eld_size != eld->eld_size ||
+ memcmp(pin_eld->eld_buffer, eld->eld_buffer,
+@@ -1272,6 +1276,18 @@ static void hdmi_present_sense(struct hd
+ eld->eld_size);
+ pin_eld->eld_size = eld->eld_size;
+ pin_eld->info = eld->info;
++
++ /* Haswell-specific workaround: re-setup when the transcoder is
++ * changed during the stream playback
++ */
++ if (codec->vendor_id == 0x80862807 &&
++ eld->eld_valid && !old_eld_valid && per_pin->setup) {
++ snd_hda_codec_write(codec, pin_nid, 0,
++ AC_VERB_SET_AMP_GAIN_MUTE,
++ AMP_OUT_UNMUTE);
++ hdmi_setup_audio_infoframe(codec, per_pin,
++ per_pin->non_pcm);
++ }
+ }
+ mutex_unlock(&pin_eld->lock);
+
+@@ -1444,14 +1460,17 @@ static int generic_hdmi_playback_pcm_pre
+ hda_nid_t cvt_nid = hinfo->nid;
+ struct hdmi_spec *spec = codec->spec;
+ int pin_idx = hinfo_to_pin_index(spec, hinfo);
+- hda_nid_t pin_nid = get_pin(spec, pin_idx)->pin_nid;
++ struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx);
++ hda_nid_t pin_nid = per_pin->pin_nid;
+ bool non_pcm;
+
+ non_pcm = check_non_pcm_per_cvt(codec, cvt_nid);
++ per_pin->channels = substream->runtime->channels;
++ per_pin->setup = true;
+
+ hdmi_set_channel_count(codec, cvt_nid, substream->runtime->channels);
+
+- hdmi_setup_audio_infoframe(codec, pin_idx, non_pcm, substream);
++ hdmi_setup_audio_infoframe(codec, per_pin, non_pcm);
+
+ return hdmi_setup_stream(codec, cvt_nid, pin_nid, stream_tag, format);
+ }
+@@ -1491,6 +1510,9 @@ static int hdmi_pcm_close(struct hda_pcm
+ snd_hda_spdif_ctls_unassign(codec, pin_idx);
+ per_pin->chmap_set = false;
+ memset(per_pin->chmap, 0, sizeof(per_pin->chmap));
++
++ per_pin->setup = false;
++ per_pin->channels = 0;
+ }
+
+ return 0;
+@@ -1626,8 +1648,7 @@ static int hdmi_chmap_ctl_put(struct snd
+ per_pin->chmap_set = true;
+ memcpy(per_pin->chmap, chmap, sizeof(chmap));
+ if (prepared)
+- hdmi_setup_audio_infoframe(codec, pin_idx, per_pin->non_pcm,
+- substream);
++ hdmi_setup_audio_infoframe(codec, per_pin, per_pin->non_pcm);
+
+ return 0;
+ }
--- /dev/null
+From 026d5b07c03458f9c0ccd19c3850564a5409c325 Mon Sep 17 00:00:00 2001
+From: Felix Fietkau <nbd@openwrt.org>
+Date: Tue, 6 Aug 2013 14:18:10 +0200
+Subject: ath9k: always clear ps filter bit on new assoc
+
+From: Felix Fietkau <nbd@openwrt.org>
+
+commit 026d5b07c03458f9c0ccd19c3850564a5409c325 upstream.
+
+Otherwise in some cases, EAPOL frames might be filtered during the
+initial handshake, causing delays and assoc failures.
+
+Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+Signed-off-by: John W. Linville <linville@tuxdriver.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/net/wireless/ath/ath9k/xmit.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/net/wireless/ath/ath9k/xmit.c
++++ b/drivers/net/wireless/ath/ath9k/xmit.c
+@@ -2387,6 +2387,7 @@ void ath_tx_node_init(struct ath_softc *
+ for (acno = 0, ac = &an->ac[acno];
+ acno < IEEE80211_NUM_ACS; acno++, ac++) {
+ ac->sched = false;
++ ac->clear_ps_filter = true;
+ ac->txq = sc->tx.txq_map[acno];
+ INIT_LIST_HEAD(&ac->tid_q);
+ }
--- /dev/null
+From a1c781bb20ac1e03280e420abd47a99eb8bbdd3b Mon Sep 17 00:00:00 2001
+From: Felix Fietkau <nbd@openwrt.org>
+Date: Tue, 13 Aug 2013 12:33:28 +0200
+Subject: ath9k: avoid accessing MRC registers on single-chain devices
+
+From: Felix Fietkau <nbd@openwrt.org>
+
+commit a1c781bb20ac1e03280e420abd47a99eb8bbdd3b upstream.
+
+They are not implemented, and accessing them might trigger errors
+
+Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+Signed-off-by: John W. Linville <linville@tuxdriver.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/net/wireless/ath/ath9k/ar9003_phy.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
++++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
+@@ -1076,6 +1076,10 @@ static bool ar9003_hw_ani_control(struct
+ * is_on == 0 means MRC CCK is OFF (more noise imm)
+ */
+ bool is_on = param ? 1 : 0;
++
++ if (ah->caps.rx_chainmask == 1)
++ break;
++
+ REG_RMW_FIELD(ah, AR_PHY_MRC_CCK_CTRL,
+ AR_PHY_MRC_CCK_ENABLE, is_on);
+ REG_RMW_FIELD(ah, AR_PHY_MRC_CCK_CTRL,
--- /dev/null
+From e96542e55a2aacf4bdeccfe2f17b77c4895b4df2 Mon Sep 17 00:00:00 2001
+From: Felix Fietkau <nbd@openwrt.org>
+Date: Sat, 10 Aug 2013 15:59:15 +0200
+Subject: ath9k: fix rx descriptor related race condition
+
+From: Felix Fietkau <nbd@openwrt.org>
+
+commit e96542e55a2aacf4bdeccfe2f17b77c4895b4df2 upstream.
+
+Similar to a race condition that exists in the tx path, the hardware
+might re-read the 'next' pointer of a descriptor of the last completed
+frame. This only affects non-EDMA (pre-AR93xx) devices.
+
+To deal with this race, defer clearing and re-linking a completed rx
+descriptor until the next one has been processed.
+
+Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+Signed-off-by: John W. Linville <linville@tuxdriver.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/net/wireless/ath/ath9k/ath9k.h | 5 +----
+ drivers/net/wireless/ath/ath9k/recv.c | 17 +++++++++++++----
+ 2 files changed, 14 insertions(+), 8 deletions(-)
+
+--- a/drivers/net/wireless/ath/ath9k/ath9k.h
++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
+@@ -79,10 +79,6 @@ struct ath_config {
+ sizeof(struct ath_buf_state)); \
+ } while (0)
+
+-#define ATH_RXBUF_RESET(_bf) do { \
+- (_bf)->bf_stale = false; \
+- } while (0)
+-
+ /**
+ * enum buffer_type - Buffer type flags
+ *
+@@ -316,6 +312,7 @@ struct ath_rx {
+ struct ath_descdma rxdma;
+ struct ath_rx_edma rx_edma[ATH9K_RX_QUEUE_MAX];
+
++ struct ath_buf *buf_hold;
+ struct sk_buff *frag;
+
+ u32 ampdu_ref;
+--- a/drivers/net/wireless/ath/ath9k/recv.c
++++ b/drivers/net/wireless/ath/ath9k/recv.c
+@@ -42,8 +42,6 @@ static void ath_rx_buf_link(struct ath_s
+ struct ath_desc *ds;
+ struct sk_buff *skb;
+
+- ATH_RXBUF_RESET(bf);
+-
+ ds = bf->bf_desc;
+ ds->ds_link = 0; /* link to null */
+ ds->ds_data = bf->bf_buf_addr;
+@@ -70,6 +68,14 @@ static void ath_rx_buf_link(struct ath_s
+ sc->rx.rxlink = &ds->ds_link;
+ }
+
++static void ath_rx_buf_relink(struct ath_softc *sc, struct ath_buf *bf)
++{
++ if (sc->rx.buf_hold)
++ ath_rx_buf_link(sc, sc->rx.buf_hold);
++
++ sc->rx.buf_hold = bf;
++}
++
+ static void ath_setdefantenna(struct ath_softc *sc, u32 antenna)
+ {
+ /* XXX block beacon interrupts */
+@@ -117,7 +123,6 @@ static bool ath_rx_edma_buf_link(struct
+
+ skb = bf->bf_mpdu;
+
+- ATH_RXBUF_RESET(bf);
+ memset(skb->data, 0, ah->caps.rx_status_len);
+ dma_sync_single_for_device(sc->dev, bf->bf_buf_addr,
+ ah->caps.rx_status_len, DMA_TO_DEVICE);
+@@ -432,6 +437,7 @@ int ath_startrecv(struct ath_softc *sc)
+ if (list_empty(&sc->rx.rxbuf))
+ goto start_recv;
+
++ sc->rx.buf_hold = NULL;
+ sc->rx.rxlink = NULL;
+ list_for_each_entry_safe(bf, tbf, &sc->rx.rxbuf, list) {
+ ath_rx_buf_link(sc, bf);
+@@ -677,6 +683,9 @@ static struct ath_buf *ath_get_next_rx_b
+ }
+
+ bf = list_first_entry(&sc->rx.rxbuf, struct ath_buf, list);
++ if (bf == sc->rx.buf_hold)
++ return NULL;
++
+ ds = bf->bf_desc;
+
+ /*
+@@ -1378,7 +1387,7 @@ requeue:
+ if (edma) {
+ ath_rx_edma_buf_link(sc, qtype);
+ } else {
+- ath_rx_buf_link(sc, bf);
++ ath_rx_buf_relink(sc, bf);
+ ath9k_hw_rxena(ah);
+ }
+ } while (1);
--- /dev/null
+From 67d0cf50bd32b66eab709871714e55725ee30ce4 Mon Sep 17 00:00:00 2001
+From: "John W. Linville" <linville@tuxdriver.com>
+Date: Fri, 9 Aug 2013 13:36:21 -0400
+Subject: brcmsmac: Fix WARNING caused by lack of calls to dma_mapping_error()
+
+From: "John W. Linville" <linville@tuxdriver.com>
+
+commit 67d0cf50bd32b66eab709871714e55725ee30ce4 upstream.
+
+The driver fails to check the results of DMA mapping in twp places,
+which results in the following warning:
+
+[ 28.078515] ------------[ cut here ]------------
+[ 28.078529] WARNING: at lib/dma-debug.c:937 check_unmap+0x47e/0x930()
+[ 28.078533] bcma-pci-bridge 0000:0e:00.0: DMA-API: device driver failed to check map error[device address=0x00000000b5d60d6c] [size=1876 bytes] [mapped as
+ single]
+[ 28.078536] Modules linked in: bnep bluetooth vboxpci(O) vboxnetadp(O) vboxnetflt(O) vboxdrv(O) ipv6 b43 brcmsmac rtl8192cu rtl8192c_common rtlwifi mac802
+11 brcmutil cfg80211 snd_hda_codec_conexant rng_core snd_hda_intel kvm_amd snd_hda_codec ssb kvm mmc_core snd_pcm snd_seq snd_timer snd_seq_device snd k8temp
+ cordic joydev serio_raw hwmon sr_mod sg pcmcia pcmcia_core soundcore cdrom i2c_nforce2 i2c_core forcedeth bcma snd_page_alloc autofs4 ext4 jbd2 mbcache crc1
+6 scsi_dh_alua scsi_dh_hp_sw scsi_dh_rdac scsi_dh_emc scsi_dh ata_generic pata_amd
+[ 28.078602] CPU: 1 PID: 2570 Comm: NetworkManager Tainted: G O 3.10.0-rc7-wl+ #42
+[ 28.078605] Hardware name: Hewlett-Packard HP Pavilion dv2700 Notebook PC/30D6, BIOS F.27 11/27/2008
+[ 28.078607] 0000000000000009 ffff8800bbb03ad8 ffffffff8144f898 ffff8800bbb03b18
+[ 28.078612] ffffffff8103e1eb 0000000000000002 ffff8800b719f480 ffff8800b7b9c010
+[ 28.078617] ffffffff824204c0 ffffffff81754d57 0000000000000754 ffff8800bbb03b78
+[ 28.078622] Call Trace:
+[ 28.078624] <IRQ> [<ffffffff8144f898>] dump_stack+0x19/0x1b
+[ 28.078634] [<ffffffff8103e1eb>] warn_slowpath_common+0x6b/0xa0
+[ 28.078638] [<ffffffff8103e2c1>] warn_slowpath_fmt+0x41/0x50
+[ 28.078650] [<ffffffff8122d7ae>] check_unmap+0x47e/0x930
+[ 28.078655] [<ffffffff8122de4c>] debug_dma_unmap_page+0x5c/0x70
+[ 28.078679] [<ffffffffa04a808c>] dma64_getnextrxp+0x10c/0x190 [brcmsmac]
+[ 28.078691] [<ffffffffa04a9042>] dma_rx+0x62/0x240 [brcmsmac]
+[ 28.078707] [<ffffffffa0479101>] brcms_c_dpc+0x211/0x9d0 [brcmsmac]
+[ 28.078717] [<ffffffffa046d927>] ? brcms_dpc+0x27/0xf0 [brcmsmac]
+[ 28.078731] [<ffffffffa046d947>] brcms_dpc+0x47/0xf0 [brcmsmac]
+[ 28.078736] [<ffffffff81047dcc>] tasklet_action+0x6c/0xf0
+--snip--
+[ 28.078974] [<ffffffff813891bd>] SyS_sendmsg+0xd/0x20
+[ 28.078979] [<ffffffff81455c24>] tracesys+0xdd/0xe2
+[ 28.078982] ---[ end trace 6164d1a08148e9c8 ]---
+[ 28.078984] Mapped at:
+[ 28.078985] [<ffffffff8122c8fd>] debug_dma_map_page+0x9d/0x150
+[ 28.078989] [<ffffffffa04a9322>] dma_rxfill+0x102/0x3d0 [brcmsmac]
+[ 28.079001] [<ffffffffa047a13d>] brcms_c_init+0x87d/0x1100 [brcmsmac]
+[ 28.079010] [<ffffffffa046d851>] brcms_init+0x21/0x30 [brcmsmac]
+[ 28.079018] [<ffffffffa04786e0>] brcms_c_up+0x150/0x430 [brcmsmac]
+
+As the patch adds a new failure mechanism to dma_rxfill(). When I changed the
+comment at the start of the routine to add that information, I also polished
+the wording.
+
+Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
+Cc: Brett Rudley <brudley@broadcom.com>
+Cc: Franky (Zhenhui) Lin <frankyl@broadcom.com>
+Cc: Hante Meuleman <meuleman@broadcom.com>
+Cc: brcm80211-dev-list@broadcom.com
+Acked-by: Arend van Spriel <arend@broadcom.com>
+Signed-off-by: John W. Linville <linville@tuxdriver.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/net/wireless/brcm80211/brcmsmac/dma.c | 15 +++++++++++----
+ 1 file changed, 11 insertions(+), 4 deletions(-)
+
+--- a/drivers/net/wireless/brcm80211/brcmsmac/dma.c
++++ b/drivers/net/wireless/brcm80211/brcmsmac/dma.c
+@@ -1015,9 +1015,10 @@ static bool dma64_txidle(struct dma_info
+
+ /*
+ * post receive buffers
+- * return false is refill failed completely and ring is empty this will stall
+- * the rx dma and user might want to call rxfill again asap. This unlikely
+- * happens on memory-rich NIC, but often on memory-constrained dongle
++ * Return false if refill failed completely or dma mapping failed. The ring
++ * is empty, which will stall the rx dma and user might want to call rxfill
++ * again asap. This is unlikely to happen on a memory-rich NIC, but often on
++ * memory-constrained dongle.
+ */
+ bool dma_rxfill(struct dma_pub *pub)
+ {
+@@ -1078,6 +1079,8 @@ bool dma_rxfill(struct dma_pub *pub)
+
+ pa = dma_map_single(di->dmadev, p->data, di->rxbufsize,
+ DMA_FROM_DEVICE);
++ if (dma_mapping_error(di->dmadev, pa))
++ return false;
+
+ /* save the free packet pointer */
+ di->rxp[rxout] = p;
+@@ -1284,7 +1287,11 @@ static void dma_txenq(struct dma_info *d
+
+ /* get physical address of buffer start */
+ pa = dma_map_single(di->dmadev, data, len, DMA_TO_DEVICE);
+-
++ /* if mapping failed, free skb */
++ if (dma_mapping_error(di->dmadev, pa)) {
++ brcmu_pkt_buf_free_skb(p);
++ return;
++ }
+ /* With a DMA segment list, Descriptor table is filled
+ * using the segment list instead of looping over
+ * buffers in multi-chain DMA. Therefore, EOF for SGLIST
--- /dev/null
+From 5208386c501276df18fee464e21d3c58d2d79517 Mon Sep 17 00:00:00 2001
+From: Jan Kara <jack@suse.cz>
+Date: Sat, 17 Aug 2013 10:07:17 -0400
+Subject: ext4: simplify truncation code in ext4_setattr()
+
+From: Jan Kara <jack@suse.cz>
+
+commit 5208386c501276df18fee464e21d3c58d2d79517 upstream.
+
+Merge conditions in ext4_setattr() handling inode size changes, also
+move ext4_begin_ordered_truncate() call somewhat earlier because it
+simplifies error recovery in case of failure. Also add error handling in
+case i_disksize update fails.
+
+Signed-off-by: Jan Kara <jack@suse.cz>
+Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/ext4/inode.c | 109 +++++++++++++++++++++++++-------------------------------
+ 1 file changed, 49 insertions(+), 60 deletions(-)
+
+--- a/fs/ext4/inode.c
++++ b/fs/ext4/inode.c
+@@ -4706,7 +4706,9 @@ int ext4_setattr(struct dentry *dentry,
+ ext4_journal_stop(handle);
+ }
+
+- if (attr->ia_valid & ATTR_SIZE) {
++ if (attr->ia_valid & ATTR_SIZE && attr->ia_size != inode->i_size) {
++ handle_t *handle;
++ loff_t oldsize = inode->i_size;
+
+ if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) {
+ struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
+@@ -4714,73 +4716,60 @@ int ext4_setattr(struct dentry *dentry,
+ if (attr->ia_size > sbi->s_bitmap_maxbytes)
+ return -EFBIG;
+ }
+- }
+-
+- if (S_ISREG(inode->i_mode) &&
+- attr->ia_valid & ATTR_SIZE &&
+- (attr->ia_size < inode->i_size)) {
+- handle_t *handle;
+-
+- handle = ext4_journal_start(inode, EXT4_HT_INODE, 3);
+- if (IS_ERR(handle)) {
+- error = PTR_ERR(handle);
+- goto err_out;
+- }
+- if (ext4_handle_valid(handle)) {
+- error = ext4_orphan_add(handle, inode);
+- orphan = 1;
+- }
+- EXT4_I(inode)->i_disksize = attr->ia_size;
+- rc = ext4_mark_inode_dirty(handle, inode);
+- if (!error)
+- error = rc;
+- ext4_journal_stop(handle);
+-
+- if (ext4_should_order_data(inode)) {
+- error = ext4_begin_ordered_truncate(inode,
++ if (S_ISREG(inode->i_mode) &&
++ (attr->ia_size < inode->i_size)) {
++ if (ext4_should_order_data(inode)) {
++ error = ext4_begin_ordered_truncate(inode,
+ attr->ia_size);
+- if (error) {
+- /* Do as much error cleanup as possible */
+- handle = ext4_journal_start(inode,
+- EXT4_HT_INODE, 3);
+- if (IS_ERR(handle)) {
+- ext4_orphan_del(NULL, inode);
++ if (error)
+ goto err_out;
+- }
+- ext4_orphan_del(handle, inode);
+- orphan = 0;
+- ext4_journal_stop(handle);
++ }
++ handle = ext4_journal_start(inode, EXT4_HT_INODE, 3);
++ if (IS_ERR(handle)) {
++ error = PTR_ERR(handle);
++ goto err_out;
++ }
++ if (ext4_handle_valid(handle)) {
++ error = ext4_orphan_add(handle, inode);
++ orphan = 1;
++ }
++ EXT4_I(inode)->i_disksize = attr->ia_size;
++ rc = ext4_mark_inode_dirty(handle, inode);
++ if (!error)
++ error = rc;
++ ext4_journal_stop(handle);
++ if (error) {
++ ext4_orphan_del(NULL, inode);
+ goto err_out;
+ }
+ }
+- }
+-
+- if (attr->ia_valid & ATTR_SIZE) {
+- if (attr->ia_size != inode->i_size) {
+- loff_t oldsize = inode->i_size;
+
+- i_size_write(inode, attr->ia_size);
+- /*
+- * Blocks are going to be removed from the inode. Wait
+- * for dio in flight. Temporarily disable
+- * dioread_nolock to prevent livelock.
+- */
+- if (orphan) {
+- if (!ext4_should_journal_data(inode)) {
+- ext4_inode_block_unlocked_dio(inode);
+- inode_dio_wait(inode);
+- ext4_inode_resume_unlocked_dio(inode);
+- } else
+- ext4_wait_for_tail_page_commit(inode);
+- }
+- /*
+- * Truncate pagecache after we've waited for commit
+- * in data=journal mode to make pages freeable.
+- */
+- truncate_pagecache(inode, oldsize, inode->i_size);
++ i_size_write(inode, attr->ia_size);
++ /*
++ * Blocks are going to be removed from the inode. Wait
++ * for dio in flight. Temporarily disable
++ * dioread_nolock to prevent livelock.
++ */
++ if (orphan) {
++ if (!ext4_should_journal_data(inode)) {
++ ext4_inode_block_unlocked_dio(inode);
++ inode_dio_wait(inode);
++ ext4_inode_resume_unlocked_dio(inode);
++ } else
++ ext4_wait_for_tail_page_commit(inode);
+ }
+- ext4_truncate(inode);
++ /*
++ * Truncate pagecache after we've waited for commit
++ * in data=journal mode to make pages freeable.
++ */
++ truncate_pagecache(inode, oldsize, inode->i_size);
+ }
++ /*
++ * We want to call ext4_truncate() even if attr->ia_size ==
++ * inode->i_size for cases like truncation of fallocated space
++ */
++ if (attr->ia_valid & ATTR_SIZE)
++ ext4_truncate(inode);
+
+ if (!rc) {
+ setattr_copy(inode, attr);
--- /dev/null
+From 8c89cc17b91992845bd635813cd162fe8dfcec6e Mon Sep 17 00:00:00 2001
+From: Henrik Rydberg <rydberg@euromail.se>
+Date: Sun, 1 Sep 2013 15:31:44 +0200
+Subject: HID: Correct the USB IDs for the new Macbook Air 6
+
+From: Henrik Rydberg <rydberg@euromail.se>
+
+commit 8c89cc17b91992845bd635813cd162fe8dfcec6e upstream.
+
+A recent patch (9d9a04ee) added support for the new machine, but got
+the sequence of USB ids wrong. Reports from both Ian and Linus T show
+that the 0x0291 id is for ISO, not ANSI, which should have the missing
+number 0x0290. This patchs moves the three numbers accordingly, fixing
+the problem.
+
+Reported-and-tested-by: Ian Munsie <darkstarsword@gmail.com>
+Tested-by: Linus G Thiel <linus@hanssonlarsson.se>
+Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
+Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Signed-off-by: Jiri Kosina <jkosina@suse.cz>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/hid/hid-ids.h | 6 +++---
+ drivers/input/mouse/bcm5974.c | 6 +++---
+ 2 files changed, 6 insertions(+), 6 deletions(-)
+
+--- a/drivers/hid/hid-ids.h
++++ b/drivers/hid/hid-ids.h
+@@ -135,9 +135,9 @@
+ #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b
+ #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI 0x0255
+ #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO 0x0256
+-#define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI 0x0291
+-#define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO 0x0292
+-#define USB_DEVICE_ID_APPLE_WELLSPRING8_JIS 0x0293
++#define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI 0x0290
++#define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO 0x0291
++#define USB_DEVICE_ID_APPLE_WELLSPRING8_JIS 0x0292
+ #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a
+ #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b
+ #define USB_DEVICE_ID_APPLE_IRCONTROL 0x8240
+--- a/drivers/input/mouse/bcm5974.c
++++ b/drivers/input/mouse/bcm5974.c
+@@ -89,9 +89,9 @@
+ #define USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO 0x025a
+ #define USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS 0x025b
+ /* MacbookAir6,2 (unibody, June 2013) */
+-#define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI 0x0291
+-#define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO 0x0292
+-#define USB_DEVICE_ID_APPLE_WELLSPRING8_JIS 0x0293
++#define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI 0x0290
++#define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO 0x0291
++#define USB_DEVICE_ID_APPLE_WELLSPRING8_JIS 0x0292
+
+ #define BCM5974_DEVICE(prod) { \
+ .match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \
--- /dev/null
+From 06bb5219118fb098f4b0c7dcb484b28a52bf1c14 Mon Sep 17 00:00:00 2001
+From: Stefan Kriwanek <dev@stefankriwanek.de>
+Date: Sun, 25 Aug 2013 10:46:13 +0200
+Subject: HID: Fix Speedlink VAD Cezanne support for some devices
+
+From: Stefan Kriwanek <dev@stefankriwanek.de>
+
+commit 06bb5219118fb098f4b0c7dcb484b28a52bf1c14 upstream.
+
+Some devices of the "Speedlink VAD Cezanne" model need more aggressive fixing
+than already done.
+
+I made sure through testing that this patch would not interfere with the proper
+working of a device that is bug-free. (The driver drops EV_REL events with
+abs(val) >= 256, which are not achievable even on the highest laser resolution
+hardware setting.)
+
+Signed-off-by: Stefan Kriwanek <mail@stefankriwanek.de>
+Signed-off-by: Jiri Kosina <jkosina@suse.cz>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/hid/hid-speedlink.c | 11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+--- a/drivers/hid/hid-speedlink.c
++++ b/drivers/hid/hid-speedlink.c
+@@ -3,7 +3,7 @@
+ * Fixes "jumpy" cursor and removes nonexistent keyboard LEDS from
+ * the HID descriptor.
+ *
+- * Copyright (c) 2011 Stefan Kriwanek <mail@stefankriwanek.de>
++ * Copyright (c) 2011, 2013 Stefan Kriwanek <dev@stefankriwanek.de>
+ */
+
+ /*
+@@ -46,8 +46,13 @@ static int speedlink_event(struct hid_de
+ struct hid_usage *usage, __s32 value)
+ {
+ /* No other conditions due to usage_table. */
+- /* Fix "jumpy" cursor (invalid events sent by device). */
+- if (value == 256)
++
++ /* This fixes the "jumpy" cursor occuring due to invalid events sent
++ * by the device. Some devices only send them with value==+256, others
++ * don't. However, catching abs(value)>=256 is restrictive enough not
++ * to interfere with devices that were bug-free (has been tested).
++ */
++ if (abs(value) >= 256)
+ return 1;
+ /* Drop useless distance 0 events (on button clicks etc.) as well */
+ if (value == 0)
--- /dev/null
+From 412f30105ec6735224535791eed5cdc02888ecb4 Mon Sep 17 00:00:00 2001
+From: Kees Cook <keescook@chromium.org>
+Date: Wed, 28 Aug 2013 22:30:49 +0200
+Subject: HID: pantherlord: validate output report details
+
+From: Kees Cook <keescook@chromium.org>
+
+commit 412f30105ec6735224535791eed5cdc02888ecb4 upstream.
+
+A HID device could send a malicious output report that would cause the
+pantherlord HID driver to write beyond the output report allocation
+during initialization, causing a heap overflow:
+
+[ 310.939483] usb 1-1: New USB device found, idVendor=0e8f, idProduct=0003
+...
+[ 315.980774] BUG kmalloc-192 (Tainted: G W ): Redzone overwritten
+
+CVE-2013-2892
+
+Signed-off-by: Kees Cook <keescook@chromium.org>
+Signed-off-by: Jiri Kosina <jkosina@suse.cz>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/hid/hid-pl.c | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+--- a/drivers/hid/hid-pl.c
++++ b/drivers/hid/hid-pl.c
+@@ -132,8 +132,14 @@ static int plff_init(struct hid_device *
+ strong = &report->field[0]->value[2];
+ weak = &report->field[0]->value[3];
+ debug("detected single-field device");
+- } else if (report->maxfield >= 4 && report->field[0]->maxusage == 1 &&
+- report->field[0]->usage[0].hid == (HID_UP_LED | 0x43)) {
++ } else if (report->field[0]->maxusage == 1 &&
++ report->field[0]->usage[0].hid ==
++ (HID_UP_LED | 0x43) &&
++ report->maxfield >= 4 &&
++ report->field[0]->report_count >= 1 &&
++ report->field[1]->report_count >= 1 &&
++ report->field[2]->report_count >= 1 &&
++ report->field[3]->report_count >= 1) {
+ report->field[0]->value[0] = 0x00;
+ report->field[1]->value[0] = 0x00;
+ strong = &report->field[2]->value[0];
--- /dev/null
+From 05d3534a321d7fe4524b3b83bb20318282f3ec2c Mon Sep 17 00:00:00 2001
+From: Boris BREZILLON <b.brezillon@overkiz.com>
+Date: Tue, 27 Aug 2013 15:19:21 +0200
+Subject: pinctrl: at91: fix get_pullup/down function return
+
+From: Boris BREZILLON <b.brezillon@overkiz.com>
+
+commit 05d3534a321d7fe4524b3b83bb20318282f3ec2c upstream.
+
+In PIO_PUSR and PIO_PPDSR register if a given bit is set 1 this means the
+pullup/down for this pin (pin is represented as a bit position) is
+disabled.
+
+Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
+Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/pinctrl/pinctrl-at91.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/pinctrl/pinctrl-at91.c
++++ b/drivers/pinctrl/pinctrl-at91.c
+@@ -325,7 +325,7 @@ static void at91_mux_disable_interrupt(v
+
+ static unsigned at91_mux_get_pullup(void __iomem *pio, unsigned pin)
+ {
+- return (readl_relaxed(pio + PIO_PUSR) >> pin) & 0x1;
++ return !((readl_relaxed(pio + PIO_PUSR) >> pin) & 0x1);
+ }
+
+ static void at91_mux_set_pullup(void __iomem *pio, unsigned mask, bool on)
+@@ -445,7 +445,7 @@ static void at91_mux_pio3_set_debounce(v
+
+ static bool at91_mux_pio3_get_pulldown(void __iomem *pio, unsigned pin)
+ {
+- return (__raw_readl(pio + PIO_PPDSR) >> pin) & 0x1;
++ return !((__raw_readl(pio + PIO_PPDSR) >> pin) & 0x1);
+ }
+
+ static void at91_mux_pio3_set_pulldown(void __iomem *pio, unsigned mask, bool is_on)
x86-amd_nb-clarify-f15h-model-30h-gart-and-l3-support.patch
x86-mce-pay-no-attention-to-f-bit-in-mcacod-when-parsing-uc-errors.patch
sched-x86-optimize-switch_mm-for-multi-threaded-workloads.patch
+alsa-hda-re-setup-hdmi-pin-and-audio-infoframe-on-stream-switches.patch
+alsa-hda-hdmi-fallback-to-alsa-allocation-when-selecting-ca.patch
+alsa-hda-add-toshiba-satellite-c870-to-msi-blacklist.patch
+pinctrl-at91-fix-get_pullup-down-function-return.patch
+ext4-simplify-truncation-code-in-ext4_setattr.patch
+brcmsmac-fix-warning-caused-by-lack-of-calls-to-dma_mapping_error.patch
+ath9k-always-clear-ps-filter-bit-on-new-assoc.patch
+ath9k-fix-rx-descriptor-related-race-condition.patch
+ath9k-avoid-accessing-mrc-registers-on-single-chain-devices.patch
+hid-correct-the-usb-ids-for-the-new-macbook-air-6.patch
+hid-pantherlord-validate-output-report-details.patch
+hid-fix-speedlink-vad-cezanne-support-for-some-devices.patch