From: Michał Mirosław Date: Tue, 13 Dec 2016 01:08:19 +0000 (+0100) Subject: kni: guard against unterminated name oops X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=d613f57dd02936bd916007d6506253b6bc31c684;p=dpdk.git kni: guard against unterminated name oops If the name is too long, it triggers BUG in alloc_netdev(). Signed-off-by: Michał Mirosław Acked-by: Ferruh Yigit --- diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c b/lib/librte_eal/linuxapp/kni/kni_misc.c index 03dacc1f90..33b61f2a8c 100644 --- a/lib/librte_eal/linuxapp/kni/kni_misc.c +++ b/lib/librte_eal/linuxapp/kni/kni_misc.c @@ -343,6 +343,12 @@ kni_ioctl_create(struct net *net, uint32_t ioctl_num, return -EIO; } + /* Check if name is zero-ended */ + if (strnlen(dev_info.name, sizeof(dev_info.name)) == sizeof(dev_info.name)) { + pr_err("kni.name not zero-terminated"); + return -EINVAL; + } + /** * Check if the cpu core id is valid for binding. */