From patchwork Thu Jun 27 08:44:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 808653 Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA9A6131E41 for ; Thu, 27 Jun 2024 08:44:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.38.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719477864; cv=none; b=mQxS3HPJKBplVkpSWIWZqXzQg0r0KrUZ3NZmIYGxxXIIAPI7WHQZr0tfagYS0ElSGFTLrVMx507bu9oljK7kEUdObJww7YkoMWv1AY/HqxKf3dpavFRA61gWL4S9H+c3r59xqSPJQSPgGEDZN6RD2U/SEDa3TLO1HW7NNRwlhN4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719477864; c=relaxed/simple; bh=VPQUNJKhYdZNWTylpP+rrsxntMvpJZVHFNXTaH8RGf8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=duJJOJe1loiWAiHlT9Dwh4xxZtolM++4s+vKBgP2quKJEXvQE9S2hCivLy2WaUVeTCV/55aAljRnwLouzT+qHfaCsyDxU7+wtI+ZPLreliiuE3CxxoAU2Qk7OWW4ZMEgdwed/TveJQ4LwGl6/MwpTJaQ/KdDL2/TyiWDYZzxB+M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b=v8cI+uXx; arc=none smtp.client-ip=168.119.38.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="v8cI+uXx" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-To:Resent-Cc: Resent-Message-ID:In-Reply-To:References; bh=tQWXCX8Y9t0oRias0uDtHTUSLKIMk4mys3zwUc3v+DY=; t=1719477861; x=1720687461; b=v8cI+uXxW+As0/LTIwBeYKPxfLBco8s/eBckqFZd3Hd47eExwV25AaXIYboSdEchhqSRHC1IWAk n7Sqh3O1MQzpfH773dgYzs2G4CLnz/xol3rFLkkT2WNseYxR50dqMYaYaZ0EQXKCOxnMXyqPpMSQD EfnpOCFnqeXzDphe5So1zp0ifKeH7mU5chHnnO7vR/7d42U7ZZoC//qu4k9IFp+ex4Lpn7BrrfzPr lWRtiUuXnuKnxskaPSoeStcZvt0cOR3y0nkmrvH1H9VhlVLHPTypNsZZz6zhr8CFrVTFy5aKCDVwR RhPfDtv8XBJuJ84XhkCDWZAWsb1akMj1AEKQ==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1sMkjq-00000006aek-39Iz; Thu, 27 Jun 2024 10:44:19 +0200 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: Johannes Berg , Miriam Rachel Korenblit Subject: [PATCH 1/2] wifi: nl80211: don't give key data to userspace Date: Thu, 27 Jun 2024 10:44:11 +0200 Message-ID: <20240627104411.b6a4f097e4ea.I7e6cc976cb9e8a80ef25a3351330f313373b4578@changeid> X-Mailer: git-send-email 2.45.2 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Johannes Berg When a key is requested by userspace, there's really no need to include the key data, the sequence counter is really what userspace needs in this case. The fact that it's included is just a historic quirk. Remove the key data. Reviewed-by: Miriam Rachel Korenblit Signed-off-by: Johannes Berg --- net/wireless/nl80211.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 72c7bf558581..63899fb2f316 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -4455,10 +4455,7 @@ static void get_key_callback(void *c, struct key_params *params) struct nlattr *key; struct get_key_cookie *cookie = c; - if ((params->key && - nla_put(cookie->msg, NL80211_ATTR_KEY_DATA, - params->key_len, params->key)) || - (params->seq && + if ((params->seq && nla_put(cookie->msg, NL80211_ATTR_KEY_SEQ, params->seq_len, params->seq)) || (params->cipher && @@ -4470,10 +4467,7 @@ static void get_key_callback(void *c, struct key_params *params) if (!key) goto nla_put_failure; - if ((params->key && - nla_put(cookie->msg, NL80211_KEY_DATA, - params->key_len, params->key)) || - (params->seq && + if ((params->seq && nla_put(cookie->msg, NL80211_KEY_SEQ, params->seq_len, params->seq)) || (params->cipher &&