]> git.baikalelectronics.ru Git - kernel.git/commit
xfrm: fix crash in XFRM_MSG_GETSA netlink handler
authorVegard Nossum <vegard.nossum@oracle.com>
Tue, 5 Jul 2016 08:18:08 +0000 (10:18 +0200)
committerSteffen Klassert <steffen.klassert@secunet.com>
Mon, 18 Jul 2016 07:37:02 +0000 (09:37 +0200)
commit6e122615f13b11a755133ac7de26f1236beff2e0
tree50acfc1c0fc36a81964f600f505ec93be0e34f10
parent26f19bc6cc5734a66123d7f9906c4563020ab0dc
xfrm: fix crash in XFRM_MSG_GETSA netlink handler

If we hit any of the error conditions inside xfrm_dump_sa(), then
xfrm_state_walk_init() never gets called. However, we still call
xfrm_state_walk_done() from xfrm_dump_sa_done(), which will crash
because the state walk was never initialized properly.

We can fix this by setting cb->args[0] only after we've processed the
first element and checking this before calling xfrm_state_walk_done().

Fixes: d90018d48f ("ipsec: add support of limited SA dump")
Cc: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
net/xfrm/xfrm_user.c