ksmbd: fix endless loop when encryption for response fails
authorNamjae Jeon <linkinjeon@kernel.org>
Thu, 22 Sep 2022 14:35:43 +0000 (23:35 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Oct 2022 10:34:26 +0000 (12:34 +0200)
commit 360c8ee6fefdb496fffd2c18bb9a96a376a1a804 upstream.

If ->encrypt_resp return error, goto statement cause endless loop.
It send an error response immediately after removing it.

Fixes: 0626e6641f6b ("cifsd: add server handler for central processing and tranport layers")
Cc: stable@vger.kernel.org
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ksmbd/server.c

index 36d368e..976d09a 100644 (file)
@@ -235,10 +235,8 @@ send:
        if (work->sess && work->sess->enc && work->encrypted &&
            conn->ops->encrypt_resp) {
                rc = conn->ops->encrypt_resp(work);
-               if (rc < 0) {
+               if (rc < 0)
                        conn->ops->set_rsp_status(work, STATUS_DATA_ERROR);
-                       goto send;
-               }
        }
 
        ksmbd_conn_write(work);