backport: handle change in netdevice destructor usage
PATCH v2 1/1 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 <[email protected]>
---
Hi Johannes,
I took a while for me to be happy with this version. More so because I found that brcmfmac has a double-free bug if register_netdevice() fails so I needed to solve that puzzle. Below is the changelog.
Regards,
Arend
V2:
- changed netdev_set_priv_destructor() to macro.
- revised semantic patch covering drivers only needing free_netdev().
- used some tricks suggested by Julia in semantic patch.
--- backport/backport-include/linux/netdevice.h | 9 ++++ patches/0079-netdev-destructor.cocci | 84 +++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 patches/0079-netdev-destructor.cocci
backport/backport-include/linux/netdevice.h +9 -0
@@ -320,4 +320,13 @@ static inline void netif_trans_update(struct net_device *dev) }#endif +#if LINUX_VERSION_IS_LESS (4 ,13 ,0 ) +#define netdev_set_priv_destructor (_dev, _destructor) \ + (_dev)->destructor = __ ## _destructor +#else + dev->needs_free_netdev = true; +if (destructor != free_netdev) + dev->priv_destructor = destructor; +#endif +#endif /* __BACKPORT_NETDEVICE_H */
patches/0079-netdev-destructor.cocci new file +84 -0
84 lines not on this page · raw message
Signature · 4 lines
1.9.1 -- To unsubscribe from this list: send the line "unsubscribe backports" in