Contents of /trunk/kernel-alx/patches-4.9/0155-4.9.56-all-fixes.patch
Parent Directory | Revision Log
Revision 3040 -
(show annotations)
(download)
Wed Dec 20 11:48:59 2017 UTC (6 years, 9 months ago) by niro
File size: 2202 byte(s)
Wed Dec 20 11:48:59 2017 UTC (6 years, 9 months ago) by niro
File size: 2202 byte(s)
-linux-4.9.56
1 | diff --git a/Makefile b/Makefile |
2 | index 2a995675d6bf..feab5f5a507c 100644 |
3 | --- a/Makefile |
4 | +++ b/Makefile |
5 | @@ -1,6 +1,6 @@ |
6 | VERSION = 4 |
7 | PATCHLEVEL = 9 |
8 | -SUBLEVEL = 55 |
9 | +SUBLEVEL = 56 |
10 | EXTRAVERSION = |
11 | NAME = Roaring Lionus |
12 | |
13 | diff --git a/net/core/filter.c b/net/core/filter.c |
14 | index bfeedbbde214..4eb4ce0aeef4 100644 |
15 | --- a/net/core/filter.c |
16 | +++ b/net/core/filter.c |
17 | @@ -937,31 +937,20 @@ void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp) |
18 | /* try to charge the socket memory if there is space available |
19 | * return true on success |
20 | */ |
21 | -static bool __sk_filter_charge(struct sock *sk, struct sk_filter *fp) |
22 | +bool sk_filter_charge(struct sock *sk, struct sk_filter *fp) |
23 | { |
24 | u32 filter_size = bpf_prog_size(fp->prog->len); |
25 | |
26 | /* same check as in sock_kmalloc() */ |
27 | if (filter_size <= sysctl_optmem_max && |
28 | atomic_read(&sk->sk_omem_alloc) + filter_size < sysctl_optmem_max) { |
29 | + atomic_inc(&fp->refcnt); |
30 | atomic_add(filter_size, &sk->sk_omem_alloc); |
31 | return true; |
32 | } |
33 | return false; |
34 | } |
35 | |
36 | -bool sk_filter_charge(struct sock *sk, struct sk_filter *fp) |
37 | -{ |
38 | - if (!atomic_inc_not_zero(&fp->refcnt)) |
39 | - return false; |
40 | - |
41 | - if (!__sk_filter_charge(sk, fp)) { |
42 | - sk_filter_release(fp); |
43 | - return false; |
44 | - } |
45 | - return true; |
46 | -} |
47 | - |
48 | static struct bpf_prog *bpf_migrate_filter(struct bpf_prog *fp) |
49 | { |
50 | struct sock_filter *old_prog; |
51 | diff --git a/net/core/sock.c b/net/core/sock.c |
52 | index 2a77cc50f021..231c38d91855 100644 |
53 | --- a/net/core/sock.c |
54 | +++ b/net/core/sock.c |
55 | @@ -1528,16 +1528,13 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority) |
56 | sock_reset_flag(newsk, SOCK_DONE); |
57 | skb_queue_head_init(&newsk->sk_error_queue); |
58 | |
59 | - rcu_read_lock(); |
60 | - filter = rcu_dereference(sk->sk_filter); |
61 | + filter = rcu_dereference_protected(newsk->sk_filter, 1); |
62 | if (filter != NULL) |
63 | /* though it's an empty new sock, the charging may fail |
64 | * if sysctl_optmem_max was changed between creation of |
65 | * original socket and cloning |
66 | */ |
67 | is_charged = sk_filter_charge(newsk, filter); |
68 | - RCU_INIT_POINTER(newsk->sk_filter, filter); |
69 | - rcu_read_unlock(); |
70 | |
71 | if (unlikely(!is_charged || xfrm_sk_clone_policy(newsk, sk))) { |
72 | /* We need to make sure that we don't uncharge the new |