mirror of
https://github.com/torvalds/linux.git
synced 2024-12-26 12:52:30 +00:00
ppp: fix out-of-bounds access in bpf_prog_create()
sock_fprog_kern::len is in units of struct sock_filter, not bytes.
Fixes: 3e859adf36
("compat_ioctl: unify copy-in of ppp filters")
Reported-by: syzbot+eb853b51b10f1befa0b7@syzkaller.appspotmail.com
Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
a116f4e238
commit
0033b34a03
@ -564,8 +564,9 @@ static struct bpf_prog *get_filter(struct sock_fprog *uprog)
|
||||
return NULL;
|
||||
|
||||
/* uprog->len is unsigned short, so no overflow here */
|
||||
fprog.len = uprog->len * sizeof(struct sock_filter);
|
||||
fprog.filter = memdup_user(uprog->filter, fprog.len);
|
||||
fprog.len = uprog->len;
|
||||
fprog.filter = memdup_user(uprog->filter,
|
||||
uprog->len * sizeof(struct sock_filter));
|
||||
if (IS_ERR(fprog.filter))
|
||||
return ERR_CAST(fprog.filter);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user