Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'for-next' of git://git.samba.org/sfrench/cifs-2.6

Pull cifs fixes from Steve French:
"Small set of cifs fixes"

* 'for-next' of git://git.samba.org/sfrench/cifs-2.6:
Move check for prefix path to within cifs_get_root()
Compare prepaths when comparing superblocks
Fix memory leaks in cifs_do_mount()

+42 -20
+12 -17
fs/cifs/cifsfs.c
··· 609 609 char *s, *p; 610 610 char sep; 611 611 612 + if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH) 613 + return dget(sb->s_root); 614 + 612 615 full_path = cifs_build_path_to_root(vol, cifs_sb, 613 616 cifs_sb_master_tcon(cifs_sb)); 614 617 if (full_path == NULL) ··· 689 686 cifs_sb->mountdata = kstrndup(data, PAGE_SIZE, GFP_KERNEL); 690 687 if (cifs_sb->mountdata == NULL) { 691 688 root = ERR_PTR(-ENOMEM); 692 - goto out_cifs_sb; 689 + goto out_free; 693 690 } 694 691 695 - if (volume_info->prepath) { 696 - cifs_sb->prepath = kstrdup(volume_info->prepath, GFP_KERNEL); 697 - if (cifs_sb->prepath == NULL) { 698 - root = ERR_PTR(-ENOMEM); 699 - goto out_cifs_sb; 700 - } 692 + rc = cifs_setup_cifs_sb(volume_info, cifs_sb); 693 + if (rc) { 694 + root = ERR_PTR(rc); 695 + goto out_free; 701 696 } 702 - 703 - cifs_setup_cifs_sb(volume_info, cifs_sb); 704 697 705 698 rc = cifs_mount(cifs_sb, volume_info); 706 699 if (rc) { ··· 704 705 cifs_dbg(VFS, "cifs_mount failed w/return code = %d\n", 705 706 rc); 706 707 root = ERR_PTR(rc); 707 - goto out_mountdata; 708 + goto out_free; 708 709 } 709 710 710 711 mnt_data.vol = volume_info; ··· 734 735 sb->s_flags |= MS_ACTIVE; 735 736 } 736 737 737 - if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH) 738 - root = dget(sb->s_root); 739 - else 740 - root = cifs_get_root(volume_info, sb); 741 - 738 + root = cifs_get_root(volume_info, sb); 742 739 if (IS_ERR(root)) 743 740 goto out_super; 744 741 ··· 747 752 cifs_cleanup_volume_info(volume_info); 748 753 return root; 749 754 750 - out_mountdata: 755 + out_free: 756 + kfree(cifs_sb->prepath); 751 757 kfree(cifs_sb->mountdata); 752 - out_cifs_sb: 753 758 kfree(cifs_sb); 754 759 out_nls: 755 760 unload_nls(volume_info->local_nls);
+1 -1
fs/cifs/cifsproto.h
··· 184 184 unsigned int to_read); 185 185 extern int cifs_read_page_from_socket(struct TCP_Server_Info *server, 186 186 struct page *page, unsigned int to_read); 187 - extern void cifs_setup_cifs_sb(struct smb_vol *pvolume_info, 187 + extern int cifs_setup_cifs_sb(struct smb_vol *pvolume_info, 188 188 struct cifs_sb_info *cifs_sb); 189 189 extern int cifs_match_super(struct super_block *, void *); 190 190 extern void cifs_cleanup_volume_info(struct smb_vol *pvolume_info);
+29 -2
fs/cifs/connect.c
··· 2781 2781 return 1; 2782 2782 } 2783 2783 2784 + static int 2785 + match_prepath(struct super_block *sb, struct cifs_mnt_data *mnt_data) 2786 + { 2787 + struct cifs_sb_info *old = CIFS_SB(sb); 2788 + struct cifs_sb_info *new = mnt_data->cifs_sb; 2789 + 2790 + if (old->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH) { 2791 + if (!(new->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH)) 2792 + return 0; 2793 + /* The prepath should be null terminated strings */ 2794 + if (strcmp(new->prepath, old->prepath)) 2795 + return 0; 2796 + 2797 + return 1; 2798 + } 2799 + return 0; 2800 + } 2801 + 2784 2802 int 2785 2803 cifs_match_super(struct super_block *sb, void *data) 2786 2804 { ··· 2826 2808 2827 2809 if (!match_server(tcp_srv, volume_info) || 2828 2810 !match_session(ses, volume_info) || 2829 - !match_tcon(tcon, volume_info->UNC)) { 2811 + !match_tcon(tcon, volume_info->UNC) || 2812 + !match_prepath(sb, mnt_data)) { 2830 2813 rc = 0; 2831 2814 goto out; 2832 2815 } ··· 3241 3222 } 3242 3223 } 3243 3224 3244 - void cifs_setup_cifs_sb(struct smb_vol *pvolume_info, 3225 + int cifs_setup_cifs_sb(struct smb_vol *pvolume_info, 3245 3226 struct cifs_sb_info *cifs_sb) 3246 3227 { 3247 3228 INIT_DELAYED_WORK(&cifs_sb->prune_tlinks, cifs_prune_tlinks); ··· 3335 3316 3336 3317 if ((pvolume_info->cifs_acl) && (pvolume_info->dynperm)) 3337 3318 cifs_dbg(VFS, "mount option dynperm ignored if cifsacl mount option supported\n"); 3319 + 3320 + if (pvolume_info->prepath) { 3321 + cifs_sb->prepath = kstrdup(pvolume_info->prepath, GFP_KERNEL); 3322 + if (cifs_sb->prepath == NULL) 3323 + return -ENOMEM; 3324 + } 3325 + 3326 + return 0; 3338 3327 } 3339 3328 3340 3329 static void