[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <514A7340.5040409@huawei.com>
Date: Thu, 21 Mar 2013 10:41:04 +0800
From: Li Zefan <lizefan@...wei.com>
To: Ming Lei <ming.lei@...onical.com>
CC: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
<linux-kernel@...r.kernel.org>, <stable@...r.kernel.org>
Subject: Re: [PATCH 1/2] sysfs: fix race between readdir and lseek
On 2013/3/20 23:25, Ming Lei wrote:
> While readdir() is running, lseek() may set filp->f_pos as zero,
> then may leave filp->private_data pointing to one sysfs_dirent
> object without holding its reference counter, so the sysfs_dirent
> object may be used after free in next readdir().
>
> This patch holds inode->i_mutex to avoid the problem since
> the lock is always held in readdir path.
>
In fact the same race exists between readdir() and read()/write()...
> Reported-by: Dave Jones <davej@...hat.com>
> Tested-by: Sasha Levin <levinsasha928@...il.com>
> Cc: <stable@...r.kernel.org>
> Signed-off-by: Ming Lei <ming.lei@...onical.com>
> ---
> fs/sysfs/dir.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
--
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