Merge 4.4.59 into android-4.4

Changes in 4.4.59:
	xfrm: policy: init locks early
	xfrm_user: validate XFRM_MSG_NEWAE XFRMA_REPLAY_ESN_VAL replay_window
	xfrm_user: validate XFRM_MSG_NEWAE incoming ESN size harder
	virtio_balloon: init 1st buffer in stats vq
	pinctrl: qcom: Don't clear status bit on irq_unmask
	c6x/ptrace: Remove useless PTRACE_SETREGSET implementation
	h8300/ptrace: Fix incorrect register transfer count
	mips/ptrace: Preserve previous registers for short regset write
	sparc/ptrace: Preserve previous registers for short regset write
	metag/ptrace: Preserve previous registers for short regset write
	metag/ptrace: Provide default TXSTATUS for short NT_PRSTATUS
	metag/ptrace: Reject partial NT_METAG_RPIPE writes
	fscrypt: remove broken support for detecting keyring key revocation
	sched/rt: Add a missing rescheduling point
	Linux 4.4.59

Change-Id: Ifa35307b133cbf29d0a0084bb78a7b0436182b53
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Greg Kroah-Hartman 2017-03-31 17:34:55 +02:00
parent e246a2f11f
commit 3a75d7a947
18 changed files with 57 additions and 135 deletions

View file

@ -1,6 +1,6 @@
VERSION = 4 VERSION = 4
PATCHLEVEL = 4 PATCHLEVEL = 4
SUBLEVEL = 58 SUBLEVEL = 59
EXTRAVERSION = EXTRAVERSION =
NAME = Blurry Fish Butt NAME = Blurry Fish Butt

View file

@ -69,46 +69,6 @@ static int gpr_get(struct task_struct *target,
0, sizeof(*regs)); 0, sizeof(*regs));
} }
static int gpr_set(struct task_struct *target,
const struct user_regset *regset,
unsigned int pos, unsigned int count,
const void *kbuf, const void __user *ubuf)
{
int ret;
struct pt_regs *regs = task_pt_regs(target);
/* Don't copyin TSR or CSR */
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
&regs,
0, PT_TSR * sizeof(long));
if (ret)
return ret;
ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
PT_TSR * sizeof(long),
(PT_TSR + 1) * sizeof(long));
if (ret)
return ret;
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
&regs,
(PT_TSR + 1) * sizeof(long),
PT_CSR * sizeof(long));
if (ret)
return ret;
ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
PT_CSR * sizeof(long),
(PT_CSR + 1) * sizeof(long));
if (ret)
return ret;
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
&regs,
(PT_CSR + 1) * sizeof(long), -1);
return ret;
}
enum c6x_regset { enum c6x_regset {
REGSET_GPR, REGSET_GPR,
}; };
@ -120,7 +80,6 @@ static const struct user_regset c6x_regsets[] = {
.size = sizeof(u32), .size = sizeof(u32),
.align = sizeof(u32), .align = sizeof(u32),
.get = gpr_get, .get = gpr_get,
.set = gpr_set
}, },
}; };

View file

