mac80211: don't remove tainted keys after not programming
authorJohannes Berg <johannes.berg@intel.com>
Mon, 13 Oct 2014 11:43:29 +0000 (13:43 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 22 Oct 2014 09:30:30 +0000 (11:30 +0200)
When a key is tainted during resume, it is no longer programmed
into the device; however, it's uploaded flag may (will) be set.
Clear the flag when not programming it because it's tainted to
avoid attempting to remove it again later.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/key.c

index 4712150dc2109df0b6f17162da8ec5119a94ec0a..434a91ad12c88dabcc2674413e86d08386c3b37d 100644 (file)
@@ -94,8 +94,17 @@ static int ieee80211_key_enable_hw_accel(struct ieee80211_key *key)
 
        might_sleep();
 
-       if (key->flags & KEY_FLAG_TAINTED)
+       if (key->flags & KEY_FLAG_TAINTED) {
+               /* If we get here, it's during resume and the key is
+                * tainted so shouldn't be used/programmed any more.
+                * However, its flags may still indicate that it was
+                * programmed into the device (since we're in resume)
+                * so clear that flag now to avoid trying to remove
+                * it again later.
+                */
+               key->flags &= ~KEY_FLAG_UPLOADED_TO_HARDWARE;
                return -EINVAL;
+       }
 
        if (!key->local->ops->set_key)
                goto out_unsupported;