@@ -719,17 +719,25 @@ cifs_mkdir_setinfo(struct inode *inode, const char *full_path,
719
719
static int cifs_open_file (const unsigned int xid , struct cifs_open_parms * oparms , __u32 * oplock ,
720
720
void * buf )
721
721
{
722
- FILE_ALL_INFO * fi = buf ;
722
+ struct cifs_open_info_data * data = buf ;
723
+ FILE_ALL_INFO fi = {};
724
+ int rc ;
723
725
724
726
if (!(oparms -> tcon -> ses -> capabilities & CAP_NT_SMBS ))
725
- return SMBLegacyOpen (xid , oparms -> tcon , oparms -> path ,
726
- oparms -> disposition ,
727
- oparms -> desired_access ,
728
- oparms -> create_options ,
729
- & oparms -> fid -> netfid , oplock , fi ,
730
- oparms -> cifs_sb -> local_nls ,
731
- cifs_remap (oparms -> cifs_sb ));
732
- return CIFS_open (xid , oparms , oplock , fi );
727
+ rc = SMBLegacyOpen (xid , oparms -> tcon , oparms -> path ,
728
+ oparms -> disposition ,
729
+ oparms -> desired_access ,
730
+ oparms -> create_options ,
731
+ & oparms -> fid -> netfid , oplock , & fi ,
732
+ oparms -> cifs_sb -> local_nls ,
733
+ cifs_remap (oparms -> cifs_sb ));
734
+ else
735
+ rc = CIFS_open (xid , oparms , oplock , & fi );
736
+
737
+ if (!rc && data )
738
+ move_cifs_info_to_smb2 (& data -> fi , & fi );
739
+
740
+ return rc ;
733
741
}
734
742
735
743
static void
@@ -1053,7 +1061,7 @@ cifs_make_node(unsigned int xid, struct inode *inode,
1053
1061
struct cifs_sb_info * cifs_sb = CIFS_SB (inode -> i_sb );
1054
1062
struct inode * newinode = NULL ;
1055
1063
int rc = - EPERM ;
1056
- FILE_ALL_INFO * buf = NULL ;
1064
+ struct cifs_open_info_data buf = {} ;
1057
1065
struct cifs_io_parms io_parms ;
1058
1066
__u32 oplock = 0 ;
1059
1067
struct cifs_fid fid ;
@@ -1085,34 +1093,28 @@ cifs_make_node(unsigned int xid, struct inode *inode,
1085
1093
cifs_sb -> local_nls ,
1086
1094
cifs_remap (cifs_sb ));
1087
1095
if (rc )
1088
- goto out ;
1096
+ return rc ;
1089
1097
1090
1098
rc = cifs_get_inode_info_unix (& newinode , full_path ,
1091
1099
inode -> i_sb , xid );
1092
1100
1093
1101
if (rc == 0 )
1094
1102
d_instantiate (dentry , newinode );
1095
- goto out ;
1103
+ return rc ;
1096
1104
}
1097
1105
1098
1106
/*
1099
1107
* SMB1 SFU emulation: should work with all servers, but only
1100
1108
* support block and char device (no socket & fifo)
1101
1109
*/
1102
1110
if (!(cifs_sb -> mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL ))
1103
- goto out ;
1111
+ return rc ;
1104
1112
1105
1113
if (!S_ISCHR (mode ) && !S_ISBLK (mode ))
1106
- goto out ;
1114
+ return rc ;
1107
1115
1108
1116
cifs_dbg (FYI , "sfu compat create special file\n" );
1109
1117
1110
- buf = kmalloc (sizeof (FILE_ALL_INFO ), GFP_KERNEL );
1111
- if (buf == NULL ) {
1112
- rc = - ENOMEM ;
1113
- goto out ;
1114
- }
1115
-
1116
1118
oparms .tcon = tcon ;
1117
1119
oparms .cifs_sb = cifs_sb ;
1118
1120
oparms .desired_access = GENERIC_WRITE ;
@@ -1127,21 +1129,21 @@ cifs_make_node(unsigned int xid, struct inode *inode,
1127
1129
oplock = REQ_OPLOCK ;
1128
1130
else
1129
1131
oplock = 0 ;
1130
- rc = tcon -> ses -> server -> ops -> open (xid , & oparms , & oplock , buf );
1132
+ rc = tcon -> ses -> server -> ops -> open (xid , & oparms , & oplock , & buf );
1131
1133
if (rc )
1132
- goto out ;
1134
+ return rc ;
1133
1135
1134
1136
/*
1135
1137
* BB Do not bother to decode buf since no local inode yet to put
1136
1138
* timestamps in, but we can reuse it safely.
1137
1139
*/
1138
1140
1139
- pdev = (struct win_dev * )buf ;
1141
+ pdev = (struct win_dev * )& buf . fi ;
1140
1142
io_parms .pid = current -> tgid ;
1141
1143
io_parms .tcon = tcon ;
1142
1144
io_parms .offset = 0 ;
1143
1145
io_parms .length = sizeof (struct win_dev );
1144
- iov [1 ].iov_base = buf ;
1146
+ iov [1 ].iov_base = & buf . fi ;
1145
1147
iov [1 ].iov_len = sizeof (struct win_dev );
1146
1148
if (S_ISCHR (mode )) {
1147
1149
memcpy (pdev -> type , "IntxCHR" , 8 );
@@ -1160,8 +1162,8 @@ cifs_make_node(unsigned int xid, struct inode *inode,
1160
1162
d_drop (dentry );
1161
1163
1162
1164
/* FIXME: add code here to set EAs */
1163
- out :
1164
- kfree ( buf );
1165
+
1166
+ cifs_free_open_info ( & buf );
1165
1167
return rc ;
1166
1168
}
1167
1169
0 commit comments