summaryrefslogtreecommitdiff
path: root/patches
diff options
context:
space:
mode:
authorArend Van Spriel <arend.vanspriel@broadcom.com>2017-06-22 08:31:04 +0100
committerJohannes Berg <johannes.berg@intel.com>2017-06-30 13:38:51 +0200
commit721ae78f93550cefe2da4541fa5f8c77a54b5e90 (patch)
tree737b6ee19d15f65d96a9805b46f8497048f396eb /patches
parent1bfbd3c3571960fa2d935f5998fa1e450b1f9c05 (diff)
backport: handle change in netdevice destructor usage
This patch deals with changes made in struct net_device by commit cf124db566e6 ("net: Fix inconsistent teardown and release of private netdev state."). Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'patches')
-rw-r--r--patches/0079-netdev-destructor.cocci84
1 files changed, 84 insertions, 0 deletions
diff --git a/patches/0079-netdev-destructor.cocci b/patches/0079-netdev-destructor.cocci
new file mode 100644
index 00000000..fab8af19
--- /dev/null
+++ b/patches/0079-netdev-destructor.cocci
@@ -0,0 +1,84 @@
+@r1@
+struct net_device *NDEV;
+identifier D, C;
+identifier TRUE =~ "true";
+@@
+C(...)
+{
+ <...
+- NDEV->needs_free_netdev = TRUE;
+- NDEV->priv_destructor = D;
++ netdev_set_priv_destructor(NDEV, D);
+ ...>
+}
+
+@r2 depends on r1@
+identifier r1.D, r1.C;
+fresh identifier E = "__" ## D;
+@@
+
++#if LINUX_VERSION_IS_LESS(4,13,0)
++static void E(struct net_device *ndev)
++{
++ D(ndev);
++ free_netdev(ndev);
++}
++#endif
++
+C(...)
+{
+ ...
+}
+
+@r3 depends on r1@
+type T;
+identifier NDEV;
+identifier r1.D;
+T RET;
+@@
+
+RET = \(register_netdevice\|register_ndev\)(NDEV);
+if (<+... RET ...+>) {
+ <...
++#if LINUX_VERSION_IS_LESS(4,13,0)
++ D(NDEV);
++#endif
+ free_netdev(NDEV);
+ ...>
+}
+
+@r4 depends on r1@
+identifier NDEV;
+identifier r1.D;
+type T;
+T RET;
+@@
+
+if (...)
+ RET = register_netdevice(NDEV);
+else
+ RET = register_netdev(NDEV);
+if (<+... RET ...+>) {
+ <...
++#if LINUX_VERSION_IS_LESS(4,13,0)
++ D(NDEV);
++#endif
+ free_netdev(NDEV);
+ ...>
+}
+
+@r5@
+struct net_device *NDEV;
+identifier TRUE =~ "true";
+@@
+
+-NDEV->needs_free_netdev = TRUE;
++netdev_set_priv_destructor(NDEV, free_netdev);
+
+@r6@
+struct net_device *NDEV;
+identifier D;
+@@
+
+-NDEV->priv_destructor = D;
++netdev_set_priv_destructor(NDEV, D);