@ -95,7 +95,8 @@ static int regs_get(struct task_struct *target,
long *reg = (long *)&regs; long *reg = (long *)&regs;
/* build user regs in buffer */ /* build user regs in buffer */
for (r = 0; r < ARRAY_SIZE(register_offset); r++) BUILD_BUG_ON(sizeof(regs) % sizeof(long) != 0);
for (r = 0; r < sizeof(regs) / sizeof(long); r++)
*reg++ = h8300_get_reg(target, r); *reg++ = h8300_get_reg(target, r);
return user_regset_copyout(&pos, &count, &kbuf, &ubuf, return user_regset_copyout(&pos, &count, &kbuf, &ubuf,
@ -113,7 +114,8 @@ static int regs_set(struct task_struct *target,
long *reg; long *reg;
/* build user regs in buffer */ /* build user regs in buffer */
for (reg = (long *)&regs, r = 0; r < ARRAY_SIZE(register_offset); r++) BUILD_BUG_ON(sizeof(regs) % sizeof(long) != 0);
for (reg = (long *)&regs, r = 0; r < sizeof(regs) / sizeof(long); r++)
*reg++ = h8300_get_reg(target, r); *reg++ = h8300_get_reg(target, r);
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
@ -122,7 +124,7 @@ static int regs_set(struct task_struct *target,
return ret; return ret;
/* write back to pt_regs */ /* write back to pt_regs */
for (reg = (long *)&regs, r = 0; r < ARRAY_SIZE(register_offset); r++) for (reg = (long *)&regs, r = 0; r < sizeof(regs) / sizeof(long); r++)
h8300_put_reg(target, r, *reg++); h8300_put_reg(target, r, *reg++);
return 0; return 0;
} }

View file

@ -24,6 +24,16 @@
* user_regset definitions. * user_regset definitions.
*/ */
static unsigned long user_txstatus(const struct pt_regs *regs)
{
unsigned long data = (unsigned long)regs->ctx.Flags;
if (regs->ctx.SaveMask & TBICTX_CBUF_BIT)
data |= USER_GP_REGS_STATUS_CATCH_BIT;
return data;
}
int metag_gp_regs_copyout(const struct pt_regs *regs, int metag_gp_regs_copyout(const struct pt_regs *regs,
unsigned int pos, unsigned int count, unsigned int pos, unsigned int count,
void *kbuf, void __user *ubuf) void *kbuf, void __user *ubuf)
@ -62,9 +72,7 @@ int metag_gp_regs_copyout(const struct pt_regs *regs,
if (ret) if (ret)
goto out; goto out;
/* TXSTATUS */ /* TXSTATUS */
data = (unsigned long)regs->ctx.Flags; data = user_txstatus(regs);
if (regs->ctx.SaveMask & TBICTX_CBUF_BIT)
data |= USER_GP_REGS_STATUS_CATCH_BIT;
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
&data, 4*25, 4*26); &data, 4*25, 4*26);
if (ret) if (ret)
@ -119,6 +127,7 @@ int metag_gp_regs_copyin(struct pt_regs *regs,
if (ret) if (ret)
goto out; goto out;
/* TXSTATUS */ /* TXSTATUS */
data = user_txstatus(regs);
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
&data, 4*25, 4*26); &data, 4*25, 4*26);
if (ret) if (ret)
@ -244,6 +253,8 @@ int metag_rp_state_copyin(struct pt_regs *regs,
unsigned long long *ptr; unsigned long long *ptr;
int ret, i; int ret, i;
if (count < 4*13)
return -EINVAL;
/* Read the entire pipeline before making any changes */ /* Read the entire pipeline before making any changes */
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
&rp, 0, 4*13); &rp, 0, 4*13);
@ -303,7 +314,7 @@ static int metag_tls_set(struct task_struct *target,
const void *kbuf, const void __user *ubuf) const void *kbuf, const void __user *ubuf)
{ {
int ret; int ret;
void __user *tls; void __user *tls = target->thread.tls_ptr;
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &tls, 0, -1); ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &tls, 0, -1);
if (ret) if (ret)

View file

