mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Sasha Levin <sashal@kernel.org>
Cc: stable@vger.kernel.org, David Howells <dhowells@redhat.com>,
	Steve French <sfrench@samba.org>,
	Paulo Alcantara <pc@manguebit.org>,
	Enzo Matsumiya <ematsumiya@suse.de>,
	linux-cifs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Steve French <stfrench@microsoft.com>
Subject: Re: [PATCH 6.12.y 1/5] cifs: Scripted clean up fs/smb/client/cifs_unicode.h
Date: Thu, 17 Sep 2026 12:36:23 +0100	[thread overview]
Message-ID: <2026091711-fervor-scribing-aace@gregkh> (raw)
In-Reply-To: <20260907114742.2872537-1-sashal@kernel.org>

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 :(

      parent reply	other threads:[~2026-09-17 11:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2026090351-popper-penpal-d0a0@gregkh>
2026-09-07 11:47 ` 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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2026091711-fervor-scribing-aace@gregkh \
    --to=greg@kroah.com \
    --cc=dhowells@redhat.com \
    --cc=ematsumiya@suse.de \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pc@manguebit.org \
    --cc=sashal@kernel.org \
    --cc=sfrench@samba.org \
    --cc=stable@vger.kernel.org \
    --cc=stfrench@microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®