Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 14b1cd25346b ("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>

authored by

David Howells and committed by
Steve French
d2c5eb57 de40579b

+2
+2
fs/smb/client/file.c
··· 2877 2877 rc = netfs_start_io_direct(inode); 2878 2878 if (rc < 0) 2879 2879 goto out; 2880 + rc = -EACCES; 2880 2881 down_read(&cinode->lock_sem); 2881 2882 if (!cifs_find_lock_conflict( 2882 2883 cfile, iocb->ki_pos, iov_iter_count(to), ··· 2890 2889 rc = netfs_start_io_read(inode); 2891 2890 if (rc < 0) 2892 2891 goto out; 2892 + rc = -EACCES; 2893 2893 down_read(&cinode->lock_sem); 2894 2894 if (!cifs_find_lock_conflict( 2895 2895 cfile, iocb->ki_pos, iov_iter_count(to),