@ -485,7 +485,8 @@ static int fpr_set(struct task_struct *target,
&target->thread.fpu, &target->thread.fpu,
0, sizeof(elf_fpregset_t)); 0, sizeof(elf_fpregset_t));
for (i = 0; i < NUM_FPU_REGS; i++) { BUILD_BUG_ON(sizeof(fpr_val) != sizeof(elf_fpreg_t));
for (i = 0; i < NUM_FPU_REGS && count >= sizeof(elf_fpreg_t); i++) {
err = user_regset_copyin(&pos, &count, &kbuf, &ubuf, err = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
&fpr_val, i * sizeof(elf_fpreg_t), &fpr_val, i * sizeof(elf_fpreg_t),
(i + 1) * sizeof(elf_fpreg_t)); (i + 1) * sizeof(elf_fpreg_t));

View file

@ -311,7 +311,7 @@ static int genregs64_set(struct task_struct *target,
} }
if (!ret) { if (!ret) {
unsigned long y; unsigned long y = regs->y;
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
&y, &y,

View file

@ -597,10 +597,6 @@ static void msm_gpio_irq_unmask(struct irq_data *d)
spin_lock_irqsave(&pctrl->lock, flags); spin_lock_irqsave(&pctrl->lock, flags);
val = readl(pctrl->regs + g->intr_status_reg);
val &= ~BIT(g->intr_status_bit);
writel(val, pctrl->regs + g->intr_status_reg);
val = readl(pctrl->regs + g->intr_cfg_reg); val = readl(pctrl->regs + g->intr_cfg_reg);
val |= BIT(g->intr_enable_bit); val |= BIT(g->intr_enable_bit);
writel(val, pctrl->regs + g->intr_cfg_reg); writel(val, pctrl->regs + g->intr_cfg_reg);

View file

@ -416,6 +416,8 @@ static int init_vqs(struct virtio_balloon *vb)
* Prime this virtqueue with one buffer so the hypervisor can * Prime this virtqueue with one buffer so the hypervisor can
* use it to signal us later (it can't be broken yet!). * use it to signal us later (it can't be broken yet!).
*/ */
update_balloon_stats(vb);
sg_init_one(&sg, vb->stats, sizeof vb->stats); sg_init_one(&sg, vb->stats, sizeof vb->stats);
if (virtqueue_add_outbuf(vb->stats_vq, &sg, 1, vb, GFP_KERNEL) if (virtqueue_add_outbuf(vb->stats_vq, &sg, 1, vb, GFP_KERNEL)
< 0) < 0)

View file

@ -173,8 +173,6 @@ void ext4_free_crypt_info(struct ext4_crypt_info *ci)
if (!ci) if (!ci)
return; return;
if (ci->ci_keyring_key)
key_put(ci->ci_keyring_key);
crypto_free_ablkcipher(ci->ci_ctfm); crypto_free_ablkcipher(ci->ci_ctfm);
kmem_cache_free(ext4_crypt_info_cachep, ci); kmem_cache_free(ext4_crypt_info_cachep, ci);
} }
@ -196,7 +194,7 @@ void ext4_free_encryption_info(struct inode *inode,
ext4_free_crypt_info(ci); ext4_free_crypt_info(ci);
} }
int _ext4_get_encryption_info(struct inode *inode) int ext4_get_encryption_info(struct inode *inode)
{ {
struct ext4_inode_info *ei = EXT4_I(inode); struct ext4_inode_info *ei = EXT4_I(inode);
struct ext4_crypt_info *crypt_info; struct ext4_crypt_info *crypt_info;
@ -213,22 +211,15 @@ int _ext4_get_encryption_info(struct inode *inode)
char mode; char mode;
int res; int res;
if (ei->i_crypt_info)
return 0;
if (!ext4_read_workqueue) { if (!ext4_read_workqueue) {
res = ext4_init_crypto(); res = ext4_init_crypto();
if (res) if (res)
return res; return res;
} }
retry:
crypt_info = ACCESS_ONCE(ei->i_crypt_info);
if (crypt_info) {
if (!crypt_info->ci_keyring_key ||
key_validate(crypt_info->ci_keyring_key) == 0)
return 0;
ext4_free_encryption_info(inode, crypt_info);
goto retry;
}
res = ext4_xattr_get(inode, EXT4_XATTR_INDEX_ENCRYPTION, res = ext4_xattr_get(inode, EXT4_XATTR_INDEX_ENCRYPTION,
EXT4_XATTR_NAME_ENCRYPTION_CONTEXT, EXT4_XATTR_NAME_ENCRYPTION_CONTEXT,
&ctx, sizeof(ctx)); &ctx, sizeof(ctx));
@ -251,7 +242,6 @@ retry:
crypt_info->ci_data_mode = ctx.contents_encryption_mode; crypt_info->ci_data_mode = ctx.contents_encryption_mode;
crypt_info->ci_filename_mode = ctx.filenames_encryption_mode; crypt_info->ci_filename_mode = ctx.filenames_encryption_mode;
crypt_info->ci_ctfm = NULL; crypt_info->ci_ctfm = NULL;
crypt_info->ci_keyring_key = NULL;
memcpy(crypt_info->ci_master_key, ctx.master_key_descriptor, memcpy(crypt_info->ci_master_key, ctx.master_key_descriptor,
sizeof(crypt_info->ci_master_key)); sizeof(crypt_info->ci_master_key));
if (S_ISREG(inode->i_mode)) if (S_ISREG(inode->i_mode))
@ -294,7 +284,6 @@ retry:
keyring_key = NULL; keyring_key = NULL;
goto out; goto out;
} }
crypt_info->ci_keyring_key = keyring_key;
if (keyring_key->type != &key_type_logon) { if (keyring_key->type != &key_type_logon) {
printk_once(KERN_WARNING printk_once(KERN_WARNING
"ext4: key type must be logon\n"); "ext4: key type must be logon\n");
@ -340,16 +329,13 @@ got_key:
ext4_encryption_key_size(mode)); ext4_encryption_key_size(mode));
if (res) if (res)
goto out; goto out;
memzero_explicit(raw_key, sizeof(raw_key));
if (cmpxchg(&ei->i_crypt_info, NULL, crypt_info) != NULL) {
ext4_free_crypt_info(crypt_info);
goto retry;
}
return 0;
if (cmpxchg(&ei->i_crypt_info, NULL, crypt_info) == NULL)
crypt_info = NULL;
out: out:
if (res == -ENOKEY) if (res == -ENOKEY)
res = 0; res = 0;
key_put(keyring_key);
ext4_free_crypt_info(crypt_info); ext4_free_crypt_info(crypt_info);
memzero_explicit(raw_key, sizeof(raw_key)); memzero_explicit(raw_key, sizeof(raw_key));
return res; return res;

