Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp343986pxk; Fri, 11 Sep 2020 08:26:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxk9x8sDQYuhvgTSVxc6bZgqZO2Qe6AOItlOEw713SQZORMU6STqJ8TylKMsn8OjNyO4/iP X-Received: by 2002:a17:906:4993:: with SMTP id p19mr2649544eju.277.1599837973259; Fri, 11 Sep 2020 08:26:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599837973; cv=none; d=google.com; s=arc-20160816; b=Zmm6gJyRliZvFmUADsmvDskqzXA0qJDZYgxyb5M3zGi2jYCOKbRBtK4ZOIwltxomOb AXYqMiVQDlzjV1fDB1BBd0kachoAoED7P77qhW7BZLwe4eiEod9se1YUGq2mDRlaJ3UD rPZ5KvjrlJHzg4mnRVZZ2mi6/rWtSLA6Dvedl4OjMyfwEYDFdZesr9OFiMje1xgUX4rB 4MqUJoCzYBHKXvHv9/awUz5K8ChWv6+LoVd4vhw/ws/5P1t3x0hoH4YJY+IZRCP3nFIC IflDwIicCkXtGov/HqfX7ZaBSJ06a2+/BVX+OKE2AOCn5UROSq1wlZYsruQgj/ahM3GB +Bvg== 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:dkim-signature; bh=l8vMTt68Us6zBYt6pN8oMljAEFXafOcD0mjx6X69Jws=; b=PdlJ8GQAxT1Qo3HQyIYVoTvQMQ/kdv+4YiC2O7nXTbKxzcPrX9GB99PBr/StHfdfIa lamiFf43t1ij2/l/A1qAJ74KOV8C5nox69YH61sKPSbXaQCWpdxp+Y1rXGl2JsWBwfwR XBU5DVFKjFk3K38TkNIcNQr1il2rLtwLWdb2dAczvBLmSyiHKU8jd6/Y6/kazDszAfuR 59xoPRcoqRtN4YcvjrJSl3ohLZjap5JRqfu91SafoJzIviiKjGzxcBNpiULwTu0OCDh2 TTrOX1XYpOoaZJF/nRaZQR+c2WaLEttJaxpxFad5dNH5Bswqo9Jing09k2OdQEdpLb7u l0Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="1M/FByuP"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b20si1433937eds.592.2020.09.11.08.25.49; Fri, 11 Sep 2020 08:26:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="1M/FByuP"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726471AbgIKPYe (ORCPT + 99 others); Fri, 11 Sep 2020 11:24:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:53392 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725838AbgIKPRi (ORCPT ); Fri, 11 Sep 2020 11:17:38 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6D03122456; Fri, 11 Sep 2020 12:59:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599829181; bh=ybDPXSWX6t6Yrp5Uds0fPcMTpwzBemoFk3ybMUuZEyY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1M/FByuPrgNq1JusDVuk1YhRm/doUstz9Ea9u/uS4/HHmulwV7a7t78H2gKn3SS4e IiSqSKDY8PuiAkh43pW8Ea6+ZwGX8hF6zSnP2ICrRynkgC8wrzBSdZhhZ7fa1nS3U1 oGplK8zKCSVpBZ/UfsUuR/vN95PGSdnB/cGyZDJw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jon Maloy , Tuong Lien , "David S. Miller" Subject: [PATCH 5.8 14/16] tipc: fix using smp_processor_id() in preemptible Date: Fri, 11 Sep 2020 14:47:31 +0200 Message-Id: <20200911122500.284435224@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200911122459.585735377@linuxfoundation.org> References: <20200911122459.585735377@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Tuong Lien [ Upstream commit bb8872a1e6bc911869a729240781076ed950764b ] The 'this_cpu_ptr()' is used to obtain the AEAD key' TFM on the current CPU for encryption, however the execution can be preemptible since it's actually user-space context, so the 'using smp_processor_id() in preemptible' has been observed. We fix the issue by using the 'get/put_cpu_ptr()' API which consists of a 'preempt_disable()' instead. Fixes: fc1b6d6de220 ("tipc: introduce TIPC encryption & authentication") Acked-by: Jon Maloy Signed-off-by: Tuong Lien Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/tipc/crypto.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) --- a/net/tipc/crypto.c +++ b/net/tipc/crypto.c @@ -326,7 +326,8 @@ static void tipc_aead_free(struct rcu_he if (aead->cloned) { tipc_aead_put(aead->cloned); } else { - head = *this_cpu_ptr(aead->tfm_entry); + head = *get_cpu_ptr(aead->tfm_entry); + put_cpu_ptr(aead->tfm_entry); list_for_each_entry_safe(tfm_entry, tmp, &head->list, list) { crypto_free_aead(tfm_entry->tfm); list_del(&tfm_entry->list); @@ -399,10 +400,15 @@ static void tipc_aead_users_set(struct t */ static struct crypto_aead *tipc_aead_tfm_next(struct tipc_aead *aead) { - struct tipc_tfm **tfm_entry = this_cpu_ptr(aead->tfm_entry); + struct tipc_tfm **tfm_entry; + struct crypto_aead *tfm; + tfm_entry = get_cpu_ptr(aead->tfm_entry); *tfm_entry = list_next_entry(*tfm_entry, list); - return (*tfm_entry)->tfm; + tfm = (*tfm_entry)->tfm; + put_cpu_ptr(tfm_entry); + + return tfm; } /**