From 1d3a1fa1188007c558586892a2cabc457e2d43f4 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 17 Aug 2020 12:58:50 +0200 Subject: [PATCH] 4.4-stable patches added patches: 9p-fix-memory-leak-in-v9fs_mount.patch alsa-usb-audio-work-around-streaming-quirk-for-macrosilicon-ms2109.patch --- .../9p-fix-memory-leak-in-v9fs_mount.patch | 48 +++++++++++ ...eaming-quirk-for-macrosilicon-ms2109.patch | 80 +++++++++++++++++++ queue-4.4/series | 2 + 3 files changed, 130 insertions(+) create mode 100644 queue-4.4/9p-fix-memory-leak-in-v9fs_mount.patch create mode 100644 queue-4.4/alsa-usb-audio-work-around-streaming-quirk-for-macrosilicon-ms2109.patch diff --git a/queue-4.4/9p-fix-memory-leak-in-v9fs_mount.patch b/queue-4.4/9p-fix-memory-leak-in-v9fs_mount.patch new file mode 100644 index 00000000000..cb325adaba9 --- /dev/null +++ b/queue-4.4/9p-fix-memory-leak-in-v9fs_mount.patch @@ -0,0 +1,48 @@ +From cb0aae0e31c632c407a2cab4307be85a001d4d98 Mon Sep 17 00:00:00 2001 +From: Zheng Bin +Date: Mon, 15 Jun 2020 09:21:53 +0800 +Subject: 9p: Fix memory leak in v9fs_mount + +From: Zheng Bin + +commit cb0aae0e31c632c407a2cab4307be85a001d4d98 upstream. + +v9fs_mount + v9fs_session_init + v9fs_cache_session_get_cookie + v9fs_random_cachetag -->alloc cachetag + v9ses->fscache = fscache_acquire_cookie -->maybe NULL + sb = sget -->fail, goto clunk +clunk_fid: + v9fs_session_close + if (v9ses->fscache) -->NULL + kfree(v9ses->cachetag) + +Thus memleak happens. + +Link: http://lkml.kernel.org/r/20200615012153.89538-1-zhengbin13@huawei.com +Fixes: 60e78d2c993e ("9p: Add fscache support to 9p") +Cc: # v2.6.32+ +Signed-off-by: Zheng Bin +Signed-off-by: Dominique Martinet +Signed-off-by: Greg Kroah-Hartman + +--- + fs/9p/v9fs.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +--- a/fs/9p/v9fs.c ++++ b/fs/9p/v9fs.c +@@ -457,10 +457,9 @@ void v9fs_session_close(struct v9fs_sess + } + + #ifdef CONFIG_9P_FSCACHE +- if (v9ses->fscache) { ++ if (v9ses->fscache) + v9fs_cache_session_put_cookie(v9ses); +- kfree(v9ses->cachetag); +- } ++ kfree(v9ses->cachetag); + #endif + kfree(v9ses->uname); + kfree(v9ses->aname); diff --git a/queue-4.4/alsa-usb-audio-work-around-streaming-quirk-for-macrosilicon-ms2109.patch b/queue-4.4/alsa-usb-audio-work-around-streaming-quirk-for-macrosilicon-ms2109.patch new file mode 100644 index 00000000000..837cdd8ac09 --- /dev/null +++ b/queue-4.4/alsa-usb-audio-work-around-streaming-quirk-for-macrosilicon-ms2109.patch @@ -0,0 +1,80 @@ +From 1b7ecc241a67ad6b584e071bd791a54e0cd5f097 Mon Sep 17 00:00:00 2001 +From: Hector Martin +Date: Mon, 10 Aug 2020 17:24:00 +0900 +Subject: ALSA: usb-audio: work around streaming quirk for MacroSilicon MS2109 + +From: Hector Martin + +commit 1b7ecc241a67ad6b584e071bd791a54e0cd5f097 upstream. + +Further investigation of the L-R swap problem on the MS2109 reveals that +the problem isn't that the channels are swapped, but rather that they +are swapped and also out of phase by one sample. In other words, the +issue is actually that the very first frame that comes from the hardware +is a half-frame containing only the right channel, and after that +everything becomes offset. + +So introduce a new quirk field to drop the very first 2 bytes that come +in after the format is configured and a capture stream starts. This puts +the channels in phase and in the correct order. + +Cc: stable@vger.kernel.org +Signed-off-by: Hector Martin +Link: https://lore.kernel.org/r/20200810082400.225858-1-marcan@marcan.st +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/usb/card.h | 1 + + sound/usb/pcm.c | 6 ++++++ + sound/usb/quirks.c | 3 +++ + sound/usb/stream.c | 1 + + 4 files changed, 11 insertions(+) + +--- a/sound/usb/card.h ++++ b/sound/usb/card.h +@@ -125,6 +125,7 @@ struct snd_usb_substream { + unsigned int tx_length_quirk:1; /* add length specifier to transfers */ + unsigned int fmt_type; /* USB audio format type (1-3) */ + unsigned int pkt_offset_adj; /* Bytes to drop from beginning of packets (for non-compliant devices) */ ++ unsigned int stream_offset_adj; /* Bytes to drop from beginning of stream (for non-compliant devices) */ + + unsigned int running: 1; /* running status */ + +--- a/sound/usb/pcm.c ++++ b/sound/usb/pcm.c +@@ -1302,6 +1302,12 @@ static void retire_capture_urb(struct sn + // continue; + } + bytes = urb->iso_frame_desc[i].actual_length; ++ if (subs->stream_offset_adj > 0) { ++ unsigned int adj = min(subs->stream_offset_adj, bytes); ++ cp += adj; ++ bytes -= adj; ++ subs->stream_offset_adj -= adj; ++ } + frames = bytes / stride; + if (!subs->txfr_quirk) + bytes = frames * stride; +--- a/sound/usb/quirks.c ++++ b/sound/usb/quirks.c +@@ -1122,6 +1122,9 @@ void snd_usb_set_format_quirk(struct snd + case USB_ID(0x041e, 0x3f19): /* E-Mu 0204 USB */ + set_format_emu_quirk(subs, fmt); + break; ++ case USB_ID(0x534d, 0x2109): /* MacroSilicon MS2109 */ ++ subs->stream_offset_adj = 2; ++ break; + } + } + +--- a/sound/usb/stream.c ++++ b/sound/usb/stream.c +@@ -95,6 +95,7 @@ static void snd_usb_init_substream(struc + subs->tx_length_quirk = as->chip->tx_length_quirk; + subs->speed = snd_usb_get_speed(subs->dev); + subs->pkt_offset_adj = 0; ++ subs->stream_offset_adj = 0; + + snd_usb_set_pcm_ops(as->pcm, stream); + diff --git a/queue-4.4/series b/queue-4.4/series index f0419b6571a..1ff98f5d824 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -111,3 +111,5 @@ crypto-qat-fix-double-free-in-qat_uclo_create_batch_init_list.patch fs-minix-check-return-value-of-sb_getblk.patch fs-minix-don-t-allow-getting-deleted-inodes.patch fs-minix-reject-too-large-maximum-file-size.patch +alsa-usb-audio-work-around-streaming-quirk-for-macrosilicon-ms2109.patch +9p-fix-memory-leak-in-v9fs_mount.patch -- 2.47.3