<feed xmlns='http://www.w3.org/2005/Atom'>
<title>wireguard-linux/fs/cifs/readdir.c, branch jd/unified-crypt-queue</title>
<subtitle>WireGuard for the Linux kernel</subtitle>
<id>https://git.zx2c4.com/wireguard-linux/atom/fs/cifs/readdir.c?h=jd%2Funified-crypt-queue</id>
<link rel='self' href='https://git.zx2c4.com/wireguard-linux/atom/fs/cifs/readdir.c?h=jd%2Funified-crypt-queue'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/'/>
<updated>2020-04-09T18:28:24Z</updated>
<entry>
<title>smb3: change noisy error message to FYI</title>
<updated>2020-04-09T18:28:24Z</updated>
<author>
<name>Steve French</name>
<email>stfrench@microsoft.com</email>
</author>
<published>2020-04-09T06:07:38Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=1dc94b7381bd5f71aa417487abaf3bd3d70938c4'/>
<id>urn:sha1:1dc94b7381bd5f71aa417487abaf3bd3d70938c4</id>
<content type='text'>
The noisy posix error message in readdir was supposed
to be an FYI (not enabled by default)
  CIFS VFS: XXX dev 66306, reparse 0, mode 755

Signed-off-by: Steve French &lt;stfrench@microsoft.com&gt;
Reviewed-by: Aurelien Aptel &lt;aaptel@suse.com&gt;
</content>
</entry>
<entry>
<title>cifs: plumb smb2 POSIX dir enumeration</title>
<updated>2020-03-23T03:49:09Z</updated>
<author>
<name>Aurelien Aptel</name>
<email>aaptel@suse.com</email>
</author>
<published>2020-02-08T14:50:58Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=3d519bd1269f1f439db818e04252022ecffdef51'/>
<id>urn:sha1:3d519bd1269f1f439db818e04252022ecffdef51</id>
<content type='text'>
* add code to request POSIX info level
* parse dir entries and fill cifs_fattr to get correct inode data

since the POSIX payload is variable size the number of entries in a
FIND response needs to be computed differently.

Dirs and regular files are properly reported along with mode bits,
hardlink number, c/m/atime. No special files yet (see below).

Current experimental version of Samba with the extension unfortunately
has issues with wildcards and needs the following patch:

