From: Greg Kroah-Hartman Date: Sun, 15 Dec 2019 17:15:53 +0000 (+0100) Subject: 4.9-stable patches X-Git-Tag: v5.4.4~58 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0af937dcd177d75f62d9a6498c64fc54f596106a;p=thirdparty%2Fkernel%2Fstable-queue.git 4.9-stable patches added patches: ext2-check-err-when-partial-null.patch powerpc-allow-64bit-vdso-__kernel_sync_dicache-to-work-across-ranges-4gb.patch quota-check-that-quota-is-not-dirty-before-release.patch quota-fix-livelock-in-dquot_writeback_dquots.patch video-hdmi-fix-avi-bar-unpack.patch --- diff --git a/queue-4.9/ext2-check-err-when-partial-null.patch b/queue-4.9/ext2-check-err-when-partial-null.patch new file mode 100644 index 00000000000..170aa500bd7 --- /dev/null +++ b/queue-4.9/ext2-check-err-when-partial-null.patch @@ -0,0 +1,41 @@ +From e705f4b8aa27a59f8933e8f384e9752f052c469c Mon Sep 17 00:00:00 2001 +From: Chengguang Xu +Date: Tue, 5 Nov 2019 12:51:00 +0800 +Subject: ext2: check err when partial != NULL + +From: Chengguang Xu + +commit e705f4b8aa27a59f8933e8f384e9752f052c469c upstream. + +Check err when partial == NULL is meaningless because +partial == NULL means getting branch successfully without +error. + +CC: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20191105045100.7104-1-cgxu519@mykernel.net +Signed-off-by: Chengguang Xu +Signed-off-by: Jan Kara +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ext2/inode.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +--- a/fs/ext2/inode.c ++++ b/fs/ext2/inode.c +@@ -697,10 +697,13 @@ static int ext2_get_blocks(struct inode + if (!partial) { + count++; + mutex_unlock(&ei->truncate_mutex); +- if (err) +- goto cleanup; + goto got_it; + } ++ ++ if (err) { ++ mutex_unlock(&ei->truncate_mutex); ++ goto cleanup; ++ } + } + + /* diff --git a/queue-4.9/powerpc-allow-64bit-vdso-__kernel_sync_dicache-to-work-across-ranges-4gb.patch b/queue-4.9/powerpc-allow-64bit-vdso-__kernel_sync_dicache-to-work-across-ranges-4gb.patch new file mode 100644 index 00000000000..c19e24016c9 --- /dev/null +++ b/queue-4.9/powerpc-allow-64bit-vdso-__kernel_sync_dicache-to-work-across-ranges-4gb.patch @@ -0,0 +1,46 @@ +From f9ec11165301982585e5e5f606739b5bae5331f3 Mon Sep 17 00:00:00 2001 +From: Alastair D'Silva +Date: Mon, 4 Nov 2019 13:32:54 +1100 +Subject: powerpc: Allow 64bit VDSO __kernel_sync_dicache to work across ranges >4GB + +From: Alastair D'Silva + +commit f9ec11165301982585e5e5f606739b5bae5331f3 upstream. + +When calling __kernel_sync_dicache with a size >4GB, we were masking +off the upper 32 bits, so we would incorrectly flush a range smaller +than intended. + +This patch replaces the 32 bit shifts with 64 bit ones, so that +the full size is accounted for. + +Signed-off-by: Alastair D'Silva +Cc: stable@vger.kernel.org +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20191104023305.9581-3-alastair@au1.ibm.com +Signed-off-by: Greg Kroah-Hartman + +--- + arch/powerpc/kernel/vdso64/cacheflush.S | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/powerpc/kernel/vdso64/cacheflush.S ++++ b/arch/powerpc/kernel/vdso64/cacheflush.S +@@ -39,7 +39,7 @@ V_FUNCTION_BEGIN(__kernel_sync_dicache) + subf r8,r6,r4 /* compute length */ + add r8,r8,r5 /* ensure we get enough */ + lwz r9,CFG_DCACHE_LOGBLOCKSZ(r10) +- srw. r8,r8,r9 /* compute line count */ ++ srd. r8,r8,r9 /* compute line count */ + crclr cr0*4+so + beqlr /* nothing to do? */ + mtctr r8 +@@ -56,7 +56,7 @@ V_FUNCTION_BEGIN(__kernel_sync_dicache) + subf r8,r6,r4 /* compute length */ + add r8,r8,r5 + lwz r9,CFG_ICACHE_LOGBLOCKSZ(r10) +- srw. r8,r8,r9 /* compute line count */ ++ srd. r8,r8,r9 /* compute line count */ + crclr cr0*4+so + beqlr /* nothing to do? */ + mtctr r8 diff --git a/queue-4.9/quota-check-that-quota-is-not-dirty-before-release.patch b/queue-4.9/quota-check-that-quota-is-not-dirty-before-release.patch new file mode 100644 index 00000000000..d9086e1ec6e --- /dev/null +++ b/queue-4.9/quota-check-that-quota-is-not-dirty-before-release.patch @@ -0,0 +1,85 @@ +From df4bb5d128e2c44848aeb36b7ceceba3ac85080d Mon Sep 17 00:00:00 2001 +From: Dmitry Monakhov +Date: Thu, 31 Oct 2019 10:39:20 +0000 +Subject: quota: Check that quota is not dirty before release + +From: Dmitry Monakhov + +commit df4bb5d128e2c44848aeb36b7ceceba3ac85080d upstream. + +There is a race window where quota was redirted once we drop dq_list_lock inside dqput(), +but before we grab dquot->dq_lock inside dquot_release() + +TASK1 TASK2 (chowner) +->dqput() + we_slept: + spin_lock(&dq_list_lock) + if (dquot_dirty(dquot)) { + spin_unlock(&dq_list_lock); + dquot->dq_sb->dq_op->write_dquot(dquot); + goto we_slept + if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) { + spin_unlock(&dq_list_lock); + dquot->dq_sb->dq_op->release_dquot(dquot); + dqget() + mark_dquot_dirty() + dqput() + goto we_slept; + } +So dquot dirty quota will be released by TASK1, but on next we_sleept loop +we detect this and call ->write_dquot() for it. +XFSTEST: https://github.com/dmonakhov/xfstests/commit/440a80d4cbb39e9234df4d7240aee1d551c36107 + +Link: https://lore.kernel.org/r/20191031103920.3919-2-dmonakhov@openvz.org +CC: stable@vger.kernel.org +Signed-off-by: Dmitry Monakhov +Signed-off-by: Jan Kara +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ocfs2/quota_global.c | 2 +- + fs/quota/dquot.c | 2 +- + include/linux/quotaops.h | 10 ++++++++++ + 3 files changed, 12 insertions(+), 2 deletions(-) + +--- a/fs/ocfs2/quota_global.c ++++ b/fs/ocfs2/quota_global.c +@@ -714,7 +714,7 @@ static int ocfs2_release_dquot(struct dq + + mutex_lock(&dquot->dq_lock); + /* Check whether we are not racing with some other dqget() */ +- if (atomic_read(&dquot->dq_count) > 1) ++ if (dquot_is_busy(dquot)) + goto out; + /* Running from downconvert thread? Postpone quota processing to wq */ + if (current == osb->dc_task) { +--- a/fs/quota/dquot.c ++++ b/fs/quota/dquot.c +@@ -479,7 +479,7 @@ int dquot_release(struct dquot *dquot) + + mutex_lock(&dquot->dq_lock); + /* Check whether we are not racing with some other dqget() */ +- if (atomic_read(&dquot->dq_count) > 1) ++ if (dquot_is_busy(dquot)) + goto out_dqlock; + mutex_lock(&dqopt->dqio_mutex); + if (dqopt->ops[dquot->dq_id.type]->release_dqblk) { +--- a/include/linux/quotaops.h ++++ b/include/linux/quotaops.h +@@ -54,6 +54,16 @@ static inline struct dquot *dqgrab(struc + atomic_inc(&dquot->dq_count); + return dquot; + } ++ ++static inline bool dquot_is_busy(struct dquot *dquot) ++{ ++ if (test_bit(DQ_MOD_B, &dquot->dq_flags)) ++ return true; ++ if (atomic_read(&dquot->dq_count) > 1) ++ return true; ++ return false; ++} ++ + void dqput(struct dquot *dquot); + int dquot_scan_active(struct super_block *sb, + int (*fn)(struct dquot *dquot, unsigned long priv), diff --git a/queue-4.9/quota-fix-livelock-in-dquot_writeback_dquots.patch b/queue-4.9/quota-fix-livelock-in-dquot_writeback_dquots.patch new file mode 100644 index 00000000000..9d9e17534e0 --- /dev/null +++ b/queue-4.9/quota-fix-livelock-in-dquot_writeback_dquots.patch @@ -0,0 +1,49 @@ +From 6ff33d99fc5c96797103b48b7b0902c296f09c05 Mon Sep 17 00:00:00 2001 +From: Dmitry Monakhov +Date: Thu, 31 Oct 2019 10:39:19 +0000 +Subject: quota: fix livelock in dquot_writeback_dquots + +From: Dmitry Monakhov + +commit 6ff33d99fc5c96797103b48b7b0902c296f09c05 upstream. + +Write only quotas which are dirty at entry. + +XFSTEST: https://github.com/dmonakhov/xfstests/commit/b10ad23566a5bf75832a6f500e1236084083cddc + +Link: https://lore.kernel.org/r/20191031103920.3919-1-dmonakhov@openvz.org +CC: stable@vger.kernel.org +Signed-off-by: Konstantin Khlebnikov +Signed-off-by: Dmitry Monakhov +Signed-off-by: Jan Kara +Signed-off-by: Greg Kroah-Hartman + +--- + fs/quota/dquot.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +--- a/fs/quota/dquot.c ++++ b/fs/quota/dquot.c +@@ -611,7 +611,7 @@ EXPORT_SYMBOL(dquot_scan_active); + /* Write all dquot structures to quota files */ + int dquot_writeback_dquots(struct super_block *sb, int type) + { +- struct list_head *dirty; ++ struct list_head dirty; + struct dquot *dquot; + struct quota_info *dqopt = sb_dqopt(sb); + int cnt; +@@ -624,9 +624,10 @@ int dquot_writeback_dquots(struct super_ + if (!sb_has_quota_active(sb, cnt)) + continue; + spin_lock(&dq_list_lock); +- dirty = &dqopt->info[cnt].dqi_dirty_list; +- while (!list_empty(dirty)) { +- dquot = list_first_entry(dirty, struct dquot, ++ /* Move list away to avoid livelock. */ ++ list_replace_init(&dqopt->info[cnt].dqi_dirty_list, &dirty); ++ while (!list_empty(&dirty)) { ++ dquot = list_first_entry(&dirty, struct dquot, + dq_dirty); + /* Dirty and inactive can be only bad dquot... */ + if (!test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) { diff --git a/queue-4.9/series b/queue-4.9/series index 3e0e3060cad..10f15e2dfec 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -140,3 +140,8 @@ pinctrl-samsung-fix-device-node-refcount-leaks-in-s3c24xx-wakeup-controller-init pinctrl-samsung-fix-device-node-refcount-leaks-in-init-code.patch mmc-host-omap_hsmmc-add-code-for-special-init-of-wl1251-to-get-rid-of-pandora_wl1251_init_card.patch ppdev-fix-ppgettime-ppsettime-ioctls.patch +powerpc-allow-64bit-vdso-__kernel_sync_dicache-to-work-across-ranges-4gb.patch +video-hdmi-fix-avi-bar-unpack.patch +quota-check-that-quota-is-not-dirty-before-release.patch +ext2-check-err-when-partial-null.patch +quota-fix-livelock-in-dquot_writeback_dquots.patch diff --git a/queue-4.9/video-hdmi-fix-avi-bar-unpack.patch b/queue-4.9/video-hdmi-fix-avi-bar-unpack.patch new file mode 100644 index 00000000000..847387ce4fd --- /dev/null +++ b/queue-4.9/video-hdmi-fix-avi-bar-unpack.patch @@ -0,0 +1,50 @@ +From 6039f37dd6b76641198e290f26b31c475248f567 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= +Date: Thu, 19 Sep 2019 16:28:53 +0300 +Subject: video/hdmi: Fix AVI bar unpack +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Ville Syrjälä + +commit 6039f37dd6b76641198e290f26b31c475248f567 upstream. + +The bar values are little endian, not big endian. The pack +function did it right but the unpack got it wrong. Fix it. + +Cc: stable@vger.kernel.org +Cc: linux-media@vger.kernel.org +Cc: Martin Bugge +Cc: Hans Verkuil +Cc: Thierry Reding +Cc: Mauro Carvalho Chehab +Fixes: 2c676f378edb ("[media] hdmi: added unpack and logging functions for InfoFrames") +Signed-off-by: Ville Syrjälä +Link: https://patchwork.freedesktop.org/patch/msgid/20190919132853.30954-1-ville.syrjala@linux.intel.com +Reviewed-by: Thierry Reding +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/video/hdmi.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/drivers/video/hdmi.c ++++ b/drivers/video/hdmi.c +@@ -1032,12 +1032,12 @@ static int hdmi_avi_infoframe_unpack(str + if (ptr[0] & 0x10) + frame->active_aspect = ptr[1] & 0xf; + if (ptr[0] & 0x8) { +- frame->top_bar = (ptr[5] << 8) + ptr[6]; +- frame->bottom_bar = (ptr[7] << 8) + ptr[8]; ++ frame->top_bar = (ptr[6] << 8) | ptr[5]; ++ frame->bottom_bar = (ptr[8] << 8) | ptr[7]; + } + if (ptr[0] & 0x4) { +- frame->left_bar = (ptr[9] << 8) + ptr[10]; +- frame->right_bar = (ptr[11] << 8) + ptr[12]; ++ frame->left_bar = (ptr[10] << 8) | ptr[9]; ++ frame->right_bar = (ptr[12] << 8) | ptr[11]; + } + frame->scan_mode = ptr[0] & 0x3; +