Bug 1556491 - Close nsHttpConnection.mTLSFilter when transaction of that connection is being closed to correctly carry cancellation status and prevent calls on a closed ssl socket, r=dragana
authorHonza Bambas <honzab.moz@firemni.cz>
Fri, 28 Jun 2019 12:45:49 +0000
changeset 543370 cc8fb7381daf980864578fb456eafc375236e96d
parent 543369 99213f6d510ee6e00df29710fce80ada5485536d
child 543371 45344eeb154da45b4daa31251d4ea077a57d47cf
push id2131
push userffxbld-merge
push dateMon, 26 Aug 2019 18:30:20 +0000
treeherdermozilla-release@b19ffb3ca153 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdragana
bugs1556491
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1556491 - Close nsHttpConnection.mTLSFilter when transaction of that connection is being closed to correctly carry cancellation status and prevent calls on a closed ssl socket, r=dragana Differential Revision: https://phabricator.services.mozilla.com/D36111
netwerk/protocol/http/nsHttpConnection.cpp
--- a/netwerk/protocol/http/nsHttpConnection.cpp
+++ b/netwerk/protocol/http/nsHttpConnection.cpp
@@ -1806,16 +1806,26 @@ void nsHttpConnection::CloseTransaction(
   if (mUsingSpdyVersion != SpdyVersion::NONE) {
     DontReuse();
     // if !mSpdySession then mUsingSpdyVersion must be false for canreuse()
     mSpdySession->SetCleanShutdown(aIsShutdown);
     mUsingSpdyVersion = SpdyVersion::NONE;
     mSpdySession = nullptr;
   }
 
+  if (!mTransaction && mTLSFilter) {
+    // In case of a race when the transaction is being closed before the tunnel
+    // is established we need to carry closing status on the proxied
+    // transaction.
+    // Not doing this leads to use of this closed connection to activate the
+    // not closed transaction what will likely lead to a use of a closed ssl
+    // socket and may cause a crash because of an unexpected use.
+    mTLSFilter->Close(reason);
+  }
+
   if (mTransaction) {
     mHttp1xTransactionCount += mTransaction->Http1xTransactionCount();
 
     mTransaction->Close(reason);
     mTransaction = nullptr;
   }
 
   {