&gt; --- i/source3/smbd/smb2_query_directory.c
&gt; +++ w/source3/smbd/smb2_query_directory.c
&gt; @@ -397,9 +397,7 @@ smbd_smb2_query_directory_send(TALLOC_CTX
&gt; *mem_ctx,
&gt; 		}
&gt; 	}
&gt;
&gt; -       if (!state-&gt;smbreq-&gt;posix_pathnames) {
&gt; 		wcard_has_wild = ms_has_wild(state-&gt;in_file_name);
&gt; -       }
&gt;
&gt; 	/* Ensure we've canonicalized any search path if not a wildcard. */
&gt; 	if (!wcard_has_wild) {
&gt;

Also for special files despite reporting them as reparse point samba
doesn't set the reparse tag field. This patch will mark them as needing
re-evaluation but the re-evaluate code doesn't deal with it yet.

Signed-off-by: Aurelien Aptel &lt;aaptel@suse.com&gt;
Signed-off-by: Steve French &lt;stfrench@microsoft.com&gt;
</content>
</entry>
<entry>
<title>cifs: fix mode bits from dir listing when mounted with modefromsid</title>
<updated>2020-02-06T23:19:38Z</updated>
<author>
<name>Aurelien Aptel</name>
<email>aaptel@suse.com</email>
</author>
<published>2020-02-06T17:16:55Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=e3e056c35108661e418c803adfc054bf683426e7'/>
<id>urn:sha1:e3e056c35108661e418c803adfc054bf683426e7</id>
<content type='text'>
When mounting with -o modefromsid, the mode bits are stored in an
ACE. Directory enumeration (e.g. ls -l /mnt) triggers an SMB Query Dir
which does not include ACEs in its response. The mode bits in this
case are silently set to a default value of 755 instead.

This patch marks the dentry created during the directory enumeration
as needing re-evaluation (i.e. additional Query Info with ACEs) so
that the mode bits can be properly extracted.

Quick repro:

$ mount.cifs //win19.test/data /mnt -o ...,modefromsid
$ touch /mnt/foo &amp;&amp; chmod 751 /mnt/foo
$ stat /mnt/foo
  # reports 751 (OK)
$ sleep 2
  # dentry older than 1s by default get invalidated
$ ls -l /mnt
  # since dentry invalid, ls does a Query Dir
  # and reports foo as 755 (WRONG)

Signed-off-by: Aurelien Aptel &lt;aaptel@suse.com&gt;
Signed-off-by: Steve French &lt;stfrench@microsoft.com&gt;
CC: Stable &lt;stable@vger.kernel.org&gt;
Reviewed-by: Pavel Shilovsky &lt;pshilov@microsoft.com&gt;
</content>
</entry>
<entry>
<title>cifs: Optimize readdir on reparse points</title>
<updated>2019-12-23T15:04:44Z</updated>
<author>
<name>Paulo Alcantara (SUSE)</name>
<email>pc@cjr.nz</email>
</author>
<published>2019-12-18T21:11:37Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=046aca3c25fd28da591f59a2dc1a01848e81e0b2'/>
<id>urn:sha1:046aca3c25fd28da591f59a2dc1a01848e81e0b2</id>
<content type='text'>
When listing a directory with thounsands of files and most of them are
reparse points, we simply marked all those dentries for revalidation
and then sending additional (compounded) create/getinfo/close requests
for each of them.

Instead, upon receiving a response from an SMB2_QUERY_DIRECTORY
(FileIdFullDirectoryInformation) command, the directory entries that
have a file attribute of FILE_ATTRIBUTE_REPARSE_POINT will contain an
EaSize field with a reparse tag in it, so we parse it and mark the
dentry for revalidation only if it is a DFS or a symlink.

Signed-off-by: Paulo Alcantara (SUSE) &lt;pc@cjr.nz&gt;
Reviewed-by: Pavel Shilovsky &lt;pshilov@microsoft.com&gt;
Signed-off-by: Steve French &lt;stfrench@microsoft.com&gt;
</content>
</entry>
<entry>
<title>cifs: check ntwrk_buf_start for NULL before dereferencing it</title>
<updated>2018-12-24T04:41:31Z</updated>
<author>
<name>Ronnie Sahlberg</name>
<email>lsahlber@redhat.com</email>
</author>
<published>2018-12-12T22:06:16Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=59a63e479ce36a3f24444c3a36efe82b78e4a8e0'/>
<id>urn:sha1:59a63e479ce36a3f24444c3a36efe82b78e4a8e0</id>
<content type='text'>
RHBZ: 1021460

There is an issue where when multiple threads open/close the same directory
ntwrk_buf_start might end up being NULL, causing the call to smbCalcSize
later to oops with a NULL deref.

The real bug is why this happens and why this can become NULL for an
open cfile, which should not be allowed.
This patch tries to avoid a oops until the time when we fix the underlying
issue.

Signed-off-by: Ronnie Sahlberg &lt;lsahlber@redhat.com&gt;
Signed-off-by: Steve French &lt;stfrench@microsoft.com&gt;
</content>
</entry>
<entry>
<title>cifs: prevent integer overflow in nxt_dir_entry()</title>
<updated>2018-09-12T14:27:57Z</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2018-09-06T09:47:51Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=8ad8aa353524d89fa2e09522f3078166ff78ec42'/>
<id>urn:sha1:8ad8aa353524d89fa2e09522f3078166ff78ec42</id>
<content type='text'>
The "old_entry + le32_to_cpu(pDirInfo-&gt;NextEntryOffset)" can wrap
around so I have added a check for integer overflow.

Reported-by: Dr Silvio Cesare of InfoSect &lt;silvio.cesare@gmail.com&gt;
Reviewed-by: Ronnie Sahlberg &lt;lsahlber@redhat.com&gt;
Reviewed-by: Aurelien Aptel &lt;aaptel@suse.com&gt;
Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Steve French &lt;stfrench@microsoft.com&gt;
CC: Stable &lt;stable@vger.kernel.org&gt;
</content>
</entry>
<entry>
<title>cifs: update calc_size to take a server argument</title>
<updated>2018-05-27T22:56:35Z</updated>
<author>
<name>Ronnie Sahlberg</name>
<email>lsahlber@redhat.com</email>
</author>
<published>2018-04-22T21:30:12Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=9ec672bd17131fe26c966960a573a76fdb1da323'/>
<id>urn:sha1:9ec672bd17131fe26c966960a573a76fdb1da323</id>
<content type='text'>
and change the smb2 version to take heder_preamble_size into account
instead of hardcoding it as 4 bytes.

Signed-off-by: Ronnie Sahlberg &lt;lsahlber@redhat.com&gt;
Signed-off-by: Steve French &lt;smfrench@gmail.com&gt;
</content>
</entry>
<entry>
<title>cifs: initialize file_info_lock</title>
<updated>2017-01-14T20:58:29Z</updated>
<author>
<name>Rabin Vincent</name>
<email>rabinv@axis.com</email>
</author>
<published>2017-01-13T14:00:16Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=81ddd8c0c5e1cb41184d66567140cb48c53eb3d1'/>
<id>urn:sha1:81ddd8c0c5e1cb41184d66567140cb48c53eb3d1</id>
<content type='text'>
Reviewed-by: Jeff Layton &lt;jlayton@redhat.com&gt;
CC: Stable &lt;stable@vger.kernel.org&gt;

file_info_lock is not initalized in initiate_cifs_search(), leading to the
following splat after a simple "mount.cifs ... dir &amp;&amp; ls dir/":

 BUG: spinlock bad magic on CPU#0, ls/486
  lock: 0xffff880009301110, .magic: 00000000, .owner: &lt;none&gt;/-1, .owner_cpu: 0
 CPU: 0 PID: 486 Comm: ls Not tainted 4.9.0 #27
 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996)
  ffffc900042f3db0 ffffffff81327533 0000000000000000 ffff880009301110
  ffffc900042f3dd0 ffffffff810baf75 ffff880009301110 ffffffff817ae077
  ffffc900042f3df0 ffffffff810baff6 ffff880009301110 ffff880008d69900
 Call Trace:
  [&lt;ffffffff81327533&gt;] dump_stack+0x65/0x92
  [&lt;ffffffff810baf75&gt;] spin_dump+0x85/0xe0
  [&lt;ffffffff810baff6&gt;] spin_bug+0x26/0x30
  [&lt;ffffffff810bb159&gt;] do_raw_spin_lock+0xe9/0x130
  [&lt;ffffffff8159ad2f&gt;] _raw_spin_lock+0x1f/0x30
  [&lt;ffffffff8127e50d&gt;] cifs_closedir+0x4d/0x100
  [&lt;ffffffff81181cfd&gt;] __fput+0x5d/0x160
  [&lt;ffffffff81181e3e&gt;] ____fput+0xe/0x10
  [&lt;ffffffff8109410e&gt;] task_work_run+0x7e/0xa0
  [&lt;ffffffff81002512&gt;] exit_to_usermode_loop+0x92/0xa0
  [&lt;ffffffff810026f9&gt;] syscall_return_slowpath+0x49/0x50
  [&lt;ffffffff8159b484&gt;] entry_SYSCALL_64_fastpath+0xa7/0xa9

