]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/2.6.32.12/cifs-initialize-nbytes-at-the-beginning-of-cifssmbwrite.patch
Fixes for 5.10
[thirdparty/kernel/stable-queue.git] / releases / 2.6.32.12 / cifs-initialize-nbytes-at-the-beginning-of-cifssmbwrite.patch
CommitLineData
ca940317
GKH
1From a24e2d7d8f512340991ef0a59cb5d08d491b8e98 Mon Sep 17 00:00:00 2001
2From: Steve French <sfrench@us.ibm.com>
3Date: Sat, 3 Apr 2010 17:20:21 +0000
4Subject: CIFS: initialize nbytes at the beginning of CIFSSMBWrite()
5
6From: Steve French <sfrench@us.ibm.com>
7
8commit a24e2d7d8f512340991ef0a59cb5d08d491b8e98 upstream.
9
10By doing this we always overwrite nbytes value that is being passed on to
11CIFSSMBWrite() and need not rely on the callers to initialize. CIFSSMBWrite2 is
12doing this already.
13
14Reviewed-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com>
15Reviewed-by: Jeff Layton <jlayton@samba.org>
16Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
17Signed-off-by: Steve French <sfrench@us.ibm.com>
18Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
19
20---
21 fs/cifs/cifssmb.c | 3 ++-
22 1 file changed, 2 insertions(+), 1 deletion(-)
23
24--- a/fs/cifs/cifssmb.c
25+++ b/fs/cifs/cifssmb.c
26@@ -1430,6 +1430,8 @@ CIFSSMBWrite(const int xid, struct cifsT
27 __u32 bytes_sent;
28 __u16 byte_count;
29
30+ *nbytes = 0;
31+
32 /* cFYI(1, ("write at %lld %d bytes", offset, count));*/
33 if (tcon->ses == NULL)
34 return -ECONNABORTED;
35@@ -1512,7 +1514,6 @@ CIFSSMBWrite(const int xid, struct cifsT
36 cifs_stats_inc(&tcon->num_writes);
37 if (rc) {
38 cFYI(1, ("Send error in write = %d", rc));
39- *nbytes = 0;
40 } else {
41 *nbytes = le16_to_cpu(pSMBr->CountHigh);
42 *nbytes = (*nbytes) << 16;