[dpdk-dev,11/13] KNI: guard against unterminated dev_info.name leading to BUG in alloc_netdev()
Checks
Commit Message
Signed-off-by: Michał Mirosław <michal.miroslaw@atendesoftware.pl>
---
lib/librte_eal/linuxapp/kni/kni_misc.c | 6 ++++++
1 file changed, 6 insertions(+)
Comments
On 12/13/2016 1:08 AM, Michał Mirosław wrote:
> Signed-off-by: Michał Mirosław <michal.miroslaw@atendesoftware.pl>
> ---
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
I guess no harm doing extra check on user input.
On Wed, Dec 14, 2016 at 05:33:11PM +0000, Ferruh Yigit wrote:
> On 12/13/2016 1:08 AM, Michał Mirosław wrote:
> > Signed-off-by: Michał Mirosław <michal.miroslaw@atendesoftware.pl>
> > ---
>
> Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
>
> I guess no harm doing extra check on user input.
This actually prevents an OOPS that happens when you try to create KNI with
too long name.
Best Regards,
Michał Mirosław
On 12/14/2016 5:37 PM, Michał Mirosław wrote:
> On Wed, Dec 14, 2016 at 05:33:11PM +0000, Ferruh Yigit wrote:
>> On 12/13/2016 1:08 AM, Michał Mirosław wrote:
>>> Signed-off-by: Michał Mirosław <michal.miroslaw@atendesoftware.pl>
>>> ---
>>
>> Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
>>
>> I guess no harm doing extra check on user input.
>
> This actually prevents an OOPS that happens when you try to create KNI with
> too long name.
Thanks for fixing then.
2016-12-14 17:33, Ferruh Yigit:
> On 12/13/2016 1:08 AM, Michał Mirosław wrote:
> > Signed-off-by: Michał Mirosław <michal.miroslaw@atendesoftware.pl>
> > ---
>
> Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Applied, thanks
@@ -344,6 +344,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.
*/