[dpdk-dev] [PATCH] kni: error release device list head could cause a kernel crash.

Ferruh Yigit ferruh.yigit at intel.com
Mon Aug 8 13:48:35 CEST 2016


Hi,

On 8/6/2016 12:19 PM, 周杨超 wrote:
> From 3edca1e3194959ba26a6c36143f8423009661b11 Mon Sep 17 00:00:00 2001
> From: zhouyangchao <zhouyates at gmail.com>
> Date: Sat, 6 Aug 2016 19:14:51 +0800
> Subject: [PATCH] kni: error release device list head could cause a kernel crash.
> 
> Signed-off-by: zhouyangchao <zhouyates at gmail.com>
> ---
>  lib/librte_eal/linuxapp/kni/kni_misc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c
> b/lib/librte_eal/linuxapp/kni/kni_misc.c
> index ae8133f..a49924b 100644
> --- a/lib/librte_eal/linuxapp/kni/kni_misc.c
> +++ b/lib/librte_eal/linuxapp/kni/kni_misc.c
> @@ -276,8 +276,8 @@ kni_release(struct inode *inode, struct file *file)
>  #ifdef RTE_KNI_VHOST
>   kni_vhost_backend_release(dev);
>  #endif
> - kni_dev_remove(dev);
>   list_del(&dev->list);
> + kni_dev_remove(dev);
>   }
>   up_write(&knet->kni_list_lock);
> 
> @@ -613,8 +613,8 @@ kni_ioctl_release(struct net *net,
>  #ifdef RTE_KNI_VHOST
>   kni_vhost_backend_release(dev);
>  #endif
> - kni_dev_remove(dev);
>   list_del(&dev->list);
> + kni_dev_remove(dev);
>   ret = 0;
>   break;
>   }
> --
> 

Can you please describe how crash can occur?
And if you have a crash log, can you include it?

Access to device via list, removing device from list and adding device
to list all are protected by lock (kni_list_lock), so as far as I can
see the order of removing device and removing it from list shouldn't be
a problem.

Thanks,
ferruh


More information about the dev mailing list