From: Eric Dumazet Date: Wed, 8 Dec 2021 20:20:19 +0000 (-0800) Subject: xfrm: fix a small bug in xfrm_sa_len() X-Git-Tag: accepted/tizen/unified/20230118.172025~3485 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=097d4aeea0fcfe569e53a19e8d13fae2888d4abf;p=platform%2Fkernel%2Flinux-rpi.git xfrm: fix a small bug in xfrm_sa_len() [ Upstream commit 7770a39d7c63faec6c4f33666d49a8cb664d0482 ] copy_user_offload() will actually push a struct struct xfrm_user_offload, which is different than (struct xfrm_state *)->xso (struct xfrm_state_offload) Fixes: d77e38e612a01 ("xfrm: Add an IPsec hardware offloading API") Signed-off-by: Eric Dumazet Cc: Steffen Klassert Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin --- diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index 3a3cb09..1157431 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c @@ -3058,7 +3058,7 @@ static inline unsigned int xfrm_sa_len(struct xfrm_state *x) if (x->props.extra_flags) l += nla_total_size(sizeof(x->props.extra_flags)); if (x->xso.dev) - l += nla_total_size(sizeof(x->xso)); + l += nla_total_size(sizeof(struct xfrm_user_offload)); if (x->props.smark.v | x->props.smark.m) { l += nla_total_size(sizeof(x->props.smark.v)); l += nla_total_size(sizeof(x->props.smark.m));