Blame SOURCES/0003-server-reset-meta-context-replies-on-starttls.patch

259ab8
From add9b794b9dc697a1b52115c997fcfb6e06bf64c Mon Sep 17 00:00:00 2001
259ab8
From: Eric Blake <eblake@redhat.com>
259ab8
Date: Mon, 16 Aug 2021 13:43:29 -0500
259ab8
Subject: [PATCH] server: reset meta context replies on starttls
259ab8
259ab8
Related to CVE-2021-3716, but not as severe.  No compliant client will
259ab8
send NBD_CMD_BLOCK_STATUS unless it first negotiates
259ab8
NBD_OPT_SET_META_CONTEXT.  If an attacker injects a premature
259ab8
SET_META_CONTEXT, either the client will never notice (because it
259ab8
never uses BLOCK_STATUS), or the client will overwrite the attacker's
259ab8
attempt with the client's own SET_META_CONTEXT request after
259ab8
encryption is enabled.  So I don't class this as having the potential
259ab8
to trigger denial-of-service due to any protocol mismatch between
259ab8
compliant client and server (I don't care what happens with
259ab8
non-compliant clients).
259ab8
259ab8
Fixes: 26455d45 (server: protocol: Implement Block Status "base:allocation".)
259ab8
(cherry picked from commit 6c5faac6a37077cf2366388a80862bb00616d0d8)
259ab8
(cherry picked from commit 814d8103fb4b581dc01dfd25d2cd81596576f211)
259ab8
---
259ab8
 server/protocol-handshake-newstyle.c | 3 +++
259ab8
 1 file changed, 3 insertions(+)
259ab8
259ab8
diff --git a/server/protocol-handshake-newstyle.c b/server/protocol-handshake-newstyle.c
259ab8
index b94950e2..eb0f3961 100644
259ab8
--- a/server/protocol-handshake-newstyle.c
259ab8
+++ b/server/protocol-handshake-newstyle.c
259ab8
@@ -497,6 +497,9 @@ negotiate_handshake_newstyle_options (void)
259ab8
         debug ("using TLS on this connection");
259ab8
         /* Wipe out any cached state. */
259ab8
         conn->structured_replies = false;
259ab8
+        free (conn->exportname_from_set_meta_context);
259ab8
+        conn->exportname_from_set_meta_context = NULL;
259ab8
+        conn->meta_context_base_allocation = false;
259ab8
         for_each_backend (b) {
259ab8
           struct handle *h = get_handle (conn, b->i);
259ab8
           free (h->default_exportname);
259ab8
-- 
259ab8
2.31.1
259ab8