[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <3626bdb18cfc40c98618d0ee68816ab0@SC-EXCH04.marvell.com>
Date: Mon, 8 Jun 2015 04:28:10 +0000
From: Lisa Du <cldu@...vell.com>
To: "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: A race condition between debugfs and seq_file operation
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?
In this case, when do the seq_file read, it grabs the seq_file->lock;
While in debugfs_remove_recursive(), it graps "parent->d_inode->i_mutex".
So there seems no protection between the ion_debug_client_show() and debugfs_remove_recursive().
Please let me know if I didn't describe the issue clear.
Would you help to comment if there's method to avoid such issue?
Best Regards.
Powered by blists - more mailing lists