Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit af955658 authored by Richard Weinberger's avatar Richard Weinberger
Browse files

hostfs: hostfs_file_open: Fix a fd leak in hostfs_file_open



In case of a race between to callers of hostfs_file_open()
it can happen that a file describtor is leaked.

Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
parent 69886e67
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -329,6 +329,7 @@ static int hostfs_file_open(struct inode *ino, struct file *file)
	/* somebody else had handled it first? */
	if ((mode & HOSTFS_I(ino)->mode) == mode) {
		mutex_unlock(&HOSTFS_I(ino)->open_mutex);
		close_file(&fd);
		return 0;
	}
	if ((mode | HOSTFS_I(ino)->mode) != mode) {