Stable Archive mirror
 help / color / mirror / Atom feed
From: zhulei <zhulei@kylinos.cn>
To: gregkh@linuxfoundation.org
Cc: ap420073@gmail.com, davem@davemloft.net, jbenc@redhat.com,
	sashal@kernel.org, stable@vger.kernel.org
Subject: Re: 4.19 stable kernel crash caused by vxlan testing
Date: Tue,  7 May 2024 17:20:49 +0800	[thread overview]
Message-ID: <20240507092049.1713953-1-zhulei@kylinos.cn> (raw)
In-Reply-To: <2024042356-launch-recapture-4bb1@gregkh>

By making the following changes and using our own 4.19 kernel
verification, we can observe the output that passes the test
in dmesg.

When using the 4.19 stable branch kernel for verification, the
dmesg has no output, which looks more like the test program is not
running. However, the code of vxlan.c is the same.

May i ask if the changes made to the maintainer are reasonable?

---
 drivers/net/vxlan.c | 36 ++++++++++++++++++++++++++----------
 1 file changed, 26 insertions(+), 10 deletions(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 704db80df38b..d3000c58c0f2 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -657,6 +657,14 @@ static struct vxlan_fdb *vxlan_fdb_alloc(struct vxlan_dev *vxlan,
 	return f;
 }
 
+static void vxlan_fdb_insert(struct vxlan_dev *vxlan, const u8 *mac,
+			     __be32 src_vni, struct vxlan_fdb *f)
+{
+	++vxlan->addrcnt;
+	hlist_add_head_rcu(&f->hlist,
+			   vxlan_fdb_head(vxlan, mac, src_vni));
+}
+
 static int vxlan_fdb_create(struct vxlan_dev *vxlan,
 			    const u8 *mac, union vxlan_addr *ip,
 			    __u16 state, __be16 port, __be32 src_vni,
@@ -682,10 +690,6 @@ static int vxlan_fdb_create(struct vxlan_dev *vxlan,
 		return rc;
 	}
 
-	++vxlan->addrcnt;
-	hlist_add_head_rcu(&f->hlist,
-			   vxlan_fdb_head(vxlan, mac, src_vni));
-
 	*fdb = f;
 
 	return 0;
@@ -758,15 +762,15 @@ static int vxlan_fdb_update(struct vxlan_dev *vxlan,
 	if (notify) {
 		if (rd == NULL)
 			rd = first_remote_rtnl(f);
+		vxlan_fdb_insert(vxlan, mac, src_vni, f);
 		vxlan_fdb_notify(vxlan, f, rd, RTM_NEWNEIGH);
 	}
 
 	return 0;
 }
 
-static void vxlan_fdb_free(struct rcu_head *head)
+static void __vxlan_fdb_free(struct vxlan_fdb *f)
 {
-	struct vxlan_fdb *f = container_of(head, struct vxlan_fdb, rcu);
 	struct vxlan_rdst *rd, *nd;
 
 	list_for_each_entry_safe(rd, nd, &f->remotes, list) {
@@ -776,6 +780,13 @@ static void vxlan_fdb_free(struct rcu_head *head)
 	kfree(f);
 }
 
+static void vxlan_fdb_free(struct rcu_head *head)
+{
+	struct vxlan_fdb *f = container_of(head, struct vxlan_fdb, rcu);
+
+	__vxlan_fdb_free(f);
+}
+
 static void vxlan_fdb_destroy(struct vxlan_dev *vxlan, struct vxlan_fdb *f,
 			      bool do_notify)
 {
@@ -3265,9 +3276,12 @@ static int __vxlan_dev_create(struct net *net, struct net_device *dev,
 	if (err)
 		goto errout;
 
-	/* notify default fdb entry */
-	if (f)
+	if (f) {
+		vxlan_fdb_insert(vxlan, all_zeros_mac,
+				 vxlan->default_dst.remote_vni, f);
+		/* notify default fdb entry */
 		vxlan_fdb_notify(vxlan, f, first_remote_rtnl(f), RTM_NEWNEIGH);
+	}
 
 	list_add(&vxlan->next, &vn->vxlan_list);
 	return 0;
@@ -3278,9 +3292,11 @@ static int __vxlan_dev_create(struct net *net, struct net_device *dev,
 	 * destroy the entry by hand here.
 	 */
 	if (f)
-		vxlan_fdb_destroy(vxlan, f, false);
-	if (unregister)
+		__vxlan_fdb_free(f);
+	if (unregister) {
+		vxlan_fdb_destroy(vxlan, f, true);
 		unregister_netdevice(dev);
+	}
 	return err;
 }
 
-- 
2.27.0


  reply	other threads:[~2024-05-07  9:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-23  5:52 4.19 stable kernel crash caused by vxlan testing zhulei
2024-04-23 11:04 ` Taehee Yoo
2024-04-23 11:11 ` Greg KH
2024-05-07  9:20   ` zhulei [this message]
2024-05-13 13:03     ` Greg KH

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=20240507092049.1713953-1-zhulei@kylinos.cn \
    --to=zhulei@kylinos.cn \
    --cc=ap420073@gmail.com \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=jbenc@redhat.com \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).