Bug 181448 - [mlxen] [patch] Using sysctl for mlxen stats might crash the kernel.
Summary: [mlxen] [patch] Using sysctl for mlxen stats might crash the kernel.
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 9.2-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: Hans Petter Selasky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-21 09:00 UTC by Daria
Modified: 2014-10-30 15:54 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daria 2013-08-21 09:00:02 UTC
When reloading mlxen there are messages in the logs:

can't re-use a leaf (various leaf names)!

then, when trying to read these leafs - the kernel crashes.

Fix: The order of releasing resources in mlxen needed to be corrected.



-       if (priv->sysctl)
-               sysctl_ctx_free(&priv->conf_ctx);
-
        cancel_delayed_work(&priv->stats_task);
        /* flush any pending task for this netdev */
        flush_workqueue(mdev->workqueue);
@@ -937,6 +934,10 @@ void mlx4_en_destroy_netdev(struct net_device *dev
        mutex_unlock(&mdev->state_lock);

        mlx4_en_free_resources(priv);
+
+       if (priv->sysctl)
+               sysctl_ctx_free(&priv->conf_ctx);
+
        mtx_destroy(&priv->stats_lock.m);
        mtx_destroy(&priv->vlan_lock.m);
        kfree(priv);--uNG4LiJEvBLt5Xf8cNAOunN2O02VJbT6WCktmtc1b291laWA
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

Index: sys/ofed/drivers/net/mlx4/en_netdev.c
===================================================================
--- sys/ofed/drivers/net/mlx4/en_netdev.c       (revision 254594)
+++ sys/ofed/drivers/net/mlx4/en_netdev.c       (working copy)
@@ -924,9 +924,6 @@ void mlx4_en_destroy_netdev(struct net_device *dev
        if (priv->allocated)
                mlx4_free_hwq_res(mdev->dev, &priv->res, MLX4_EN_PAGE_SIZE);
How-To-Repeat: reload mlxen then try sysctl -a or a certain problematic leaf.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2013-08-22 02:45:52 UTC
Responsible Changed
From-To: freebsd-amd64->freebsd-bugs

not amd64-specific.
Comment 2 Hans Petter Selasky freebsd_committer freebsd_triage 2014-10-06 15:37:30 UTC
Hi,

This issue has been fixed in both 10-stable and 11-current.

Can you use 10-stable or 11-current?

We will also try to push a fix to 9-stable.

Thank you!

--HPS
Comment 3 Hans Petter Selasky freebsd_committer freebsd_triage 2014-10-30 15:54:53 UTC
Hi,

This issue should be fixed in r273864.

Please re-open if not.

--HPS