* [PATCH AUTOSEL 4.9 1/7] NFSv4 only print the label when its queried
@ 2022-02-03 20:36 Sasha Levin
2022-02-03 20:36 ` [PATCH AUTOSEL 4.9 2/7] nfs: nfs4clinet: check the return value of kstrdup() Sasha Levin
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Sasha Levin @ 2022-02-03 20:36 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Olga Kornievskaia, Anna Schumaker, Sasha Levin, trond.myklebust,
anna.schumaker, linux-nfs
From: Olga Kornievskaia <kolga@netapp.com>
[ Upstream commit 2c52c8376db7160a1dd8a681c61c9258405ef143 ]
When the bitmask of the attributes doesn't include the security label,
don't bother printing it. Since the label might not be null terminated,
adjust the printing format accordingly.
Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfs/nfs4xdr.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 0a7c4e30a385e..29dbb14b6fd11 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -4177,10 +4177,11 @@ static int decode_attr_security_label(struct xdr_stream *xdr, uint32_t *bitmap,
} else
printk(KERN_WARNING "%s: label too long (%u)!\n",
__func__, len);
+ if (label && label->label)
+ dprintk("%s: label=%.*s, len=%d, PI=%d, LFS=%d\n",
+ __func__, label->len, (char *)label->label,
+ label->len, label->pi, label->lfs);
}
- if (label && label->label)
- dprintk("%s: label=%s, len=%d, PI=%d, LFS=%d\n", __func__,
- (char *)label->label, label->len, label->pi, label->lfs);
return status;
out_overflow:
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH AUTOSEL 4.9 2/7] nfs: nfs4clinet: check the return value of kstrdup()
2022-02-03 20:36 [PATCH AUTOSEL 4.9 1/7] NFSv4 only print the label when its queried Sasha Levin
@ 2022-02-03 20:36 ` Sasha Levin
2022-02-03 20:36 ` [PATCH AUTOSEL 4.9 4/7] NFSv4 remove zero number of fs_locations entries error check Sasha Levin
2022-02-03 20:36 ` [PATCH AUTOSEL 4.9 5/7] NFSv4 expose nfs_parse_server_name function Sasha Levin
2 siblings, 0 replies; 6+ messages in thread
From: Sasha Levin @ 2022-02-03 20:36 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Xiaoke Wang, Anna Schumaker, Sasha Levin, trond.myklebust,
anna.schumaker, linux-nfs
From: Xiaoke Wang <xkernel.wang@foxmail.com>
[ Upstream commit fbd2057e5329d3502a27491190237b6be52a1cb6 ]
kstrdup() returns NULL when some internal memory errors happen, it is
better to check the return value of it so to catch the memory error in
time.
Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfs/nfs4client.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c
index 2fb4633897084..48baa92846e5f 100644
--- a/fs/nfs/nfs4client.c
+++ b/fs/nfs/nfs4client.c
@@ -1329,8 +1329,11 @@ int nfs4_update_server(struct nfs_server *server, const char *hostname,
goto out;
}
- if (server->nfs_client->cl_hostname == NULL)
+ if (server->nfs_client->cl_hostname == NULL) {
server->nfs_client->cl_hostname = kstrdup(hostname, GFP_KERNEL);
+ if (server->nfs_client->cl_hostname == NULL)
+ return -ENOMEM;
+ }
nfs_server_insert_lists(server);
error = nfs_probe_destination(server);
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH AUTOSEL 4.9 4/7] NFSv4 remove zero number of fs_locations entries error check
2022-02-03 20:36 [PATCH AUTOSEL 4.9 1/7] NFSv4 only print the label when its queried Sasha Levin
2022-02-03 20:36 ` [PATCH AUTOSEL 4.9 2/7] nfs: nfs4clinet: check the return value of kstrdup() Sasha Levin
@ 2022-02-03 20:36 ` Sasha Levin
2022-02-03 20:36 ` [PATCH AUTOSEL 4.9 5/7] NFSv4 expose nfs_parse_server_name function Sasha Levin
2 siblings, 0 replies; 6+ messages in thread
From: Sasha Levin @ 2022-02-03 20:36 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Olga Kornievskaia, Anna Schumaker, Sasha Levin, trond.myklebust,
anna.schumaker, linux-nfs
From: Olga Kornievskaia <kolga@netapp.com>
[ Upstream commit 90e12a3191040bd3854d3e236c35921e4e92a044 ]
Remove the check for the zero length fs_locations reply in the
xdr decoding, and instead check for that in the migration code.
Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfs/nfs4state.c | 3 +++
fs/nfs/nfs4xdr.c | 2 --
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 4e63daeef6339..466c07bd06295 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -1985,6 +1985,9 @@ static int nfs4_try_migration(struct nfs_server *server, struct rpc_cred *cred)
}
result = -NFS4ERR_NXIO;
+ if (!locations->nlocations)
+ goto out;
+
if (!(locations->fattr.valid & NFS_ATTR_FATTR_V4_LOCATIONS)) {
dprintk("<-- %s: No fs_locations data, migration skipped\n",
__func__);
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 29dbb14b6fd11..b50c97c6aecb3 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -3633,8 +3633,6 @@ static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, st
if (unlikely(!p))
goto out_overflow;
n = be32_to_cpup(p);
- if (n <= 0)
- goto out_eio;
for (res->nlocations = 0; res->nlocations < n; res->nlocations++) {
u32 m;
struct nfs4_fs_location *loc;
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH AUTOSEL 4.9 5/7] NFSv4 expose nfs_parse_server_name function
2022-02-03 20:36 [PATCH AUTOSEL 4.9 1/7] NFSv4 only print the label when its queried Sasha Levin
2022-02-03 20:36 ` [PATCH AUTOSEL 4.9 2/7] nfs: nfs4clinet: check the return value of kstrdup() Sasha Levin
2022-02-03 20:36 ` [PATCH AUTOSEL 4.9 4/7] NFSv4 remove zero number of fs_locations entries error check Sasha Levin
@ 2022-02-03 20:36 ` Sasha Levin
2022-02-06 22:19 ` Pavel Machek
2 siblings, 1 reply; 6+ messages in thread
From: Sasha Levin @ 2022-02-03 20:36 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Olga Kornievskaia, Anna Schumaker, Sasha Levin, trond.myklebust,
anna.schumaker, linux-nfs
From: Olga Kornievskaia <kolga@netapp.com>
[ Upstream commit f5b27cc6761e27ee6387a24df1a99ca77b360fea ]
Make nfs_parse_server_name available outside of nfs4namespace.c.
Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/nfs/nfs4_fs.h | 3 ++-
fs/nfs/nfs4namespace.c | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index c719389381dc4..0b867d7c02992 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -241,7 +241,8 @@ struct vfsmount *nfs4_submount(struct nfs_server *, struct dentry *,
struct nfs_fh *, struct nfs_fattr *);
int nfs4_replace_transport(struct nfs_server *server,
const struct nfs4_fs_locations *locations);
-
+size_t nfs_parse_server_name(char *string, size_t len, struct sockaddr *sa,
+ size_t salen, struct net *net);
/* nfs4proc.c */
extern int nfs4_handle_exception(struct nfs_server *, int, struct nfs4_exception *);
extern int nfs4_call_sync(struct rpc_clnt *, struct nfs_server *,
diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c
index d8b040bd9814d..2b1921bb5348b 100644
--- a/fs/nfs/nfs4namespace.c
+++ b/fs/nfs/nfs4namespace.c
@@ -120,8 +120,8 @@ static int nfs4_validate_fspath(struct dentry *dentry,
return 0;
}
-static size_t nfs_parse_server_name(char *string, size_t len,
- struct sockaddr *sa, size_t salen, struct net *net)
+size_t nfs_parse_server_name(char *string, size_t len, struct sockaddr *sa,
+ size_t salen, struct net *net)
{
ssize_t ret;
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH AUTOSEL 4.9 5/7] NFSv4 expose nfs_parse_server_name function
2022-02-03 20:36 ` [PATCH AUTOSEL 4.9 5/7] NFSv4 expose nfs_parse_server_name function Sasha Levin
@ 2022-02-06 22:19 ` Pavel Machek
2022-02-11 14:49 ` Sasha Levin
0 siblings, 1 reply; 6+ messages in thread
From: Pavel Machek @ 2022-02-06 22:19 UTC (permalink / raw)
To: Sasha Levin
Cc: linux-kernel, stable, Olga Kornievskaia, Anna Schumaker,
trond.myklebust, linux-nfs
[-- Attachment #1: Type: text/plain, Size: 449 bytes --]
Hi!
> From: Olga Kornievskaia <kolga@netapp.com>
>
> [ Upstream commit f5b27cc6761e27ee6387a24df1a99ca77b360fea ]
>
> Make nfs_parse_server_name available outside of nfs4namespace.c.
I don't think this makes sense for 4.9-stable. Noone uses the new
export.
Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH AUTOSEL 4.9 5/7] NFSv4 expose nfs_parse_server_name function
2022-02-06 22:19 ` Pavel Machek
@ 2022-02-11 14:49 ` Sasha Levin
0 siblings, 0 replies; 6+ messages in thread
From: Sasha Levin @ 2022-02-11 14:49 UTC (permalink / raw)
To: Pavel Machek
Cc: linux-kernel, stable, Olga Kornievskaia, Anna Schumaker,
trond.myklebust, linux-nfs
On Sun, Feb 06, 2022 at 11:19:08PM +0100, Pavel Machek wrote:
>Hi!
>
>> From: Olga Kornievskaia <kolga@netapp.com>
>>
>> [ Upstream commit f5b27cc6761e27ee6387a24df1a99ca77b360fea ]
>>
>> Make nfs_parse_server_name available outside of nfs4namespace.c.
>
>I don't think this makes sense for 4.9-stable. Noone uses the new
>export.
I'll drop it, thanks!
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-02-11 14:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-03 20:36 [PATCH AUTOSEL 4.9 1/7] NFSv4 only print the label when its queried Sasha Levin
2022-02-03 20:36 ` [PATCH AUTOSEL 4.9 2/7] nfs: nfs4clinet: check the return value of kstrdup() Sasha Levin
2022-02-03 20:36 ` [PATCH AUTOSEL 4.9 4/7] NFSv4 remove zero number of fs_locations entries error check Sasha Levin
2022-02-03 20:36 ` [PATCH AUTOSEL 4.9 5/7] NFSv4 expose nfs_parse_server_name function Sasha Levin
2022-02-06 22:19 ` Pavel Machek
2022-02-11 14:49 ` Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox