]> git.baikalelectronics.ru Git - kernel.git/commit
cifs: sanitize multiple delimiters in prepath
authorThiago Rafael Becker <trbecker@gmail.com>
Fri, 17 Dec 2021 18:20:22 +0000 (15:20 -0300)
committerSteve French <stfrench@microsoft.com>
Sat, 18 Dec 2021 01:16:49 +0000 (19:16 -0600)
commit4d43fc8f6c33e6d890823680f16da6b917d503e5
tree227afe3dfcae761b9431a0f29d00dc7f29c68cdc
parent258373709790d7db764b919cd16e26d9fa167914
cifs: sanitize multiple delimiters in prepath

mount.cifs can pass a device with multiple delimiters in it. This will
cause rename(2) to fail with ENOENT.

V2:
  - Make sanitize_path more readable.
  - Fix multiple delimiters between UNC and prepath.
  - Avoid a memory leak if a bad user starts putting a lot of delimiters
    in the path on purpose.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=2031200
Fixes: 84e70c69068d ("cifs: switch to new mount api")
Cc: stable@vger.kernel.org # 5.11+
Acked-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Thiago Rafael Becker <trbecker@gmail.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/fs_context.c