locks: missing unlock on error in generic_add_lease()
Subsystems (3)
PATCH 1/1 locks: missing unlock on error in generic_add_lease()
We should unlock here before returning.
---
Static checker stuff.
fs/locks.c +1 -0
@@ -1494,6 +1494,7 @@ static int generic_add_lease(struct file *filp, long arg, struct file_lock **flpif (is_deleg && arg =F_WRLCK ) {/* Write delegations are not currently supported: */ +mutex_unlock (&inode->i_mutex);WARN_ON_ONCE (1 );return -EINVAL ; }
Quoted 1 line · Dan Carpenter
We should unlock here before returning.
A buggy-caller case, so shouldn't be a huge deal, but obviously should be fixed, thanks!
I'm assuming Al will pick it up.
(Though error = -EAGAIN and "goto out" would be more consistent with other exits.)
--b.
Quoted 18 lines
Fixes df4e8d2c1d2b ('locks: implement delegations')Signed-off-by Dan Carpenter <[email protected]>---
Static checker stuff.fs/locks.c +1
-0@@ -1494,6 +1494,7 @@ static int generic_add_lease(struct file *filp, long arg, struct file_lock **flpif (is_deleg && arg =F_WRLCK ) {/* Write delegations are not currently supported: */ +mutex_unlock (&inode->i_mutex);WARN_ON_ONCE (1 );return -EINVAL ; }
Quoted 6 lines · J. Bruce Fields
Quoted 1 line · Dan Carpenter
We should unlock here before returning.
A buggy-caller case, so shouldn't be a huge deal, but obviously should be fixed, thanks!
Quoted 6 lines
Acked-by J. Bruce Fields <[email protected]>I'm assuming Al will pick it up.
(Though error =
-EAGAINand "goto out" would be more consistent with other exits.)
-EINVAL, but yeah you're right. I'll resend.
regards,
dan carpenter
PATCH v2 1/1 locks: missing unlock on error in generic_add_lease()
In reply to J. Bruce FieldsWe should unlock here before returning.
---
v2: Style fix
fs/locks.c +2 -1
@@ -1495,7 +1495,8 @@ static int generic_add_lease(struct file *filp, long arg, struct file_lock **flpif (is_deleg && arg =F_WRLCK ) {/* Write delegations are not currently supported: */ WARN_ON_ONCE (1 ); -return -EINVAL ; + error = -EINVAL ; + goto out; } error = -EAGAIN ;