diff options
| -rw-r--r-- | fs/cifs/link.c | 6 | ||||
| -rw-r--r-- | fs/cifs/smb2file.c | 3 | ||||
| -rw-r--r-- | fs/cifs/smb2inode.c | 3 | ||||
| -rw-r--r-- | fs/cifs/smb2ops.c | 51 | ||||
| -rw-r--r-- | fs/cifs/smb2pdu.c | 3 | ||||
| -rw-r--r-- | fs/cifs/smb2proto.h | 2 |
6 files changed, 39 insertions, 29 deletions
diff --git a/fs/cifs/link.c b/fs/cifs/link.c index 889a840172eb..de41f96aba49 100644 --- a/fs/cifs/link.c +++ b/fs/cifs/link.c | |||
| @@ -421,7 +421,8 @@ smb3_query_mf_symlink(unsigned int xid, struct cifs_tcon *tcon, | |||
| 421 | return -ENOMEM; | 421 | return -ENOMEM; |
| 422 | } | 422 | } |
| 423 | 423 | ||
| 424 | rc = SMB2_open(xid, &oparms, utf16_path, &oplock, pfile_info, NULL); | 424 | rc = SMB2_open(xid, &oparms, utf16_path, &oplock, pfile_info, NULL, |
| 425 | NULL); | ||
| 425 | if (rc) | 426 | if (rc) |
| 426 | goto qmf_out_open_fail; | 427 | goto qmf_out_open_fail; |
| 427 | 428 | ||
| @@ -478,7 +479,8 @@ smb3_create_mf_symlink(unsigned int xid, struct cifs_tcon *tcon, | |||
| 478 | oparms.fid = &fid; | 479 | oparms.fid = &fid; |
| 479 | oparms.reconnect = false; | 480 | oparms.reconnect = false; |
| 480 | 481 | ||
| 481 | rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL); | 482 | rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL, |
| 483 | NULL); | ||
| 482 | if (rc) { | 484 | if (rc) { |
| 483 | kfree(utf16_path); | 485 | kfree(utf16_path); |
| 484 | return rc; | 486 | return rc; |
diff --git a/fs/cifs/smb2file.c b/fs/cifs/smb2file.c index 12af5dba742b..788412675723 100644 --- a/fs/cifs/smb2file.c +++ b/fs/cifs/smb2file.c | |||
| @@ -64,7 +64,8 @@ smb2_open_file(const unsigned int xid, struct cifs_open_parms *oparms, | |||
| 64 | if (oparms->tcon->ses->server->capabilities & SMB2_GLOBAL_CAP_LEASING) | 64 | if (oparms->tcon->ses->server->capabilities & SMB2_GLOBAL_CAP_LEASING) |
| 65 | memcpy(smb2_oplock + 1, fid->lease_key, SMB2_LEASE_KEY_SIZE); | 65 | memcpy(smb2_oplock + 1, fid->lease_key, SMB2_LEASE_KEY_SIZE); |
| 66 | 66 | ||
| 67 | rc = SMB2_open(xid, oparms, smb2_path, smb2_oplock, smb2_data, NULL); | 67 | rc = SMB2_open(xid, oparms, smb2_path, smb2_oplock, smb2_data, NULL, |
| 68 | NULL); | ||
| 68 | if (rc) | 69 | if (rc) |
| 69 | goto out; | 70 | goto out; |
| 70 | 71 | ||
diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c index a6e786e39248..d01ad706d7fc 100644 --- a/fs/cifs/smb2inode.c +++ b/fs/cifs/smb2inode.c | |||
| @@ -71,7 +71,8 @@ smb2_open_op_close(const unsigned int xid, struct cifs_tcon *tcon, | |||
| 71 | oparms.fid = &fid; | 71 | oparms.fid = &fid; |
| 72 | oparms.reconnect = false; | 72 | oparms.reconnect = false; |
| 73 | 73 | ||
| 74 | rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL); | 74 | rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL, |
| 75 | NULL); | ||
| 75 | if (rc) { | 76 | if (rc) { |
| 76 | kfree(utf16_path); | 77 | kfree(utf16_path); |
| 77 | return rc; | 78 | return rc; |
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index aec03d586b16..b15f5957d645 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c | |||
| @@ -348,7 +348,7 @@ int open_shroot(unsigned int xid, struct cifs_tcon *tcon, struct cifs_fid *pfid) | |||
| 348 | oparams.fid = pfid; | 348 | oparams.fid = pfid; |
| 349 | oparams.reconnect = false; | 349 | oparams.reconnect = false; |
| 350 | 350 | ||
| 351 | rc = SMB2_open(xid, &oparams, &srch_path, &oplock, NULL, NULL); | 351 | rc = SMB2_open(xid, &oparams, &srch_path, &oplock, NULL, NULL, NULL); |
| 352 | if (rc == 0) { | 352 | if (rc == 0) { |
| 353 | memcpy(tcon->prfid, pfid, sizeof(struct cifs_fid)); | 353 | memcpy(tcon->prfid, pfid, sizeof(struct cifs_fid)); |
| 354 | tcon->valid_root_fid = true; | 354 | tcon->valid_root_fid = true; |
| @@ -375,7 +375,8 @@ smb3_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon) | |||
| 375 | oparms.reconnect = false; | 375 | oparms.reconnect = false; |
| 376 | 376 | ||
| 377 | if (no_cached_open) | 377 | if (no_cached_open) |
| 378 | rc = SMB2_open(xid, &oparms, &srch_path, &oplock, NULL, NULL); | 378 | rc = SMB2_open(xid, &oparms, &srch_path, &oplock, NULL, NULL, |
| 379 | NULL); | ||
| 379 | else | 380 | else |
| 380 | rc = open_shroot(xid, tcon, &fid); | 381 | rc = open_shroot(xid, tcon, &fid); |
| 381 | 382 | ||
| @@ -413,7 +414,7 @@ smb2_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon) | |||
| 413 | oparms.fid = &fid; | 414 | oparms.fid = &fid; |
| 414 | oparms.reconnect = false; | 415 | oparms.reconnect = false; |
| 415 | 416 | ||
| 416 | rc = SMB2_open(xid, &oparms, &srch_path, &oplock, NULL, NULL); | 417 | rc = SMB2_open(xid, &oparms, &srch_path, &oplock, NULL, NULL, NULL); |
| 417 | if (rc) | 418 | if (rc) |
| 418 | return; | 419 | return; |
| 419 | 420 | ||
| @@ -449,7 +450,7 @@ smb2_is_path_accessible(const unsigned int xid, struct cifs_tcon *tcon, | |||
| 449 | oparms.fid = &fid; | 450 | oparms.fid = &fid; |
| 450 | oparms.reconnect = false; | 451 | oparms.reconnect = false; |
| 451 | 452 | ||
| 452 | rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL); | 453 | rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL, NULL); |
| 453 | if (rc) { | 454 | if (rc) { |
| 454 | kfree(utf16_path); | 455 | kfree(utf16_path); |
| 455 | return rc; | 456 | return rc; |
| @@ -598,7 +599,7 @@ smb2_query_eas(const unsigned int xid, struct cifs_tcon *tcon, | |||
| 598 | oparms.fid = &fid; | 599 | oparms.fid = &fid; |
| 599 | oparms.reconnect = false; | 600 | oparms.reconnect = false; |
| 600 | 601 | ||
| 601 | rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL); | 602 | rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL, NULL); |
| 602 | kfree(utf16_path); | 603 | kfree(utf16_path); |
| 603 | if (rc) { | 604 | if (rc) { |
| 604 | cifs_dbg(FYI, "open failed rc=%d\n", rc); | 605 | cifs_dbg(FYI, "open failed rc=%d\n", rc); |
| @@ -677,7 +678,7 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon, | |||
| 677 | oparms.fid = &fid; | 678 | oparms.fid = &fid; |
| 678 | oparms.reconnect = false; | 679 | oparms.reconnect = false; |
| 679 | 680 | ||
| 680 | rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL); | 681 | rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL, NULL); |
| 681 | kfree(utf16_path); | 682 | kfree(utf16_path); |
| 682 | if (rc) { | 683 | if (rc) { |
| 683 | cifs_dbg(FYI, "open failed rc=%d\n", rc); | 684 | cifs_dbg(FYI, "open failed rc=%d\n", rc); |
| @@ -1261,7 +1262,7 @@ smb2_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon, | |||
| 1261 | oparms.fid = fid; | 1262 | oparms.fid = fid; |
| 1262 | oparms.reconnect = false; | 1263 | oparms.reconnect = false; |
| 1263 | 1264 | ||
| 1264 | rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL); | 1265 | rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL, NULL); |
| 1265 | kfree(utf16_path); | 1266 | kfree(utf16_path); |
| 1266 | if (rc) { | 1267 | if (rc) { |
| 1267 | cifs_dbg(FYI, "open dir failed rc=%d\n", rc); | 1268 | cifs_dbg(FYI, "open dir failed rc=%d\n", rc); |
| @@ -1361,7 +1362,7 @@ smb2_queryfs(const unsigned int xid, struct cifs_tcon *tcon, | |||
| 1361 | oparms.fid = &fid; | 1362 | oparms.fid = &fid; |
| 1362 | oparms.reconnect = false; | 1363 | oparms.reconnect = false; |
| 1363 | 1364 | ||
| 1364 | rc = SMB2_open(xid, &oparms, &srch_path, &oplock, NULL, NULL); | 1365 | rc = SMB2_open(xid, &oparms, &srch_path, &oplock, NULL, NULL, NULL); |
| 1365 | if (rc) | 1366 | if (rc) |
| 1366 | return rc; | 1367 | return rc; |
| 1367 | buf->f_type = SMB2_MAGIC_NUMBER; | 1368 | buf->f_type = SMB2_MAGIC_NUMBER; |
| @@ -1515,7 +1516,8 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon, | |||
| 1515 | struct cifs_open_parms oparms; | 1516 | struct cifs_open_parms oparms; |
| 1516 | struct cifs_fid fid; | 1517 | struct cifs_fid fid; |
| 1517 | struct kvec err_iov = {NULL, 0}; | 1518 | struct kvec err_iov = {NULL, 0}; |
| 1518 | struct smb2_err_rsp *err_buf; | 1519 | struct smb2_err_rsp *err_buf = NULL; |
| 1520 | int resp_buftype; | ||
| 1519 | struct smb2_symlink_err_rsp *symlink; | 1521 | struct smb2_symlink_err_rsp *symlink; |
| 1520 | unsigned int sub_len; | 1522 | unsigned int sub_len; |
| 1521 | unsigned int sub_offset; | 1523 | unsigned int sub_offset; |
| @@ -1535,18 +1537,18 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon, | |||
| 1535 | oparms.fid = &fid; | 1537 | oparms.fid = &fid; |
| 1536 | oparms.reconnect = false; | 1538 | oparms.reconnect = false; |
| 1537 | 1539 | ||
| 1538 | rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, &err_iov); | 1540 | rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, &err_iov, |
| 1539 | 1541 | &resp_buftype); | |
| 1540 | if (!rc || !err_iov.iov_base) { | 1542 | if (!rc || !err_iov.iov_base) { |
| 1541 | kfree(utf16_path); | 1543 | rc = -ENOENT; |
| 1542 | return -ENOENT; | 1544 | goto querty_exit; |
| 1543 | } | 1545 | } |
| 1544 | 1546 | ||
| 1545 | err_buf = err_iov.iov_base; | 1547 | err_buf = err_iov.iov_base; |
| 1546 | if (le32_to_cpu(err_buf->ByteCount) < sizeof(struct smb2_symlink_err_rsp) || | 1548 | if (le32_to_cpu(err_buf->ByteCount) < sizeof(struct smb2_symlink_err_rsp) || |
| 1547 | err_iov.iov_len < SMB2_SYMLINK_STRUCT_SIZE) { | 1549 | err_iov.iov_len < SMB2_SYMLINK_STRUCT_SIZE) { |
| 1548 | kfree(utf16_path); | 1550 | rc = -ENOENT; |
| 1549 | return -ENOENT; | 1551 | goto querty_exit; |
| 1550 | } | 1552 | } |
| 1551 | 1553 | ||
| 1552 | /* open must fail on symlink - reset rc */ | 1554 | /* open must fail on symlink - reset rc */ |
| @@ -1558,25 +1560,28 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon, | |||
| 1558 | print_offset = le16_to_cpu(symlink->PrintNameOffset); | 1560 | print_offset = le16_to_cpu(symlink->PrintNameOffset); |
| 1559 | 1561 | ||
| 1560 | if (err_iov.iov_len < SMB2_SYMLINK_STRUCT_SIZE + sub_offset + sub_len) { | 1562 | if (err_iov.iov_len < SMB2_SYMLINK_STRUCT_SIZE + sub_offset + sub_len) { |
| 1561 | kfree(utf16_path); | 1563 | rc = -ENOENT; |
| 1562 | return -ENOENT; | 1564 | goto querty_exit; |
| 1563 | } | 1565 | } |
| 1564 | 1566 | ||
| 1565 | if (err_iov.iov_len < | 1567 | if (err_iov.iov_len < |
| 1566 | SMB2_SYMLINK_STRUCT_SIZE + print_offset + print_len) { | 1568 | SMB2_SYMLINK_STRUCT_SIZE + print_offset + print_len) { |
| 1567 | kfree(utf16_path); | 1569 | rc = -ENOENT; |
| 1568 | return -ENOENT; | 1570 | goto querty_exit; |
| 1569 | } | 1571 | } |
| 1570 | 1572 | ||
| 1571 | *target_path = cifs_strndup_from_utf16( | 1573 | *target_path = cifs_strndup_from_utf16( |
| 1572 | (char *)symlink->PathBuffer + sub_offset, | 1574 | (char *)symlink->PathBuffer + sub_offset, |
| 1573 | sub_len, true, cifs_sb->local_nls); | 1575 | sub_len, true, cifs_sb->local_nls); |
| 1574 | if (!(*target_path)) { | 1576 | if (!(*target_path)) { |
| 1575 | kfree(utf16_path); | 1577 | rc = -ENOMEM; |
| 1576 | return -ENOMEM; | 1578 | goto querty_exit; |
| 1577 | } | 1579 | } |
| 1578 | convert_delimiter(*target_path, '/'); | 1580 | convert_delimiter(*target_path, '/'); |
| 1579 | cifs_dbg(FYI, "%s: target path: %s\n", __func__, *target_path); | 1581 | cifs_dbg(FYI, "%s: target path: %s\n", __func__, *target_path); |
| 1582 | |||
| 1583 | querty_exit: | ||
| 1584 | free_rsp_buf(resp_buftype, err_buf); | ||
| 1580 | kfree(utf16_path); | 1585 | kfree(utf16_path); |
| 1581 | return rc; | 1586 | return rc; |
| 1582 | } | 1587 | } |
| @@ -1649,7 +1654,7 @@ get_smb2_acl_by_path(struct cifs_sb_info *cifs_sb, | |||
| 1649 | oparms.fid = &fid; | 1654 | oparms.fid = &fid; |
| 1650 | oparms.reconnect = false; | 1655 | oparms.reconnect = false; |
| 1651 | 1656 | ||
| 1652 | rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL); | 1657 | rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL, NULL); |
| 1653 | kfree(utf16_path); | 1658 | kfree(utf16_path); |
| 1654 | if (!rc) { | 1659 | if (!rc) { |
| 1655 | rc = SMB2_query_acl(xid, tlink_tcon(tlink), fid.persistent_fid, | 1660 | rc = SMB2_query_acl(xid, tlink_tcon(tlink), fid.persistent_fid, |
| @@ -1712,7 +1717,7 @@ set_smb2_acl(struct cifs_ntsd *pnntsd, __u32 acllen, | |||
| 1712 | oparms.fid = &fid; | 1717 | oparms.fid = &fid; |
| 1713 | oparms.reconnect = false; | 1718 | oparms.reconnect = false; |
| 1714 | 1719 | ||
| 1715 | rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL); | 1720 | rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL, NULL); |
| 1716 | kfree(utf16_path); | 1721 | kfree(utf16_path); |
| 1717 | if (!rc) { | 1722 | if (!rc) { |
| 1718 | rc = SMB2_set_acl(xid, tlink_tcon(tlink), fid.persistent_fid, | 1723 | rc = SMB2_set_acl(xid, tlink_tcon(tlink), fid.persistent_fid, |
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 92e54b1638be..48e2004c75fb 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c | |||
| @@ -1889,7 +1889,7 @@ alloc_path_with_tree_prefix(__le16 **out_path, int *out_size, int *out_len, | |||
| 1889 | int | 1889 | int |
| 1890 | SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path, | 1890 | SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path, |
| 1891 | __u8 *oplock, struct smb2_file_all_info *buf, | 1891 | __u8 *oplock, struct smb2_file_all_info *buf, |
| 1892 | struct kvec *err_iov) | 1892 | struct kvec *err_iov, int *buftype) |
| 1893 | { | 1893 | { |
| 1894 | struct smb2_create_req *req; | 1894 | struct smb2_create_req *req; |
| 1895 | struct smb2_create_rsp *rsp; | 1895 | struct smb2_create_rsp *rsp; |
| @@ -2052,6 +2052,7 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path, | |||
| 2052 | cifs_stats_fail_inc(tcon, SMB2_CREATE_HE); | 2052 | cifs_stats_fail_inc(tcon, SMB2_CREATE_HE); |
| 2053 | if (err_iov && rsp) { | 2053 | if (err_iov && rsp) { |
| 2054 | *err_iov = rsp_iov; | 2054 | *err_iov = rsp_iov; |
| 2055 | *buftype = resp_buftype; | ||
| 2055 | resp_buftype = CIFS_NO_BUFFER; | 2056 | resp_buftype = CIFS_NO_BUFFER; |
| 2056 | rsp = NULL; | 2057 | rsp = NULL; |
| 2057 | } | 2058 | } |
diff --git a/fs/cifs/smb2proto.h b/fs/cifs/smb2proto.h index 908555b1c6b5..c84020057bd8 100644 --- a/fs/cifs/smb2proto.h +++ b/fs/cifs/smb2proto.h | |||
| @@ -125,7 +125,7 @@ extern int SMB2_tdis(const unsigned int xid, struct cifs_tcon *tcon); | |||
| 125 | extern int SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, | 125 | extern int SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, |
| 126 | __le16 *path, __u8 *oplock, | 126 | __le16 *path, __u8 *oplock, |
| 127 | struct smb2_file_all_info *buf, | 127 | struct smb2_file_all_info *buf, |
| 128 | struct kvec *err_iov); | 128 | struct kvec *err_iov, int *resp_buftype); |
| 129 | extern int SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, | 129 | extern int SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, |
| 130 | u64 persistent_fid, u64 volatile_fid, u32 opcode, | 130 | u64 persistent_fid, u64 volatile_fid, u32 opcode, |
| 131 | bool is_fsctl, char *in_data, u32 indatalen, | 131 | bool is_fsctl, char *in_data, u32 indatalen, |
