From e97b7c5d55587fd6461c8698e2d1c549ec6daa4f Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 27 Jul 2020 14:58:28 +0200 Subject: [PATCH] 4.4-stable patches added patches: revert-cifs-fix-the-target-file-was-deleted-when-rename-failed.patch staging-wlan-ng-properly-check-endpoint-types.patch --- ...-file-was-deleted-when-rename-failed.patch | 58 +++++++++++++++++++ queue-4.4/series | 2 + ...lan-ng-properly-check-endpoint-types.patch | 52 +++++++++++++++++ ...th-emu-fix-up-cmp-insn-for-clang-ias.patch | 7 +-- 4 files changed, 113 insertions(+), 6 deletions(-) create mode 100644 queue-4.4/revert-cifs-fix-the-target-file-was-deleted-when-rename-failed.patch create mode 100644 queue-4.4/staging-wlan-ng-properly-check-endpoint-types.patch diff --git a/queue-4.4/revert-cifs-fix-the-target-file-was-deleted-when-rename-failed.patch b/queue-4.4/revert-cifs-fix-the-target-file-was-deleted-when-rename-failed.patch new file mode 100644 index 00000000000..f9cf013405a --- /dev/null +++ b/queue-4.4/revert-cifs-fix-the-target-file-was-deleted-when-rename-failed.patch @@ -0,0 +1,58 @@ +From 0e6705182d4e1b77248a93470d6d7b3013d59b30 Mon Sep 17 00:00:00 2001 +From: Steve French +Date: Thu, 23 Jul 2020 14:41:29 -0500 +Subject: Revert "cifs: Fix the target file was deleted when rename failed." + +From: Steve French + +commit 0e6705182d4e1b77248a93470d6d7b3013d59b30 upstream. + +This reverts commit 9ffad9263b467efd8f8dc7ae1941a0a655a2bab2. + +Upon additional testing with older servers, it was found that +the original commit introduced a regression when using the old SMB1 +dialect and rsyncing over an existing file. + +The patch will need to be respun to address this, likely including +a larger refactoring of the SMB1 and SMB3 rename code paths to make +it less confusing and also to address some additional rename error +cases that SMB3 may be able to workaround. + +Signed-off-by: Steve French +Reported-by: Patrick Fernie +CC: Stable +Acked-by: Ronnie Sahlberg +Acked-by: Pavel Shilovsky +Acked-by: Zhang Xiaoxu +Signed-off-by: Greg Kroah-Hartman + +--- + fs/cifs/inode.c | 10 ++-------- + 1 file changed, 2 insertions(+), 8 deletions(-) + +--- a/fs/cifs/inode.c ++++ b/fs/cifs/inode.c +@@ -1737,7 +1737,6 @@ cifs_rename2(struct inode *source_dir, s + FILE_UNIX_BASIC_INFO *info_buf_target; + unsigned int xid; + int rc, tmprc; +- bool new_target = d_really_is_negative(target_dentry); + + if (flags & ~RENAME_NOREPLACE) + return -EINVAL; +@@ -1814,13 +1813,8 @@ cifs_rename2(struct inode *source_dir, s + */ + + unlink_target: +- /* +- * If the target dentry was created during the rename, try +- * unlinking it if it's not negative +- */ +- if (new_target && +- d_really_is_positive(target_dentry) && +- (rc == -EACCES || rc == -EEXIST)) { ++ /* Try unlinking the target dentry if it's not negative */ ++ if (d_really_is_positive(target_dentry) && (rc == -EACCES || rc == -EEXIST)) { + if (d_is_dir(target_dentry)) + tmprc = cifs_rmdir(target_dir, target_dentry); + else diff --git a/queue-4.4/series b/queue-4.4/series index a49273da3f4..08f932c02f1 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -23,3 +23,5 @@ regmap-dev_get_regmap_match-fix-string-comparison.patch usb-gadget-udc-gr_udc-fix-memleak-on-error-handling-.patch arm64-use-test_tsk_thread_flag-for-checking-tif_sing.patch x86-math-emu-fix-up-cmp-insn-for-clang-ias.patch +revert-cifs-fix-the-target-file-was-deleted-when-rename-failed.patch +staging-wlan-ng-properly-check-endpoint-types.patch diff --git a/queue-4.4/staging-wlan-ng-properly-check-endpoint-types.patch b/queue-4.4/staging-wlan-ng-properly-check-endpoint-types.patch new file mode 100644 index 00000000000..d75d40f773f --- /dev/null +++ b/queue-4.4/staging-wlan-ng-properly-check-endpoint-types.patch @@ -0,0 +1,52 @@ +From faaff9765664009c1c7c65551d32e9ed3b1dda8f Mon Sep 17 00:00:00 2001 +From: Rustam Kovhaev +Date: Wed, 22 Jul 2020 09:10:52 -0700 +Subject: staging: wlan-ng: properly check endpoint types + +From: Rustam Kovhaev + +commit faaff9765664009c1c7c65551d32e9ed3b1dda8f upstream. + +As syzkaller detected, wlan-ng driver does not do sanity check of +endpoints in prism2sta_probe_usb(), add check for xfer direction and type + +Reported-and-tested-by: syzbot+c2a1fa67c02faa0de723@syzkaller.appspotmail.com +Link: https://syzkaller.appspot.com/bug?extid=c2a1fa67c02faa0de723 +Signed-off-by: Rustam Kovhaev +Cc: stable +Link: https://lore.kernel.org/r/20200722161052.999754-1-rkovhaev@gmail.com +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/staging/wlan-ng/prism2usb.c | 16 +++++++++++++++- + 1 file changed, 15 insertions(+), 1 deletion(-) + +--- a/drivers/staging/wlan-ng/prism2usb.c ++++ b/drivers/staging/wlan-ng/prism2usb.c +@@ -60,11 +60,25 @@ static int prism2sta_probe_usb(struct us + const struct usb_device_id *id) + { + struct usb_device *dev; +- ++ const struct usb_endpoint_descriptor *epd; ++ const struct usb_host_interface *iface_desc = interface->cur_altsetting; + wlandevice_t *wlandev = NULL; + hfa384x_t *hw = NULL; + int result = 0; + ++ if (iface_desc->desc.bNumEndpoints != 2) { ++ result = -ENODEV; ++ goto failed; ++ } ++ ++ result = -EINVAL; ++ epd = &iface_desc->endpoint[1].desc; ++ if (!usb_endpoint_is_bulk_in(epd)) ++ goto failed; ++ epd = &iface_desc->endpoint[2].desc; ++ if (!usb_endpoint_is_bulk_out(epd)) ++ goto failed; ++ + dev = interface_to_usbdev(interface); + wlandev = create_wlan(); + if (wlandev == NULL) { diff --git a/queue-4.4/x86-math-emu-fix-up-cmp-insn-for-clang-ias.patch b/queue-4.4/x86-math-emu-fix-up-cmp-insn-for-clang-ias.patch index baac02600f8..1353589c09b 100644 --- a/queue-4.4/x86-math-emu-fix-up-cmp-insn-for-clang-ias.patch +++ b/queue-4.4/x86-math-emu-fix-up-cmp-insn-for-clang-ias.patch @@ -22,11 +22,9 @@ Reviewed-by: Nick Desaulniers Link: https://lkml.kernel.org/r/20200527135352.1198078-1-arnd@arndb.de Signed-off-by: Sasha Levin --- - arch/x86/math-emu/wm_sqrt.S | 2 +- + arch/x86/math-emu/wm_sqrt.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/arch/x86/math-emu/wm_sqrt.S b/arch/x86/math-emu/wm_sqrt.S -index d258f59564e11..3b40c98bbbd40 100644 --- a/arch/x86/math-emu/wm_sqrt.S +++ b/arch/x86/math-emu/wm_sqrt.S @@ -208,7 +208,7 @@ sqrt_stage_2_finish: @@ -38,6 +36,3 @@ index d258f59564e11..3b40c98bbbd40 100644 jnz sqrt_stage_2_error #endif /* PARANOID */ --- -2.25.1 - -- 2.47.3