diff mbox

[V9fs-developer] fs/9p/: don't treat error as status value in file locking

Message ID 1403480661-32620-1-git-send-email-sasha.levin@oracle.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Sasha Levin June 22, 2014, 11:44 p.m. UTC
When trying to lock a file we didn't properly handle the case where a
failure in p9_client_lock_dotl() occurs and treated the status value
as valid instead of discarding it due to the error.

This would usually trigger a BUG() since the status value would
just be stack garbage.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 fs/9p/vfs_file.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sasha Levin Aug. 6, 2014, 12:53 a.m. UTC | #1
Ping?

On 06/22/2014 07:44 PM, Sasha Levin wrote:
> When trying to lock a file we didn't properly handle the case where a
> failure in p9_client_lock_dotl() occurs and treated the status value
> as valid instead of discarding it due to the error.
> 
> This would usually trigger a BUG() since the status value would
> just be stack garbage.
> 
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
> ---
>  fs/9p/vfs_file.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
> index 520c11c..06077f3 100644
> --- a/fs/9p/vfs_file.c
> +++ b/fs/9p/vfs_file.c
> @@ -194,7 +194,7 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl)
>  	for (;;) {
>  		res = p9_client_lock_dotl(fid, &flock, &status);
>  		if (res < 0)
> -			break;
> +			return res;
>  
>  		if (status != P9_LOCK_BLOCKED)
>  			break;
> 


------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
diff mbox

Patch

diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index 520c11c..06077f3 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -194,7 +194,7 @@  static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl)
 	for (;;) {
 		res = p9_client_lock_dotl(fid, &flock, &status);
 		if (res < 0)
-			break;
+			return res;
 
 		if (status != P9_LOCK_BLOCKED)
 			break;