From: Dan Carpenter <error27@gmail.com>
To: oe-kbuild@lists.linux.dev, Denis Arefev <arefev@swemel.ru>,
Alexander Viro <viro@zeniv.linux.org.uk>
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
trufanov@swemel.ru, vfh@swemel.ru
Subject: Re: [PATCH] namespace: Added pointer check in copy_mnt_ns()
Date: Thu, 17 Nov 2022 16:34:43 +0300 [thread overview]
Message-ID: <202211171954.d4Dr5tHz-lkp@intel.com> (raw)
In-Reply-To: <20221116091255.84576-1-arefev@swemel.ru>
Hi Denis,
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Denis-Arefev/namespace-Added-pointer-check-in-copy_mnt_ns/20221116-171424
patch link: https://lore.kernel.org/r/20221116091255.84576-1-arefev%40swemel.ru
patch subject: [PATCH] namespace: Added pointer check in copy_mnt_ns()
config: x86_64-randconfig-m001
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
New smatch warnings:
fs/namespace.c:3518 copy_mnt_ns() error: we previously assumed 'p' could be null (see line 3518)
Old smatch warnings:
fs/namespace.c:4059 mount_setattr_prepare() error: uninitialized symbol 'err'.
vim +/p +3518 fs/namespace.c
^1da177e4c3f41 Linus Torvalds 2005-04-16 3494 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 3495 * Second pass: switch the tsk->fs->* elements and mark new vfsmounts
^1da177e4c3f41 Linus Torvalds 2005-04-16 3496 * as belonging to new namespace. We have already acquired a private
^1da177e4c3f41 Linus Torvalds 2005-04-16 3497 * fs_struct, so tsk->fs->lock is not needed.
^1da177e4c3f41 Linus Torvalds 2005-04-16 3498 */
909b0a88ef2dc8 Al Viro 2011-11-25 3499 p = old;
cb338d06e9716c Al Viro 2011-11-24 3500 q = new;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3501 while (p) {
143c8c91cee7ef Al Viro 2011-11-25 3502 q->mnt_ns = new_ns;
d29216842a85c7 Eric W. Biederman 2016-09-28 3503 new_ns->mounts++;
9559f68915024e Al Viro 2013-09-28 3504 if (new_fs) {
9559f68915024e Al Viro 2013-09-28 3505 if (&p->mnt == new_fs->root.mnt) {
9559f68915024e Al Viro 2013-09-28 3506 new_fs->root.mnt = mntget(&q->mnt);
315fc83e56c699 Al Viro 2011-11-24 3507 rootmnt = &p->mnt;
315fc83e56c699 Al Viro 2011-11-24 3508 }
9559f68915024e Al Viro 2013-09-28 3509 if (&p->mnt == new_fs->pwd.mnt) {
9559f68915024e Al Viro 2013-09-28 3510 new_fs->pwd.mnt = mntget(&q->mnt);
315fc83e56c699 Al Viro 2011-11-24 3511 pwdmnt = &p->mnt;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3512 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3513 }
909b0a88ef2dc8 Al Viro 2011-11-25 3514 p = next_mnt(p, old);
909b0a88ef2dc8 Al Viro 2011-11-25 3515 q = next_mnt(q, new);
ff6985ba29d455 Denis Arefev 2022-11-16 3516 if (!q || !p)
4ce5d2b1a8fde8 Eric W. Biederman 2013-03-30 3517 break;
ff6985ba29d455 Denis Arefev 2022-11-16 @3518 while (!p && (p->mnt.mnt_root != q->mnt.mnt_root))
^
The ! needs to be removed.
4ce5d2b1a8fde8 Eric W. Biederman 2013-03-30 3519 p = next_mnt(p, old);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3520 }
328e6d9014636a Al Viro 2013-03-16 3521 namespace_unlock();
^1da177e4c3f41 Linus Torvalds 2005-04-16 3522
^1da177e4c3f41 Linus Torvalds 2005-04-16 3523 if (rootmnt)
f03c65993b98ee Al Viro 2011-01-14 3524 mntput(rootmnt);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3525 if (pwdmnt)
f03c65993b98ee Al Viro 2011-01-14 3526 mntput(pwdmnt);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3527
741a2951306061 JANAK DESAI 2006-02-07 3528 return new_ns;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3529 }
--
0-DAY CI Kernel Test Service
https://01.org/lkp
prev parent reply other threads:[~2022-11-17 13:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-16 9:12 [PATCH] namespace: Added pointer check in copy_mnt_ns() Denis Arefev
2022-11-16 18:16 ` Matthew Wilcox
2022-11-17 13:34 ` Dan Carpenter [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=202211171954.d4Dr5tHz-lkp@intel.com \
--to=error27@gmail.com \
--cc=arefev@swemel.ru \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=oe-kbuild@lists.linux.dev \
--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