Skip to content

Commit

Permalink
[PATCH] Return error in case flock_lock_file failure
Browse files Browse the repository at this point in the history
If flock_lock_file() failed to allocate flock with locks_alloc_lock()
then "error = 0" is returned. Need to return some non-zero.

Signed-off-by: Pavel Emelianov <xemul@openvz.org>
Signed-off-by: Kirill Korotaev <dev@openvz.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Kirill Korotaev authored and Linus Torvalds committed Jun 14, 2006
1 parent eb35cf6 commit 9cedc19
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/locks.c
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,7 @@ static int flock_lock_file(struct file *filp, struct file_lock *request)
if (request->fl_type == F_UNLCK)
goto out;

error = -ENOMEM;
new_fl = locks_alloc_lock();
if (new_fl == NULL)
goto out;
Expand All @@ -781,6 +782,7 @@ static int flock_lock_file(struct file *filp, struct file_lock *request)
locks_copy_lock(new_fl, request);
locks_insert_lock(&inode->i_flock, new_fl);
new_fl = NULL;
error = 0;

out:
unlock_kernel();
Expand Down

0 comments on commit 9cedc19

Please sign in to comment.