cifs: fix memory leak in SMB2_open()
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <smfrench@gmail.com> CC: Stable <stable@vger.kernel.org>
This commit is contained in:
parent
ac65cb6203
commit
b7a73c84eb
@ -1738,8 +1738,10 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
|
|||||||
rc = alloc_path_with_tree_prefix(©_path, ©_size,
|
rc = alloc_path_with_tree_prefix(©_path, ©_size,
|
||||||
&name_len,
|
&name_len,
|
||||||
tcon->treeName, path);
|
tcon->treeName, path);
|
||||||
if (rc)
|
if (rc) {
|
||||||
|
cifs_small_buf_release(req);
|
||||||
return rc;
|
return rc;
|
||||||
|
}
|
||||||
req->NameLength = cpu_to_le16(name_len * 2);
|
req->NameLength = cpu_to_le16(name_len * 2);
|
||||||
uni_path_len = copy_size;
|
uni_path_len = copy_size;
|
||||||
path = copy_path;
|
path = copy_path;
|
||||||
@ -1750,8 +1752,10 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
|
|||||||
if (uni_path_len % 8 != 0) {
|
if (uni_path_len % 8 != 0) {
|
||||||
copy_size = roundup(uni_path_len, 8);
|
copy_size = roundup(uni_path_len, 8);
|
||||||
copy_path = kzalloc(copy_size, GFP_KERNEL);
|
copy_path = kzalloc(copy_size, GFP_KERNEL);
|
||||||
if (!copy_path)
|
if (!copy_path) {
|
||||||
|
cifs_small_buf_release(req);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
}
|
||||||
memcpy((char *)copy_path, (const char *)path,
|
memcpy((char *)copy_path, (const char *)path,
|
||||||
uni_path_len);
|
uni_path_len);
|
||||||
uni_path_len = copy_size;
|
uni_path_len = copy_size;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user