From: Denis Arefev <arefev@swemel.ru>
To: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
trufanov@swemel.ru, vfh@swemel.ru
Subject: [PATCH] namespace: Added pointer check in copy_mnt_ns()
Date: Wed, 16 Nov 2022 12:12:55 +0300 [thread overview]
Message-ID: <20221116091255.84576-1-arefev@swemel.ru> (raw)
Return value of a function 'next_mnt' is dereferenced at
namespace.c:3377 without checking for null,
but it is usually checked for this function
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Denis Arefev <arefev@swemel.ru>
---
fs/namespace.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/namespace.c b/fs/namespace.c
index cebaa3e81794..06472a110257 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -3348,9 +3348,9 @@ struct mnt_namespace *copy_mnt_ns(unsigned long flags, struct mnt_namespace *ns,
}
p = next_mnt(p, old);
q = next_mnt(q, new);
- if (!q)
+ if (!q || !p)
break;
- while (p->mnt.mnt_root != q->mnt.mnt_root)
+ while (!p && (p->mnt.mnt_root != q->mnt.mnt_root))
p = next_mnt(p, old);
}
namespace_unlock();
--
2.25.1
next reply other threads:[~2022-11-16 9:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-16 9:12 Denis Arefev [this message]
2022-11-16 18:16 ` Matthew Wilcox
2022-11-17 13:34 ` Dan Carpenter
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=20221116091255.84576-1-arefev@swemel.ru \
--to=arefev@swemel.ru \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=trufanov@swemel.ru \
--cc=vfh@swemel.ru \
--cc=viro@zeniv.linux.org.uk \
/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®