Magellan Linux

Annotation of /trunk/kernel-alx/patches-4.9/0292-4.9.193-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3567 - (hide annotations) (download)
Thu Aug 13 10:21:11 2020 UTC (3 years, 10 months ago) by niro
File size: 13157 byte(s)
linux-193
1 niro 3567 diff --git a/Makefile b/Makefile
2     index 946951930f62..48f79c6729ad 100644
3     --- a/Makefile
4     +++ b/Makefile
5     @@ -1,6 +1,6 @@
6     VERSION = 4
7     PATCHLEVEL = 9
8     -SUBLEVEL = 192
9     +SUBLEVEL = 193
10     EXTRAVERSION =
11     NAME = Roaring Lionus
12    
13     diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
14     index 609f0e87ced7..47c6c0401b3a 100644
15     --- a/arch/powerpc/kernel/process.c
16     +++ b/arch/powerpc/kernel/process.c
17     @@ -476,13 +476,14 @@ void giveup_all(struct task_struct *tsk)
18     if (!tsk->thread.regs)
19     return;
20    
21     + check_if_tm_restore_required(tsk);
22     +
23     usermsr = tsk->thread.regs->msr;
24    
25     if ((usermsr & msr_all_available) == 0)
26     return;
27    
28     msr_check_and_set(msr_all_available);
29     - check_if_tm_restore_required(tsk);
30    
31     #ifdef CONFIG_PPC_FPU
32     if (usermsr & MSR_FP)
33     diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c
34     index 14071a57c926..f5d74e8db432 100644
35     --- a/drivers/clk/clk-s2mps11.c
36     +++ b/drivers/clk/clk-s2mps11.c
37     @@ -255,7 +255,7 @@ MODULE_DEVICE_TABLE(platform, s2mps11_clk_id);
38     * This requires of_device_id table. In the same time this will not change the
39     * actual *device* matching so do not add .of_match_table.
40     */
41     -static const struct of_device_id s2mps11_dt_match[] = {
42     +static const struct of_device_id s2mps11_dt_match[] __used = {
43     {
44     .compatible = "samsung,s2mps11-clk",
45     .data = (void *)S2MPS11X,
46     diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
47     index 77df50dd6d30..123d85de80d6 100644
48     --- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
49     +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
50     @@ -264,7 +264,7 @@ static int vmw_recv_msg(struct rpc_channel *channel, void **msg,
51    
52     if ((HIGH_WORD(ebx) & MESSAGE_STATUS_SUCCESS) == 0) {
53     kfree(reply);
54     -
55     + reply = NULL;
56     if ((HIGH_WORD(ebx) & MESSAGE_STATUS_CPT) != 0) {
57     /* A checkpoint occurred. Retry. */
58     continue;
59     @@ -288,7 +288,7 @@ static int vmw_recv_msg(struct rpc_channel *channel, void **msg,
60    
61     if ((HIGH_WORD(ecx) & MESSAGE_STATUS_SUCCESS) == 0) {
62     kfree(reply);
63     -
64     + reply = NULL;
65     if ((HIGH_WORD(ecx) & MESSAGE_STATUS_CPT) != 0) {
66     /* A checkpoint occurred. Retry. */
67     continue;
68     @@ -300,10 +300,8 @@ static int vmw_recv_msg(struct rpc_channel *channel, void **msg,
69     break;
70     }
71    
72     - if (retries == RETRIES) {
73     - kfree(reply);
74     + if (!reply)
75     return -EINVAL;
76     - }
77    
78     *msg_len = reply_len;
79     *msg = reply;
80     diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c
81     index 3cc98c07dcd3..682fc58e1f75 100644
82     --- a/drivers/vhost/test.c
83     +++ b/drivers/vhost/test.c
84     @@ -23,6 +23,12 @@
85     * Using this limit prevents one virtqueue from starving others. */
86     #define VHOST_TEST_WEIGHT 0x80000
87    
88     +/* Max number of packets transferred before requeueing the job.
89     + * Using this limit prevents one virtqueue from starving others with
90     + * pkts.
91     + */
92     +#define VHOST_TEST_PKT_WEIGHT 256
93     +
94     enum {
95     VHOST_TEST_VQ = 0,
96     VHOST_TEST_VQ_MAX = 1,
97     @@ -81,10 +87,8 @@ static void handle_vq(struct vhost_test *n)
98     }
99     vhost_add_used_and_signal(&n->dev, vq, head, 0);
100     total_len += len;
101     - if (unlikely(total_len >= VHOST_TEST_WEIGHT)) {
102     - vhost_poll_queue(&vq->poll);
103     + if (unlikely(vhost_exceeds_weight(vq, 0, total_len)))
104     break;
105     - }
106     }
107    
108     mutex_unlock(&vq->mutex);
109     @@ -116,7 +120,8 @@ static int vhost_test_open(struct inode *inode, struct file *f)
110     dev = &n->dev;
111     vqs[VHOST_TEST_VQ] = &n->vqs[VHOST_TEST_VQ];
112     n->vqs[VHOST_TEST_VQ].handle_kick = handle_vq_kick;
113     - vhost_dev_init(dev, vqs, VHOST_TEST_VQ_MAX);
114     + vhost_dev_init(dev, vqs, VHOST_TEST_VQ_MAX,
115     + VHOST_TEST_PKT_WEIGHT, VHOST_TEST_WEIGHT);
116    
117     f->private_data = n;
118    
119     diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
120     index 8da95d4ac4b7..b14e62f11075 100644
121     --- a/drivers/vhost/vhost.c
122     +++ b/drivers/vhost/vhost.c
123     @@ -1987,7 +1987,7 @@ static int get_indirect(struct vhost_virtqueue *vq,
124     /* If this is an input descriptor, increment that count. */
125     if (access == VHOST_ACCESS_WO) {
126     *in_num += ret;
127     - if (unlikely(log)) {
128     + if (unlikely(log && ret)) {
129     log[*log_num].addr = vhost64_to_cpu(vq, desc.addr);
130     log[*log_num].len = vhost32_to_cpu(vq, desc.len);
131     ++*log_num;
132     @@ -2123,7 +2123,7 @@ int vhost_get_vq_desc(struct vhost_virtqueue *vq,
133     /* If this is an input descriptor,
134     * increment that count. */
135     *in_num += ret;
136     - if (unlikely(log)) {
137     + if (unlikely(log && ret)) {
138     log[*log_num].addr = vhost64_to_cpu(vq, desc.addr);
139     log[*log_num].len = vhost32_to_cpu(vq, desc.len);
140     ++*log_num;
141     diff --git a/include/net/ipv6_frag.h b/include/net/ipv6_frag.h
142     index 28aa9b30aece..1f77fb4dc79d 100644
143     --- a/include/net/ipv6_frag.h
144     +++ b/include/net/ipv6_frag.h
145     @@ -94,7 +94,6 @@ ip6frag_expire_frag_queue(struct net *net, struct frag_queue *fq)
146     goto out;
147    
148     head->dev = dev;
149     - skb_get(head);
150     spin_unlock(&fq->q.lock);
151    
152     icmpv6_send(head, ICMPV6_TIME_EXCEED, ICMPV6_EXC_FRAGTIME, 0);
153     diff --git a/include/net/xfrm.h b/include/net/xfrm.h
154     index 835c30e491c8..9e2f260cbb51 100644
155     --- a/include/net/xfrm.h
156     +++ b/include/net/xfrm.h
157     @@ -1297,6 +1297,23 @@ static inline int xfrm_state_kern(const struct xfrm_state *x)
158     return atomic_read(&x->tunnel_users);
159     }
160    
161     +static inline bool xfrm_id_proto_valid(u8 proto)
162     +{
163     + switch (proto) {
164     + case IPPROTO_AH:
165     + case IPPROTO_ESP:
166     + case IPPROTO_COMP:
167     +#if IS_ENABLED(CONFIG_IPV6)
168     + case IPPROTO_ROUTING:
169     + case IPPROTO_DSTOPTS:
170     +#endif
171     + return true;
172     + default:
173     + return false;
174     + }
175     +}
176     +
177     +/* IPSEC_PROTO_ANY only matches 3 IPsec protocols, 0 could match all. */
178     static inline int xfrm_id_proto_match(u8 proto, u8 userproto)
179     {
180     return (!userproto || proto == userproto ||
181     diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
182     index 924bb307c0fa..b314feaf91f4 100644
183     --- a/kernel/sched/fair.c
184     +++ b/kernel/sched/fair.c
185     @@ -3882,6 +3882,8 @@ static void __account_cfs_rq_runtime(struct cfs_rq *cfs_rq, u64 delta_exec)
186     if (likely(cfs_rq->runtime_remaining > 0))
187     return;
188    
189     + if (cfs_rq->throttled)
190     + return;
191     /*
192     * if we're unable to extend our runtime we resched so that the active
193     * hierarchy can be throttled
194     @@ -4077,6 +4079,9 @@ static u64 distribute_cfs_runtime(struct cfs_bandwidth *cfs_b,
195     if (!cfs_rq_throttled(cfs_rq))
196     goto next;
197    
198     + /* By the above check, this should never be true */
199     + SCHED_WARN_ON(cfs_rq->runtime_remaining > 0);
200     +
201     runtime = -cfs_rq->runtime_remaining + 1;
202     if (runtime > remaining)
203     runtime = remaining;
204     diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
205     index 1ae8c59fcb2d..780700fcbe63 100644
206     --- a/net/batman-adv/bat_iv_ogm.c
207     +++ b/net/batman-adv/bat_iv_ogm.c
208     @@ -450,17 +450,23 @@ static u8 batadv_hop_penalty(u8 tq, const struct batadv_priv *bat_priv)
209     * batadv_iv_ogm_aggr_packet - checks if there is another OGM attached
210     * @buff_pos: current position in the skb
211     * @packet_len: total length of the skb
212     - * @tvlv_len: tvlv length of the previously considered OGM
213     + * @ogm_packet: potential OGM in buffer
214     *
215     * Return: true if there is enough space for another OGM, false otherwise.
216     */
217     -static bool batadv_iv_ogm_aggr_packet(int buff_pos, int packet_len,
218     - __be16 tvlv_len)
219     +static bool
220     +batadv_iv_ogm_aggr_packet(int buff_pos, int packet_len,
221     + const struct batadv_ogm_packet *ogm_packet)
222     {
223     int next_buff_pos = 0;
224    
225     - next_buff_pos += buff_pos + BATADV_OGM_HLEN;
226     - next_buff_pos += ntohs(tvlv_len);
227     + /* check if there is enough space for the header */
228     + next_buff_pos += buff_pos + sizeof(*ogm_packet);
229     + if (next_buff_pos > packet_len)
230     + return false;
231     +
232     + /* check if there is enough space for the optional TVLV */
233     + next_buff_pos += ntohs(ogm_packet->tvlv_len);
234    
235     return (next_buff_pos <= packet_len) &&
236     (next_buff_pos <= BATADV_MAX_AGGREGATION_BYTES);
237     @@ -488,7 +494,7 @@ static void batadv_iv_ogm_send_to_if(struct batadv_forw_packet *forw_packet,
238    
239     /* adjust all flags and log packets */
240     while (batadv_iv_ogm_aggr_packet(buff_pos, forw_packet->packet_len,
241     - batadv_ogm_packet->tvlv_len)) {
242     + batadv_ogm_packet)) {
243     /* we might have aggregated direct link packets with an
244     * ordinary base packet
245     */
246     @@ -1841,7 +1847,7 @@ static int batadv_iv_ogm_receive(struct sk_buff *skb,
247    
248     /* unpack the aggregated packets and process them one by one */
249     while (batadv_iv_ogm_aggr_packet(ogm_offset, skb_headlen(skb),
250     - ogm_packet->tvlv_len)) {
251     + ogm_packet)) {
252     batadv_iv_ogm_process(skb, ogm_offset, if_incoming);
253    
254     ogm_offset += BATADV_OGM_HLEN;
255     diff --git a/net/batman-adv/netlink.c b/net/batman-adv/netlink.c
256     index 64cb6acbe0a6..d7ba4fd24e3d 100644
257     --- a/net/batman-adv/netlink.c
258     +++ b/net/batman-adv/netlink.c
259     @@ -114,7 +114,7 @@ batadv_netlink_get_ifindex(const struct nlmsghdr *nlh, int attrtype)
260     {
261     struct nlattr *attr = nlmsg_find_attr(nlh, GENL_HDRLEN, attrtype);
262    
263     - return attr ? nla_get_u32(attr) : 0;
264     + return (attr && nla_len(attr) == sizeof(u32)) ? nla_get_u32(attr) : 0;
265     }
266    
267     /**
268     diff --git a/net/key/af_key.c b/net/key/af_key.c
269     index 36db179d848e..d2ec620319d7 100644
270     --- a/net/key/af_key.c
271     +++ b/net/key/af_key.c
272     @@ -1969,8 +1969,10 @@ parse_ipsecrequest(struct xfrm_policy *xp, struct sadb_x_ipsecrequest *rq)
273    
274     if (rq->sadb_x_ipsecrequest_mode == 0)
275     return -EINVAL;
276     + if (!xfrm_id_proto_valid(rq->sadb_x_ipsecrequest_proto))
277     + return -EINVAL;
278    
279     - t->id.proto = rq->sadb_x_ipsecrequest_proto; /* XXX check proto */
280     + t->id.proto = rq->sadb_x_ipsecrequest_proto;
281     if ((mode = pfkey_mode_to_xfrm(rq->sadb_x_ipsecrequest_mode)) < 0)
282     return -EINVAL;
283     t->mode = mode;
284     diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
285     index 884f2136b34b..3734ad56b456 100644
286     --- a/net/xfrm/xfrm_state.c
287     +++ b/net/xfrm/xfrm_state.c
288     @@ -2168,7 +2168,7 @@ void xfrm_state_fini(struct net *net)
289     unsigned int sz;
290    
291     flush_work(&net->xfrm.state_hash_work);
292     - xfrm_state_flush(net, IPSEC_PROTO_ANY, false);
293     + xfrm_state_flush(net, 0, false);
294     flush_work(&xfrm_state_gc_work);
295    
296     WARN_ON(!list_empty(&net->xfrm.state_all));
297     diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
298     index f3e9d500fa5a..ff641b2e1577 100644
299     --- a/net/xfrm/xfrm_user.c
300     +++ b/net/xfrm/xfrm_user.c
301     @@ -1452,20 +1452,8 @@ static int validate_tmpl(int nr, struct xfrm_user_tmpl *ut, u16 family)
302     return -EINVAL;
303     }
304    
305     - switch (ut[i].id.proto) {
306     - case IPPROTO_AH:
307     - case IPPROTO_ESP:
308     - case IPPROTO_COMP:
309     -#if IS_ENABLED(CONFIG_IPV6)
310     - case IPPROTO_ROUTING:
311     - case IPPROTO_DSTOPTS:
312     -#endif
313     - case IPSEC_PROTO_ANY:
314     - break;
315     - default:
316     + if (!xfrm_id_proto_valid(ut[i].id.proto))
317     return -EINVAL;
318     - }
319     -
320     }
321    
322     return 0;
323     diff --git a/scripts/decode_stacktrace.sh b/scripts/decode_stacktrace.sh
324     index 381acfc4c59d..98cf6343afcd 100755
325     --- a/scripts/decode_stacktrace.sh
326     +++ b/scripts/decode_stacktrace.sh
327     @@ -77,7 +77,7 @@ parse_symbol() {
328     fi
329    
330     # Strip out the base of the path
331     - code=${code//^$basepath/""}
332     + code=${code#$basepath/}
333    
334     # In the case of inlines, move everything to same line
335     code=${code//$'\n'/' '}
336     diff --git a/sound/pci/hda/hda_auto_parser.c b/sound/pci/hda/hda_auto_parser.c
337     index a03cf68d0bcd..12d87204e373 100644
338     --- a/sound/pci/hda/hda_auto_parser.c
339     +++ b/sound/pci/hda/hda_auto_parser.c
340     @@ -827,6 +827,8 @@ static void apply_fixup(struct hda_codec *codec, int id, int action, int depth)
341     while (id >= 0) {
342     const struct hda_fixup *fix = codec->fixup_list + id;
343    
344     + if (++depth > 10)
345     + break;
346     if (fix->chained_before)
347     apply_fixup(codec, fix->chain_id, action, depth + 1);
348    
349     @@ -866,8 +868,6 @@ static void apply_fixup(struct hda_codec *codec, int id, int action, int depth)
350     }
351     if (!fix->chained || fix->chained_before)
352     break;
353     - if (++depth > 10)
354     - break;
355     id = fix->chain_id;
356     }
357     }
358     diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
359     index 98594cbe34c8..949c90a859fa 100644
360     --- a/sound/pci/hda/hda_generic.c
361     +++ b/sound/pci/hda/hda_generic.c
362     @@ -5807,7 +5807,8 @@ int snd_hda_gen_init(struct hda_codec *codec)
363     if (spec->init_hook)
364     spec->init_hook(codec);
365    
366     - snd_hda_apply_verbs(codec);
367     + if (!spec->skip_verbs)
368     + snd_hda_apply_verbs(codec);
369    
370     init_multi_out(codec);
371     init_extra_out(codec);
372     diff --git a/sound/pci/hda/hda_generic.h b/sound/pci/hda/hda_generic.h
373     index 932b533feb48..6d1cb2fb447d 100644
374     --- a/sound/pci/hda/hda_generic.h
375     +++ b/sound/pci/hda/hda_generic.h
376     @@ -236,6 +236,7 @@ struct hda_gen_spec {
377     unsigned int indep_hp_enabled:1; /* independent HP enabled */
378     unsigned int have_aamix_ctl:1;
379     unsigned int hp_mic_jack_modes:1;
380     + unsigned int skip_verbs:1; /* don't apply verbs at snd_hda_gen_init() */
381    
382     /* additional mute flags (only effective with auto_mute_via_amp=1) */
383     u64 mute_bits;
384     diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
385     index 8e995fb27312..31322aeebcff 100644
386     --- a/sound/pci/hda/patch_realtek.c
387     +++ b/sound/pci/hda/patch_realtek.c
388     @@ -773,9 +773,11 @@ static int alc_init(struct hda_codec *codec)
389     if (spec->init_hook)
390     spec->init_hook(codec);
391    
392     + spec->gen.skip_verbs = 1; /* applied in below */
393     snd_hda_gen_init(codec);
394     alc_fix_pll(codec);
395     alc_auto_init_amp(codec, spec->init_amp);
396     + snd_hda_apply_verbs(codec); /* apply verbs here after own init */
397    
398     snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
399