Fixes: 3afca265b5f53a0 ("Clarify locking of cifs file and tcon structures and make more granular")
Signed-off-by: Rabin Vincent &lt;rabinv@axis.com&gt;
Signed-off-by: Steve French &lt;smfrench@gmail.com&gt;
</content>
</entry>
<entry>
<title>Clarify locking of cifs file and tcon structures and make more granular</title>
<updated>2016-10-12T17:08:32Z</updated>
<author>
<name>Steve French</name>
<email>smfrench@gmail.com</email>
</author>
<published>2016-09-22T23:58:16Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=3afca265b5f53a0b15b79531c13858049505582d'/>
<id>urn:sha1:3afca265b5f53a0b15b79531c13858049505582d</id>
<content type='text'>
Remove the global file_list_lock to simplify cifs/smb3 locking and
have spinlocks that more closely match the information they are
protecting.

Add new tcon-&gt;open_file_lock and file-&gt;file_info_lock spinlocks.
Locks continue to follow a heirachy,
	cifs_socket --&gt; cifs_ses --&gt; cifs_tcon --&gt; cifs_file
where global tcp_ses_lock still protects socket and cifs_ses, while the
the newer locks protect the lower level structure's information
(tcon and cifs_file respectively).

CC: Stable &lt;stable@vger.kernel.org&gt;
Signed-off-by: Steve French &lt;steve.french@primarydata.com&gt;
Signed-off-by: Pavel Shilovsky &lt;pshilov@microsoft.com&gt;
Reviewed-by: Aurelien Aptel &lt;aaptel@suse.com&gt;
Reviewed-by: Germano Percossi &lt;germano.percossi@citrix.com&gt;
</content>
</entry>
<entry>
<title>cifs: Use file_dentry()</title>
<updated>2016-05-17T19:09:33Z</updated>
<author>
<name>Goldwyn Rodrigues</name>
<email>rgoldwyn@suse.com</email>
</author>
<published>2016-04-18T11:41:52Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=1f1735cb75ab31ed948a7fce65beaaa6c0ed4ed4'/>
<id>urn:sha1:1f1735cb75ab31ed948a7fce65beaaa6c0ed4ed4</id>
<content type='text'>
CIFS may be used as lower layer of overlayfs and accessing f_path.dentry can
lead to a crash.

Fix by replacing direct access of file-&gt;f_path.dentry with the
file_dentry() accessor, which will always return a native object.

Signed-off-by: Goldwyn Rodrigues &lt;rgoldwyn@suse.com&gt;
Acked-by: Shirish Pargaonkar &lt;shirishpargaonkar@gmail.com&gt;
Signed-off-by: Steve French &lt;smfrench@gmail.com&gt;
</content>
</entry>
</feed>
