From: Greg Kroah-Hartman Date: Mon, 20 Dec 2021 12:33:23 +0000 (+0100) Subject: 4.14-stable patches X-Git-Tag: v4.4.296~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2e233b7154d9e44098fbfa343225613003a0747d;p=thirdparty%2Fkernel%2Fstable-queue.git 4.14-stable patches added patches: fuse-annotate-lock-in-fuse_reverse_inval_entry.patch scsi-scsi_debug-sanity-check-block-descriptor-length-in-resp_mode_select.patch --- diff --git a/queue-4.14/fuse-annotate-lock-in-fuse_reverse_inval_entry.patch b/queue-4.14/fuse-annotate-lock-in-fuse_reverse_inval_entry.patch new file mode 100644 index 00000000000..8f6f5aa7f26 --- /dev/null +++ b/queue-4.14/fuse-annotate-lock-in-fuse_reverse_inval_entry.patch @@ -0,0 +1,29 @@ +From bda9a71980e083699a0360963c0135657b73f47a Mon Sep 17 00:00:00 2001 +From: Miklos Szeredi +Date: Fri, 22 Oct 2021 17:03:01 +0200 +Subject: fuse: annotate lock in fuse_reverse_inval_entry() + +From: Miklos Szeredi + +commit bda9a71980e083699a0360963c0135657b73f47a upstream. + +Add missing inode lock annotatation; found by syzbot. + +Reported-and-tested-by: syzbot+9f747458f5990eaa8d43@syzkaller.appspotmail.com +Signed-off-by: Miklos Szeredi +Signed-off-by: Greg Kroah-Hartman +--- + fs/fuse/dir.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/fs/fuse/dir.c ++++ b/fs/fuse/dir.c +@@ -969,7 +969,7 @@ int fuse_reverse_inval_entry(struct supe + if (!parent) + return -ENOENT; + +- inode_lock(parent); ++ inode_lock_nested(parent, I_MUTEX_PARENT); + if (!S_ISDIR(parent->i_mode)) + goto unlock; + diff --git a/queue-4.14/scsi-scsi_debug-sanity-check-block-descriptor-length-in-resp_mode_select.patch b/queue-4.14/scsi-scsi_debug-sanity-check-block-descriptor-length-in-resp_mode_select.patch new file mode 100644 index 00000000000..d55c47aa330 --- /dev/null +++ b/queue-4.14/scsi-scsi_debug-sanity-check-block-descriptor-length-in-resp_mode_select.patch @@ -0,0 +1,68 @@ +From e0a2c28da11e2c2b963fc01d50acbf03045ac732 Mon Sep 17 00:00:00 2001 +From: George Kennedy +Date: Thu, 18 Nov 2021 14:03:28 -0500 +Subject: scsi: scsi_debug: Sanity check block descriptor length in resp_mode_select() + +From: George Kennedy + +commit e0a2c28da11e2c2b963fc01d50acbf03045ac732 upstream. + +In resp_mode_select() sanity check the block descriptor len to avoid UAF. + +BUG: KASAN: use-after-free in resp_mode_select+0xa4c/0xb40 drivers/scsi/scsi_debug.c:2509 +Read of size 1 at addr ffff888026670f50 by task scsicmd/15032 + +CPU: 1 PID: 15032 Comm: scsicmd Not tainted 5.15.0-01d0625 #15 +Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS +Call Trace: + + dump_stack_lvl+0x89/0xb5 lib/dump_stack.c:107 + print_address_description.constprop.9+0x28/0x160 mm/kasan/report.c:257 + kasan_report.cold.14+0x7d/0x117 mm/kasan/report.c:443 + __asan_report_load1_noabort+0x14/0x20 mm/kasan/report_generic.c:306 + resp_mode_select+0xa4c/0xb40 drivers/scsi/scsi_debug.c:2509 + schedule_resp+0x4af/0x1a10 drivers/scsi/scsi_debug.c:5483 + scsi_debug_queuecommand+0x8c9/0x1e70 drivers/scsi/scsi_debug.c:7537 + scsi_queue_rq+0x16b4/0x2d10 drivers/scsi/scsi_lib.c:1521 + blk_mq_dispatch_rq_list+0xb9b/0x2700 block/blk-mq.c:1640 + __blk_mq_sched_dispatch_requests+0x28f/0x590 block/blk-mq-sched.c:325 + blk_mq_sched_dispatch_requests+0x105/0x190 block/blk-mq-sched.c:358 + __blk_mq_run_hw_queue+0xe5/0x150 block/blk-mq.c:1762 + __blk_mq_delay_run_hw_queue+0x4f8/0x5c0 block/blk-mq.c:1839 + blk_mq_run_hw_queue+0x18d/0x350 block/blk-mq.c:1891 + blk_mq_sched_insert_request+0x3db/0x4e0 block/blk-mq-sched.c:474 + blk_execute_rq_nowait+0x16b/0x1c0 block/blk-exec.c:63 + sg_common_write.isra.18+0xeb3/0x2000 drivers/scsi/sg.c:837 + sg_new_write.isra.19+0x570/0x8c0 drivers/scsi/sg.c:775 + sg_ioctl_common+0x14d6/0x2710 drivers/scsi/sg.c:941 + sg_ioctl+0xa2/0x180 drivers/scsi/sg.c:1166 + __x64_sys_ioctl+0x19d/0x220 fs/ioctl.c:52 + do_syscall_64+0x3a/0x80 arch/x86/entry/common.c:50 + entry_SYSCALL_64_after_hwframe+0x44/0xae arch/x86/entry/entry_64.S:113 + +Link: https://lore.kernel.org/r/1637262208-28850-1-git-send-email-george.kennedy@oracle.com +Reported-by: syzkaller +Acked-by: Douglas Gilbert +Signed-off-by: George Kennedy +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/scsi_debug.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/scsi/scsi_debug.c ++++ b/drivers/scsi/scsi_debug.c +@@ -2181,11 +2181,11 @@ static int resp_mode_select(struct scsi_ + __func__, param_len, res); + md_len = mselect6 ? (arr[0] + 1) : (get_unaligned_be16(arr + 0) + 2); + bd_len = mselect6 ? arr[3] : get_unaligned_be16(arr + 6); +- if (md_len > 2) { ++ off = bd_len + (mselect6 ? 4 : 8); ++ if (md_len > 2 || off >= res) { + mk_sense_invalid_fld(scp, SDEB_IN_DATA, 0, -1); + return check_condition_result; + } +- off = bd_len + (mselect6 ? 4 : 8); + mpage = arr[off] & 0x3f; + ps = !!(arr[off] & 0x80); + if (ps) { diff --git a/queue-4.14/series b/queue-4.14/series index b9b20dc49c2..b9e1d12ee2d 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -31,3 +31,5 @@ libata-if-t_length-is-zero-dma-direction-should-be-dma_none.patch net-systemport-add-global-locking-for-descriptor-lifecycle.patch firmware-arm_scpi-fix-string-overflow-in-scpi-genpd-driver.patch arm-dts-imx6ull-pinfunc-fix-csi_data07__esai_tx0-pad-name.patch +fuse-annotate-lock-in-fuse_reverse_inval_entry.patch +scsi-scsi_debug-sanity-check-block-descriptor-length-in-resp_mode_select.patch