[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150609211202.GA16801@kroah.com>
Date: Tue, 9 Jun 2015 14:12:02 -0700
From: "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>
To: Lisa Du <cldu@...vell.com>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: A race condition between debugfs and seq_file operation
On Mon, Jun 08, 2015 at 04:28:10AM +0000, Lisa Du wrote:
> Hi, All
> Recently I met one race condition related to debugfs.
>
> Take an example from ion.c in kernel3.14:
> static int ion_debug_client_open(struct inode *inode, struct file *file)
> {
> return single_open(file, ion_debug_client_show, inode->i_private);
> }
>
> static const struct file_operations debug_client_fops = {
> .open = ion_debug_client_open,
> .read = seq_read,
> .llseek = seq_lseek,
> .release = single_release,
> };
> client->debug_root = debugfs_create_file(client->display_name, 0664,
> dev->clients_debug_root,
> client, &debug_client_fops);
>
> I find during I read the debugfs node, driver can do debugfs_remove_recursive(dentry);
> Is it expected?
Yes. Well, not "expected", but a mess, yes.
Removing debugfs files are known to have lots of races, this isn't the
only one :(
thanks,
greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists