Received: by 2002:a17:90a:9103:0:0:0:0 with SMTP id k3csp11805485pjo; Thu, 2 Jan 2020 14:35:29 -0800 (PST) X-Google-Smtp-Source: APXvYqwEIe40d2ErimBbpu628Wr1iLMW5GHpJIpzOlxP3Xg8lkxZoU4/unRkiHq8V9PpO6YAZ0om X-Received: by 2002:a05:6808:181:: with SMTP id w1mr3315949oic.176.1578004529785; Thu, 02 Jan 2020 14:35:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578004529; cv=none; d=google.com; s=arc-20160816; b=unO5hdrWj/1QXe60p1oXZS4RfPtvAB1Nkqqbj+gOiFuuKl31y5yOGjHK6Armh0nwi3 yj0TR8mBOu2dI9Rc6adJKeSVXtK9TA+7B9JTIpWJeQ3xyzgPOMKCgbVUIs0L4jczw1eo 4eMkn6feKxtUOfLhbrDL/2bi1hhu/PTSFQHKN5P0lELQfezaMKogSoObiVIrttenxWcw Bo64hFscM9ukGY1r5EhF/wxsd3l7Rk5bCnZu6NAqp2XoEVQYo8DryjqvZbm8MFby9LXI 2dRV7F6OscGhb8tl9ICx7/oLSmzCw40JtjVsq875B+OEaF/lPOCBAQFouGxw1OIabHgk cacw== 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=x5iqL6oqmsRSgtEjBHOQYctCl7Gfe+4CmA3w4jivjbA=; b=ct439b+ItON1BKlXjamNDb7cTHcs8mm/Nk/3iDSUQ3PJ6RpGLhUmYYX5M/py7NIuhb URItqYdFk2pEjAqx48ddK+fDDbjQNIcXOLLKVheumUI/ONGgyXtTjL8xsvgwBwL6hV2s XrdLzqOeE6g7DpiVnU0wXD6ra/AQJk5Iizhj/fp03kopzS8JEVe0zbAa55zDI91W0C7y k2uF+DRqZmkIR7n7n75WxL7QQxwh+81rbP4GuqqZhfvj0fOgRzmof/I5OgOD2Yaue12Q cHwlfoye1KWO/6GcSwf6/CppMqVffVL7tzBiSHS0M0uptnCBrdVZYaGfoEuHbrhbyIwU xmaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EiPJSqb5; 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 b137si28722170oii.63.2020.01.02.14.35.18; Thu, 02 Jan 2020 14:35:29 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=EiPJSqb5; 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 S1730573AbgABWdl (ORCPT + 99 others); Thu, 2 Jan 2020 17:33:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:41312 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730430AbgABWdj (ORCPT ); Thu, 2 Jan 2020 17:33:39 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 821F220863; Thu, 2 Jan 2020 22:33:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578004419; bh=VJZ/oYc6ReQtUDu6H24cPfLjQVk3H/I46//pOOe/Uw8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EiPJSqb5B0Ae0y/7EtdsB3m+tLqAx1phNUm+PZKZ7MIWy+xlmJRsn/0Xr8mGWciIg QIExnL/LuSMJMWmsYi47SBbH1hNGlNdBu2vtf0SSDWIvaJTNiMkH3Wv72c5zSy9RH/ soIePACl1eRr4SBGPYWAPQAhbSQLU515vTymfjFk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Taehee Yoo , Jakub Kicinski Subject: [PATCH 4.9 171/171] gtp: avoid zero size hashtable Date: Thu, 2 Jan 2020 23:08:22 +0100 Message-Id: <20200102220610.316545567@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102220546.960200039@linuxfoundation.org> References: <20200102220546.960200039@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: Taehee Yoo [ Upstream commit 6a902c0f31993ab02e1b6ea7085002b9c9083b6a ] GTP default hashtable size is 1024 and userspace could set specific hashtable size with IFLA_GTP_PDP_HASHSIZE. If hashtable size is set to 0 from userspace, hashtable will not work and panic will occur. Fixes: 459aa660eb1d ("gtp: add initial driver for datapath of GPRS Tunneling Protocol (GTP-U)") Signed-off-by: Taehee Yoo Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/gtp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/drivers/net/gtp.c +++ b/drivers/net/gtp.c @@ -677,10 +677,13 @@ static int gtp_newlink(struct net *src_n if (err < 0) goto out_err; - if (!data[IFLA_GTP_PDP_HASHSIZE]) + if (!data[IFLA_GTP_PDP_HASHSIZE]) { hashsize = 1024; - else + } else { hashsize = nla_get_u32(data[IFLA_GTP_PDP_HASHSIZE]); + if (!hashsize) + hashsize = 1024; + } err = gtp_hashtable_new(gtp, hashsize); if (err < 0)