diff options
author | Shannon Nelson <shannon.nelson@oracle.com> | 2017-12-19 15:35:47 -0800 |
---|---|---|
committer | Steffen Klassert <steffen.klassert@secunet.com> | 2017-12-21 08:17:48 +0100 |
commit | 7f05b467a735aba1476d9ae8e0ae9d9d8e60066c (patch) | |
tree | fd465f66ae953e9abedce0d2374ae48b1900d3bd /include/net/xfrm.h | |
parent | f58869c44fb3f0835dd2dabce06e5919a18655c6 (diff) | |
download | linux-7f05b467a735aba1476d9ae8e0ae9d9d8e60066c.tar.bz2 |
xfrm: check for xdo_dev_state_free
The current XFRM code assumes that we've implemented the
xdo_dev_state_free() callback, even if it is meaningless to the driver.
This patch adds a check for it before calling, as done in other APIs,
to prevent a NULL function pointer kernel crash.
Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'include/net/xfrm.h')
-rw-r--r-- | include/net/xfrm.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 357764a2bb4e..079ea9455bcd 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -1933,7 +1933,8 @@ static inline void xfrm_dev_state_free(struct xfrm_state *x) struct net_device *dev = xso->dev; if (dev && dev->xfrmdev_ops) { - dev->xfrmdev_ops->xdo_dev_state_free(x); + if (dev->xfrmdev_ops->xdo_dev_state_free) + dev->xfrmdev_ops->xdo_dev_state_free(x); xso->dev = NULL; dev_put(dev); } |