diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2021-09-21 22:33:35 +0200 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2021-09-22 03:51:50 +0200 |
commit | e946d3c887a9dc33aa82a349c6284f4a084163f4 (patch) | |
tree | 733ed2ab3f3d856302b7aef5b1ff0557b0e5b2b3 /fs/cifs/file.c | |
parent | Merge tag '5.15-rc1-smb3' of git://git.samba.org/sfrench/cifs-2.6 (diff) | |
download | linux-e946d3c887a9dc33aa82a349c6284f4a084163f4.tar.xz linux-e946d3c887a9dc33aa82a349c6284f4a084163f4.zip |
cifs: fix a sign extension bug
The problem is the mismatched types between "ctx->total_len" which is
an unsigned int, "rc" which is an int, and "ctx->rc" which is a
ssize_t. The code does:
ctx->rc = (rc == 0) ? ctx->total_len : rc;
We want "ctx->rc" to store the negative "rc" error code. But what
happens is that "rc" is type promoted to a high unsigned int and
'ctx->rc" will store the high positive value instead of a negative
value.
The fix is to change "rc" from an int to a ssize_t.
Fixes: c610c4b619e5 ("CIFS: Add asynchronous write support through kernel AIO")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/file.c')
-rw-r--r-- | fs/cifs/file.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 6796fc73b304..0ab5bb24b8ca 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -3113,7 +3113,7 @@ static void collect_uncached_write_data(struct cifs_aio_ctx *ctx) struct cifs_tcon *tcon; struct cifs_sb_info *cifs_sb; struct dentry *dentry = ctx->cfile->dentry; - int rc; + ssize_t rc; tcon = tlink_tcon(ctx->cfile->tlink); cifs_sb = CIFS_SB(dentry->d_sb); |