Bug 1486228 - Grab mutex when accessing nsDNSService::mLocalDomains r=mayhemer!
authorValentin Gosu <valentin.gosu@gmail.com>
Tue, 28 Aug 2018 22:37:12 +0000
changeset 488784 19caa87ed595777c72d563471eb04135712155ff
parent 488783 511ad3e51be353f40f5f0a56ac953f39e7beba32
child 488785 21eff49dce24897629fac41be0a5c3cdfdc502a9
push id9734
push usershindli@mozilla.com
push dateThu, 30 Aug 2018 12:18:07 +0000
treeherdermozilla-beta@71c71ab3afae [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmayhemer
bugs1486228
milestone63.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 1486228 - Grab mutex when accessing nsDNSService::mLocalDomains r=mayhemer! Differential Revision: https://phabricator.services.mozilla.com/D4452
netwerk/dns/nsDNSService2.cpp
netwerk/dns/nsDNSService2.h
--- a/netwerk/dns/nsDNSService2.cpp
+++ b/netwerk/dns/nsDNSService2.cpp
@@ -614,16 +614,17 @@ nsDNSService::ReadPrefs(const char *name
         }
     }
     if (!name || !strcmp(name, kPrefIPv4OnlyDomains)) {
         Preferences::GetCString(kPrefIPv4OnlyDomains, mIPv4OnlyDomains);
     }
     if (!name || !strcmp(name, kPrefDnsLocalDomains)) {
         nsCString localDomains;
         Preferences::GetCString(kPrefDnsLocalDomains, localDomains);
+        MutexAutoLock lock(mLock);
         mLocalDomains.Clear();
         if (!localDomains.IsEmpty()) {
             nsCCharSeparatedTokenizer tokenizer(localDomains, ',',
                                                 nsCCharSeparatedTokenizer::SEPARATOR_OPTIONAL);
             while (tokenizer.hasMoreTokens()) {
                 mLocalDomains.PutEntry(tokenizer.nextToken());
             }
         }
--- a/netwerk/dns/nsDNSService2.h
+++ b/netwerk/dns/nsDNSService2.h
@@ -64,17 +64,17 @@ private:
     nsresult ResolveInternal(const nsACString &aHostname,
                              uint32_t flags,
                              const mozilla::OriginAttributes &aOriginAttributes,
                              nsIDNSRecord **result);
 
     RefPtr<nsHostResolver>  mResolver;
     nsCOMPtr<nsIIDNService>   mIDN;
 
-    // mLock protects access to mResolver and mIPv4OnlyDomains
+    // mLock protects access to mResolver, mLocalDomains and mIPv4OnlyDomains
     mozilla::Mutex            mLock;
 
     // mIPv4OnlyDomains is a comma-separated list of domains for which only
     // IPv4 DNS lookups are performed. This allows the user to disable IPv6 on
     // a per-domain basis and work around broken DNS servers. See bug 68796.
     nsCString                                 mIPv4OnlyDomains;
     nsCString                                 mForceResolve;
     bool                                      mDisableIPv6;