Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1769206imm; Thu, 27 Sep 2018 02:08:25 -0700 (PDT) X-Google-Smtp-Source: ACcGV63kqLSKk2qQ3VuyHR36f3/Os1pQO4Z/GaKMUxd4+v3PIQlACJ6xhQzpO9T2vT+OjiOOSIzc X-Received: by 2002:a62:435c:: with SMTP id q89-v6mr10410402pfa.135.1538039305699; Thu, 27 Sep 2018 02:08:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538039305; cv=none; d=google.com; s=arc-20160816; b=GVKfi624qvq3D63qEN/2Qy0f+gHLv2PgzfUi5BRJDBgo/AJskdIWyPQI18XOk3MpSu qS55CpP4BpmSPOqcv1Qk7n3NHtdgJbcoqODhyyqWIHGcj60dmhqalvfo33tWvWvLr4jf Kpms1bfzGREZgR17AliI7Yu1PDSWvEpMa94ONgc7zSzgRFLIAbFTCSgCJ6ppSBU2UZhQ G40MzQeWKZ8QM7C4VGg8RaIUQ9cWFRQ7If7O2HV/YDd03B4dGOZUh1MAEy71jV3i/vio VM5O+DJaS9wg7IPC0I/uxbEQCZFj38iJoRJ2mOOBRztpM3zN5QD7b+lX1sln5eeRziRA tp1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=Ab1jbKq0xtUXyu9ADUM1jCy7KN+Pun5SOpSoJh7wLZs=; b=EV9f1QB23ufVigfQb0aBsB1fiVDxOd2rmCMsH8yprV1luwvgHhOqdf7+Z1vLKEd904 +hpP2pTTLTOz0Vqud3AlvYBbKPWeNFSvxLgZXpC0FeLAtj55zKM5GDRacxHwdA/INMrX L+ToEhPO3oQQj87z9W2jsUFJRVMrv7N5y6DRNL54q4RktaRil1hiZAasMhCHiIS4M08M Vz8mljWRnb2aiBWzHK86ov2MqtfZkCGacgBJUrrjJhqt+bt4y6f77TE4+h62W9U3t2li FKV8Q26mdKXbdJhuVgn5BXjGiMt7P69Lgr0T/lIUscksG820SmcOp0UklLLIsOqPCWOD Me+g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y28-v6si1479540pge.487.2018.09.27.02.08.10; Thu, 27 Sep 2018 02:08:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727599AbeI0PY4 (ORCPT + 99 others); Thu, 27 Sep 2018 11:24:56 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:54866 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727020AbeI0PYz (ORCPT ); Thu, 27 Sep 2018 11:24:55 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id B33A610A4; Thu, 27 Sep 2018 09:07:40 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sabrina Dubroca , "David S. Miller" Subject: [PATCH 4.18 08/88] tls: dont copy the key out of tls12_crypto_info_aes_gcm_128 Date: Thu, 27 Sep 2018 11:02:49 +0200 Message-Id: <20180927090301.535122979@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180927090300.631426620@linuxfoundation.org> References: <20180927090300.631426620@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sabrina Dubroca [ Upstream commit 7cba09c6d5bc73ebbd25a353742d9ddb7a713b95 ] There's no need to copy the key to an on-stack buffer before calling crypto_aead_setkey(). Fixes: 3c4d7559159b ("tls: kernel TLS support") Signed-off-by: Sabrina Dubroca Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/tls/tls_sw.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) --- a/net/tls/tls_sw.c +++ b/net/tls/tls_sw.c @@ -1064,7 +1064,6 @@ void tls_sw_free_resources_rx(struct soc int tls_set_sw_offload(struct sock *sk, struct tls_context *ctx, int tx) { - char keyval[TLS_CIPHER_AES_GCM_128_KEY_SIZE]; struct tls_crypto_info *crypto_info; struct tls12_crypto_info_aes_gcm_128 *gcm_128_info; struct tls_sw_context_tx *sw_ctx_tx = NULL; @@ -1184,9 +1183,7 @@ int tls_set_sw_offload(struct sock *sk, ctx->push_pending_record = tls_sw_push_pending_record; - memcpy(keyval, gcm_128_info->key, TLS_CIPHER_AES_GCM_128_KEY_SIZE); - - rc = crypto_aead_setkey(*aead, keyval, + rc = crypto_aead_setkey(*aead, gcm_128_info->key, TLS_CIPHER_AES_GCM_128_KEY_SIZE); if (rc) goto free_aead;