Received: by 2002:a17:90a:9103:0:0:0:0 with SMTP id k3csp11795271pjo; Thu, 2 Jan 2020 14:24:51 -0800 (PST) X-Google-Smtp-Source: APXvYqwG/O6lvKW8csLR929vGYMI31GaQGmq1IMpssMxmPOFYu3RoJEp6Uf09KtobccFfJnh5Mgf X-Received: by 2002:a9d:6acd:: with SMTP id m13mr89137877otq.313.1578003891707; Thu, 02 Jan 2020 14:24:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578003891; cv=none; d=google.com; s=arc-20160816; b=oO8rXOLpjZLsZ+dvdNYzHbBOvtGzVEpUxrYgztiAo+rpnKsDsg2YZ+uXNj4vkM3ZFT yri1pcAN59j0SAlxKoKqmGpFu4LWeidYK92woKF0sK7U5uKGlU9G3jSJyXKhoN1dezZH agWOGBfAqEpXZW630g7qK3jVEo38uiSIepRhsEOAb8kFKpb0cJzNZ6A5L5vLdb8a4u5G q03A03CN3zE6XhxuXA3d+AnSgErLayxARmYJiHTfMUOJ3H1Jo9hyLKVl0Xake39udQ7K u2CcOnKZaZ+J8+6Y3kzjiYIPUNqCDegrUwV+R+Njqff+cfIF/h4fRwwL+WuBHikHXWF0 FiOw== 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=kEnjiyN8tQknwYaJf3xpnw3JroFiIiauss6tGeNLG6g=; b=LxieLxqz+Am6Rdz1+VOm+Mp0oephSDODAU/7ShPXMZYGupDvR9cT7yCUdTCBVA3XZm Hjya81eE/qxoCK0WBJTqTfO/hpRgmFmrd/KVMpV1mZdcs8PjVLaEmEO6iEULds6Jo33U iUpLIGWaDRBmOrlWxxXY522C6HYu3LLmXlMcTylttGn/SDMUmZVO9Z+qJ1vL4klxFZcA 7Tpm8N6Ndr+rP139IWd3FAKDdlzQcI7SgsmTd7Wh75hrokGG7WdE2DqolCO3PpfMphCT aiRhfR9ZIX51flElurSpaZSmHJf9kndZ6k35o1ZNotBhoNgZ9rgHF+vW8yhyisYY+P7U 2kFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mFNS6H7i; 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 d11si28108260oti.325.2020.01.02.14.24.39; Thu, 02 Jan 2020 14:24:51 -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=mFNS6H7i; 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 S1729083AbgABWXG (ORCPT + 99 others); Thu, 2 Jan 2020 17:23:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:44200 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728893AbgABWW7 (ORCPT ); Thu, 2 Jan 2020 17:22:59 -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 20623227BF; Thu, 2 Jan 2020 22:22:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578003778; bh=VSbxciRBW1NU4N+Z4pzUXw6YKwRStrA6h3PqUi1d9kg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mFNS6H7isdL8UTfoirzHhLI/BwfZeT5J5STEnGBJ+tIoU1gAOGl65sYGMb3OednRM QKaKQpP2uyRUbADPhbRHjX/Goe/P29m/LQUunakkS93YPhMXlSAsyyM6ouMk3M07Cs oM3jFnsp0MTd7FMC0nJ/FBV7mqkN5V7hlUTFNANY= 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.19 111/114] gtp: avoid zero size hashtable Date: Thu, 2 Jan 2020 23:08:03 +0100 Message-Id: <20200102220040.300302593@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102220029.183913184@linuxfoundation.org> References: <20200102220029.183913184@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 @@ -671,10 +671,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)