From patchwork Thu Jun 8 07:54:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 772901 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3wjyQP0yjHz9s81 for ; Thu, 8 Jun 2017 17:55:25 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751563AbdFHHzL (ORCPT ); Thu, 8 Jun 2017 03:55:11 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:61668 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751393AbdFHHzJ (ORCPT ); Thu, 8 Jun 2017 03:55:09 -0400 Received: from wuerfel.lan ([78.42.17.5]) by mrelayeu.kundenserver.de (mreue103 [212.227.15.145]) with ESMTPA (Nemesis) id 0LyBrp-1dxYk00Ppt-015W3d; Thu, 08 Jun 2017 09:54:57 +0200 From: Arnd Bergmann To: Tom Herbert Cc: Arnd Bergmann , "David S. Miller" , Alexey Kuznetsov , James Morris , Hideaki YOSHIFUJI , Patrick McHardy , stephen hemminger , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ila_xlat: add missing hash secret initialization Date: Thu, 8 Jun 2017 09:54:24 +0200 Message-Id: <20170608075448.2076975-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:8pBqiF+mQfRG0gc8ilo7rb5bugWTUUp4MiqTrLC+TUFj9Sam4cP wWzQesVistjIU2i7zAZxDzz4F0OVCkSXu7pDqGHlkGzn3T4ECp/VVHLe/lI6eEovylgjXL0 eX7GJFzdcA5cmiE3L1eIgiKbK9btN5XdL81BQf6gH+roIvpS4fpE61iBWG3RCj1l4HDhNCC Dr4omYKXD3Ousbm6vAlDg== X-UI-Out-Filterresults: notjunk:1; V01:K0:i+tYl99lBt8=:5mszeUOibA4ddWOCZcESZe t7AZiRWD1Q1xyxm6NFBc7LVG836K0y6uJnVojXeGLEJzrGToljv2CzXbfU8CkiObNW3q4vuP9 t+hC4tMeaiD7twucihXG7mFTwHqqJ+1005D4gr5ZjZt2UeuoXH5BTbJVq51MyEjh3E0apwdnf 4pq9clHClbu9ubuYeN04X0RZ6GizaPujs3yA7o2fqTZgO81P8HLQSFWQtQzlR4/WIckwPVezw FJZz1F33cSQ0Vzuuv09u/Mb2TbPaf3Re3tTvfNLEyUXdmA5yJPA83hC/JND0RZTIBbOO0eWtk itpMW2bepTwPQebEe21K/QlikLK3VWGo60rYaZdv5DYfovxG5XYIYRZLXldgfD6g2fDbuAtIX ZwX576p9UGLnoVMGM04L6T2LKjXA6Bk5EtS3sQJ3vFlphvJjT7MvaChTfJF26wnd+L4B1D/Pt Jz5p0Up6NMN8sEcNtHccwh3olmpPyGY8LKbHLPstSeOw3fmTgZw9zNnn+WyoRgKCx7WE6vczE wQklPfg4hnkB/UXfwS88FEc8Nja4pG/sHkan1K0G8+lFsq8i1rsCP/OetJR2gYhDRHAZm0CTN lS2Tp1f1TiyYOvC646a52yDsnMxT4RcMCQ+NZG5C/ZjFeSBBoOzIVgB6Jtzu8zc25oxyuMg1l jW7lVRXbTUsMqGYOWcVvPQU2p5Jsmcnu57AM+wh6T9Sz9Z+J7zvdTe7NqxSKrR0AzI4I= Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org While discussing the possible merits of clang warning about unused initialized functions, I found one function that was clearly meant to be called but never actually is. __ila_hash_secret_init() initializes the hash value for the ila locator, apparently this is intended to prevent hash collision attacks, but this ends up being a read-only zero constant since there is no caller. I could find no indication of why it was never called, the earliest patch submission for the module already was like this. If my interpretation is right, we certainly want to backport the patch to stable kernels as well. I considered adding it to the ila_xlat_init callback, but for best effect the random data is read as late as possible, just before it is first used. The underlying net_get_random_once() is already highly optimized to avoid overhead when called frequently. Fixes: 7f00feaf1076 ("ila: Add generic ILA translation facility") Cc: stable@vger.kernel.org Link: https://www.spinics.net/lists/kernel/msg2527243.html Signed-off-by: Arnd Bergmann Acked-by: Tom Herbert --- net/ipv6/ila/ila_xlat.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/ipv6/ila/ila_xlat.c b/net/ipv6/ila/ila_xlat.c index 2fd5ca151dcf..77f7f8c7d93d 100644 --- a/net/ipv6/ila/ila_xlat.c +++ b/net/ipv6/ila/ila_xlat.c @@ -62,6 +62,7 @@ static inline u32 ila_locator_hash(struct ila_locator loc) { u32 *v = (u32 *)loc.v32; + __ila_hash_secret_init(); return jhash_2words(v[0], v[1], hashrnd); }