]> git.proxmox.com Git - mirror_ubuntu-jammy-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)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 4 Jan 2022 08:49:28 +0000 (09:49 +0100)
commit9e3ee3fe8b695b8aa4e18a2aac28899b5efcd02b
tree8418539bc9e8ecc0bb36a5c8a9b38dd7efe09740
parent58c9cc7128e756b73ed88e0ad3aa911ae8892496
cifs: sanitize multiple delimiters in prepath

BugLink: https://bugs.launchpad.net/bugs/1956302
commit a31080899d5fdafcccf7f39dd214a814a2c82626 upstream.

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: 24e0a1eff9e2 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
fs/cifs/fs_context.c