.. | .. |
---|
522 | 522 | struct nlattr *et = attrs[XFRMA_ETIMER_THRESH]; |
---|
523 | 523 | struct nlattr *rt = attrs[XFRMA_REPLAY_THRESH]; |
---|
524 | 524 | |
---|
525 | | - if (re) { |
---|
| 525 | + if (re && x->replay_esn && x->preplay_esn) { |
---|
526 | 526 | struct xfrm_replay_state_esn *replay_esn; |
---|
527 | 527 | replay_esn = nla_data(re); |
---|
528 | 528 | memcpy(x->replay_esn, replay_esn, |
---|
.. | .. |
---|
1049 | 1049 | sizeof(*filter), GFP_KERNEL); |
---|
1050 | 1050 | if (filter == NULL) |
---|
1051 | 1051 | return -ENOMEM; |
---|
| 1052 | + |
---|
| 1053 | + /* see addr_match(), (prefix length >> 5) << 2 |
---|
| 1054 | + * will be used to compare xfrm_address_t |
---|
| 1055 | + */ |
---|
| 1056 | + if (filter->splen > (sizeof(xfrm_address_t) << 3) || |
---|
| 1057 | + filter->dplen > (sizeof(xfrm_address_t) << 3)) { |
---|
| 1058 | + kfree(filter); |
---|
| 1059 | + return -EINVAL; |
---|
| 1060 | + } |
---|
1052 | 1061 | } |
---|
1053 | 1062 | |
---|
1054 | 1063 | if (attrs[XFRMA_PROTO]) |
---|
.. | .. |
---|
2624 | 2633 | [XFRMA_ALG_COMP] = { .len = sizeof(struct xfrm_algo) }, |
---|
2625 | 2634 | [XFRMA_ENCAP] = { .len = sizeof(struct xfrm_encap_tmpl) }, |
---|
2626 | 2635 | [XFRMA_TMPL] = { .len = sizeof(struct xfrm_user_tmpl) }, |
---|
2627 | | - [XFRMA_SEC_CTX] = { .len = sizeof(struct xfrm_sec_ctx) }, |
---|
| 2636 | + [XFRMA_SEC_CTX] = { .len = sizeof(struct xfrm_user_sec_ctx) }, |
---|
2628 | 2637 | [XFRMA_LTIME_VAL] = { .len = sizeof(struct xfrm_lifetime_cur) }, |
---|
2629 | 2638 | [XFRMA_REPLAY_VAL] = { .len = sizeof(struct xfrm_replay_state) }, |
---|
2630 | 2639 | [XFRMA_REPLAY_THRESH] = { .type = NLA_U32 }, |
---|