* [PATCH AUTOSEL 5.12 102/102] cifs: prevent NULL deref in cifs_compose_mount_options()
[not found] <20210714194036.53141-1-sashal@kernel.org>
@ 2021-07-14 19:40 ` Sasha Levin
0 siblings, 0 replies; only message in thread
From: Sasha Levin @ 2021-07-14 19:40 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Paulo Alcantara, Steve French, Sasha Levin, linux-cifs, samba-technical
From: Paulo Alcantara <pc@cjr.nz>
[ Upstream commit 03313d1c3a2f086bb60920607ab79ac8f8578306 ]
The optional @ref parameter might contain an NULL node_name, so
prevent dereferencing it in cifs_compose_mount_options().
Addresses-Coverity: 1476408 ("Explicit null dereferenced")
Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/cifs/cifs_dfs_ref.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c
index 6b1ce4efb591..2891089aadbb 100644
--- a/fs/cifs/cifs_dfs_ref.c
+++ b/fs/cifs/cifs_dfs_ref.c
@@ -151,6 +151,9 @@ char *cifs_compose_mount_options(const char *sb_mountdata,
return ERR_PTR(-EINVAL);
if (ref) {
+ if (WARN_ON_ONCE(!ref->node_name || ref->path_consumed < 0))
+ return ERR_PTR(-EINVAL);
+
if (strlen(fullpath) - ref->path_consumed) {
prepath = fullpath + ref->path_consumed;
/* skip initial delimiter */
--
2.30.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-07-14 19:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20210714194036.53141-1-sashal@kernel.org>
2021-07-14 19:40 ` [PATCH AUTOSEL 5.12 102/102] cifs: prevent NULL deref in cifs_compose_mount_options() Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).