Skip to content

Commit 101dde4

Browse files
committed
xfrm: Fix crash when the hold queue is used.
The commits "xfrm: Move dst->path into struct xfrm_dst" and "net: Create and use new helper xfrm_dst_child()." changed xfrm bundle handling under the assumption that xdst->path and dst->child are not a NULL pointer only if dst->xfrm is not a NULL pointer. That is true with one exception. If the xfrm hold queue is used to wait until a SA is installed by the key manager, we create a dummy bundle without a valid dst->xfrm pointer. The current xfrm bundle handling crashes in that case. Fix this by extending the NULL check of dst->xfrm with a test of the DST_XFRM_QUEUE flag. Fixes: 0f6c480 ("xfrm: Move dst->path into struct xfrm_dst") Fixes: b92cf4a ("net: Create and use new helper xfrm_dst_child().") Signed-off-by: Steffen Klassert <[email protected]>
1 parent 0a266f8 commit 101dde4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/net/xfrm.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,7 @@ struct xfrm_dst {
941941
static inline struct dst_entry *xfrm_dst_path(const struct dst_entry *dst)
942942
{
943943
#ifdef CONFIG_XFRM
944-
if (dst->xfrm) {
944+
if (dst->xfrm || (dst->flags & DST_XFRM_QUEUE)) {
945945
const struct xfrm_dst *xdst = (const struct xfrm_dst *) dst;
946946

947947
return xdst->path;
@@ -953,7 +953,7 @@ static inline struct dst_entry *xfrm_dst_path(const struct dst_entry *dst)
953953
static inline struct dst_entry *xfrm_dst_child(const struct dst_entry *dst)
954954
{
955955
#ifdef CONFIG_XFRM
956-
if (dst->xfrm) {
956+
if (dst->xfrm || (dst->flags & DST_XFRM_QUEUE)) {
957957
struct xfrm_dst *xdst = (struct xfrm_dst *) dst;
958958
return xdst->child;
959959
}

0 commit comments

Comments
 (0)