summaryrefslogtreecommitdiff
path: root/drivers/net/gtp.c
diff options
context:
space:
mode:
authorTaehee Yoo <ap420073@gmail.com>2019-12-11 11:23:48 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-01-04 21:13:43 +0300
commitcd2458224c6f51d76298cfe1a0c98ff5fcb75106 (patch)
tree2302dc3cb171da422730314346a6f2a82359ed00 /drivers/net/gtp.c
parent043a283d24f40fea4c8a8d06b0e2694c8e372200 (diff)
downloadlinux-cd2458224c6f51d76298cfe1a0c98ff5fcb75106.tar.xz
gtp: avoid zero size hashtable
[ 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 <ap420073@gmail.com> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/net/gtp.c')
-rw-r--r--drivers/net/gtp.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c
index 8c32abad162f..494f00b9c5ef 100644
--- a/drivers/net/gtp.c
+++ b/drivers/net/gtp.c
@@ -671,10 +671,13 @@ static int gtp_newlink(struct net *src_net, struct net_device *dev,
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)