rx: Assert call error for RXS_PreparePacket error
authorAndrew Deason <adeason@sinenomine.net>
Mon, 18 Feb 2013 01:34:06 +0000 (19:34 -0600)
committerDerrick Brashear <shadow@your-file-system.com>
Tue, 19 Feb 2013 18:03:07 +0000 (10:03 -0800)
If we've received an error from the underlying security class, we must
not try to send the given packet, or we risk security issues. We
currently achieve this by setting an error on the connection. It is
slightly indirect in how this yields an error on this specific call,
and so it may not be immediately clear, but doing so is critical. If
somehow the call does not have an error by the end of this, we cannot
proceed as this is an error condition we do not handle. So, assert.

Change-Id: Ie0106ab170ecb77bb102c5afa3ec44ba2b704283
Reviewed-on: http://gerrit.openafs.org/9122
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

src/rx/rx_packet.c

index ac10c27..442f598 100644 (file)
@@ -2785,6 +2785,11 @@ rxi_PrepareSendPacket(struct rx_call *call,
        p = rxi_SendConnectionAbort(conn, p, 0, 0);
        MUTEX_EXIT(&conn->conn_data_lock);
        MUTEX_ENTER(&call->lock);
+       /* setting a connection error means all calls for that conn are also
+        * error'd. if this call does not have an error by now, something is
+        * very wrong, and we risk sending data in the clear that is supposed
+        * to be encrypted. */
+       osi_Assert(call->error);
     }
 }