* [PATCH] xfrm: state: fix potential null pointer dereference on afinfo
@ 2017-01-13 14:07 Colin King
2017-01-16 13:27 ` Steffen Klassert
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2017-01-13 14:07 UTC (permalink / raw)
To: Steffen Klassert, Herbert Xu, David S . Miller, netdev; +Cc: linux-kernel
From: Colin Ian King <colin.king@canonical.com>
afinfo is being null checked before a call afinfo->init_tempsel
so afinfo may be potentially null. ifinfo may still be null in
the case were it is not updated when family == tmpl->encap_family,
hence we may hit a null pointer dereference in the call to
afinfo->init_temprop.
Fix this by adding a null ptr check before calling init_temprop.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
net/xfrm/xfrm_state.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index a62097e..5083418 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -656,7 +656,8 @@ xfrm_init_tempstate(struct xfrm_state *x, const struct flowi *fl,
if (!afinfo)
return;
}
- afinfo->init_temprop(x, tmpl, daddr, saddr);
+ if (afinfo)
+ afinfo->init_temprop(x, tmpl, daddr, saddr);
}
static struct xfrm_state *__xfrm_state_lookup(struct net *net, u32 mark,
--
2.10.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] xfrm: state: fix potential null pointer dereference on afinfo
2017-01-13 14:07 [PATCH] xfrm: state: fix potential null pointer dereference on afinfo Colin King
@ 2017-01-16 13:27 ` Steffen Klassert
0 siblings, 0 replies; 2+ messages in thread
From: Steffen Klassert @ 2017-01-16 13:27 UTC (permalink / raw)
To: Colin King; +Cc: Herbert Xu, David S . Miller, netdev, linux-kernel
On Fri, Jan 13, 2017 at 02:07:03PM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> afinfo is being null checked before a call afinfo->init_tempsel
> so afinfo may be potentially null. ifinfo may still be null in
> the case were it is not updated when family == tmpl->encap_family,
> hence we may hit a null pointer dereference in the call to
> afinfo->init_temprop.
>
> Fix this by adding a null ptr check before calling init_temprop.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
I've applied already a fix for this from Florian Westphal.
Thanks a lot anyway!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-01-16 13:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-13 14:07 [PATCH] xfrm: state: fix potential null pointer dereference on afinfo Colin King
2017-01-16 13:27 ` Steffen Klassert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).