]> git.baikalelectronics.ru Git - kernel.git/commit
cifs: return ENAMETOOLONG for overlong names in cifs_open()/cifs_lookup()
authorRonnie Sahlberg <lsahlber@redhat.com>
Wed, 23 Aug 2017 04:48:14 +0000 (14:48 +1000)
committerSteve French <smfrench@gmail.com>
Wed, 23 Aug 2017 18:34:52 +0000 (13:34 -0500)
commitfea38c9138bed3030ffd4d91bc15cc00bca403c6
tree391465f2a1f199a8e5b789faca7556dac3b1ecc9
parent92c08160ee92f589456f9191f21f91645c8fde6c
cifs: return ENAMETOOLONG for overlong names in cifs_open()/cifs_lookup()

Add checking for the path component length and verify it is <= the maximum
that the server advertizes via FileFsAttributeInformation.

With this patch cifs.ko will now return ENAMETOOLONG instead of ENOENT
when users to access an overlong path.

To test this, try to cd into a (non-existing) directory on a CIFS share
that has a too long name:
cd /mnt/aaaaaaaaaaaaaaa...

and it now should show a good error message from the shell:
bash: cd: /mnt/aaaaaaaaaaaaaaaa...aaaaaa: File name too long

rh bz 1153996

Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Cc: <stable@vger.kernel.org>
fs/cifs/dir.c