@@ -52,15 +52,16 @@ struct cop_vars {
52
52
* note: If cfile is passed, the reference to it is dropped here.
53
53
* So make sure that you do not reuse cfile after return from this func.
54
54
*
55
- * If passing @err_iov and @err_buftype, ensure to make them both large enough (>= 3) to hold all
56
- * error responses. Caller is also responsible for freeing them up.
55
+ * If passing @out_iov and @out_buftype, ensure to make them both large enough
56
+ * (>= 3) to hold all compounded responses. Caller is also responsible for
57
+ * freeing them up with free_rsp_buf().
57
58
*/
58
59
static int smb2_compound_op (const unsigned int xid , struct cifs_tcon * tcon ,
59
60
struct cifs_sb_info * cifs_sb , const char * full_path ,
60
61
__u32 desired_access , __u32 create_disposition , __u32 create_options ,
61
62
umode_t mode , void * ptr , int command , struct cifsFileInfo * cfile ,
62
63
__u8 * * extbuf , size_t * extbuflen ,
63
- struct kvec * err_iov , int * err_buftype )
64
+ struct kvec * out_iov , int * out_buftype )
64
65
{
65
66
struct cop_vars * vars = NULL ;
66
67
struct kvec * rsp_iov ;
@@ -529,9 +530,9 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
529
530
if (cfile )
530
531
cifsFileInfo_put (cfile );
531
532
532
- if (rc && err_iov && err_buftype ) {
533
- memcpy (err_iov , rsp_iov , 3 * sizeof (* err_iov ));
534
- memcpy (err_buftype , resp_buftype , 3 * sizeof (* err_buftype ));
533
+ if (out_iov && out_buftype ) {
534
+ memcpy (out_iov , rsp_iov , 3 * sizeof (* out_iov ));
535
+ memcpy (out_buftype , resp_buftype , 3 * sizeof (* out_buftype ));
535
536
} else {
536
537
free_rsp_buf (resp_buftype [0 ], rsp_iov [0 ].iov_base );
537
538
free_rsp_buf (resp_buftype [1 ], rsp_iov [1 ].iov_base );
@@ -550,8 +551,8 @@ int smb2_query_path_info(const unsigned int xid,
550
551
__u32 create_options = 0 ;
551
552
struct cifsFileInfo * cfile ;
552
553
struct cached_fid * cfid = NULL ;
553
- struct kvec err_iov [3 ] = {};
554
- int err_buftype [3 ] = {};
554
+ struct kvec out_iov [3 ] = {};
555
+ int out_buftype [3 ] = {};
555
556
bool islink ;
556
557
int rc , rc2 ;
557
558
@@ -577,15 +578,15 @@ int smb2_query_path_info(const unsigned int xid,
577
578
cifs_get_readable_path (tcon , full_path , & cfile );
578
579
rc = smb2_compound_op (xid , tcon , cifs_sb , full_path , FILE_READ_ATTRIBUTES , FILE_OPEN ,
579
580
create_options , ACL_NO_MODE , data , SMB2_OP_QUERY_INFO , cfile ,
580
- NULL , NULL , err_iov , err_buftype );
581
+ NULL , NULL , out_iov , out_buftype );
581
582
if (rc ) {
582
- struct smb2_hdr * hdr = err_iov [0 ].iov_base ;
583
+ struct smb2_hdr * hdr = out_iov [0 ].iov_base ;
583
584
584
- if (unlikely (!hdr || err_buftype [0 ] == CIFS_NO_BUFFER ))
585
+ if (unlikely (!hdr || out_buftype [0 ] == CIFS_NO_BUFFER ))
585
586
goto out ;
586
587
if (rc == - EOPNOTSUPP && hdr -> Command == SMB2_CREATE &&
587
588
hdr -> Status == STATUS_STOPPED_ON_SYMLINK ) {
588
- rc = smb2_parse_symlink_response (cifs_sb , err_iov ,
589
+ rc = smb2_parse_symlink_response (cifs_sb , out_iov ,
589
590
& data -> symlink_target );
590
591
if (rc )
591
592
goto out ;
@@ -614,13 +615,12 @@ int smb2_query_path_info(const unsigned int xid,
614
615
}
615
616
616
617
out :
617
- free_rsp_buf (err_buftype [0 ], err_iov [0 ].iov_base );
618
- free_rsp_buf (err_buftype [1 ], err_iov [1 ].iov_base );
619
- free_rsp_buf (err_buftype [2 ], err_iov [2 ].iov_base );
618
+ free_rsp_buf (out_buftype [0 ], out_iov [0 ].iov_base );
619
+ free_rsp_buf (out_buftype [1 ], out_iov [1 ].iov_base );
620
+ free_rsp_buf (out_buftype [2 ], out_iov [2 ].iov_base );
620
621
return rc ;
621
622
}
622
623
623
-
624
624
int smb311_posix_query_path_info (const unsigned int xid ,
625
625
struct cifs_tcon * tcon ,
626
626
struct cifs_sb_info * cifs_sb ,
@@ -632,8 +632,8 @@ int smb311_posix_query_path_info(const unsigned int xid,
632
632
int rc ;
633
633
__u32 create_options = 0 ;
634
634
struct cifsFileInfo * cfile ;
635
- struct kvec err_iov [3 ] = {};
636
- int err_buftype [3 ] = {};
635
+ struct kvec out_iov [3 ] = {};
636
+ int out_buftype [3 ] = {};
637
637
__u8 * sidsbuf = NULL ;
638
638
__u8 * sidsbuf_end = NULL ;
639
639
size_t sidsbuflen = 0 ;
@@ -652,13 +652,13 @@ int smb311_posix_query_path_info(const unsigned int xid,
652
652
cifs_get_readable_path (tcon , full_path , & cfile );
653
653
rc = smb2_compound_op (xid , tcon , cifs_sb , full_path , FILE_READ_ATTRIBUTES , FILE_OPEN ,
654
654
create_options , ACL_NO_MODE , data , SMB2_OP_POSIX_QUERY_INFO , cfile ,
655
- & sidsbuf , & sidsbuflen , err_iov , err_buftype );
655
+ & sidsbuf , & sidsbuflen , out_iov , out_buftype );
656
656
if (rc == - EOPNOTSUPP ) {
657
657
/* BB TODO: When support for special files added to Samba re-verify this path */
658
- if (err_iov [0 ].iov_base && err_buftype [0 ] != CIFS_NO_BUFFER &&
659
- ((struct smb2_hdr * )err_iov [0 ].iov_base )-> Command == SMB2_CREATE &&
660
- ((struct smb2_hdr * )err_iov [0 ].iov_base )-> Status == STATUS_STOPPED_ON_SYMLINK ) {
661
- rc = smb2_parse_symlink_response (cifs_sb , err_iov , & data -> symlink_target );
658
+ if (out_iov [0 ].iov_base && out_buftype [0 ] != CIFS_NO_BUFFER &&
659
+ ((struct smb2_hdr * )out_iov [0 ].iov_base )-> Command == SMB2_CREATE &&
660
+ ((struct smb2_hdr * )out_iov [0 ].iov_base )-> Status == STATUS_STOPPED_ON_SYMLINK ) {
661
+ rc = smb2_parse_symlink_response (cifs_sb , out_iov , & data -> symlink_target );
662
662
if (rc )
663
663
goto out ;
664
664
}
@@ -694,9 +694,9 @@ int smb311_posix_query_path_info(const unsigned int xid,
694
694
695
695
out :
696
696
kfree (sidsbuf );
697
- free_rsp_buf (err_buftype [0 ], err_iov [0 ].iov_base );
698
- free_rsp_buf (err_buftype [1 ], err_iov [1 ].iov_base );
699
- free_rsp_buf (err_buftype [2 ], err_iov [2 ].iov_base );
697
+ free_rsp_buf (out_buftype [0 ], out_iov [0 ].iov_base );
698
+ free_rsp_buf (out_buftype [1 ], out_iov [1 ].iov_base );
699
+ free_rsp_buf (out_buftype [2 ], out_iov [2 ].iov_base );
700
700
return rc ;
701
701
}
702
702
0 commit comments