Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp17925757ybl; Thu, 2 Jan 2020 14:57:23 -0800 (PST) X-Google-Smtp-Source: APXvYqy5vR0wVqYNouGgBuLbOBh2VrTKAsnyVYzTbBOA9xonv+bFnViFVnPMMpQmV8A2yPpAXZRK X-Received: by 2002:a05:6830:1707:: with SMTP id 7mr69038952otk.235.1578005843623; Thu, 02 Jan 2020 14:57:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578005843; cv=none; d=google.com; s=arc-20160816; b=AtwuvyivMQ2hBF6XCjuXG+7LtZMsGWEGDwZT/6UfSJn5wLFIvaBFkRXaEbIyYEN5JQ irr7gxuYogEx40byMtrl7Mx9FRPC6P+s+00ZCbGEukfJ0RLbOzwYQJi5ef/aBdLXg5R6 pHbXHvy5wfigP7wTicGMp2W0uj7G8Rr5mKeBJ6wkz0/JrINBfQUYB5ptZ0vJTUl6+pA1 DBiRdqGzK8fitjODcmYJkaOMOzHn5XQSSffJzkomRI3f0D32fhYrVvmlKajZUB5kl2ts KbD+eWjNAPf8Y7xcCGFAv7CPDJz7qC4q31bYUv4GeggdOmx+Zoq6Bg4fpqp0iBq9BKjP yiLQ== 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=Og26BfRKyKtui2/kyJHYtaGyJqNkfz6zQki6uC2LP1s=; b=l66djMN8JYmYtX8cyqLpnkfgadWinKmIKHDJ9TDIMExR27FdusX/6JBA46e2cjWhQZ I0bOhTD44rrO8juVHgv//dtWEdNp532hDJAs6azLwVtyYH7lyo6pkpGa1et01PSBrrBw qWkeO1g+02w4P1lu0UQaSY09DveiTdtIT6O1SA1OVb4y8RKoZpbdMOBN7xhoY2rlIKx4 6h4nmL4gTG25QAdqjLPGPXkwLDEWjAT0MmZf1r4Ljpti+VYeNx4heCap1AtRwOgNohBg wkWnExkPgsw6YTdR55oxpnBH9TBijrvOgoL2PgmVRUg69LBEo9852+8MoaTOBpx63++g MNOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1DWxOc0n; 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 l16si25780191otj.59.2020.01.02.14.57.11; Thu, 02 Jan 2020 14:57:23 -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=1DWxOc0n; 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 S1728917AbgABWz5 (ORCPT + 99 others); Thu, 2 Jan 2020 17:55:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:34314 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728234AbgABWSq (ORCPT ); Thu, 2 Jan 2020 17:18:46 -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 1917B2253D; Thu, 2 Jan 2020 22:18:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578003526; bh=jkeFTtf4Zp47zVtKtE+iaHCA9aRYTcKmzpJUTSdGcoY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1DWxOc0nOhldEA6xxaitAy++VpWhrbExFBp0wXkYnpCo2TH7HkuVFcoA4ZXxyFOPw uCVrMaGps6gCbJ3F+YepM/nF9dZBHR2Tgud4CNahNFCOxhJg/+y1D+LKLeGBt929Y7 4eRFTknMtPesULUj7QlRYg1Vul1fjLFZDGVbDy2E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Taehee Yoo , Jakub Kicinski Subject: [PATCH 5.4 178/191] gtp: avoid zero size hashtable Date: Thu, 2 Jan 2020 23:07:40 +0100 Message-Id: <20200102215848.339891688@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102215829.911231638@linuxfoundation.org> References: <20200102215829.911231638@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 @@ -660,10 +660,13 @@ static int gtp_newlink(struct net *src_n if (err < 0) return 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)