Patch "cifs: fix a sign extension bug" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    cifs: fix a sign extension bug

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     cifs-fix-a-sign-extension-bug.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit f8fa6eb81209765f53acc34c5bb481c42fc6daf3
Author: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Date:   Tue Sep 21 23:33:35 2021 +0300

    cifs: fix a sign extension bug
    
    [ Upstream commit e946d3c887a9dc33aa82a349c6284f4a084163f4 ]
    
    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@xxxxxxxxxx>
    Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index f46904a4ead3..67139f9d583f 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -3039,7 +3039,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);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux