Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'driver-core-3.9-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull sysfs fixes from Greg Kroah-Hartman:
"Here are two fixes for sysfs that resolve issues that have been found
by the Trinity fuzz tool, causing oopses in sysfs. They both have
been in linux-next for a while to ensure that they do not cause any
other problems."

* tag 'driver-core-3.9-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
sysfs: handle failure path correctly for readdir()
sysfs: fix race between readdir and lseek

+16 -1
+16 -1
fs/sysfs/dir.c
··· 1020 1020 ino = parent_sd->s_ino; 1021 1021 if (filldir(dirent, ".", 1, filp->f_pos, ino, DT_DIR) == 0) 1022 1022 filp->f_pos++; 1023 + else 1024 + return 0; 1023 1025 } 1024 1026 if (filp->f_pos == 1) { 1025 1027 if (parent_sd->s_parent) ··· 1030 1028 ino = parent_sd->s_ino; 1031 1029 if (filldir(dirent, "..", 2, filp->f_pos, ino, DT_DIR) == 0) 1032 1030 filp->f_pos++; 1031 + else 1032 + return 0; 1033 1033 } 1034 1034 mutex_lock(&sysfs_mutex); 1035 1035 for (pos = sysfs_dir_pos(ns, parent_sd, filp->f_pos, pos); ··· 1062 1058 return 0; 1063 1059 } 1064 1060 1061 + static loff_t sysfs_dir_llseek(struct file *file, loff_t offset, int whence) 1062 + { 1063 + struct inode *inode = file_inode(file); 1064 + loff_t ret; 1065 + 1066 + mutex_lock(&inode->i_mutex); 1067 + ret = generic_file_llseek(file, offset, whence); 1068 + mutex_unlock(&inode->i_mutex); 1069 + 1070 + return ret; 1071 + } 1065 1072 1066 1073 const struct file_operations sysfs_dir_operations = { 1067 1074 .read = generic_read_dir, 1068 1075 .readdir = sysfs_readdir, 1069 1076 .release = sysfs_dir_release, 1070 - .llseek = generic_file_llseek, 1077 + .llseek = sysfs_dir_llseek, 1071 1078 };