Magellan Linux

Contents of /trunk/kernel-alx-legacy/patches-4.9/0416-4.9.317-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3718 - (show annotations) (download)
Mon Oct 24 14:08:30 2022 UTC (19 months ago) by niro
File size: 10213 byte(s)
-linux-4.9.317
1 diff --git a/Makefile b/Makefile
2 index 24a0bb5416ff5..cc1a47220975b 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,6 +1,6 @@
6 VERSION = 4
7 PATCHLEVEL = 9
8 -SUBLEVEL = 316
9 +SUBLEVEL = 317
10 EXTRAVERSION =
11 NAME = Roaring Lionus
12
13 diff --git a/block/bio.c b/block/bio.c
14 index 4c18a68913deb..db3723675f5a0 100644
15 --- a/block/bio.c
16 +++ b/block/bio.c
17 @@ -1538,7 +1538,7 @@ struct bio *bio_copy_kern(struct request_queue *q, void *data, unsigned int len,
18 if (bytes > len)
19 bytes = len;
20
21 - page = alloc_page(q->bounce_gfp | gfp_mask);
22 + page = alloc_page(q->bounce_gfp | __GFP_ZERO | gfp_mask);
23 if (!page)
24 goto cleanup;
25
26 diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c
27 index 0fad6cf37bab4..b0f546f4b15ca 100644
28 --- a/drivers/char/tpm/tpm_ibmvtpm.c
29 +++ b/drivers/char/tpm/tpm_ibmvtpm.c
30 @@ -653,6 +653,7 @@ static int tpm_ibmvtpm_probe(struct vio_dev *vio_dev,
31 if (!wait_event_timeout(ibmvtpm->crq_queue.wq,
32 ibmvtpm->rtce_buf != NULL,
33 HZ)) {
34 + rc = -ENODEV;
35 dev_err(dev, "CRQ response timed out\n");
36 goto init_irq_cleanup;
37 }
38 diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
39 index 202c00b17df2d..dcae0ec973a91 100644
40 --- a/drivers/gpu/drm/i915/intel_pm.c
41 +++ b/drivers/gpu/drm/i915/intel_pm.c
42 @@ -2083,7 +2083,7 @@ hsw_compute_linetime_wm(const struct intel_crtc_state *cstate)
43 PIPE_WM_LINETIME_TIME(linetime);
44 }
45
46 -static void intel_read_wm_latency(struct drm_device *dev, uint16_t wm[8])
47 +static void intel_read_wm_latency(struct drm_device *dev, uint16_t wm[])
48 {
49 struct drm_i915_private *dev_priv = to_i915(dev);
50
51 diff --git a/drivers/i2c/busses/i2c-thunderx-pcidrv.c b/drivers/i2c/busses/i2c-thunderx-pcidrv.c
52 index bba5b429f69c9..3298483bb9b41 100644
53 --- a/drivers/i2c/busses/i2c-thunderx-pcidrv.c
54 +++ b/drivers/i2c/busses/i2c-thunderx-pcidrv.c
55 @@ -208,6 +208,7 @@ static int thunder_i2c_probe_pci(struct pci_dev *pdev,
56 i2c->adap.bus_recovery_info = &octeon_i2c_recovery_info;
57 i2c->adap.dev.parent = dev;
58 i2c->adap.dev.of_node = pdev->dev.of_node;
59 + i2c->adap.dev.fwnode = dev->fwnode;
60 snprintf(i2c->adap.name, sizeof(i2c->adap.name),
61 "Cavium ThunderX i2c adapter at %s", dev_name(dev));
62 i2c_set_adapdata(&i2c->adap, i2c);
63 diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
64 index 0aedd0ebccec1..13a5fcca28330 100644
65 --- a/drivers/md/dm-crypt.c
66 +++ b/drivers/md/dm-crypt.c
67 @@ -1943,6 +1943,11 @@ static int crypt_map(struct dm_target *ti, struct bio *bio)
68 return DM_MAPIO_SUBMITTED;
69 }
70
71 +static char hex2asc(unsigned char c)
72 +{
73 + return c + '0' + ((unsigned)(9 - c) >> 4 & 0x27);
74 +}
75 +
76 static void crypt_status(struct dm_target *ti, status_type_t type,
77 unsigned status_flags, char *result, unsigned maxlen)
78 {
79 @@ -1958,10 +1963,12 @@ static void crypt_status(struct dm_target *ti, status_type_t type,
80 case STATUSTYPE_TABLE:
81 DMEMIT("%s ", cc->cipher_string);
82
83 - if (cc->key_size > 0)
84 - for (i = 0; i < cc->key_size; i++)
85 - DMEMIT("%02x", cc->key[i]);
86 - else
87 + if (cc->key_size > 0) {
88 + for (i = 0; i < cc->key_size; i++) {
89 + DMEMIT("%c%c", hex2asc(cc->key[i] >> 4),
90 + hex2asc(cc->key[i] & 0xf));
91 + }
92 + } else
93 DMEMIT("-");
94
95 DMEMIT(" %llu %s %llu", (unsigned long long)cc->iv_offset,
96 diff --git a/drivers/md/dm-stats.c b/drivers/md/dm-stats.c
97 index 0250e7e521abc..fdd4a840b30fa 100644
98 --- a/drivers/md/dm-stats.c
99 +++ b/drivers/md/dm-stats.c
100 @@ -228,6 +228,7 @@ void dm_stats_cleanup(struct dm_stats *stats)
101 atomic_read(&shared->in_flight[READ]),
102 atomic_read(&shared->in_flight[WRITE]));
103 }
104 + cond_resched();
105 }
106 dm_stat_free(&s->rcu_head);
107 }
108 @@ -316,6 +317,7 @@ static int dm_stats_create(struct dm_stats *stats, sector_t start, sector_t end,
109 for (ni = 0; ni < n_entries; ni++) {
110 atomic_set(&s->stat_shared[ni].in_flight[READ], 0);
111 atomic_set(&s->stat_shared[ni].in_flight[WRITE], 0);
112 + cond_resched();
113 }
114
115 if (s->n_histogram_entries) {
116 @@ -328,6 +330,7 @@ static int dm_stats_create(struct dm_stats *stats, sector_t start, sector_t end,
117 for (ni = 0; ni < n_entries; ni++) {
118 s->stat_shared[ni].tmp.histogram = hi;
119 hi += s->n_histogram_entries + 1;
120 + cond_resched();
121 }
122 }
123
124 @@ -348,6 +351,7 @@ static int dm_stats_create(struct dm_stats *stats, sector_t start, sector_t end,
125 for (ni = 0; ni < n_entries; ni++) {
126 p[ni].histogram = hi;
127 hi += s->n_histogram_entries + 1;
128 + cond_resched();
129 }
130 }
131 }
132 @@ -477,6 +481,7 @@ static int dm_stats_list(struct dm_stats *stats, const char *program,
133 }
134 DMEMIT("\n");
135 }
136 + cond_resched();
137 }
138 mutex_unlock(&stats->mutex);
139
140 @@ -753,6 +758,7 @@ static void __dm_stat_clear(struct dm_stat *s, size_t idx_start, size_t idx_end,
141 local_irq_enable();
142 }
143 }
144 + cond_resched();
145 }
146 }
147
148 @@ -868,6 +874,8 @@ static int dm_stats_print(struct dm_stats *stats, int id,
149
150 if (unlikely(sz + 1 >= maxlen))
151 goto buffer_overflow;
152 +
153 + cond_resched();
154 }
155
156 if (clear)
157 diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c
158 index 727f9e5719555..bd9d9f183e4b9 100644
159 --- a/drivers/md/dm-verity-target.c
160 +++ b/drivers/md/dm-verity-target.c
161 @@ -1056,6 +1056,7 @@ bad:
162
163 static struct target_type verity_target = {
164 .name = "verity",
165 + .features = DM_TARGET_IMMUTABLE,
166 .version = {1, 3, 0},
167 .module = THIS_MODULE,
168 .ctr = verity_ctr,
169 diff --git a/fs/exec.c b/fs/exec.c
170 index 482a8b4f41a5b..19f8b075d3b6b 100644
171 --- a/fs/exec.c
172 +++ b/fs/exec.c
173 @@ -1758,6 +1758,9 @@ static int do_execveat_common(int fd, struct filename *filename,
174 goto out_unmark;
175
176 bprm->argc = count(argv, MAX_ARG_STRINGS);
177 + if (bprm->argc == 0)
178 + pr_warn_once("process '%s' launched '%s' with NULL argv: empty string added\n",
179 + current->comm, bprm->filename);
180 if ((retval = bprm->argc) < 0)
181 goto out;
182
183 @@ -1782,6 +1785,20 @@ static int do_execveat_common(int fd, struct filename *filename,
184 if (retval < 0)
185 goto out;
186
187 + /*
188 + * When argv is empty, add an empty string ("") as argv[0] to
189 + * ensure confused userspace programs that start processing
190 + * from argv[1] won't end up walking envp. See also
191 + * bprm_stack_limits().
192 + */
193 + if (bprm->argc == 0) {
194 + const char *argv[] = { "", NULL };
195 + retval = copy_strings_kernel(1, argv, bprm);
196 + if (retval < 0)
197 + goto out;
198 + bprm->argc = 1;
199 + }
200 +
201 retval = exec_binprm(bprm);
202 if (retval < 0)
203 goto out;
204 diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
205 index d9381ca0ac479..b13649c63653f 100644
206 --- a/fs/nfsd/nfs4state.c
207 +++ b/fs/nfsd/nfs4state.c
208 @@ -6342,16 +6342,12 @@ nfsd4_release_lockowner(struct svc_rqst *rqstp,
209 if (sop->so_is_open_owner || !same_owner_str(sop, owner))
210 continue;
211
212 - /* see if there are still any locks associated with it */
213 - lo = lockowner(sop);
214 - list_for_each_entry(stp, &sop->so_stateids, st_perstateowner) {
215 - if (check_for_locks(stp->st_stid.sc_file, lo)) {
216 - status = nfserr_locks_held;
217 - spin_unlock(&clp->cl_lock);
218 - return status;
219 - }
220 + if (atomic_read(&sop->so_count) != 1) {
221 + spin_unlock(&clp->cl_lock);
222 + return nfserr_locks_held;
223 }
224
225 + lo = lockowner(sop);
226 nfs4_get_stateowner(sop);
227 break;
228 }
229 diff --git a/lib/assoc_array.c b/lib/assoc_array.c
230 index 3b46c5433b7ac..70ef5fdd11c79 100644
231 --- a/lib/assoc_array.c
232 +++ b/lib/assoc_array.c
233 @@ -1478,6 +1478,7 @@ int assoc_array_gc(struct assoc_array *array,
234 struct assoc_array_ptr *cursor, *ptr;
235 struct assoc_array_ptr *new_root, *new_parent, **new_ptr_pp;
236 unsigned long nr_leaves_on_tree;
237 + bool retained;
238 int keylen, slot, nr_free, next_slot, i;
239
240 pr_devel("-->%s()\n", __func__);
241 @@ -1554,6 +1555,7 @@ continue_node:
242 goto descend;
243 }
244
245 +retry_compress:
246 pr_devel("-- compress node %p --\n", new_n);
247
248 /* Count up the number of empty slots in this node and work out the
249 @@ -1571,6 +1573,7 @@ continue_node:
250 pr_devel("free=%d, leaves=%lu\n", nr_free, new_n->nr_leaves_on_branch);
251
252 /* See what we can fold in */
253 + retained = false;
254 next_slot = 0;
255 for (slot = 0; slot < ASSOC_ARRAY_FAN_OUT; slot++) {
256 struct assoc_array_shortcut *s;
257 @@ -1620,9 +1623,14 @@ continue_node:
258 pr_devel("[%d] retain node %lu/%d [nx %d]\n",
259 slot, child->nr_leaves_on_branch, nr_free + 1,
260 next_slot);
261 + retained = true;
262 }
263 }
264
265 + if (retained && new_n->nr_leaves_on_branch <= ASSOC_ARRAY_FAN_OUT) {
266 + pr_devel("internal nodes remain despite enough space, retrying\n");
267 + goto retry_compress;
268 + }
269 pr_devel("after: %lu\n", new_n->nr_leaves_on_branch);
270
271 nr_leaves_on_tree = new_n->nr_leaves_on_branch;
272 diff --git a/net/core/filter.c b/net/core/filter.c
273 index 94bf897485db0..799ac1fb46f2d 100644
274 --- a/net/core/filter.c
275 +++ b/net/core/filter.c
276 @@ -1388,7 +1388,7 @@ BPF_CALL_5(bpf_skb_store_bytes, struct sk_buff *, skb, u32, offset,
277
278 if (unlikely(flags & ~(BPF_F_RECOMPUTE_CSUM | BPF_F_INVALIDATE_HASH)))
279 return -EINVAL;
280 - if (unlikely(offset > 0xffff))
281 + if (unlikely(offset > INT_MAX))
282 return -EFAULT;
283 if (unlikely(bpf_try_make_writable(skb, offset + len)))
284 return -EFAULT;
285 @@ -1423,7 +1423,7 @@ BPF_CALL_4(bpf_skb_load_bytes, const struct sk_buff *, skb, u32, offset,
286 {
287 void *ptr;
288
289 - if (unlikely(offset > 0xffff))
290 + if (unlikely(offset > INT_MAX))
291 goto err_clear;
292
293 ptr = skb_header_pointer(skb, offset, len, to);
294 diff --git a/net/key/af_key.c b/net/key/af_key.c
295 index 776f94ecbfe6d..d5dc614af2f91 100644
296 --- a/net/key/af_key.c
297 +++ b/net/key/af_key.c
298 @@ -2935,7 +2935,7 @@ static int count_ah_combs(const struct xfrm_tmpl *t)
299 break;
300 if (!aalg->pfkey_supported)
301 continue;
302 - if (aalg_tmpl_set(t, aalg))
303 + if (aalg_tmpl_set(t, aalg) && aalg->available)
304 sz += sizeof(struct sadb_comb);
305 }
306 return sz + sizeof(struct sadb_prop);
307 @@ -2953,7 +2953,7 @@ static int count_esp_combs(const struct xfrm_tmpl *t)
308 if (!ealg->pfkey_supported)
309 continue;
310
311 - if (!(ealg_tmpl_set(t, ealg)))
312 + if (!(ealg_tmpl_set(t, ealg) && ealg->available))
313 continue;
314
315 for (k = 1; ; k++) {
316 @@ -2964,7 +2964,7 @@ static int count_esp_combs(const struct xfrm_tmpl *t)
317 if (!aalg->pfkey_supported)
318 continue;
319
320 - if (aalg_tmpl_set(t, aalg))
321 + if (aalg_tmpl_set(t, aalg) && aalg->available)
322 sz += sizeof(struct sadb_comb);
323 }
324 }