History

Merge tag 'pull-work.fd-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull file descriptor fix from Al Viro: "Fix for breakage in #work.fd this window" * tag 'pull-work.fd-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: fix the breakage in close_fd_get_file() calling conventions change

Linus Torvalds committed 4 years ago

Commit 6684cf42 parents 815b196 40a19263 files · +4 −6Browse files

Unified · Split

3 files
  1. drivers/android/binder.c +2 −0
  2. fs/file.c +1 −2
  3. fs/io_uring.c +1 −4
drivers/android/binder.c+2−0
@@ -1886,6 +1886,8 @@ static void binder_deferred_fd_close(int fd) · 1885 unmodified lines
1886 init_task_work(&twcb->twork, binder_do_fd_close);1886 init_task_work(&twcb->twork, binder_do_fd_close);
1887 twcb->file = close_fd_get_file(fd);1887 twcb->file = close_fd_get_file(fd);
1888 if (twcb->file) {1888 if (twcb->file) {
1889 // pin it until binder_do_fd_close(); see comments there
1890 get_file(twcb->file);
1889 filp_close(twcb->file, current->files);1891 filp_close(twcb->file, current->files);
1890 task_work_add(current, &twcb->twork, TWA_RESUME);1892 task_work_add(current, &twcb->twork, TWA_RESUME);
1891 } else {1893 } else {
fs/file.c+1−2
@@ -800,8 +800,7 @@ struct file *__close_fd_get_file(unsigned int fd) · 799 unmodified lines
800 800
801/*801/*
802 * variant of close_fd that gets a ref on the file for later fput.802 * variant of close_fd that gets a ref on the file for later fput.
803 * The caller must ensure that filp_close() called on the file, and then803 * The caller must ensure that filp_close() called on the file.
804 * an fput().
805 */804 */
806struct file *close_fd_get_file(unsigned int fd)805struct file *close_fd_get_file(unsigned int fd)
807{806{
fs/io_uring.c+1−4
@@ -6010,7 +6010,7 @@ static int io_close(struct io_kiocb *req, unsigned int issue_flags) · 6009 unmodified lines
6010 struct files_struct *files = current->files;6010 struct files_struct *files = current->files;
6011 struct io_close *close = &req->close;6011 struct io_close *close = &req->close;
6012 struct fdtable *fdt;6012 struct fdtable *fdt;
6013 struct file *file = NULL;6013 struct file *file;
6014 int ret = -EBADF;6014 int ret = -EBADF;
6015 6015
6016 if (req->close.file_slot) {6016 if (req->close.file_slot) {
@@ -6029,7 +6029,6 @@ static int io_close(struct io_kiocb *req, unsigned int issue_flags) · 12 unmodified lines
6029 lockdep_is_held(&files->file_lock));6029 lockdep_is_held(&files->file_lock));
6030 if (!file || file->f_op == &io_uring_fops) {6030 if (!file || file->f_op == &io_uring_fops) {
6031 spin_unlock(&files->file_lock);6031 spin_unlock(&files->file_lock);
6032 file = NULL;
6033 goto err;6032 goto err;
6034 }6033 }
6035 6034
@@ -6049,8 +6048,6 @@ static int io_close(struct io_kiocb *req, unsigned int issue_flags) · 13 unmodified lines
6049err:6048err:
6050 if (ret < 0)6049 if (ret < 0)
6051 req_set_fail(req);6050 req_set_fail(req);
6052 if (file)
6053 fput(file);
6054 __io_req_complete(req, issue_flags, ret, 0);6051 __io_req_complete(req, issue_flags, ret, 0);
6055 return 0;6052 return 0;
6056}6053}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t