DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] kni: error rollback with kni_dev_remove could cause a kernel crash
@ 2016-08-16  7:57 zhouyangchao
  2016-08-25 13:41 ` Ferruh Yigit
  0 siblings, 1 reply; 3+ messages in thread
From: zhouyangchao @ 2016-08-16  7:57 UTC (permalink / raw)
  To: dev; +Cc: Ferruh Yigit



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [dpdk-dev] [PATCH] kni: error rollback with kni_dev_remove could cause a kernel crash
  2016-08-16  7:57 [dpdk-dev] [PATCH] kni: error rollback with kni_dev_remove could cause a kernel crash zhouyangchao
@ 2016-08-25 13:41 ` Ferruh Yigit
  2016-08-25 13:49   ` Ferruh Yigit
  0 siblings, 1 reply; 3+ messages in thread
From: Ferruh Yigit @ 2016-08-25 13:41 UTC (permalink / raw)
  To: dev; +Cc: ZhouYates

From: ZhouYates <zhouyates@gmail.com>

Signed-off-by: ZhouYates <zhouyates@gmail.com>
---
 lib/librte_eal/linuxapp/kni/kni_misc.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c b/lib/librte_eal/linuxapp/kni/kni_misc.c
index 59d15ca..7ef17f5 100644
--- a/lib/librte_eal/linuxapp/kni/kni_misc.c
+++ b/lib/librte_eal/linuxapp/kni/kni_misc.c
@@ -448,7 +448,6 @@ kni_ioctl_create(struct net *net,
 
 	kni = netdev_priv(net_dev);
 
-	kni->net_dev = net_dev;
 	kni->group_id = dev_info.group_id;
 	kni->core_id = dev_info.core_id;
 	strncpy(kni->name, dev_info.name, RTE_KNI_NAMESIZE);
@@ -561,6 +560,9 @@ kni_ioctl_create(struct net *net,
 		kni_dev_remove(kni);
 		return -ENODEV;
 	}
+	/*Set the kni->net_dev when the net_dev has registered success.
+	 * Avoid unregistering unregistered net_dev by kni_dev_remove.*/
+	kni->net_dev = net_dev;
 
 #ifdef RTE_KNI_VHOST
 	kni_vhost_init(kni);
-- 
1.7.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] kni: error rollback with kni_dev_remove could cause a kernel crash
  2016-08-25 13:41 ` Ferruh Yigit
@ 2016-08-25 13:49   ` Ferruh Yigit
  0 siblings, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2016-08-25 13:49 UTC (permalink / raw)
  To: dev; +Cc: ZhouYates

Hi ZhouYates,

On 8/25/2016 2:41 PM, Ferruh Yigit wrote:
> From: ZhouYates <zhouyates@gmail.com>

I have re-sent your exact patch which was sent as attachment.
Thank you for the patch, can you please follow contribution guide for
next version of the patch? More details on:
http://dpdk.org/doc/guides/contributing/patches.html#sending-patches

> 
> Signed-off-by: ZhouYates <zhouyates@gmail.com>
> ---
>  lib/librte_eal/linuxapp/kni/kni_misc.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c b/lib/librte_eal/linuxapp/kni/kni_misc.c
> index 59d15ca..7ef17f5 100644
> --- a/lib/librte_eal/linuxapp/kni/kni_misc.c
> +++ b/lib/librte_eal/linuxapp/kni/kni_misc.c
> @@ -448,7 +448,6 @@ kni_ioctl_create(struct net *net,
>  
>  	kni = netdev_priv(net_dev);
>  
> -	kni->net_dev = net_dev;
>  	kni->group_id = dev_info.group_id;
>  	kni->core_id = dev_info.core_id;
>  	strncpy(kni->name, dev_info.name, RTE_KNI_NAMESIZE);
> @@ -561,6 +560,9 @@ kni_ioctl_create(struct net *net,
>  		kni_dev_remove(kni);

But this cause allocated net_dev not freed here ...

>  		return -ENODEV;
>  	}
> +	/*Set the kni->net_dev when the net_dev has registered success.
> +	 * Avoid unregistering unregistered net_dev by kni_dev_remove.*/

Can you please use multi line comment syntax same as rest of the
document. Or perhaps first line can be enough.


> +	kni->net_dev = net_dev;
>  
>  #ifdef RTE_KNI_VHOST
>  	kni_vhost_init(kni);
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-08-25 13:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-16  7:57 [dpdk-dev] [PATCH] kni: error rollback with kni_dev_remove could cause a kernel crash zhouyangchao
2016-08-25 13:41 ` Ferruh Yigit
2016-08-25 13:49   ` Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).