]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
CIFS: set *resp_buf_type to NO_BUFFER on error
authorSteve French <smfrench@gmail.com>
Sun, 22 Apr 2018 15:24:19 +0000 (10:24 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Jun 2018 19:01:24 +0000 (04:01 +0900)
[ Upstream commit 117e3b7fed552eba96ae0b3b92312fe8c5b0bfdd ]

Dan Carpenter had pointed this out a while ago, but the code around
this had changed so wasn't causing any problems since that field
was not used in this error path.

Still, it is cleaner to always initialize this field, so changing
the error path to set it.

Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
CC: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/cifs/transport.c

index 1b5cd3b8617cfce5abd0210cb5e80c33d767948f..a56abb46613e29bca23fb58ce32daf880f422f19 100644 (file)
@@ -833,8 +833,11 @@ SendReceive2(const unsigned int xid, struct cifs_ses *ses,
        if (n_vec + 1 > CIFS_MAX_IOV_SIZE) {
                new_iov = kmalloc(sizeof(struct kvec) * (n_vec + 1),
                                  GFP_KERNEL);
-               if (!new_iov)
+               if (!new_iov) {
+                       /* otherwise cifs_send_recv below sets resp_buf_type */
+                       *resp_buf_type = CIFS_NO_BUFFER;
                        return -ENOMEM;
+               }
        } else
                new_iov = s_iov;