DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: dev@dpdk.org
Cc: ZhouYates <zhouyates@gmail.com>
Subject: [dpdk-dev] [PATCH] kni: error rollback with kni_dev_remove could cause a kernel crash
Date: Thu, 25 Aug 2016 14:41:30 +0100	[thread overview]
Message-ID: <1472132490-27425-1-git-send-email-ferruh.yigit@intel.com> (raw)
In-Reply-To: <CABLiTuw+zvV2foChv3x88TEjncFYR0aBnqJs__wWMUBuL9vqkQ@mail.gmail.com>

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

  reply	other threads:[~2016-08-25 13:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-16  7:57 zhouyangchao
2016-08-25 13:41 ` Ferruh Yigit [this message]
2016-08-25 13:49   ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1472132490-27425-1-git-send-email-ferruh.yigit@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=dev@dpdk.org \
    --cc=zhouyates@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).