File tree Expand file tree Collapse file tree 2 files changed +12
-22
lines changed
Expand file tree Collapse file tree 2 files changed +12
-22
lines changed Original file line number Diff line number Diff line change @@ -188,4 +188,11 @@ static inline void dfs_put_root_smb_sessions(struct list_head *head)
188188 }
189189}
190190
191+ static inline const char * dfs_ses_refpath (struct cifs_ses * ses )
192+ {
193+ const char * path = ses -> server -> leaf_fullpath ;
194+
195+ return path ? path + 1 : ERR_PTR (- ENOENT );
196+ }
197+
191198#endif /* _CIFS_DFS_H */
Original file line number Diff line number Diff line change @@ -1136,33 +1136,19 @@ static bool is_ses_good(struct cifs_ses *ses)
11361136 return ret ;
11371137}
11381138
1139- static char * get_ses_refpath (struct cifs_ses * ses )
1140- {
1141- struct TCP_Server_Info * server = ses -> server ;
1142- char * path = ERR_PTR (- ENOENT );
1143-
1144- if (server -> leaf_fullpath ) {
1145- path = kstrdup (server -> leaf_fullpath + 1 , GFP_KERNEL );
1146- if (!path )
1147- path = ERR_PTR (- ENOMEM );
1148- }
1149- return path ;
1150- }
1151-
11521139/* Refresh dfs referral of @ses */
11531140static void refresh_ses_referral (struct cifs_ses * ses )
11541141{
11551142 struct cache_entry * ce ;
11561143 unsigned int xid ;
1157- char * path ;
1144+ const char * path ;
11581145 int rc = 0 ;
11591146
11601147 xid = get_xid ();
11611148
1162- path = get_ses_refpath (ses );
1149+ path = dfs_ses_refpath (ses );
11631150 if (IS_ERR (path )) {
11641151 rc = PTR_ERR (path );
1165- path = NULL ;
11661152 goto out ;
11671153 }
11681154
@@ -1181,7 +1167,6 @@ static void refresh_ses_referral(struct cifs_ses *ses)
11811167
11821168out :
11831169 free_xid (xid );
1184- kfree (path );
11851170}
11861171
11871172static int __refresh_tcon_referral (struct cifs_tcon * tcon ,
@@ -1231,19 +1216,18 @@ static void refresh_tcon_referral(struct cifs_tcon *tcon, bool force_refresh)
12311216 struct dfs_info3_param * refs = NULL ;
12321217 struct cache_entry * ce ;
12331218 struct cifs_ses * ses ;
1234- unsigned int xid ;
12351219 bool needs_refresh ;
1236- char * path ;
1220+ const char * path ;
1221+ unsigned int xid ;
12371222 int numrefs = 0 ;
12381223 int rc = 0 ;
12391224
12401225 xid = get_xid ();
12411226 ses = tcon -> ses ;
12421227
1243- path = get_ses_refpath (ses );
1228+ path = dfs_ses_refpath (ses );
12441229 if (IS_ERR (path )) {
12451230 rc = PTR_ERR (path );
1246- path = NULL ;
12471231 goto out ;
12481232 }
12491233
@@ -1271,7 +1255,6 @@ static void refresh_tcon_referral(struct cifs_tcon *tcon, bool force_refresh)
12711255
12721256out :
12731257 free_xid (xid );
1274- kfree (path );
12751258 free_dfs_info_array (refs , numrefs );
12761259}
12771260
You can’t perform that action at this time.
0 commit comments