Commit de95c4a4 authored by Nicolas Dichtel's avatar Nicolas Dichtel Committed by David S. Miller

xfrm: align nlattr properly when needed

Signed-off-by: default avatarNicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 73520786
...@@ -302,6 +302,7 @@ enum xfrm_attr_type_t { ...@@ -302,6 +302,7 @@ enum xfrm_attr_type_t {
XFRMA_SA_EXTRA_FLAGS, /* __u32 */ XFRMA_SA_EXTRA_FLAGS, /* __u32 */
XFRMA_PROTO, /* __u8 */ XFRMA_PROTO, /* __u8 */
XFRMA_ADDRESS_FILTER, /* struct xfrm_address_filter */ XFRMA_ADDRESS_FILTER, /* struct xfrm_address_filter */
XFRMA_PAD,
__XFRMA_MAX __XFRMA_MAX
#define XFRMA_MAX (__XFRMA_MAX - 1) #define XFRMA_MAX (__XFRMA_MAX - 1)
......
...@@ -809,7 +809,8 @@ static int copy_to_user_state_extra(struct xfrm_state *x, ...@@ -809,7 +809,8 @@ static int copy_to_user_state_extra(struct xfrm_state *x,
goto out; goto out;
} }
if (x->lastused) { if (x->lastused) {
ret = nla_put_u64(skb, XFRMA_LASTUSED, x->lastused); ret = nla_put_u64_64bit(skb, XFRMA_LASTUSED, x->lastused,
XFRMA_PAD);
if (ret) if (ret)
goto out; goto out;
} }
...@@ -1813,7 +1814,7 @@ static inline size_t xfrm_aevent_msgsize(struct xfrm_state *x) ...@@ -1813,7 +1814,7 @@ static inline size_t xfrm_aevent_msgsize(struct xfrm_state *x)
return NLMSG_ALIGN(sizeof(struct xfrm_aevent_id)) return NLMSG_ALIGN(sizeof(struct xfrm_aevent_id))
+ nla_total_size(replay_size) + nla_total_size(replay_size)
+ nla_total_size(sizeof(struct xfrm_lifetime_cur)) + nla_total_size_64bit(sizeof(struct xfrm_lifetime_cur))
+ nla_total_size(sizeof(struct xfrm_mark)) + nla_total_size(sizeof(struct xfrm_mark))
+ nla_total_size(4) /* XFRM_AE_RTHR */ + nla_total_size(4) /* XFRM_AE_RTHR */
+ nla_total_size(4); /* XFRM_AE_ETHR */ + nla_total_size(4); /* XFRM_AE_ETHR */
...@@ -1848,7 +1849,8 @@ static int build_aevent(struct sk_buff *skb, struct xfrm_state *x, const struct ...@@ -1848,7 +1849,8 @@ static int build_aevent(struct sk_buff *skb, struct xfrm_state *x, const struct
} }
if (err) if (err)
goto out_cancel; goto out_cancel;
err = nla_put(skb, XFRMA_LTIME_VAL, sizeof(x->curlft), &x->curlft); err = nla_put_64bit(skb, XFRMA_LTIME_VAL, sizeof(x->curlft), &x->curlft,
XFRMA_PAD);
if (err) if (err)
goto out_cancel; goto out_cancel;
...@@ -2617,7 +2619,7 @@ static inline size_t xfrm_sa_len(struct xfrm_state *x) ...@@ -2617,7 +2619,7 @@ static inline size_t xfrm_sa_len(struct xfrm_state *x)
l += nla_total_size(sizeof(x->props.extra_flags)); l += nla_total_size(sizeof(x->props.extra_flags));
/* Must count x->lastused as it may become non-zero behind our back. */ /* Must count x->lastused as it may become non-zero behind our back. */
l += nla_total_size(sizeof(u64)); l += nla_total_size_64bit(sizeof(u64));
return l; return l;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment