@@ -2580,36 +2580,22 @@ validate_and_copy_iov(unsigned int offset, unsigned int buffer_length,
2580
2580
return 0 ;
2581
2581
}
2582
2582
2583
- static int
2584
- query_info ( const unsigned int xid , struct cifs_tcon * tcon ,
2585
- u64 persistent_fid , u64 volatile_fid , u8 info_class , u8 info_type ,
2586
- u32 additional_info , size_t output_len , size_t min_len , void * * data ,
2587
- u32 * dlen )
2583
+ int
2584
+ SMB2_query_info_init ( struct cifs_tcon * tcon , struct smb_rqst * rqst ,
2585
+ u64 persistent_fid , u64 volatile_fid ,
2586
+ u8 info_class , u8 info_type , u32 additional_info ,
2587
+ size_t output_len )
2588
2588
{
2589
- struct smb_rqst rqst ;
2590
2589
struct smb2_query_info_req * req ;
2591
- struct smb2_query_info_rsp * rsp = NULL ;
2592
- struct kvec iov [2 ];
2593
- struct kvec rsp_iov ;
2594
- int rc = 0 ;
2595
- int resp_buftype ;
2596
- struct cifs_ses * ses = tcon -> ses ;
2597
- int flags = 0 ;
2590
+ struct kvec * iov = rqst -> rq_iov ;
2598
2591
unsigned int total_len ;
2599
-
2600
- cifs_dbg (FYI , "Query Info\n" );
2601
-
2602
- if (!ses || !(ses -> server ))
2603
- return - EIO ;
2592
+ int rc ;
2604
2593
2605
2594
rc = smb2_plain_req_init (SMB2_QUERY_INFO , tcon , (void * * ) & req ,
2606
2595
& total_len );
2607
2596
if (rc )
2608
2597
return rc ;
2609
2598
2610
- if (smb3_encryption_required (tcon ))
2611
- flags |= CIFS_TRANSFORM_REQ ;
2612
-
2613
2599
req -> InfoType = info_type ;
2614
2600
req -> FileInfoClass = info_class ;
2615
2601
req -> PersistentFileId = persistent_fid ;
@@ -2626,13 +2612,50 @@ query_info(const unsigned int xid, struct cifs_tcon *tcon,
2626
2612
iov [0 ].iov_base = (char * )req ;
2627
2613
/* 1 for Buffer */
2628
2614
iov [0 ].iov_len = total_len - 1 ;
2615
+ return 0 ;
2616
+ }
2617
+
2618
+ void
2619
+ SMB2_query_info_free (struct smb_rqst * rqst )
2620
+ {
2621
+ cifs_small_buf_release (rqst -> rq_iov [0 ].iov_base ); /* request */
2622
+ }
2623
+
2624
+ static int
2625
+ query_info (const unsigned int xid , struct cifs_tcon * tcon ,
2626
+ u64 persistent_fid , u64 volatile_fid , u8 info_class , u8 info_type ,
2627
+ u32 additional_info , size_t output_len , size_t min_len , void * * data ,
2628
+ u32 * dlen )
2629
+ {
2630
+ struct smb_rqst rqst ;
2631
+ struct smb2_query_info_rsp * rsp = NULL ;
2632
+ struct kvec iov [1 ];
2633
+ struct kvec rsp_iov ;
2634
+ int rc = 0 ;
2635
+ int resp_buftype ;
2636
+ struct cifs_ses * ses = tcon -> ses ;
2637
+ int flags = 0 ;
2638
+
2639
+ cifs_dbg (FYI , "Query Info\n" );
2640
+
2641
+ if (!ses || !(ses -> server ))
2642
+ return - EIO ;
2643
+
2644
+ if (smb3_encryption_required (tcon ))
2645
+ flags |= CIFS_TRANSFORM_REQ ;
2629
2646
2630
2647
memset (& rqst , 0 , sizeof (struct smb_rqst ));
2648
+ memset (& iov , 0 , sizeof (iov ));
2631
2649
rqst .rq_iov = iov ;
2632
2650
rqst .rq_nvec = 1 ;
2633
2651
2652
+ rc = SMB2_query_info_init (tcon , & rqst , persistent_fid , volatile_fid ,
2653
+ info_class , info_type , additional_info ,
2654
+ output_len );
2655
+ if (rc )
2656
+ goto qinf_exit ;
2657
+
2634
2658
rc = cifs_send_recv (xid , ses , & rqst , & resp_buftype , flags , & rsp_iov );
2635
- cifs_small_buf_release (req );
2636
2659
rsp = (struct smb2_query_info_rsp * )rsp_iov .iov_base ;
2637
2660
2638
2661
if (rc ) {
@@ -2661,6 +2684,7 @@ query_info(const unsigned int xid, struct cifs_tcon *tcon,
2661
2684
& rsp_iov , min_len , * data );
2662
2685
2663
2686
qinf_exit :
2687
+ SMB2_query_info_free (& rqst );
2664
2688
free_rsp_buf (resp_buftype , rsp );
2665
2689
return rc ;
2666
2690
}
0 commit comments