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 branch 'work.epoll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull epoll fixes from Al Viro:
"Fix reference counting and clean up exit paths"

* 'work.epoll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
do_epoll_ctl(): clean the failure exits up a bit
epoll: Keep a reference on files added to the check list

+14 -14
+14 -14
fs/eventpoll.c
··· 1994 1994 * not already there, and calling reverse_path_check() 1995 1995 * during ep_insert(). 1996 1996 */ 1997 - if (list_empty(&epi->ffd.file->f_tfile_llink)) 1997 + if (list_empty(&epi->ffd.file->f_tfile_llink)) { 1998 + get_file(epi->ffd.file); 1998 1999 list_add(&epi->ffd.file->f_tfile_llink, 1999 2000 &tfile_check_list); 2001 + } 2000 2002 } 2001 2003 } 2002 2004 mutex_unlock(&ep->mtx); ··· 2042 2040 file = list_first_entry(&tfile_check_list, struct file, 2043 2041 f_tfile_llink); 2044 2042 list_del_init(&file->f_tfile_llink); 2043 + fput(file); 2045 2044 } 2046 2045 INIT_LIST_HEAD(&tfile_check_list); 2047 2046 } ··· 2203 2200 full_check = 1; 2204 2201 if (is_file_epoll(tf.file)) { 2205 2202 error = -ELOOP; 2206 - if (ep_loop_check(ep, tf.file) != 0) { 2207 - clear_tfile_check_list(); 2203 + if (ep_loop_check(ep, tf.file) != 0) 2208 2204 goto error_tgt_fput; 2209 - } 2210 - } else 2205 + } else { 2206 + get_file(tf.file); 2211 2207 list_add(&tf.file->f_tfile_llink, 2212 2208 &tfile_check_list); 2213 - error = epoll_mutex_lock(&ep->mtx, 0, nonblock); 2214 - if (error) { 2215 - out_del: 2216 - list_del(&tf.file->f_tfile_llink); 2217 - goto error_tgt_fput; 2218 2209 } 2210 + error = epoll_mutex_lock(&ep->mtx, 0, nonblock); 2211 + if (error) 2212 + goto error_tgt_fput; 2219 2213 if (is_file_epoll(tf.file)) { 2220 2214 tep = tf.file->private_data; 2221 2215 error = epoll_mutex_lock(&tep->mtx, 1, nonblock); 2222 2216 if (error) { 2223 2217 mutex_unlock(&ep->mtx); 2224 - goto out_del; 2218 + goto error_tgt_fput; 2225 2219 } 2226 2220 } 2227 2221 } ··· 2239 2239 error = ep_insert(ep, epds, tf.file, fd, full_check); 2240 2240 } else 2241 2241 error = -EEXIST; 2242 - if (full_check) 2243 - clear_tfile_check_list(); 2244 2242 break; 2245 2243 case EPOLL_CTL_DEL: 2246 2244 if (epi) ··· 2261 2263 mutex_unlock(&ep->mtx); 2262 2264 2263 2265 error_tgt_fput: 2264 - if (full_check) 2266 + if (full_check) { 2267 + clear_tfile_check_list(); 2265 2268 mutex_unlock(&epmutex); 2269 + } 2266 2270 2267 2271 fdput(tf); 2268 2272 error_fput: