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

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