lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAH2r5mtvP34-Da12BNjgjpQ9pNjrEfXc3HPGgrsZBowPwdW0zw@mail.gmail.com>
Date: Sat, 20 Sep 2025 12:33:39 -0500
From: Steve French <smfrench@...il.com>
To: Pali Rohár <pali@...nel.org>
Cc: Steve French <sfrench@...ba.org>, Paulo Alcantara <pc@...guebit.com>, 
	ronnie sahlberg <ronniesahlberg@...il.com>, linux-cifs@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 27/35] cifs: Move SMB1 usage of CIFSPOSIXDelFile() from
 inode.c to cifssmb.c

This did not apply to current mainline

On Sun, Aug 31, 2025 at 7:37 AM Pali Rohár <pali@...nel.org> wrote:
>
> Special case of unlinking file via SMB1 UNIX extension is currently in the
> dialect agnostic function cifs_unlink() and hidden under the #ifdef
> CONFIG_CIFS_ALLOW_INSECURE_LEGACY.
>
> Cleanup the code and move this functionality into the SMB1 ->unlink()
> callback, which removes one #ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
> code block from inode.c
>
> Signed-off-by: Pali Rohár <pali@...nel.org>
> ---
>  fs/smb/client/cifssmb.c | 12 ++++++++++++
>  fs/smb/client/inode.c   | 20 +++-----------------
>  2 files changed, 15 insertions(+), 17 deletions(-)
>
> diff --git a/fs/smb/client/cifssmb.c b/fs/smb/client/cifssmb.c
> index c09713ebdc7c..3a0452479a69 100644
> --- a/fs/smb/client/cifssmb.c
> +++ b/fs/smb/client/cifssmb.c
> @@ -768,6 +768,18 @@ CIFSSMBDelFile(const unsigned int xid, struct cifs_tcon *tcon, const char *name,
>         int name_len;
>         int remap = cifs_remap(cifs_sb);
>
> +       /* If UNIX extensions are available then use UNIX UNLINK call. */
> +       if (cap_unix(tcon->ses) &&
> +           (le64_to_cpu(tcon->fsUnixInfo.Capability) & CIFS_UNIX_POSIX_PATH_OPS_CAP)) {
> +               rc = CIFSPOSIXDelFile(xid, tcon, name,
> +                                     SMB_POSIX_UNLINK_FILE_TARGET,
> +                                     cifs_sb->local_nls,
> +                                     cifs_remap(cifs_sb));
> +               cifs_dbg(FYI, "posix del rc %d\n", rc);
> +               if (rc == 0 || rc == -ENOENT)
> +                       return rc;
> +       }
> +
>  DelFileRetry:
>         rc = smb_init(SMB_COM_DELETE, 1, tcon, (void **) &pSMB,
>                       (void **) &pSMBr);
> diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c
> index c3f101d10488..545964cac9cd 100644
> --- a/fs/smb/client/inode.c
> +++ b/fs/smb/client/inode.c
> @@ -1947,27 +1947,13 @@ int cifs_unlink(struct inode *dir, struct dentry *dentry)
>
>         netfs_wait_for_outstanding_io(inode);
>         cifs_close_deferred_file_under_dentry(tcon, full_path);
> -#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
> -       if (cap_unix(tcon->ses) && (CIFS_UNIX_POSIX_PATH_OPS_CAP &
> -                               le64_to_cpu(tcon->fsUnixInfo.Capability))) {
> -               rc = CIFSPOSIXDelFile(xid, tcon, full_path,
> -                       SMB_POSIX_UNLINK_FILE_TARGET, cifs_sb->local_nls,
> -                       cifs_remap(cifs_sb));
> -               cifs_dbg(FYI, "posix del rc %d\n", rc);
> -               if ((rc == 0) || (rc == -ENOENT))
> -                       goto psx_del_no_retry;
> -       }
> -#endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */
>
>  retry_std_delete:
> -       if (!server->ops->unlink) {
> +       if (!server->ops->unlink)
>                 rc = -ENOSYS;
> -               goto psx_del_no_retry;
> -       }
> -
> -       rc = server->ops->unlink(xid, tcon, full_path, cifs_sb, dentry);
> +       else
> +               rc = server->ops->unlink(xid, tcon, full_path, cifs_sb, dentry);
>
> -psx_del_no_retry:
>         if (!rc) {
>                 if (inode) {
>                         cifs_mark_open_handles_for_deleted_file(inode, full_path);
> --
> 2.20.1
>
>


-- 
Thanks,

Steve

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