cifs: CIFS_ENUMERATE_SNAPSHOTS fixes
Subsystems (2)
cover cifs: CIFS_ENUMERATE_SNAPSHOTS fixes
A couple of one line fixes for the new CIFS_ENUMERATE_SNAPSHOTS functionality.
fs/cifs/ioctl.c | 2 ++ fs/cifs/smb2ops.c | 1 + 2 files changed, 3 insertions(+)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/2 cifs: fix CIFS_ENUMERATE_SNAPSHOTS oops
As with 618763958b22, an open directory may have a NULL private_data pointer prior to readdir. CIFS_ENUMERATE_SNAPSHOTS must check for this before dereference.
--- fs/cifs/ioctl.c | 2 ++ 1 file changed, 2 insertions(+)
fs/cifs/ioctl.c +2 -0
@@ -213,6 +213,8 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) rc =smb_mnt_get_fsinfo (xid, tcon, (void __user *)arg);break ;case CIFS_ENUMERATE_SNAPSHOTS : +if (pSMBFile ==NULL ) +break ;if (arg ==0 ) { rc = -EINVAL ; goto cifs_ioc_exit;
Signature · 1 line
2.12.0
PATCH 2/2 cifs: fix leak in FSCTL_ENUM_SNAPS response handling
In reply to a message not in the archiveThe server may respond with success, and an output buffer less than sizeof(struct smb_snapshot_array) in length. Do not leak the output buffer in this case.
--- fs/cifs/smb2ops.c | 1 + 1 file changed, 1 insertion(+)
fs/cifs/smb2ops.c +1 -0
@@ -942,6 +942,7 @@ smb3_enum_snapshots(const unsigned int xid, struct cifs_tcon *tcon, }if (snapshot_in.snapshot_array_size <sizeof (struct smb_snapshot_array )) { rc = -ERANGE ; +kfree (retbuf);return rc; }
Signature · 1 line
2.12.0
Steve French
Appliedmerged into cifs-2.6.git for-next
thx!
Quoted 11 lines · David Disseldorp
A couple of one line fixes for the new
CIFS_ENUMERATE_SNAPSHOTSfunctionality.fs/cifs/ioctl.c | 2 ++ fs/cifs/smb2ops.c | 1 + 2 files changed, 3 insertions(+)--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 3 lines
Thanks, Steve
Quoted 6 lines · David Disseldorp
A couple of one line fixes for the new
CIFS_ENUMERATE_SNAPSHOTSfunctionality.fs/cifs/ioctl.c | 2 ++ fs/cifs/smb2ops.c | 1 + 2 files changed, 3 insertions(+)
FWIW, below is the xfstests based reproducer that I used to trip the CIFS_ENUMERATE_SNAPSHOTS and CIFS_IOC_GET_MNT_INFO bugs. It can be run against file and dir paths on a cifs.ko mount.
As discussed with Steve, it'd probably make sense to add some sort of xfs_io like helper to cifs-utils, to avoid polluting xfstests with these things (cloner could also go).
Cheers, David
Quoted 1 line
From
4df1ea0e254b9b394a49606f82717302bb7fadbcMon Sep 17 00:00:00 2001
From: David Disseldorp <[email protected]>
Date: Fri, 5 May 2017 13:22:39 +0200
Subject: [PATCH] src/shot: cifs snapshot ioctl helper
--- src/Makefile | 2 +- src/shot.c | 188 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 189 insertions(+), 1 deletion(-) create mode 100644 src/shot.c
src/Makefile +1 -1
@@ -22,7 +22,7 @@ LINUX_TARGETS = xfsctl bstat t_mtab getdevicesize preallo_rw_pattern_reader \ seek_copy_test t_readdir_1 t_readdir_2 fsync-tester nsexec cloner \ renameat2 t_getcwd e4compact test-nextquota punch-alternating \ attr-list-by-handle-cursor-test listxattr dio-interleaved t_dir_type \ - dio-invalidate-cache stat_test + dio-invalidate-cache stat_test shot SUBDIRS =
src/shot.c new file +188 -0
188 lines not on this page · raw message
Signature · 1 line
2.12.0