lkml.org 
[lkml]   [1999]   [Jul]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject2.3.10: Bug with locks held in fs code
Hi,

By browsing in the latest (2.3.10) diff I observed the following strange
things:

In linux/fs/fcntl.c:
---- snip ----
+ write_lock(&files->file_lock);
arg = find_next_zero_bit(&files->open_fds, NR_OPEN, arg);
if (arg >= current->rlim[RLIMIT_NOFILE].rlim_cur)
goto out_putf;
FD_SET(arg, &files->open_fds);
FD_CLR(arg, &files->close_on_exec);
+ write_unlock(&files->file_lock);
fd_install(arg, file);
error = arg;
out:
---- snap ----

In the middle, the "goto out_putf" exits this function without unlocking
the &files->file_lock.

And similarly in linux/fs/file_table.c:
---- snip ----
+ /* Writable file? */
+ if (S_ISREG(inode->i_mode) && (file->f_mode & FMODE_WRITE))
+ return 0;
}
+ file_list_unlock();
+ return 1; /* Tis' cool bro. */
+too_bad:
+ file_list_unlock();
+ return 0;
}
---- snap ----

The first "return 0" should better read "goto too_bad", otherwise the
function exits without doing "file_list_unlock();"



Ciao,
Michael.



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:52    [W:2.425 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site