From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: [brauner:debugfs_namespaces 3/5] kernel/utsname.c:108 copy_utsname() error: 'new_ns' dereferencing possible ERR_PTR()
Date: Mon, 07 Oct 2019 12:57:57 +0300 [thread overview]
Message-ID: <20191007095756.GC21515@kadam> (raw)
[-- Attachment #1: Type: text/plain, Size: 3566 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git debugfs_namespaces
head: aef8406e30cf9b60c76e5de205fa77f3791e2c54
commit: fce9acb4ffd1b7b342c69f0c39d49835b7232414 [3/5] DEBUG
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
kernel/utsname.c:108 copy_utsname() error: 'new_ns' dereferencing possible ERR_PTR()
# https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git/commit/?id=fce9acb4ffd1b7b342c69f0c39d49835b7232414
git remote add brauner https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git
git remote update brauner
git checkout fce9acb4ffd1b7b342c69f0c39d49835b7232414
vim +/new_ns +108 kernel/utsname.c
071df104f808b8 Serge E. Hallyn 2006-10-02 84
4865ecf1315b45 Serge E. Hallyn 2006-10-02 85 /*
4865ecf1315b45 Serge E. Hallyn 2006-10-02 86 * Copy task tsk's utsname namespace, or clone it if flags
4865ecf1315b45 Serge E. Hallyn 2006-10-02 87 * specifies CLONE_NEWUTS. In latter case, changes to the
4865ecf1315b45 Serge E. Hallyn 2006-10-02 88 * utsname of this process won't be seen by parent, and vice
4865ecf1315b45 Serge E. Hallyn 2006-10-02 89 * versa.
4865ecf1315b45 Serge E. Hallyn 2006-10-02 90 */
bb96a6f50be273 Serge E. Hallyn 2011-03-23 91 struct uts_namespace *copy_utsname(unsigned long flags,
bcf58e725ddc45 Eric W. Biederman 2012-07-26 92 struct user_namespace *user_ns, struct uts_namespace *old_ns)
4865ecf1315b45 Serge E. Hallyn 2006-10-02 93 {
071df104f808b8 Serge E. Hallyn 2006-10-02 94 struct uts_namespace *new_ns;
fce9acb4ffd1b7 Christian Brauner 2019-10-02 95 char name[50];
4865ecf1315b45 Serge E. Hallyn 2006-10-02 96
e3222c4ecc649c Badari Pulavarty 2007-05-08 97 BUG_ON(!old_ns);
4865ecf1315b45 Serge E. Hallyn 2006-10-02 98 get_uts_ns(old_ns);
4865ecf1315b45 Serge E. Hallyn 2006-10-02 99
071df104f808b8 Serge E. Hallyn 2006-10-02 100 if (!(flags & CLONE_NEWUTS))
e3222c4ecc649c Badari Pulavarty 2007-05-08 101 return old_ns;
071df104f808b8 Serge E. Hallyn 2006-10-02 102
bcf58e725ddc45 Eric W. Biederman 2012-07-26 103 new_ns = clone_uts_ns(user_ns, old_ns);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This isn't checked for errors
071df104f808b8 Serge E. Hallyn 2006-10-02 104
071df104f808b8 Serge E. Hallyn 2006-10-02 105 put_uts_ns(old_ns);
fce9acb4ffd1b7 Christian Brauner 2019-10-02 106
fce9acb4ffd1b7 Christian Brauner 2019-10-02 107 if (uts_debugfs) {
fce9acb4ffd1b7 Christian Brauner 2019-10-02 @108 snprintf(name, 50, "uts:[%u]", new_ns->ns.inum);
^^^^^^^^^^^^^^^
Oops
fce9acb4ffd1b7 Christian Brauner 2019-10-02 109 new_ns->ns.debugfs = debugfs_create_file(name, 0600, uts_debugfs,
fce9acb4ffd1b7 Christian Brauner 2019-10-02 110 &new_ns->ns, &ns_file_operations);
fce9acb4ffd1b7 Christian Brauner 2019-10-02 111 }
fce9acb4ffd1b7 Christian Brauner 2019-10-02 112
e3222c4ecc649c Badari Pulavarty 2007-05-08 113 return new_ns;
4865ecf1315b45 Serge E. Hallyn 2006-10-02 114 }
4865ecf1315b45 Serge E. Hallyn 2006-10-02 115
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: [brauner:debugfs_namespaces 3/5] kernel/utsname.c:108 copy_utsname() error: 'new_ns' dereferencing possible ERR_PTR()
Date: Mon, 07 Oct 2019 12:57:57 +0300 [thread overview]
Message-ID: <20191007095756.GC21515@kadam> (raw)
[-- Attachment #1: Type: text/plain, Size: 3566 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git debugfs_namespaces
head: aef8406e30cf9b60c76e5de205fa77f3791e2c54
commit: fce9acb4ffd1b7b342c69f0c39d49835b7232414 [3/5] DEBUG
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
kernel/utsname.c:108 copy_utsname() error: 'new_ns' dereferencing possible ERR_PTR()
# https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git/commit/?id=fce9acb4ffd1b7b342c69f0c39d49835b7232414
git remote add brauner https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git
git remote update brauner
git checkout fce9acb4ffd1b7b342c69f0c39d49835b7232414
vim +/new_ns +108 kernel/utsname.c
071df104f808b8 Serge E. Hallyn 2006-10-02 84
4865ecf1315b45 Serge E. Hallyn 2006-10-02 85 /*
4865ecf1315b45 Serge E. Hallyn 2006-10-02 86 * Copy task tsk's utsname namespace, or clone it if flags
4865ecf1315b45 Serge E. Hallyn 2006-10-02 87 * specifies CLONE_NEWUTS. In latter case, changes to the
4865ecf1315b45 Serge E. Hallyn 2006-10-02 88 * utsname of this process won't be seen by parent, and vice
4865ecf1315b45 Serge E. Hallyn 2006-10-02 89 * versa.
4865ecf1315b45 Serge E. Hallyn 2006-10-02 90 */
bb96a6f50be273 Serge E. Hallyn 2011-03-23 91 struct uts_namespace *copy_utsname(unsigned long flags,
bcf58e725ddc45 Eric W. Biederman 2012-07-26 92 struct user_namespace *user_ns, struct uts_namespace *old_ns)
4865ecf1315b45 Serge E. Hallyn 2006-10-02 93 {
071df104f808b8 Serge E. Hallyn 2006-10-02 94 struct uts_namespace *new_ns;
fce9acb4ffd1b7 Christian Brauner 2019-10-02 95 char name[50];
4865ecf1315b45 Serge E. Hallyn 2006-10-02 96
e3222c4ecc649c Badari Pulavarty 2007-05-08 97 BUG_ON(!old_ns);
4865ecf1315b45 Serge E. Hallyn 2006-10-02 98 get_uts_ns(old_ns);
4865ecf1315b45 Serge E. Hallyn 2006-10-02 99
071df104f808b8 Serge E. Hallyn 2006-10-02 100 if (!(flags & CLONE_NEWUTS))
e3222c4ecc649c Badari Pulavarty 2007-05-08 101 return old_ns;
071df104f808b8 Serge E. Hallyn 2006-10-02 102
bcf58e725ddc45 Eric W. Biederman 2012-07-26 103 new_ns = clone_uts_ns(user_ns, old_ns);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This isn't checked for errors
071df104f808b8 Serge E. Hallyn 2006-10-02 104
071df104f808b8 Serge E. Hallyn 2006-10-02 105 put_uts_ns(old_ns);
fce9acb4ffd1b7 Christian Brauner 2019-10-02 106
fce9acb4ffd1b7 Christian Brauner 2019-10-02 107 if (uts_debugfs) {
fce9acb4ffd1b7 Christian Brauner 2019-10-02 @108 snprintf(name, 50, "uts:[%u]", new_ns->ns.inum);
^^^^^^^^^^^^^^^
Oops
fce9acb4ffd1b7 Christian Brauner 2019-10-02 109 new_ns->ns.debugfs = debugfs_create_file(name, 0600, uts_debugfs,
fce9acb4ffd1b7 Christian Brauner 2019-10-02 110 &new_ns->ns, &ns_file_operations);
fce9acb4ffd1b7 Christian Brauner 2019-10-02 111 }
fce9acb4ffd1b7 Christian Brauner 2019-10-02 112
e3222c4ecc649c Badari Pulavarty 2007-05-08 113 return new_ns;
4865ecf1315b45 Serge E. Hallyn 2006-10-02 114 }
4865ecf1315b45 Serge E. Hallyn 2006-10-02 115
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
next reply other threads:[~2019-10-07 9:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-07 9:57 Dan Carpenter [this message]
2019-10-07 9:57 ` [brauner:debugfs_namespaces 3/5] kernel/utsname.c:108 copy_utsname() error: 'new_ns' dereferencing possible ERR_PTR() Dan Carpenter
[not found] <20191007100530.xnpvxrhbl77yabjr@wittgenstein>
2019-10-07 10:26 ` Dan Carpenter
2019-10-07 10:26 ` 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=20191007095756.GC21515@kadam \
--to=dan.carpenter@oracle.com \
--cc=kbuild@lists.01.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.