@@ -562,17 +562,20 @@ static int cifs_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
562562 if ((rc == - EOPNOTSUPP ) || (rc == - EINVAL )) {
563563 rc = SMBQueryInformation (xid , tcon , full_path , & fi , cifs_sb -> local_nls ,
564564 cifs_remap (cifs_sb ));
565- if (!rc )
566- move_cifs_info_to_smb2 (& data -> fi , & fi );
567565 * adjustTZ = true;
568566 }
569567
570- if (!rc && ( le32_to_cpu ( fi . Attributes ) & ATTR_REPARSE ) ) {
568+ if (!rc ) {
571569 int tmprc ;
572570 int oplock = 0 ;
573571 struct cifs_fid fid ;
574572 struct cifs_open_parms oparms ;
575573
574+ move_cifs_info_to_smb2 (& data -> fi , & fi );
575+
576+ if (!(le32_to_cpu (fi .Attributes ) & ATTR_REPARSE ))
577+ return 0 ;
578+
576579 oparms .tcon = tcon ;
577580 oparms .cifs_sb = cifs_sb ;
578581 oparms .desired_access = FILE_READ_ATTRIBUTES ;
@@ -716,17 +719,25 @@ cifs_mkdir_setinfo(struct inode *inode, const char *full_path,
716719static int cifs_open_file (const unsigned int xid , struct cifs_open_parms * oparms , __u32 * oplock ,
717720 void * buf )
718721{
719- FILE_ALL_INFO * fi = buf ;
722+ struct cifs_open_info_data * data = buf ;
723+ FILE_ALL_INFO fi = {};
724+ int rc ;
720725
721726 if (!(oparms -> tcon -> ses -> capabilities & CAP_NT_SMBS ))
722- return SMBLegacyOpen (xid , oparms -> tcon , oparms -> path ,
723- oparms -> disposition ,
724- oparms -> desired_access ,
725- oparms -> create_options ,
726- & oparms -> fid -> netfid , oplock , fi ,
727- oparms -> cifs_sb -> local_nls ,
728- cifs_remap (oparms -> cifs_sb ));
729- 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 ;
730741}
731742
732743static void
@@ -1050,7 +1061,7 @@ cifs_make_node(unsigned int xid, struct inode *inode,
10501061 struct cifs_sb_info * cifs_sb = CIFS_SB (inode -> i_sb );
10511062 struct inode * newinode = NULL ;
10521063 int rc = - EPERM ;
1053- FILE_ALL_INFO * buf = NULL ;
1064+ struct cifs_open_info_data buf = {} ;
10541065 struct cifs_io_parms io_parms ;
10551066 __u32 oplock = 0 ;
10561067 struct cifs_fid fid ;
@@ -1082,34 +1093,28 @@ cifs_make_node(unsigned int xid, struct inode *inode,
10821093 cifs_sb -> local_nls ,
10831094 cifs_remap (cifs_sb ));
10841095 if (rc )
1085- goto out ;
1096+ return rc ;
10861097
10871098 rc = cifs_get_inode_info_unix (& newinode , full_path ,
10881099 inode -> i_sb , xid );
10891100
10901101 if (rc == 0 )
10911102 d_instantiate (dentry , newinode );
1092- goto out ;
1103+ return rc ;
10931104 }
10941105
10951106 /*
10961107 * SMB1 SFU emulation: should work with all servers, but only
10971108 * support block and char device (no socket & fifo)
10981109 */
10991110 if (!(cifs_sb -> mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL ))
1100- goto out ;
1111+ return rc ;
11011112
11021113 if (!S_ISCHR (mode ) && !S_ISBLK (mode ))
1103- goto out ;
1114+ return rc ;
11041115
11051116 cifs_dbg (FYI , "sfu compat create special file\n" );
11061117
1107- buf = kmalloc (sizeof (FILE_ALL_INFO ), GFP_KERNEL );
1108- if (buf == NULL ) {
1109- rc = - ENOMEM ;
1110- goto out ;
1111- }
1112-
11131118 oparms .tcon = tcon ;
11141119 oparms .cifs_sb = cifs_sb ;
11151120 oparms .desired_access = GENERIC_WRITE ;
@@ -1124,21 +1129,21 @@ cifs_make_node(unsigned int xid, struct inode *inode,
11241129 oplock = REQ_OPLOCK ;
11251130 else
11261131 oplock = 0 ;
1127- rc = tcon -> ses -> server -> ops -> open (xid , & oparms , & oplock , buf );
1132+ rc = tcon -> ses -> server -> ops -> open (xid , & oparms , & oplock , & buf );
11281133 if (rc )
1129- goto out ;
1134+ return rc ;
11301135
11311136 /*
11321137 * BB Do not bother to decode buf since no local inode yet to put
11331138 * timestamps in, but we can reuse it safely.
11341139 */
11351140
1136- pdev = (struct win_dev * )buf ;
1141+ pdev = (struct win_dev * )& buf . fi ;
11371142 io_parms .pid = current -> tgid ;
11381143 io_parms .tcon = tcon ;
11391144 io_parms .offset = 0 ;
11401145 io_parms .length = sizeof (struct win_dev );
1141- iov [1 ].iov_base = buf ;
1146+ iov [1 ].iov_base = & buf . fi ;
11421147 iov [1 ].iov_len = sizeof (struct win_dev );
11431148 if (S_ISCHR (mode )) {
11441149 memcpy (pdev -> type , "IntxCHR" , 8 );
@@ -1157,8 +1162,8 @@ cifs_make_node(unsigned int xid, struct inode *inode,
11571162 d_drop (dentry );
11581163
11591164 /* FIXME: add code here to set EAs */
1160- out :
1161- kfree ( buf );
1165+
1166+ cifs_free_open_info ( & buf );
11621167 return rc ;
11631168}
11641169
0 commit comments