All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: oe-kbuild@lists.linux.dev, Johannes Berg <johannes@sipsolutions.net>
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev
Subject: Re: [RFC PATCH 1/6] debugfs: fix automount d_fsdata usage
Date: Mon, 20 Nov 2023 06:31:18 -0500	[thread overview]
Message-ID: <5c59da09-c04a-4727-9265-58976ac13a45@suswa.mountain> (raw)
In-Reply-To: <20231109222251.9e54cb55c700.I64fe5615568e87f9ae2d7fb2ac4e5fa96924cb50@changeid>

Hi Johannes,

kernel test robot noticed the following build warnings:

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Johannes-Berg/debugfs-fix-automount-d_fsdata-usage/20231110-054024
base:   driver-core/driver-core-testing
patch link:    https://lore.kernel.org/r/20231109222251.9e54cb55c700.I64fe5615568e87f9ae2d7fb2ac4e5fa96924cb50%40changeid
patch subject: [RFC PATCH 1/6] debugfs: fix automount d_fsdata usage
config: i386-randconfig-141-20231111 (https://download.01.org/0day-ci/archive/20231111/202311110653.cItFLCy6-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231111/202311110653.cItFLCy6-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202311110653.cItFLCy6-lkp@intel.com/

New smatch warnings:
fs/debugfs/inode.c:655 debugfs_create_automount() warn: possible memory leak of 'fsd'

vim +/fsd +655 fs/debugfs/inode.c

77b3da6e3232d3 Al Viro            2015-01-25  633  struct dentry *debugfs_create_automount(const char *name,
77b3da6e3232d3 Al Viro            2015-01-25  634  					struct dentry *parent,
93faccbbfa958a Eric W. Biederman  2017-02-01  635  					debugfs_automount_t f,
77b3da6e3232d3 Al Viro            2015-01-25  636  					void *data)
77b3da6e3232d3 Al Viro            2015-01-25  637  {
77b3da6e3232d3 Al Viro            2015-01-25  638  	struct dentry *dentry = start_creating(name, parent);
3e1dead436f419 Johannes Berg      2023-11-09  639  	struct debugfs_fsdata *fsd;
77b3da6e3232d3 Al Viro            2015-01-25  640  	struct inode *inode;
77b3da6e3232d3 Al Viro            2015-01-25  641  
77b3da6e3232d3 Al Viro            2015-01-25  642  	if (IS_ERR(dentry))
ff9fb72bc07705 Greg Kroah-Hartman 2019-01-23  643  		return dentry;
77b3da6e3232d3 Al Viro            2015-01-25  644  
3e1dead436f419 Johannes Berg      2023-11-09  645  	fsd = kzalloc(sizeof(*fsd), GFP_KERNEL);
3e1dead436f419 Johannes Berg      2023-11-09  646  	if (!fsd) {
3e1dead436f419 Johannes Berg      2023-11-09  647  		failed_creating(dentry);
3e1dead436f419 Johannes Berg      2023-11-09  648  		return ERR_PTR(-ENOMEM);
3e1dead436f419 Johannes Berg      2023-11-09  649  	}
3e1dead436f419 Johannes Berg      2023-11-09  650  
3e1dead436f419 Johannes Berg      2023-11-09  651  	fsd->automount = f;
3e1dead436f419 Johannes Berg      2023-11-09  652  
a24c6f7bc923d5 Peter Enderborg    2020-07-16  653  	if (!(debugfs_allow & DEBUGFS_ALLOW_API)) {
a24c6f7bc923d5 Peter Enderborg    2020-07-16  654  		failed_creating(dentry);
a24c6f7bc923d5 Peter Enderborg    2020-07-16 @655  		return ERR_PTR(-EPERM);

kfree(fsd);

a24c6f7bc923d5 Peter Enderborg    2020-07-16  656  	}
a24c6f7bc923d5 Peter Enderborg    2020-07-16  657  
77b3da6e3232d3 Al Viro            2015-01-25  658  	inode = debugfs_get_inode(dentry->d_sb);
43e23b6c0b0151 Greg Kroah-Hartman 2019-07-03  659  	if (unlikely(!inode)) {
43e23b6c0b0151 Greg Kroah-Hartman 2019-07-03  660  		pr_err("out of free dentries, can not create automount '%s'\n",
43e23b6c0b0151 Greg Kroah-Hartman 2019-07-03  661  		       name);
77b3da6e3232d3 Al Viro            2015-01-25  662  		return failed_creating(dentry);
43e23b6c0b0151 Greg Kroah-Hartman 2019-07-03  663  	}
77b3da6e3232d3 Al Viro            2015-01-25  664  
87243deb88671f Seth Forshee       2016-03-09  665  	make_empty_dir_inode(inode);
77b3da6e3232d3 Al Viro            2015-01-25  666  	inode->i_flags |= S_AUTOMOUNT;
77b3da6e3232d3 Al Viro            2015-01-25  667  	inode->i_private = data;
3e1dead436f419 Johannes Berg      2023-11-09  668  	dentry->d_fsdata = fsd;
a8f324a46fbe54 Roman Pen          2016-02-09  669  	/* directory inodes start off with i_nlink == 2 (for "." entry) */
a8f324a46fbe54 Roman Pen          2016-02-09  670  	inc_nlink(inode);
77b3da6e3232d3 Al Viro            2015-01-25  671  	d_instantiate(dentry, inode);
a8f324a46fbe54 Roman Pen          2016-02-09  672  	inc_nlink(d_inode(dentry->d_parent));
a8f324a46fbe54 Roman Pen          2016-02-09  673  	fsnotify_mkdir(d_inode(dentry->d_parent), dentry);
77b3da6e3232d3 Al Viro            2015-01-25  674  	return end_creating(dentry);
77b3da6e3232d3 Al Viro            2015-01-25  675  }

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


  reply	other threads:[~2023-11-20 11:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-09 21:22 [RFC PATCH 0/6] debugfs/wifi: locking fixes Johannes Berg
2023-11-09 21:22 ` [RFC PATCH 1/6] debugfs: fix automount d_fsdata usage Johannes Berg
2023-11-20 11:31   ` Dan Carpenter [this message]
2023-11-09 21:22 ` [RFC PATCH 2/6] debugfs: annotate debugfs handlers vs. removal with lockdep Johannes Berg
2023-12-02  6:37   ` Sergey Senozhatsky
2023-12-02 10:40     ` Johannes Berg
2023-11-09 21:22 ` [RFC PATCH 3/6] debugfs: add API to allow debugfs operations cancellation Johannes Berg
2023-11-10  9:35   ` Benjamin Berg
2023-11-09 21:22 ` [RFC PATCH 4/6] wifi: cfg80211: add locked debugfs wrappers Johannes Berg
2023-11-09 21:22 ` [RFC PATCH 5/6] wifi: mac80211: use wiphy locked debugfs helpers for agg_status Johannes Berg
2023-11-10  4:23   ` kernel test robot
2023-11-10 12:04   ` kernel test robot
2023-11-09 21:22 ` [RFC PATCH 6/6] wifi: mac80211: use wiphy locked debugfs for sdata/link Johannes Berg
2023-11-10  6:33   ` kernel test robot
2023-11-10 23:12 [RFC PATCH 1/6] debugfs: fix automount d_fsdata usage kernel test robot

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=5c59da09-c04a-4727-9265-58976ac13a45@suswa.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=johannes@sipsolutions.net \
    --cc=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=oe-kbuild@lists.linux.dev \
    /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.