diff mbox series

[1/3] cifs: fix credit leaks in async callback

Message ID 20230629085858.2834937-1-wentao@uniontech.com (mailing list archive)
State New, archived
Headers show
Series [1/3] cifs: fix credit leaks in async callback | expand

Commit Message

Winston Wen June 29, 2023, 8:58 a.m. UTC
Initialize credits.value to 1, which will be passed to add_credits() if
mid->mid_state is not MID_RESPONSE_RECEIVED or MID_RESPONSE_MALFORMED.

Signed-off-by: Winston Wen <wentao@uniontech.com>
---
 fs/smb/client/smb2pdu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c
index e04766fe6f80..4c71979fca6d 100644
--- a/fs/smb/client/smb2pdu.c
+++ b/fs/smb/client/smb2pdu.c
@@ -3760,7 +3760,7 @@  smb2_echo_callback(struct mid_q_entry *mid)
 {
 	struct TCP_Server_Info *server = mid->callback_data;
 	struct smb2_echo_rsp *rsp = (struct smb2_echo_rsp *)mid->resp_buf;
-	struct cifs_credits credits = { .value = 0, .instance = 0 };
+	struct cifs_credits credits = { .value = 1, .instance = 0 };
 
 	if (mid->mid_state == MID_RESPONSE_RECEIVED
 	    || mid->mid_state == MID_RESPONSE_MALFORMED) {
@@ -4150,7 +4150,7 @@  smb2_readv_callback(struct mid_q_entry *mid)
 	struct TCP_Server_Info *server = rdata->server;
 	struct smb2_hdr *shdr =
 				(struct smb2_hdr *)rdata->iov[0].iov_base;
-	struct cifs_credits credits = { .value = 0, .instance = 0 };
+	struct cifs_credits credits = { .value = 1, .instance = 0 };
 	struct smb_rqst rqst = { .rq_iov = &rdata->iov[1], .rq_nvec = 1 };
 
 	if (rdata->got_bytes) {
@@ -4402,7 +4402,7 @@  smb2_writev_callback(struct mid_q_entry *mid)
 	struct TCP_Server_Info *server = wdata->server;
 	unsigned int written;
 	struct smb2_write_rsp *rsp = (struct smb2_write_rsp *)mid->resp_buf;
-	struct cifs_credits credits = { .value = 0, .instance = 0 };
+	struct cifs_credits credits = { .value = 1, .instance = 0 };
 
 	WARN_ONCE(wdata->server != mid->server,
 		  "wdata server %p != mid server %p",