DNS: If the DNS server returns an error, allow that to be cached [ver #2]
[linux-3.10.git] / net / dns_resolver / dns_query.c
index 03d5255..c32be29 100644 (file)
@@ -136,6 +136,11 @@ int dns_query(const char *type, const char *name, size_t namelen,
        if (ret < 0)
                goto put;
 
+       /* If the DNS server gave an error, return that to the caller */
+       ret = rkey->type_data.x[0];
+       if (ret)
+               goto put;
+
        upayload = rcu_dereference_protected(rkey->payload.data,
                                             lockdep_is_held(&rkey->sem));
        len = upayload->datalen;