Skip to content

Commit d2c5eb5

Browse files
dhowellsSteve French
authored andcommitted
cifs: Fix missing error code set
In cifs_strict_readv(), the default rc (-EACCES) is accidentally cleared by a successful return from netfs_start_io_direct(), such that if cifs_find_lock_conflict() fails, we don't return an error. Fix this by resetting the default error code. Fixes: 14b1cd2 ("cifs: Fix locking in cifs_strict_readv()") Cc: stable@vger.kernel.org Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Paulo Alcantara (Red Hat) <pc@manguebit.com> cc: Jeff Layton <jlayton@kernel.org> cc: linux-cifs@vger.kernel.org cc: netfs@lists.linux.dev cc: linux-fsdevel@vger.kernel.org Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent de40579 commit d2c5eb5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/smb/client/file.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2877,6 +2877,7 @@ cifs_strict_readv(struct kiocb *iocb, struct iov_iter *to)
28772877
rc = netfs_start_io_direct(inode);
28782878
if (rc < 0)
28792879
goto out;
2880+
rc = -EACCES;
28802881
down_read(&cinode->lock_sem);
28812882
if (!cifs_find_lock_conflict(
28822883
cfile, iocb->ki_pos, iov_iter_count(to),
@@ -2889,6 +2890,7 @@ cifs_strict_readv(struct kiocb *iocb, struct iov_iter *to)
28892890
rc = netfs_start_io_read(inode);
28902891
if (rc < 0)
28912892
goto out;
2893+
rc = -EACCES;
28922894
down_read(&cinode->lock_sem);
28932895
if (!cifs_find_lock_conflict(
28942896
cfile, iocb->ki_pos, iov_iter_count(to),

0 commit comments

Comments
 (0)