diff mbox

[-next] CIFS: fix error return code in cifs_atomic_open()

Message ID CAPgLHd-3rC7ZJz+SWnd-Gt1C9RxtPs58OCCMgOeHvgdT3TFj5A@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wei Yongjun April 4, 2013, 6:16 a.m. UTC
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Fix to return a negative error code from the error handling
case instead of 0, as returned elsewhere in this function.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 fs/cifs/dir.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Steve French April 4, 2013, 6:42 a.m. UTC | #1
Your fix looks correct - do you have a problem reproduction scenario
where you encountered this?

On Thu, Apr 4, 2013 at 1:16 AM, Wei Yongjun <weiyj.lk@gmail.com> wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> Fix to return a negative error code from the error handling
> case instead of 0, as returned elsewhere in this function.
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
>  fs/cifs/dir.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
> index 46e455e..5699b50 100644
> --- a/fs/cifs/dir.c
> +++ b/fs/cifs/dir.c
> @@ -457,8 +457,10 @@ cifs_atomic_open(struct inode *inode, struct dentry *direntry,
>                  inode, direntry->d_name.name, direntry);
>
>         tlink = cifs_sb_tlink(CIFS_SB(inode->i_sb));
> -       if (IS_ERR(tlink))
> +       if (IS_ERR(tlink)) {
> +               rc = PTR_ERR(tlink);
>                 goto out_free_xid;
> +       }
>
>         tcon = tlink_tcon(tlink);
>         server = tcon->ses->server;
>
Jeff Layton April 4, 2013, 5:39 p.m. UTC | #2
On Thu, 4 Apr 2013 14:16:21 +0800
Wei Yongjun <weiyj.lk@gmail.com> wrote:

> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> Fix to return a negative error code from the error handling
> case instead of 0, as returned elsewhere in this function.
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
>  fs/cifs/dir.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
> index 46e455e..5699b50 100644
> --- a/fs/cifs/dir.c
> +++ b/fs/cifs/dir.c
> @@ -457,8 +457,10 @@ cifs_atomic_open(struct inode *inode, struct dentry *direntry,
>  		 inode, direntry->d_name.name, direntry);
>  
>  	tlink = cifs_sb_tlink(CIFS_SB(inode->i_sb));
> -	if (IS_ERR(tlink))
> +	if (IS_ERR(tlink)) {
> +		rc = PTR_ERR(tlink);
>  		goto out_free_xid;
> +	}
>  
>  	tcon = tlink_tcon(tlink);
>  	server = tcon->ses->server;
> 

Looks right...

Reviewed-by: Jeff Layton <jlayton@redhat.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Steve French April 5, 2013, 4:05 a.m. UTC | #3
Merged into cifs-2.6.git for-next branch (for 3.10)

On Thu, Apr 4, 2013 at 12:39 PM, Jeff Layton <jlayton@redhat.com> wrote:
> On Thu, 4 Apr 2013 14:16:21 +0800
> Wei Yongjun <weiyj.lk@gmail.com> wrote:
>
>> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>>
>> Fix to return a negative error code from the error handling
>> case instead of 0, as returned elsewhere in this function.
>>
>> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>> ---
>>  fs/cifs/dir.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
>> index 46e455e..5699b50 100644
>> --- a/fs/cifs/dir.c
>> +++ b/fs/cifs/dir.c
>> @@ -457,8 +457,10 @@ cifs_atomic_open(struct inode *inode, struct dentry *direntry,
>>                inode, direntry->d_name.name, direntry);
>>
>>       tlink = cifs_sb_tlink(CIFS_SB(inode->i_sb));
>> -     if (IS_ERR(tlink))
>> +     if (IS_ERR(tlink)) {
>> +             rc = PTR_ERR(tlink);
>>               goto out_free_xid;
>> +     }
>>
>>       tcon = tlink_tcon(tlink);
>>       server = tcon->ses->server;
>>
>
> Looks right...
>
> Reviewed-by: Jeff Layton <jlayton@redhat.com>
diff mbox

Patch

diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index 46e455e..5699b50 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -457,8 +457,10 @@  cifs_atomic_open(struct inode *inode, struct dentry *direntry,
 		 inode, direntry->d_name.name, direntry);
 
 	tlink = cifs_sb_tlink(CIFS_SB(inode->i_sb));
-	if (IS_ERR(tlink))
+	if (IS_ERR(tlink)) {
+		rc = PTR_ERR(tlink);
 		goto out_free_xid;
+	}
 
 	tcon = tlink_tcon(tlink);
 	server = tcon->ses->server;