View file

@ -2331,23 +2331,11 @@ static inline void ext4_fname_free_filename(struct ext4_filename *fname) { }
/* crypto_key.c */ /* crypto_key.c */
void ext4_free_crypt_info(struct ext4_crypt_info *ci); void ext4_free_crypt_info(struct ext4_crypt_info *ci);
void ext4_free_encryption_info(struct inode *inode, struct ext4_crypt_info *ci); void ext4_free_encryption_info(struct inode *inode, struct ext4_crypt_info *ci);
int _ext4_get_encryption_info(struct inode *inode);
#ifdef CONFIG_EXT4_FS_ENCRYPTION #ifdef CONFIG_EXT4_FS_ENCRYPTION
int ext4_has_encryption_key(struct inode *inode); int ext4_has_encryption_key(struct inode *inode);
static inline int ext4_get_encryption_info(struct inode *inode) int ext4_get_encryption_info(struct inode *inode);
{
struct ext4_crypt_info *ci = EXT4_I(inode)->i_crypt_info;
if (!ci ||
(ci->ci_keyring_key &&
(ci->ci_keyring_key->flags & ((1 << KEY_FLAG_INVALIDATED) |
(1 << KEY_FLAG_REVOKED) |
(1 << KEY_FLAG_DEAD)))))
return _ext4_get_encryption_info(inode);
return 0;
}
static inline struct ext4_crypt_info *ext4_encryption_info(struct inode *inode) static inline struct ext4_crypt_info *ext4_encryption_info(struct inode *inode)
{ {

View file

@ -80,7 +80,6 @@ struct ext4_crypt_info {
char ci_filename_mode; char ci_filename_mode;
char ci_flags; char ci_flags;
struct crypto_ablkcipher *ci_ctfm; struct crypto_ablkcipher *ci_ctfm;
struct key *ci_keyring_key;
char ci_master_key[EXT4_KEY_DESCRIPTOR_SIZE]; char ci_master_key[EXT4_KEY_DESCRIPTOR_SIZE];
}; };

View file

@ -92,7 +92,6 @@ static void f2fs_free_crypt_info(struct f2fs_crypt_info *ci)
if (!ci) if (!ci)
return; return;
key_put(ci->ci_keyring_key);
crypto_free_ablkcipher(ci->ci_ctfm); crypto_free_ablkcipher(ci->ci_ctfm);
kmem_cache_free(f2fs_crypt_info_cachep, ci); kmem_cache_free(f2fs_crypt_info_cachep, ci);
} }
@ -113,7 +112,7 @@ void f2fs_free_encryption_info(struct inode *inode, struct f2fs_crypt_info *ci)
f2fs_free_crypt_info(ci); f2fs_free_crypt_info(ci);
} }
int _f2fs_get_encryption_info(struct inode *inode) int f2fs_get_encryption_info(struct inode *inode)
{ {
struct f2fs_inode_info *fi = F2FS_I(inode); struct f2fs_inode_info *fi = F2FS_I(inode);
struct f2fs_crypt_info *crypt_info; struct f2fs_crypt_info *crypt_info;
@ -129,18 +128,12 @@ int _f2fs_get_encryption_info(struct inode *inode)
char mode; char mode;
int res; int res;
if (fi->i_crypt_info)
return 0;
res = f2fs_crypto_initialize(); res = f2fs_crypto_initialize();
if (res) if (res)
return res; return res;
retry:
crypt_info = ACCESS_ONCE(fi->i_crypt_info);
if (crypt_info) {
if (!crypt_info->ci_keyring_key ||
key_validate(crypt_info->ci_keyring_key) == 0)
return 0;
f2fs_free_encryption_info(inode, crypt_info);
goto retry;
}
res = f2fs_getxattr(inode, F2FS_XATTR_INDEX_ENCRYPTION, res = f2fs_getxattr(inode, F2FS_XATTR_INDEX_ENCRYPTION,
F2FS_XATTR_NAME_ENCRYPTION_CONTEXT, F2FS_XATTR_NAME_ENCRYPTION_CONTEXT,
@ -159,7 +152,6 @@ retry:
crypt_info->ci_data_mode = ctx.contents_encryption_mode; crypt_info->ci_data_mode = ctx.contents_encryption_mode;
crypt_info->ci_filename_mode = ctx.filenames_encryption_mode; crypt_info->ci_filename_mode = ctx.filenames_encryption_mode;
crypt_info->ci_ctfm = NULL; crypt_info->ci_ctfm = NULL;
crypt_info->ci_keyring_key = NULL;
memcpy(crypt_info->ci_master_key, ctx.master_key_descriptor, memcpy(crypt_info->ci_master_key, ctx.master_key_descriptor,
sizeof(crypt_info->ci_master_key)); sizeof(crypt_info->ci_master_key));
if (S_ISREG(inode->i_mode)) if (S_ISREG(inode->i_mode))
@ -197,7 +189,6 @@ retry:
keyring_key = NULL; keyring_key = NULL;
goto out; goto out;
} }
crypt_info->ci_keyring_key = keyring_key;
BUG_ON(keyring_key->type != &key_type_logon); BUG_ON(keyring_key->type != &key_type_logon);
ukp = user_key_payload(keyring_key); ukp = user_key_payload(keyring_key);
if (ukp->datalen != sizeof(struct f2fs_encryption_key)) { if (ukp->datalen != sizeof(struct f2fs_encryption_key)) {
@ -230,17 +221,12 @@ retry:
if (res) if (res)
goto out; goto out;
memzero_explicit(raw_key, sizeof(raw_key)); if (cmpxchg(&fi->i_crypt_info, NULL, crypt_info) == NULL)
if (cmpxchg(&fi->i_crypt_info, NULL, crypt_info) != NULL) { crypt_info = NULL;
f2fs_free_crypt_info(crypt_info);
goto retry;
}
return 0;
out: out:
if (res == -ENOKEY && !S_ISREG(inode->i_mode)) if (res == -ENOKEY && !S_ISREG(inode->i_mode))
res = 0; res = 0;
key_put(keyring_key);
f2fs_free_crypt_info(crypt_info); f2fs_free_crypt_info(crypt_info);
memzero_explicit(raw_key, sizeof(raw_key)); memzero_explicit(raw_key, sizeof(raw_key));
return res; return res;

View file

@ -2149,7 +2149,6 @@ void f2fs_end_io_crypto_work(struct f2fs_crypto_ctx *, struct bio *);
/* crypto_key.c */ /* crypto_key.c */
void f2fs_free_encryption_info(struct inode *, struct f2fs_crypt_info *); void f2fs_free_encryption_info(struct inode *, struct f2fs_crypt_info *);
int _f2fs_get_encryption_info(struct inode *inode);
/* crypto_fname.c */ /* crypto_fname.c */
bool f2fs_valid_filenames_enc_mode(uint32_t); bool f2fs_valid_filenames_enc_mode(uint32_t);
@ -2170,18 +2169,7 @@ void f2fs_exit_crypto(void);
int f2fs_has_encryption_key(struct inode *); int f2fs_has_encryption_key(struct inode *);
static inline int f2fs_get_encryption_info(struct inode *inode) int f2fs_get_encryption_info(struct inode *inode);
{
struct f2fs_crypt_info *ci = F2FS_I(inode)->i_crypt_info;
if (!ci ||
(ci->ci_keyring_key &&
(ci->ci_keyring_key->flags & ((1 << KEY_FLAG_INVALIDATED) |
(1 << KEY_FLAG_REVOKED) |
(1 << KEY_FLAG_DEAD)))))
return _f2fs_get_encryption_info(inode);
return 0;
}
void f2fs_fname_crypto_free_buffer(struct f2fs_str *); void f2fs_fname_crypto_free_buffer(struct f2fs_str *);
int f2fs_fname_setup_filename(struct inode *, const struct qstr *, int f2fs_fname_setup_filename(struct inode *, const struct qstr *,

View file

@ -79,7 +79,6 @@ struct f2fs_crypt_info {
char ci_filename_mode; char ci_filename_mode;
char ci_flags; char ci_flags;
struct crypto_ablkcipher *ci_ctfm; struct crypto_ablkcipher *ci_ctfm;
struct key *ci_keyring_key;
char ci_master_key[F2FS_KEY_DESCRIPTOR_SIZE]; char ci_master_key[F2FS_KEY_DESCRIPTOR_SIZE];
}; };

View file

@ -1800,12 +1800,11 @@ static void switched_to_dl(struct rq *rq, struct task_struct *p)
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
if (p->nr_cpus_allowed > 1 && rq->dl.overloaded) if (p->nr_cpus_allowed > 1 && rq->dl.overloaded)
queue_push_tasks(rq); queue_push_tasks(rq);
#else #endif
if (dl_task(rq->curr)) if (dl_task(rq->curr))
check_preempt_curr_dl(rq, p, 0); check_preempt_curr_dl(rq, p, 0);
else else
resched_curr(rq); resched_curr(rq);
#endif
} }
} }

View file

@ -2235,10 +2235,9 @@ static void switched_to_rt(struct rq *rq, struct task_struct *p)
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
if (p->nr_cpus_allowed > 1 && rq->rt.overloaded) if (p->nr_cpus_allowed > 1 && rq->rt.overloaded)
queue_push_tasks(rq); queue_push_tasks(rq);
#else #endif /* CONFIG_SMP */
if (p->prio < rq->curr->prio) if (p->prio < rq->curr->prio)
resched_curr(rq); resched_curr(rq);
#endif /* CONFIG_SMP */
} }
} }

