]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.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)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 1 Oct 2018 12:57:43 +0000 (14:57 +0200)
BugLink: http://bugs.launchpad.net/bugs/1794889
[ 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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
fs/cifs/transport.c

index 7efbab013957551c1812f73d833426a537bd99c7..6407c3bd337e98dad8bbb6556af4382be2367df5 100644 (file)
@@ -807,8 +807,11 @@ SendReceive2(const unsigned int xid, struct cifs_ses *ses,
        int rc;
 
        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;
+       }
 
        /* 1st iov is a RFC1001 length followed by the rest of the packet */
        memcpy(new_iov + 1, iov, (sizeof(struct kvec) * n_vec));