linux/fs/sysfs
Ming Lei e5110f411d sysfs: handle failure path correctly for readdir()
In case of 'if (filp->f_pos ==  0 or 1)' of sysfs_readdir(),
the failure from filldir() isn't handled, and the reference counter
of the sysfs_dirent object pointed by filp->private_data will be
released without clearing filp->private_data, so use after free
bug will be triggered later.

This patch returns immeadiately under the situation for fixing the bug,
and it is reasonable to return from readdir() when filldir() fails.

Reported-by: Dave Jones <davej@redhat.com>
Tested-by: Sasha Levin <levinsasha928@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-20 16:53:42 -07:00
..
bin.c hlist: drop the node parameter from iterators 2013-02-27 19:10:24 -08:00
dir.c sysfs: handle failure path correctly for readdir() 2013-03-20 16:53:42 -07:00
file.c Revert "sysfs: Convert print_symbol to %pSR" 2013-01-17 13:09:57 -08:00
group.c sysfs: Functions for adding/removing symlinks to/from attribute groups 2013-01-25 21:51:13 +01:00
inode.c avoid iput() from flusher thread 2012-05-28 09:54:45 -07:00
Kconfig kconfig: rename CONFIG_EMBEDDED to CONFIG_EXPERT 2011-01-20 17:02:05 -08:00
Makefile
mount.c sysfs: Fixed a trailing white space error 2013-01-17 12:54:47 -08:00
symlink.c sysfs: Functions for adding/removing symlinks to/from attribute groups 2013-01-25 21:51:13 +01:00
sysfs.h sysfs: Functions for adding/removing symlinks to/from attribute groups 2013-01-25 21:51:13 +01:00