View file

@ -3030,6 +3030,11 @@ static int __net_init xfrm_net_init(struct net *net)
{ {
int rv; int rv;
/* Initialize the per-net locks here */
spin_lock_init(&net->xfrm.xfrm_state_lock);
rwlock_init(&net->xfrm.xfrm_policy_lock);
mutex_init(&net->xfrm.xfrm_cfg_mutex);
rv = xfrm_statistics_init(net); rv = xfrm_statistics_init(net);
if (rv < 0) if (rv < 0)
goto out_statistics; goto out_statistics;
@ -3046,11 +3051,6 @@ static int __net_init xfrm_net_init(struct net *net)
if (rv < 0) if (rv < 0)
goto out; goto out;
/* Initialize the per-net locks here */
spin_lock_init(&net->xfrm.xfrm_state_lock);
rwlock_init(&net->xfrm.xfrm_policy_lock);
mutex_init(&net->xfrm.xfrm_cfg_mutex);
return 0; return 0;
out: out:

View file

@ -412,7 +412,14 @@ static inline int xfrm_replay_verify_len(struct xfrm_replay_state_esn *replay_es
up = nla_data(rp); up = nla_data(rp);
ulen = xfrm_replay_state_esn_len(up); ulen = xfrm_replay_state_esn_len(up);
if (nla_len(rp) < ulen || xfrm_replay_state_esn_len(replay_esn) != ulen) /* Check the overall length and the internal bitmap length to avoid
* potential overflow. */
if (nla_len(rp) < ulen ||
xfrm_replay_state_esn_len(replay_esn) != ulen ||
replay_esn->bmp_len != up->bmp_len)
return -EINVAL;
if (up->replay_window > up->bmp_len * sizeof(__u32) * 8)
return -EINVAL; return -EINVAL;
return 0; return 0;