All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] locks: missing unlock on error in generic_add_lease()
@ 2013-11-13  7:56 ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2013-11-13  7:56 UTC (permalink / raw)
  To: Matthew Wilcox, J. Bruce Fields
  Cc: Alexander Viro, linux-fsdevel, kernel-janitors

We should unlock here before returning.

Fixes: df4e8d2c1d2b ('locks: implement delegations')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Static checker stuff.

diff --git a/fs/locks.c b/fs/locks.c
index f99d52b..92a0f0a 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1494,6 +1494,7 @@ static int generic_add_lease(struct file *filp, long arg, struct file_lock **flp
 
 	if (is_deleg && arg == F_WRLCK) {
 		/* Write delegations are not currently supported: */
+		mutex_unlock(&inode->i_mutex);
 		WARN_ON_ONCE(1);
 		return -EINVAL;
 	}

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [patch] locks: missing unlock on error in generic_add_lease()
@ 2013-11-13  7:56 ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2013-11-13  7:56 UTC (permalink / raw)
  To: Matthew Wilcox, J. Bruce Fields
  Cc: Alexander Viro, linux-fsdevel, kernel-janitors

We should unlock here before returning.

Fixes: df4e8d2c1d2b ('locks: implement delegations')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Static checker stuff.

diff --git a/fs/locks.c b/fs/locks.c
index f99d52b..92a0f0a 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1494,6 +1494,7 @@ static int generic_add_lease(struct file *filp, long arg, struct file_lock **flp
 
 	if (is_deleg && arg = F_WRLCK) {
 		/* Write delegations are not currently supported: */
+		mutex_unlock(&inode->i_mutex);
 		WARN_ON_ONCE(1);
 		return -EINVAL;
 	}

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [patch] locks: missing unlock on error in generic_add_lease()
  2013-11-13  7:56 ` Dan Carpenter
@ 2013-11-13 13:51   ` J. Bruce Fields
  -1 siblings, 0 replies; 8+ messages in thread
From: J. Bruce Fields @ 2013-11-13 13:51 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Matthew Wilcox, Alexander Viro, linux-fsdevel, kernel-janitors

On Wed, Nov 13, 2013 at 10:56:27AM +0300, Dan Carpenter wrote:
> We should unlock here before returning.

A buggy-caller case, so shouldn't be a huge deal, but obviously should
be fixed, thanks!

	Acked-by: J. Bruce Fields <bfields@redhat.com>

I'm assuming Al will pick it up.

(Though error = -EAGAIN and "goto out" would be more consistent with
other exits.)

--b.

> 
> Fixes: df4e8d2c1d2b ('locks: implement delegations')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Static checker stuff.
> 
> diff --git a/fs/locks.c b/fs/locks.c
> index f99d52b..92a0f0a 100644
> --- a/fs/locks.c
> +++ b/fs/locks.c
> @@ -1494,6 +1494,7 @@ static int generic_add_lease(struct file *filp, long arg, struct file_lock **flp
>  
>  	if (is_deleg && arg == F_WRLCK) {
>  		/* Write delegations are not currently supported: */
> +		mutex_unlock(&inode->i_mutex);
>  		WARN_ON_ONCE(1);
>  		return -EINVAL;
>  	}

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] locks: missing unlock on error in generic_add_lease()
@ 2013-11-13 13:51   ` J. Bruce Fields
  0 siblings, 0 replies; 8+ messages in thread
From: J. Bruce Fields @ 2013-11-13 13:51 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Matthew Wilcox, Alexander Viro, linux-fsdevel, kernel-janitors

On Wed, Nov 13, 2013 at 10:56:27AM +0300, Dan Carpenter wrote:
> We should unlock here before returning.

A buggy-caller case, so shouldn't be a huge deal, but obviously should
be fixed, thanks!

	Acked-by: J. Bruce Fields <bfields@redhat.com>

I'm assuming Al will pick it up.

(Though error = -EAGAIN and "goto out" would be more consistent with
other exits.)

--b.

> 
> Fixes: df4e8d2c1d2b ('locks: implement delegations')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Static checker stuff.
> 
> diff --git a/fs/locks.c b/fs/locks.c
> index f99d52b..92a0f0a 100644
> --- a/fs/locks.c
> +++ b/fs/locks.c
> @@ -1494,6 +1494,7 @@ static int generic_add_lease(struct file *filp, long arg, struct file_lock **flp
>  
>  	if (is_deleg && arg = F_WRLCK) {
>  		/* Write delegations are not currently supported: */
> +		mutex_unlock(&inode->i_mutex);
>  		WARN_ON_ONCE(1);
>  		return -EINVAL;
>  	}

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] locks: missing unlock on error in generic_add_lease()
  2013-11-13 13:51   ` J. Bruce Fields
@ 2013-11-13 14:07     ` Dan Carpenter
  -1 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2013-11-13 14:07 UTC (permalink / raw)
  To: J. Bruce Fields
  Cc: Matthew Wilcox, Alexander Viro, linux-fsdevel, kernel-janitors

On Wed, Nov 13, 2013 at 08:51:04AM -0500, J. Bruce Fields wrote:
> On Wed, Nov 13, 2013 at 10:56:27AM +0300, Dan Carpenter wrote:
> > We should unlock here before returning.
> 
> A buggy-caller case, so shouldn't be a huge deal, but obviously should
> be fixed, thanks!
> 
> 	Acked-by: J. Bruce Fields <bfields@redhat.com>
> 
> I'm assuming Al will pick it up.
> 
> (Though error = -EAGAIN and "goto out" would be more consistent with
> other exits.)


-EINVAL, but yeah you're right.  I'll resend.

regards,
dan carpenter



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] locks: missing unlock on error in generic_add_lease()
@ 2013-11-13 14:07     ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2013-11-13 14:07 UTC (permalink / raw)
  To: J. Bruce Fields
  Cc: Matthew Wilcox, Alexander Viro, linux-fsdevel, kernel-janitors

On Wed, Nov 13, 2013 at 08:51:04AM -0500, J. Bruce Fields wrote:
> On Wed, Nov 13, 2013 at 10:56:27AM +0300, Dan Carpenter wrote:
> > We should unlock here before returning.
> 
> A buggy-caller case, so shouldn't be a huge deal, but obviously should
> be fixed, thanks!
> 
> 	Acked-by: J. Bruce Fields <bfields@redhat.com>
> 
> I'm assuming Al will pick it up.
> 
> (Though error = -EAGAIN and "goto out" would be more consistent with
> other exits.)


-EINVAL, but yeah you're right.  I'll resend.

regards,
dan carpenter



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [patch v2] locks: missing unlock on error in generic_add_lease()
  2013-11-13 13:51   ` J. Bruce Fields
@ 2013-11-13 14:10     ` Dan Carpenter
  -1 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2013-11-13 14:10 UTC (permalink / raw)
  To: Matthew Wilcox, J. Bruce Fields
  Cc: Alexander Viro, linux-fsdevel, kernel-janitors

We should unlock here before returning.

Fixes: df4e8d2c1d2b ('locks: implement delegations')
Acked-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: Style fix

diff --git a/fs/locks.c b/fs/locks.c
index f99d52b..7b7ed7d 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1495,7 +1495,8 @@ static int generic_add_lease(struct file *filp, long arg, struct file_lock **flp
 	if (is_deleg && arg == F_WRLCK) {
 		/* Write delegations are not currently supported: */
 		WARN_ON_ONCE(1);
-		return -EINVAL;
+		error = -EINVAL;
+		goto out;
 	}
 
 	error = -EAGAIN;

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [patch v2] locks: missing unlock on error in generic_add_lease()
@ 2013-11-13 14:10     ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2013-11-13 14:10 UTC (permalink / raw)
  To: Matthew Wilcox, J. Bruce Fields
  Cc: Alexander Viro, linux-fsdevel, kernel-janitors

We should unlock here before returning.

Fixes: df4e8d2c1d2b ('locks: implement delegations')
Acked-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: Style fix

diff --git a/fs/locks.c b/fs/locks.c
index f99d52b..7b7ed7d 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1495,7 +1495,8 @@ static int generic_add_lease(struct file *filp, long arg, struct file_lock **flp
 	if (is_deleg && arg = F_WRLCK) {
 		/* Write delegations are not currently supported: */
 		WARN_ON_ONCE(1);
-		return -EINVAL;
+		error = -EINVAL;
+		goto out;
 	}
 
 	error = -EAGAIN;

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-11-13 14:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-13  7:56 [patch] locks: missing unlock on error in generic_add_lease() Dan Carpenter
2013-11-13  7:56 ` Dan Carpenter
2013-11-13 13:51 ` J. Bruce Fields
2013-11-13 13:51   ` J. Bruce Fields
2013-11-13 14:07   ` Dan Carpenter
2013-11-13 14:07     ` Dan Carpenter
2013-11-13 14:10   ` [patch v2] " Dan Carpenter
2013-11-13 14:10     ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.