* [PATCH 6.12.y 3/5] cifs: SMB1 split: Create smb1proto.h for SMB1 declarations
2026-09-07 11:47 ` [PATCH 6.12.y 1/5] cifs: Scripted clean up fs/smb/client/cifs_unicode.h Sasha Levin
2026-09-07 11:47 ` [PATCH 6.12.y 2/5] cifs: Scripted clean up fs/smb/client/fscache.h Sasha Levin
@ 2026-09-07 11:47 ` Sasha Levin
2026-09-17 11:36 ` [PATCH 6.12.y 1/5] cifs: Scripted clean up fs/smb/client/cifs_unicode.h Greg KH
2 siblings, 0 replies; 4+ messages in thread
From: Sasha Levin @ 2026-09-07 11:47 UTC (permalink / raw)
To: stable
Cc: David Howells, Steve French, Paulo Alcantara, Enzo Matsumiya,
linux-cifs, linux-fsdevel, linux-kernel, Steve French,
Sasha Levin
From: David Howells <dhowells@redhat.com>
[ Upstream commit 86c666506ea2c42649879eeac7f29e7bedef2f23 ]
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Enzo Matsumiya <ematsumiya@suse.de>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
Stable-dep-of: b8e5dc4f95e5 ("smb: client: clear setuid/setgid bit on write with cifsacl/modefromsid/posix extensions")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/smb/client/cifsglob.h | 2 --
fs/smb/client/cifsproto.h | 11 +----------
fs/smb/client/smb1proto.h | 38 ++++++++++++++++++++++++++++++++++++++
3 files changed, 39 insertions(+), 12 deletions(-)
create mode 100644 fs/smb/client/smb1proto.h
diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h
index 3f9c03828cd4f..4f30059c08ddc 100644
--- a/fs/smb/client/cifsglob.h
+++ b/fs/smb/client/cifsglob.h
@@ -2061,8 +2061,6 @@ extern mempool_t cifs_io_subrequest_pool;
/* Operations for different SMB versions */
#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
-extern struct smb_version_operations smb1_operations;
-extern struct smb_version_values smb1_values;
extern struct smb_version_operations smb20_operations;
extern struct smb_version_values smb20_values;
#endif /* CIFS_ALLOW_INSECURE_LEGACY */
diff --git a/fs/smb/client/cifsproto.h b/fs/smb/client/cifsproto.h
index d2d004764a708..79158c0fd303e 100644
--- a/fs/smb/client/cifsproto.h
+++ b/fs/smb/client/cifsproto.h
@@ -13,6 +13,7 @@
#ifdef CONFIG_CIFS_DFS_UPCALL
#include "dfs_cache.h"
#endif
+#include "smb1proto.h"
struct statfs;
struct smb_rqst;
@@ -421,16 +422,6 @@ extern int CIFSSMBSetFileSize(const unsigned int xid, struct cifs_tcon *tcon,
struct cifsFileInfo *cfile, __u64 size,
bool set_allocation);
-struct cifs_unix_set_info_args {
- __u64 ctime;
- __u64 atime;
- __u64 mtime;
- __u64 mode;
- kuid_t uid;
- kgid_t gid;
- dev_t device;
-};
-
extern int CIFSSMBUnixSetFileInfo(const unsigned int xid,
struct cifs_tcon *tcon,
const struct cifs_unix_set_info_args *args,
diff --git a/fs/smb/client/smb1proto.h b/fs/smb/client/smb1proto.h
new file mode 100644
index 0000000000000..a73213f6a2aa1
--- /dev/null
+++ b/fs/smb/client/smb1proto.h
@@ -0,0 +1,38 @@
+/* SPDX-License-Identifier: LGPL-2.1 */
+/*
+ *
+ * Copyright (c) International Business Machines Corp., 2002,2008
+ * Author(s): Steve French (sfrench@us.ibm.com)
+ *
+ */
+#ifndef _SMB1PROTO_H
+#define _SMB1PROTO_H
+
+struct cifs_unix_set_info_args {
+ __u64 ctime;
+ __u64 atime;
+ __u64 mtime;
+ __u64 mode;
+ kuid_t uid;
+ kgid_t gid;
+ dev_t device;
+};
+
+#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
+
+/*
+ * cifssmb.c
+ */
+
+/*
+ * smb1ops.c
+ */
+extern struct smb_version_operations smb1_operations;
+extern struct smb_version_values smb1_values;
+
+/*
+ * smb1transport.c
+ */
+
+#endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */
+#endif /* _SMB1PROTO_H */
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 6.12.y 1/5] cifs: Scripted clean up fs/smb/client/cifs_unicode.h
2026-09-07 11:47 ` [PATCH 6.12.y 1/5] cifs: Scripted clean up fs/smb/client/cifs_unicode.h Sasha Levin
2026-09-07 11:47 ` [PATCH 6.12.y 2/5] cifs: Scripted clean up fs/smb/client/fscache.h Sasha Levin
2026-09-07 11:47 ` [PATCH 6.12.y 3/5] cifs: SMB1 split: Create smb1proto.h for SMB1 declarations Sasha Levin
@ 2026-09-17 11:36 ` Greg KH
2 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2026-09-17 11:36 UTC (permalink / raw)
To: Sasha Levin
Cc: stable, David Howells, Steve French, Paulo Alcantara,
Enzo Matsumiya, linux-cifs, linux-fsdevel, linux-kernel,
Steve French
On Mon, Sep 07, 2026 at 07:47:38AM -0400, Sasha Levin wrote:
> From: David Howells <dhowells@redhat.com>
>
> [ Upstream commit 696ca7d95658224ba807813101d0d5714d1d8aa4 ]
>
> Remove externs, correct argument names and reformat declarations.
>
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Steve French <sfrench@samba.org>
> cc: Paulo Alcantara <pc@manguebit.org>
> cc: Enzo Matsumiya <ematsumiya@suse.de>
> cc: linux-cifs@vger.kernel.org
> cc: linux-fsdevel@vger.kernel.org
> cc: linux-kernel@vger.kernel.org
> Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
> Signed-off-by: Steve French <stfrench@microsoft.com>
> Stable-dep-of: b8e5dc4f95e5 ("smb: client: clear setuid/setgid bit on write with cifsacl/modefromsid/posix extensions")
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
> fs/smb/client/cifs_unicode.h | 17 +++++++++--------
> fs/smb/client/inode.c | 26 ++++++++++++++------------
> 2 files changed, 23 insertions(+), 20 deletions(-)
>
> diff --git a/fs/smb/client/cifs_unicode.h b/fs/smb/client/cifs_unicode.h
> index e137a0dfbbe9a..d69b64422fe98 100644
> --- a/fs/smb/client/cifs_unicode.h
> +++ b/fs/smb/client/cifs_unicode.h
> @@ -56,19 +56,20 @@
>
> #ifdef __KERNEL__
> int cifs_from_utf16(char *to, const __le16 *from, int tolen, int fromlen,
> - const struct nls_table *cp, int map_type);
> + const struct nls_table *codepage, int map_type);
> int cifs_utf16_bytes(const __le16 *from, int maxbytes,
> const struct nls_table *codepage);
> -int cifs_strtoUTF16(__le16 *, const char *, int, const struct nls_table *);
> +int cifs_strtoUTF16(__le16 *to, const char *from, int len,
> + const struct nls_table *codepage);
> char *cifs_strndup_from_utf16(const char *src, const int maxlen,
> const bool is_unicode,
> const struct nls_table *codepage);
> -extern int cifsConvertToUTF16(__le16 *target, const char *source, int maxlen,
> - const struct nls_table *cp, int mapChars);
> -extern int cifs_remap(struct cifs_sb_info *cifs_sb);
> -extern __le16 *cifs_strndup_to_utf16(const char *src, const int maxlen,
> - int *utf16_len, const struct nls_table *cp,
> - int remap);
> +int cifsConvertToUTF16(__le16 *target, const char *source, int srclen,
> + const struct nls_table *cp, int map_chars);
> +int cifs_remap(struct cifs_sb_info *cifs_sb);
> +__le16 *cifs_strndup_to_utf16(const char *src, const int maxlen,
> + int *utf16_len, const struct nls_table *cp,
> + int remap);
> #endif
>
> wchar_t cifs_toupper(wchar_t in);
> diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c
> index b67b316538b83..8c422b3c73662 100644
> --- a/fs/smb/client/inode.c
> +++ b/fs/smb/client/inode.c
> @@ -3115,13 +3115,14 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs)
> rc = cifs_set_file_size(inode, attrs, xid, full_path, direntry);
> if (rc != 0)
> goto out;
> + attrs->ia_valid &= ~(ATTR_CTIME | ATTR_MTIME);
> }
>
> /* skip mode change if it's just for clearing setuid/setgid */
> if (attrs->ia_valid & (ATTR_KILL_SUID|ATTR_KILL_SGID))
> attrs->ia_valid &= ~ATTR_MODE;
>
> - args = kmalloc(sizeof(*args), GFP_KERNEL);
> + args = kmalloc_obj(*args);
> if (args == NULL) {
> rc = -ENOMEM;
> goto out;
> @@ -3217,6 +3218,7 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
> struct inode *inode = d_inode(direntry);
> struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
> struct cifsInodeInfo *cifsInode = CIFS_I(inode);
> + unsigned int sbflags = cifs_sb->mnt_cifs_flags;
> struct cifsFileInfo *wfile;
> struct cifs_tcon *tcon;
> const char *full_path;
> @@ -3231,7 +3233,7 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
> cifs_dbg(FYI, "setattr on file %pd attrs->ia_valid 0x%x\n",
> direntry, attrs->ia_valid);
>
> - if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM)
> + if (sbflags & CIFS_MOUNT_NO_PERM)
> attrs->ia_valid |= ATTR_FORCE;
>
> rc = setattr_prepare(&nop_mnt_idmap, direntry, attrs);
> @@ -3265,7 +3267,7 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
> rc = 0;
>
> if ((attrs->ia_valid & ATTR_MTIME) &&
> - !(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC)) {
> + !(sbflags & CIFS_MOUNT_NOSSYNC)) {
> rc = cifs_get_writable_file(cifsInode, FIND_WR_ANY, &wfile);
> if (!rc) {
> tcon = tlink_tcon(wfile->tlink);
> @@ -3291,8 +3293,8 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
> if (attrs->ia_valid & ATTR_GID)
> gid = attrs->ia_gid;
>
> - if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) ||
> - (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MODE_FROM_SID)) {
> + if ((sbflags & CIFS_MOUNT_CIFS_ACL) ||
> + (sbflags & CIFS_MOUNT_MODE_FROM_SID)) {
> if (uid_valid(uid) || gid_valid(gid)) {
> mode = NO_CHANGE_64;
> rc = id_mode_to_cifs_acl(inode, full_path, &mode,
> @@ -3303,9 +3305,9 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
> goto cifs_setattr_exit;
> }
> }
> - } else
> - if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID))
> + } else if (!(sbflags & CIFS_MOUNT_SET_UID)) {
> attrs->ia_valid &= ~(ATTR_UID | ATTR_GID);
> + }
>
> /* skip mode change if it's just for clearing setuid/setgid */
> if (attrs->ia_valid & (ATTR_KILL_SUID|ATTR_KILL_SGID))
> @@ -3314,8 +3316,8 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
> if (attrs->ia_valid & ATTR_MODE) {
> mode = attrs->ia_mode;
> rc = 0;
> - if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) ||
> - (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MODE_FROM_SID) ||
> + if ((sbflags & CIFS_MOUNT_CIFS_ACL) ||
> + (sbflags & CIFS_MOUNT_MODE_FROM_SID) ||
> posix) {
> rc = id_mode_to_cifs_acl(inode, full_path, &mode,
> INVALID_UID, INVALID_GID);
> @@ -3338,7 +3340,7 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
> dosattr = cifsInode->cifsAttrs | ATTR_READONLY;
>
> /* fix up mode if we're not using dynperm */
> - if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DYNPERM) == 0)
> + if ((sbflags & CIFS_MOUNT_DYNPERM) == 0)
> attrs->ia_mode = inode->i_mode & ~S_IWUGO;
> } else if ((mode & S_IWUGO) &&
> (cifsInode->cifsAttrs & ATTR_READONLY)) {
> @@ -3349,7 +3351,7 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
> dosattr |= ATTR_NORMAL;
>
> /* reset local inode permissions to normal */
> - if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DYNPERM)) {
> + if (!(sbflags & CIFS_MOUNT_DYNPERM)) {
> attrs->ia_mode &= ~(S_IALLUGO);
> if (S_ISDIR(inode->i_mode))
> attrs->ia_mode |=
> @@ -3358,7 +3360,7 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
> attrs->ia_mode |=
> cifs_sb->ctx->file_mode;
> }
> - } else if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DYNPERM)) {
> + } else if (!(sbflags & CIFS_MOUNT_DYNPERM)) {
> /* ignore mode change - ATTR_READONLY hasn't changed */
> attrs->ia_valid &= ~ATTR_MODE;
> }
> --
> 2.53.0
>
>
The two cifs series backports conflicts, so I'll drop both :(
^ permalink raw reply [flat|nested] 4+ messages in thread