1 // SPDX-License-Identifier: LGPL-2.1 2 /* 3 * 4 * Copyright (C) International Business Machines Corp., 2002,2008 5 * Author(s): Steve French (sfrench@us.ibm.com) 6 * 7 */ 8 #include <linux/fs.h> 9 #include <linux/stat.h> 10 #include <linux/slab.h> 11 #include <linux/namei.h> 12 #include "cifsfs.h" 13 #include "cifspdu.h" 14 #include "cifsglob.h" 15 #include "cifsproto.h" 16 #include "cifs_debug.h" 17 #include "cifs_fs_sb.h" 18 #include "cifs_unicode.h" 19 #include "smb2proto.h" 20 #include "cifs_ioctl.h" 21 #include "fs_context.h" 22 23 /* 24 * M-F Symlink Functions - Begin 25 */ 26 27 #define CIFS_MF_SYMLINK_LEN_OFFSET (4+1) 28 #define CIFS_MF_SYMLINK_MD5_OFFSET (CIFS_MF_SYMLINK_LEN_OFFSET+(4+1)) 29 #define CIFS_MF_SYMLINK_LINK_OFFSET (CIFS_MF_SYMLINK_MD5_OFFSET+(32+1)) 30 #define CIFS_MF_SYMLINK_LINK_MAXLEN (1024) 31 #define CIFS_MF_SYMLINK_FILE_SIZE \ 32 (CIFS_MF_SYMLINK_LINK_OFFSET + CIFS_MF_SYMLINK_LINK_MAXLEN) 33 34 #define CIFS_MF_SYMLINK_LEN_FORMAT "XSym\n%04u\n" 35 #define CIFS_MF_SYMLINK_MD5_FORMAT "%16phN\n" 36 #define CIFS_MF_SYMLINK_MD5_ARGS(md5_hash) md5_hash 37 38 static int 39 symlink_hash(unsigned int link_len, const char *link_str, u8 *md5_hash) 40 { 41 int rc; 42 struct shash_desc *md5 = NULL; 43 44 rc = cifs_alloc_hash("md5", &md5); 45 if (rc) 46 return rc; 47 48 rc = crypto_shash_digest(md5, link_str, link_len, md5_hash); 49 if (rc) 50 cifs_dbg(VFS, "%s: Could not generate md5 hash\n", __func__); 51 cifs_free_hash(&md5); 52 return rc; 53 } 54 55 static int 56 parse_mf_symlink(const u8 *buf, unsigned int buf_len, unsigned int *_link_len, 57 char **_link_str) 58 { 59 int rc; 60 unsigned int link_len; 61 const char *md5_str1; 62 const char *link_str; 63 u8 md5_hash[16]; 64 char md5_str2[34]; 65 66 if (buf_len != CIFS_MF_SYMLINK_FILE_SIZE) 67 return -EINVAL; 68 69 md5_str1 = (const char *)&buf[CIFS_MF_SYMLINK_MD5_OFFSET]; 70 link_str = (const char *)&buf[CIFS_MF_SYMLINK_LINK_OFFSET]; 71 72 rc = sscanf(buf, CIFS_MF_SYMLINK_LEN_FORMAT, &link_len); 73 if (rc != 1) 74 return -EINVAL; 75 76 if (link_len > CIFS_MF_SYMLINK_LINK_MAXLEN) 77 return -EINVAL; 78 79 rc = symlink_hash(link_len, link_str, md5_hash); 80 if (rc) { 81 cifs_dbg(FYI, "%s: MD5 hash failure: %d\n", __func__, rc); 82 return rc; 83 } 84 85 scnprintf(md5_str2, sizeof(md5_str2), 86 CIFS_MF_SYMLINK_MD5_FORMAT, 87 CIFS_MF_SYMLINK_MD5_ARGS(md5_hash)); 88 89 if (strncmp(md5_str1, md5_str2, 17) != 0) 90 return -EINVAL; 91 92 if (_link_str) { 93 *_link_str = kstrndup(link_str, link_len, GFP_KERNEL); 94 if (!*_link_str) 95 return -ENOMEM; 96 } 97 98 *_link_len = link_len; 99 return 0; 100 } 101 102 static int 103 format_mf_symlink(u8 *buf, unsigned int buf_len, const char *link_str) 104 { 105 int rc; 106 unsigned int link_len; 107 unsigned int ofs; 108 u8 md5_hash[16]; 109 110 if (buf_len != CIFS_MF_SYMLINK_FILE_SIZE) 111 return -EINVAL; 112 113 link_len = strlen(link_str); 114 115 if (link_len > CIFS_MF_SYMLINK_LINK_MAXLEN) 116 return -ENAMETOOLONG; 117 118 rc = symlink_hash(link_len, link_str, md5_hash); 119 if (rc) { 120 cifs_dbg(FYI, "%s: MD5 hash failure: %d\n", __func__, rc); 121 return rc; 122 } 123 124 scnprintf(buf, buf_len, 125 CIFS_MF_SYMLINK_LEN_FORMAT CIFS_MF_SYMLINK_MD5_FORMAT, 126 link_len, 127 CIFS_MF_SYMLINK_MD5_ARGS(md5_hash)); 128 129 ofs = CIFS_MF_SYMLINK_LINK_OFFSET; 130 memcpy(buf + ofs, link_str, link_len); 131 132 ofs += link_len; 133 if (ofs < CIFS_MF_SYMLINK_FILE_SIZE) { 134 buf[ofs] = '\n'; 135 ofs++; 136 } 137 138 while (ofs < CIFS_MF_SYMLINK_FILE_SIZE) { 139 buf[ofs] = ' '; 140 ofs++; 141 } 142 143 return 0; 144 } 145 146 bool 147 couldbe_mf_symlink(const struct cifs_fattr *fattr) 148 { 149 if (!S_ISREG(fattr->cf_mode)) 150 /* it's not a symlink */ 151 return false; 152 153 if (fattr->cf_eof != CIFS_MF_SYMLINK_FILE_SIZE) 154 /* it's not a symlink */ 155 return false; 156 157 return true; 158 } 159 160 static int 161 create_mf_symlink(const unsigned int xid, struct cifs_tcon *tcon, 162 struct cifs_sb_info *cifs_sb, const char *fromName, 163 const char *toName) 164 { 165 int rc; 166 u8 *buf; 167 unsigned int bytes_written = 0; 168 169 buf = kmalloc(CIFS_MF_SYMLINK_FILE_SIZE, GFP_KERNEL); 170 if (!buf) 171 return -ENOMEM; 172 173 rc = format_mf_symlink(buf, CIFS_MF_SYMLINK_FILE_SIZE, toName); 174 if (rc) 175 goto out; 176 177 if (tcon->ses->server->ops->create_mf_symlink) 178 rc = tcon->ses->server->ops->create_mf_symlink(xid, tcon, 179 cifs_sb, fromName, buf, &bytes_written); 180 else 181 rc = -EOPNOTSUPP; 182 183 if (rc) 184 goto out; 185 186 if (bytes_written != CIFS_MF_SYMLINK_FILE_SIZE) 187 rc = -EIO; 188 out: 189 kfree(buf); 190 return rc; 191 } 192 193 int 194 check_mf_symlink(unsigned int xid, struct cifs_tcon *tcon, 195 struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr, 196 const unsigned char *path) 197 { 198 int rc; 199 u8 *buf = NULL; 200 unsigned int link_len = 0; 201 unsigned int bytes_read = 0; 202 char *symlink = NULL; 203 204 if (!couldbe_mf_symlink(fattr)) 205 /* it's not a symlink */ 206 return 0; 207 208 buf = kmalloc(CIFS_MF_SYMLINK_FILE_SIZE, GFP_KERNEL); 209 if (!buf) 210 return -ENOMEM; 211 212 if (tcon->ses->server->ops->query_mf_symlink) 213 rc = tcon->ses->server->ops->query_mf_symlink(xid, tcon, 214 cifs_sb, path, buf, &bytes_read); 215 else 216 rc = -ENOSYS; 217 218 if (rc) 219 goto out; 220 221 if (bytes_read == 0) /* not a symlink */ 222 goto out; 223 224 rc = parse_mf_symlink(buf, bytes_read, &link_len, &symlink); 225 if (rc == -EINVAL) { 226 /* it's not a symlink */ 227 rc = 0; 228 goto out; 229 } 230 231 if (rc != 0) 232 goto out; 233 234 /* it is a symlink */ 235 fattr->cf_eof = link_len; 236 fattr->cf_mode &= ~S_IFMT; 237 fattr->cf_mode |= S_IFLNK | S_IRWXU | S_IRWXG | S_IRWXO; 238 fattr->cf_dtype = DT_LNK; 239 fattr->cf_symlink_target = symlink; 240 out: 241 kfree(buf); 242 return rc; 243 } 244 245 #ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY 246 /* 247 * SMB 1.0 Protocol specific functions 248 */ 249 250 int 251 cifs_query_mf_symlink(unsigned int xid, struct cifs_tcon *tcon, 252 struct cifs_sb_info *cifs_sb, const unsigned char *path, 253 char *pbuf, unsigned int *pbytes_read) 254 { 255 int rc; 256 int oplock = 0; 257 struct cifs_fid fid; 258 struct cifs_open_parms oparms; 259 struct cifs_io_parms io_parms = {0}; 260 int buf_type = CIFS_NO_BUFFER; 261 struct cifs_open_info_data query_data; 262 263 oparms = (struct cifs_open_parms) { 264 .tcon = tcon, 265 .cifs_sb = cifs_sb, 266 .desired_access = GENERIC_READ, 267 .create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR), 268 .disposition = FILE_OPEN, 269 .path = path, 270 .fid = &fid, 271 }; 272 273 rc = tcon->ses->server->ops->open(xid, &oparms, &oplock, &query_data); 274 if (rc) 275 return rc; 276 277 if (query_data.fi.EndOfFile != cpu_to_le64(CIFS_MF_SYMLINK_FILE_SIZE)) { 278 rc = -ENOENT; 279 /* it's not a symlink */ 280 goto out; 281 } 282 283 io_parms.netfid = fid.netfid; 284 io_parms.pid = current->tgid; 285 io_parms.tcon = tcon; 286 io_parms.offset = 0; 287 io_parms.length = CIFS_MF_SYMLINK_FILE_SIZE; 288 289 rc = CIFSSMBRead(xid, &io_parms, pbytes_read, &pbuf, &buf_type); 290 out: 291 CIFSSMBClose(xid, tcon, fid.netfid); 292 return rc; 293 } 294 295 int 296 cifs_create_mf_symlink(unsigned int xid, struct cifs_tcon *tcon, 297 struct cifs_sb_info *cifs_sb, const unsigned char *path, 298 char *pbuf, unsigned int *pbytes_written) 299 { 300 int rc; 301 int oplock = 0; 302 struct cifs_fid fid; 303 struct cifs_open_parms oparms; 304 struct cifs_io_parms io_parms = {0}; 305 306 oparms = (struct cifs_open_parms) { 307 .tcon = tcon, 308 .cifs_sb = cifs_sb, 309 .desired_access = GENERIC_WRITE, 310 .create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR), 311 .disposition = FILE_CREATE, 312 .path = path, 313 .fid = &fid, 314 }; 315 316 rc = tcon->ses->server->ops->open(xid, &oparms, &oplock, NULL); 317 if (rc) 318 return rc; 319 320 io_parms.netfid = fid.netfid; 321 io_parms.pid = current->tgid; 322 io_parms.tcon = tcon; 323 io_parms.offset = 0; 324 io_parms.length = CIFS_MF_SYMLINK_FILE_SIZE; 325 326 rc = CIFSSMBWrite(xid, &io_parms, pbytes_written, pbuf); 327 CIFSSMBClose(xid, tcon, fid.netfid); 328 return rc; 329 } 330 #endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */ 331 332 /* 333 * SMB 2.1/SMB3 Protocol specific functions 334 */ 335 int 336 smb3_query_mf_symlink(unsigned int xid, struct cifs_tcon *tcon, 337 struct cifs_sb_info *cifs_sb, const unsigned char *path, 338 char *pbuf, unsigned int *pbytes_read) 339 { 340 int rc; 341 struct cifs_fid fid; 342 struct cifs_open_parms oparms; 343 struct cifs_io_parms io_parms = {0}; 344 int buf_type = CIFS_NO_BUFFER; 345 __le16 *utf16_path; 346 __u8 oplock = SMB2_OPLOCK_LEVEL_NONE; 347 struct smb2_file_all_info *pfile_info = NULL; 348 349 oparms = (struct cifs_open_parms) { 350 .tcon = tcon, 351 .cifs_sb = cifs_sb, 352 .path = path, 353 .desired_access = GENERIC_READ, 354 .create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR), 355 .disposition = FILE_OPEN, 356 .fid = &fid, 357 }; 358 359 utf16_path = cifs_convert_path_to_utf16(path, cifs_sb); 360 if (utf16_path == NULL) 361 return -ENOMEM; 362 363 pfile_info = kzalloc(sizeof(struct smb2_file_all_info) + PATH_MAX * 2, 364 GFP_KERNEL); 365 366 if (pfile_info == NULL) { 367 kfree(utf16_path); 368 return -ENOMEM; 369 } 370 371 rc = SMB2_open(xid, &oparms, utf16_path, &oplock, pfile_info, NULL, 372 NULL, NULL); 373 if (rc) 374 goto qmf_out_open_fail; 375 376 if (pfile_info->EndOfFile != cpu_to_le64(CIFS_MF_SYMLINK_FILE_SIZE)) { 377 /* it's not a symlink */ 378 rc = -ENOENT; /* Is there a better rc to return? */ 379 goto qmf_out; 380 } 381 382 io_parms.netfid = fid.netfid; 383 io_parms.pid = current->tgid; 384 io_parms.tcon = tcon; 385 io_parms.offset = 0; 386 io_parms.length = CIFS_MF_SYMLINK_FILE_SIZE; 387 io_parms.persistent_fid = fid.persistent_fid; 388 io_parms.volatile_fid = fid.volatile_fid; 389 rc = SMB2_read(xid, &io_parms, pbytes_read, &pbuf, &buf_type); 390 qmf_out: 391 SMB2_close(xid, tcon, fid.persistent_fid, fid.volatile_fid); 392 qmf_out_open_fail: 393 kfree(utf16_path); 394 kfree(pfile_info); 395 return rc; 396 } 397 398 int 399 smb3_create_mf_symlink(unsigned int xid, struct cifs_tcon *tcon, 400 struct cifs_sb_info *cifs_sb, const unsigned char *path, 401 char *pbuf, unsigned int *pbytes_written) 402 { 403 int rc; 404 struct cifs_fid fid; 405 struct cifs_open_parms oparms; 406 struct cifs_io_parms io_parms = {0}; 407 __le16 *utf16_path; 408 __u8 oplock = SMB2_OPLOCK_LEVEL_NONE; 409 struct kvec iov[2]; 410 411 cifs_dbg(FYI, "%s: path: %s\n", __func__, path); 412 413 utf16_path = cifs_convert_path_to_utf16(path, cifs_sb); 414 if (!utf16_path) 415 return -ENOMEM; 416 417 oparms = (struct cifs_open_parms) { 418 .tcon = tcon, 419 .cifs_sb = cifs_sb, 420 .path = path, 421 .desired_access = GENERIC_WRITE, 422 .create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR), 423 .disposition = FILE_CREATE, 424 .fid = &fid, 425 .mode = 0644, 426 }; 427 428 rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL, 429 NULL, NULL); 430 if (rc) { 431 kfree(utf16_path); 432 return rc; 433 } 434 435 io_parms.netfid = fid.netfid; 436 io_parms.pid = current->tgid; 437 io_parms.tcon = tcon; 438 io_parms.offset = 0; 439 io_parms.length = CIFS_MF_SYMLINK_FILE_SIZE; 440 io_parms.persistent_fid = fid.persistent_fid; 441 io_parms.volatile_fid = fid.volatile_fid; 442 443 /* iov[0] is reserved for smb header */ 444 iov[1].iov_base = pbuf; 445 iov[1].iov_len = CIFS_MF_SYMLINK_FILE_SIZE; 446 447 rc = SMB2_write(xid, &io_parms, pbytes_written, iov, 1); 448 449 /* Make sure we wrote all of the symlink data */ 450 if ((rc == 0) && (*pbytes_written != CIFS_MF_SYMLINK_FILE_SIZE)) 451 rc = -EIO; 452 453 SMB2_close(xid, tcon, fid.persistent_fid, fid.volatile_fid); 454 455 kfree(utf16_path); 456 return rc; 457 } 458 459 /* 460 * M-F Symlink Functions - End 461 */ 462 463 int 464 cifs_hardlink(struct dentry *old_file, struct inode *inode, 465 struct dentry *direntry) 466 { 467 int rc = -EACCES; 468 unsigned int xid; 469 const char *from_name, *to_name; 470 void *page1, *page2; 471 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); 472 struct tcon_link *tlink; 473 struct cifs_tcon *tcon; 474 struct TCP_Server_Info *server; 475 struct cifsInodeInfo *cifsInode; 476 477 if (unlikely(cifs_forced_shutdown(cifs_sb))) 478 return -EIO; 479 480 tlink = cifs_sb_tlink(cifs_sb); 481 if (IS_ERR(tlink)) 482 return PTR_ERR(tlink); 483 tcon = tlink_tcon(tlink); 484 485 xid = get_xid(); 486 page1 = alloc_dentry_path(); 487 page2 = alloc_dentry_path(); 488 489 from_name = build_path_from_dentry(old_file, page1); 490 if (IS_ERR(from_name)) { 491 rc = PTR_ERR(from_name); 492 goto cifs_hl_exit; 493 } 494 to_name = build_path_from_dentry(direntry, page2); 495 if (IS_ERR(to_name)) { 496 rc = PTR_ERR(to_name); 497 goto cifs_hl_exit; 498 } 499 500 #ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY 501 if (tcon->unix_ext) 502 rc = CIFSUnixCreateHardLink(xid, tcon, from_name, to_name, 503 cifs_sb->local_nls, 504 cifs_remap(cifs_sb)); 505 else { 506 #else 507 { 508 #endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */ 509 server = tcon->ses->server; 510 if (!server->ops->create_hardlink) { 511 rc = -ENOSYS; 512 goto cifs_hl_exit; 513 } 514 rc = server->ops->create_hardlink(xid, tcon, old_file, 515 from_name, to_name, cifs_sb); 516 if ((rc == -EIO) || (rc == -EINVAL)) 517 rc = -EOPNOTSUPP; 518 } 519 520 d_drop(direntry); /* force new lookup from server of target */ 521 522 /* 523 * if source file is cached (oplocked) revalidate will not go to server 524 * until the file is closed or oplock broken so update nlinks locally 525 */ 526 if (d_really_is_positive(old_file)) { 527 cifsInode = CIFS_I(d_inode(old_file)); 528 if (rc == 0) { 529 spin_lock(&d_inode(old_file)->i_lock); 530 inc_nlink(d_inode(old_file)); 531 spin_unlock(&d_inode(old_file)->i_lock); 532 533 /* 534 * parent dir timestamps will update from srv within a 535 * second, would it really be worth it to set the parent 536 * dir cifs inode time to zero to force revalidate 537 * (faster) for it too? 538 */ 539 } 540 /* 541 * if not oplocked will force revalidate to get info on source 542 * file from srv. Note Samba server prior to 4.2 has bug - 543 * not updating src file ctime on hardlinks but Windows servers 544 * handle it properly 545 */ 546 cifsInode->time = 0; 547 548 /* 549 * Will update parent dir timestamps from srv within a second. 550 * Would it really be worth it to set the parent dir (cifs 551 * inode) time field to zero to force revalidate on parent 552 * directory faster ie 553 * 554 * CIFS_I(inode)->time = 0; 555 */ 556 } 557 558 cifs_hl_exit: 559 free_dentry_path(page1); 560 free_dentry_path(page2); 561 free_xid(xid); 562 cifs_put_tlink(tlink); 563 return rc; 564 } 565 566 int 567 cifs_symlink(struct mnt_idmap *idmap, struct inode *inode, 568 struct dentry *direntry, const char *symname) 569 { 570 int rc = -EOPNOTSUPP; 571 unsigned int xid; 572 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); 573 struct TCP_Server_Info *server; 574 struct tcon_link *tlink; 575 struct cifs_tcon *pTcon; 576 const char *full_path; 577 void *page; 578 struct inode *newinode = NULL; 579 580 if (unlikely(cifs_forced_shutdown(cifs_sb))) 581 return -EIO; 582 583 page = alloc_dentry_path(); 584 if (!page) 585 return -ENOMEM; 586 587 xid = get_xid(); 588 589 tlink = cifs_sb_tlink(cifs_sb); 590 if (IS_ERR(tlink)) { 591 rc = PTR_ERR(tlink); 592 /* BB could be clearer if skipped put_tlink on error here, but harmless */ 593 goto symlink_exit; 594 } 595 pTcon = tlink_tcon(tlink); 596 server = cifs_pick_channel(pTcon->ses); 597 598 full_path = build_path_from_dentry(direntry, page); 599 if (IS_ERR(full_path)) { 600 rc = PTR_ERR(full_path); 601 goto symlink_exit; 602 } 603 604 cifs_dbg(FYI, "Full path: %s\n", full_path); 605 cifs_dbg(FYI, "symname is %s\n", symname); 606 607 /* BB what if DFS and this volume is on different share? BB */ 608 rc = -EOPNOTSUPP; 609 switch (get_cifs_symlink_type(cifs_sb)) { 610 case CIFS_SYMLINK_TYPE_DEFAULT: 611 /* should not happen, get_cifs_symlink_type() resolves the default */ 612 break; 613 614 case CIFS_SYMLINK_TYPE_NONE: 615 break; 616 617 case CIFS_SYMLINK_TYPE_UNIX: 618 #ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY 619 if (pTcon->unix_ext) { 620 rc = CIFSUnixCreateSymLink(xid, pTcon, full_path, 621 symname, 622 cifs_sb->local_nls, 623 cifs_remap(cifs_sb)); 624 } 625 #endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */ 626 break; 627 628 case CIFS_SYMLINK_TYPE_MFSYMLINKS: 629 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MF_SYMLINKS) { 630 rc = create_mf_symlink(xid, pTcon, cifs_sb, 631 full_path, symname); 632 } 633 break; 634 635 case CIFS_SYMLINK_TYPE_SFU: 636 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) { 637 rc = __cifs_sfu_make_node(xid, inode, direntry, pTcon, 638 full_path, S_IFLNK, 639 0, symname); 640 } 641 break; 642 643 case CIFS_SYMLINK_TYPE_NATIVE: 644 case CIFS_SYMLINK_TYPE_NFS: 645 case CIFS_SYMLINK_TYPE_WSL: 646 if (server->ops->create_reparse_symlink && 647 (le32_to_cpu(pTcon->fsAttrInfo.Attributes) & FILE_SUPPORTS_REPARSE_POINTS)) { 648 rc = server->ops->create_reparse_symlink(xid, inode, 649 direntry, 650 pTcon, 651 full_path, 652 symname); 653 goto symlink_exit; 654 } 655 break; 656 } 657 658 if (rc == 0) { 659 if (pTcon->posix_extensions) { 660 rc = smb311_posix_get_inode_info(&newinode, full_path, 661 NULL, inode->i_sb, xid); 662 } else if (pTcon->unix_ext) { 663 rc = cifs_get_inode_info_unix(&newinode, full_path, 664 inode->i_sb, xid); 665 } else { 666 rc = cifs_get_inode_info(&newinode, full_path, NULL, 667 inode->i_sb, xid, NULL); 668 } 669 670 if (rc != 0) { 671 cifs_dbg(FYI, "Create symlink ok, getinodeinfo fail rc = %d\n", 672 rc); 673 } else { 674 d_instantiate(direntry, newinode); 675 } 676 } 677 symlink_exit: 678 free_dentry_path(page); 679 cifs_put_tlink(tlink); 680 free_xid(xid); 681 return rc; 682 } 683