Magellan Linux

Contents of /trunk/kernel-alx-legacy/patches-4.9/0250-4.9.151-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3608 - (show annotations) (download)
Fri Aug 14 07:34:29 2020 UTC (3 years, 9 months ago) by niro
File size: 14721 byte(s)
-added kerenl-alx-legacy pkg
1 diff --git a/Makefile b/Makefile
2 index 0e7874951ac5..f1aeb98f9ace 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,6 +1,6 @@
6 VERSION = 4
7 PATCHLEVEL = 9
8 -SUBLEVEL = 150
9 +SUBLEVEL = 151
10 EXTRAVERSION =
11 NAME = Roaring Lionus
12
13 diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
14 index 3a6c9b741b23..4f4c34892086 100644
15 --- a/drivers/acpi/power.c
16 +++ b/drivers/acpi/power.c
17 @@ -131,6 +131,23 @@ void acpi_power_resources_list_free(struct list_head *list)
18 }
19 }
20
21 +static bool acpi_power_resource_is_dup(union acpi_object *package,
22 + unsigned int start, unsigned int i)
23 +{
24 + acpi_handle rhandle, dup;
25 + unsigned int j;
26 +
27 + /* The caller is expected to check the package element types */
28 + rhandle = package->package.elements[i].reference.handle;
29 + for (j = start; j < i; j++) {
30 + dup = package->package.elements[j].reference.handle;
31 + if (dup == rhandle)
32 + return true;
33 + }
34 +
35 + return false;
36 +}
37 +
38 int acpi_extract_power_resources(union acpi_object *package, unsigned int start,
39 struct list_head *list)
40 {
41 @@ -150,6 +167,11 @@ int acpi_extract_power_resources(union acpi_object *package, unsigned int start,
42 err = -ENODEV;
43 break;
44 }
45 +
46 + /* Some ACPI tables contain duplicate power resource references */
47 + if (acpi_power_resource_is_dup(package, start, i))
48 + continue;
49 +
50 err = acpi_add_power_resource(rhandle);
51 if (err)
52 break;
53 diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
54 index ef3016a467a0..8a93ca4d6840 100644
55 --- a/drivers/block/rbd.c
56 +++ b/drivers/block/rbd.c
57 @@ -6346,7 +6346,6 @@ static ssize_t do_rbd_remove(struct bus_type *bus,
58 struct list_head *tmp;
59 int dev_id;
60 char opt_buf[6];
61 - bool already = false;
62 bool force = false;
63 int ret;
64
65 @@ -6379,13 +6378,13 @@ static ssize_t do_rbd_remove(struct bus_type *bus,
66 spin_lock_irq(&rbd_dev->lock);
67 if (rbd_dev->open_count && !force)
68 ret = -EBUSY;
69 - else
70 - already = test_and_set_bit(RBD_DEV_FLAG_REMOVING,
71 - &rbd_dev->flags);
72 + else if (test_and_set_bit(RBD_DEV_FLAG_REMOVING,
73 + &rbd_dev->flags))
74 + ret = -EINPROGRESS;
75 spin_unlock_irq(&rbd_dev->lock);
76 }
77 spin_unlock(&rbd_dev_list_lock);
78 - if (ret < 0 || already)
79 + if (ret)
80 return ret;
81
82 if (force) {
83 diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
84 index 6f638bbc922d..00e8e675cbeb 100644
85 --- a/drivers/i2c/i2c-dev.c
86 +++ b/drivers/i2c/i2c-dev.c
87 @@ -461,9 +461,15 @@ static long i2cdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
88 return i2cdev_ioctl_smbus(client, arg);
89
90 case I2C_RETRIES:
91 + if (arg > INT_MAX)
92 + return -EINVAL;
93 +
94 client->adapter->retries = arg;
95 break;
96 case I2C_TIMEOUT:
97 + if (arg > INT_MAX)
98 + return -EINVAL;
99 +
100 /* For historical reasons, user-space sets the timeout
101 * value in units of 10 ms.
102 */
103 diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
104 index 6c0bb38c4089..8d4d46f3fd16 100644
105 --- a/drivers/usb/class/cdc-acm.c
106 +++ b/drivers/usb/class/cdc-acm.c
107 @@ -1828,6 +1828,13 @@ static const struct usb_device_id acm_ids[] = {
108 .driver_info = IGNORE_DEVICE,
109 },
110
111 + { USB_DEVICE(0x1bc7, 0x0021), /* Telit 3G ACM only composition */
112 + .driver_info = SEND_ZERO_PACKET,
113 + },
114 + { USB_DEVICE(0x1bc7, 0x0023), /* Telit 3G ACM + ECM composition */
115 + .driver_info = SEND_ZERO_PACKET,
116 + },
117 +
118 /* control interfaces without any protocol set */
119 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM,
120 USB_CDC_PROTO_NONE) },
121 diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
122 index cf378b1ed373..733479ddf8a7 100644
123 --- a/drivers/usb/core/quirks.c
124 +++ b/drivers/usb/core/quirks.c
125 @@ -240,7 +240,8 @@ static const struct usb_device_id usb_quirk_list[] = {
126 USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL },
127
128 /* Corsair K70 RGB */
129 - { USB_DEVICE(0x1b1c, 0x1b13), .driver_info = USB_QUIRK_DELAY_INIT },
130 + { USB_DEVICE(0x1b1c, 0x1b13), .driver_info = USB_QUIRK_DELAY_INIT |
131 + USB_QUIRK_DELAY_CTRL_MSG },
132
133 /* Corsair Strafe */
134 { USB_DEVICE(0x1b1c, 0x1b15), .driver_info = USB_QUIRK_DELAY_INIT |
135 diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
136 index 344ec8631481..13f2c051dbf2 100644
137 --- a/drivers/usb/storage/scsiglue.c
138 +++ b/drivers/usb/storage/scsiglue.c
139 @@ -251,8 +251,12 @@ static int slave_configure(struct scsi_device *sdev)
140 if (!(us->fflags & US_FL_NEEDS_CAP16))
141 sdev->try_rc_10_first = 1;
142
143 - /* assume SPC3 or latter devices support sense size > 18 */
144 - if (sdev->scsi_level > SCSI_SPC_2)
145 + /*
146 + * assume SPC3 or latter devices support sense size > 18
147 + * unless US_FL_BAD_SENSE quirk is specified.
148 + */
149 + if (sdev->scsi_level > SCSI_SPC_2 &&
150 + !(us->fflags & US_FL_BAD_SENSE))
151 us->fflags |= US_FL_SANE_SENSE;
152
153 /*
154 diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
155 index 0a86b3f3638e..c802aabcc58c 100644
156 --- a/drivers/usb/storage/unusual_devs.h
157 +++ b/drivers/usb/storage/unusual_devs.h
158 @@ -1284,6 +1284,18 @@ UNUSUAL_DEV( 0x090c, 0x1132, 0x0000, 0xffff,
159 USB_SC_DEVICE, USB_PR_DEVICE, NULL,
160 US_FL_FIX_CAPACITY ),
161
162 +/*
163 + * Reported by Icenowy Zheng <icenowy@aosc.io>
164 + * The SMI SM3350 USB-UFS bridge controller will enter a wrong state
165 + * that do not process read/write command if a long sense is requested,
166 + * so force to use 18-byte sense.
167 + */
168 +UNUSUAL_DEV( 0x090c, 0x3350, 0x0000, 0xffff,
169 + "SMI",
170 + "SM3350 UFS-to-USB-Mass-Storage bridge",
171 + USB_SC_DEVICE, USB_PR_DEVICE, NULL,
172 + US_FL_BAD_SENSE ),
173 +
174 /*
175 * Reported by Paul Hartman <paul.hartman+linux@gmail.com>
176 * This card reader returns "Illegal Request, Logical Block Address
177 diff --git a/fs/cifs/file.c b/fs/cifs/file.c
178 index 49eeed25f200..a3046b6523c8 100644
179 --- a/fs/cifs/file.c
180 +++ b/fs/cifs/file.c
181 @@ -1118,10 +1118,10 @@ cifs_push_mandatory_locks(struct cifsFileInfo *cfile)
182
183 /*
184 * Accessing maxBuf is racy with cifs_reconnect - need to store value
185 - * and check it for zero before using.
186 + * and check it before using.
187 */
188 max_buf = tcon->ses->server->maxBuf;
189 - if (!max_buf) {
190 + if (max_buf < (sizeof(struct smb_hdr) + sizeof(LOCKING_ANDX_RANGE))) {
191 free_xid(xid);
192 return -EINVAL;
193 }
194 @@ -1456,10 +1456,10 @@ cifs_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock,
195
196 /*
197 * Accessing maxBuf is racy with cifs_reconnect - need to store value
198 - * and check it for zero before using.
199 + * and check it before using.
200 */
201 max_buf = tcon->ses->server->maxBuf;
202 - if (!max_buf)
203 + if (max_buf < (sizeof(struct smb_hdr) + sizeof(LOCKING_ANDX_RANGE)))
204 return -EINVAL;
205
206 max_num = (max_buf - sizeof(struct smb_hdr)) /
207 diff --git a/fs/cifs/smb2file.c b/fs/cifs/smb2file.c
208 index b2aff0c6f22c..b7885dc0d9bb 100644
209 --- a/fs/cifs/smb2file.c
210 +++ b/fs/cifs/smb2file.c
211 @@ -123,10 +123,10 @@ smb2_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock,
212
213 /*
214 * Accessing maxBuf is racy with cifs_reconnect - need to store value
215 - * and check it for zero before using.
216 + * and check it before using.
217 */
218 max_buf = tcon->ses->server->maxBuf;
219 - if (!max_buf)
220 + if (max_buf < sizeof(struct smb2_lock_element))
221 return -EINVAL;
222
223 max_num = max_buf / sizeof(struct smb2_lock_element);
224 diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
225 index cc26d4138d70..de133eeebc8a 100644
226 --- a/fs/cifs/transport.c
227 +++ b/fs/cifs/transport.c
228 @@ -301,7 +301,7 @@ uncork:
229 if (rc < 0 && rc != -EINTR)
230 cifs_dbg(VFS, "Error %d sending data on socket to server\n",
231 rc);
232 - else
233 + else if (rc > 0)
234 rc = 0;
235
236 return rc;
237 diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
238 index 1008384d5ed5..9a13f86fed62 100644
239 --- a/fs/ext4/inline.c
240 +++ b/fs/ext4/inline.c
241 @@ -1859,12 +1859,12 @@ int ext4_inline_data_fiemap(struct inode *inode,
242 physical += (char *)ext4_raw_inode(&iloc) - iloc.bh->b_data;
243 physical += offsetof(struct ext4_inode, i_block);
244
245 - if (physical)
246 - error = fiemap_fill_next_extent(fieinfo, start, physical,
247 - inline_len, flags);
248 brelse(iloc.bh);
249 out:
250 up_read(&EXT4_I(inode)->xattr_sem);
251 + if (physical)
252 + error = fiemap_fill_next_extent(fieinfo, start, physical,
253 + inline_len, flags);
254 return (error < 0 ? error : 0);
255 }
256
257 diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
258 index f62eca8cbde0..4815be26b15f 100644
259 --- a/fs/ext4/inode.c
260 +++ b/fs/ext4/inode.c
261 @@ -2698,7 +2698,8 @@ static int ext4_writepages(struct address_space *mapping,
262 * We may need to convert up to one extent per block in
263 * the page and we may dirty the inode.
264 */
265 - rsv_blocks = 1 + (PAGE_SIZE >> inode->i_blkbits);
266 + rsv_blocks = 1 + ext4_chunk_trans_blocks(inode,
267 + PAGE_SIZE >> inode->i_blkbits);
268 }
269
270 /*
271 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
272 index 6810234b0b27..a6c7ace9cfd1 100644
273 --- a/fs/ext4/super.c
274 +++ b/fs/ext4/super.c
275 @@ -4679,7 +4679,7 @@ static int ext4_commit_super(struct super_block *sb, int sync)
276 ext4_superblock_csum_set(sb);
277 if (sync)
278 lock_buffer(sbh);
279 - if (buffer_write_io_error(sbh)) {
280 + if (buffer_write_io_error(sbh) || !buffer_uptodate(sbh)) {
281 /*
282 * Oh, dear. A previous attempt to write the
283 * superblock failed. This could happen because the
284 diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
285 index 102c84dcc11a..63eed9ac8fd7 100644
286 --- a/include/linux/sunrpc/svc.h
287 +++ b/include/linux/sunrpc/svc.h
288 @@ -291,9 +291,12 @@ struct svc_rqst {
289 struct svc_cacherep * rq_cacherep; /* cache info */
290 struct task_struct *rq_task; /* service thread */
291 spinlock_t rq_lock; /* per-request lock */
292 + struct net *rq_bc_net; /* pointer to backchannel's
293 + * net namespace
294 + */
295 };
296
297 -#define SVC_NET(svc_rqst) (svc_rqst->rq_xprt->xpt_net)
298 +#define SVC_NET(rqst) (rqst->rq_xprt ? rqst->rq_xprt->xpt_net : rqst->rq_bc_net)
299
300 /*
301 * Rigorous type checking on sockaddr type conversions
302 diff --git a/mm/slab.c b/mm/slab.c
303 index 263dcda6897b..354a09deecff 100644
304 --- a/mm/slab.c
305 +++ b/mm/slab.c
306 @@ -682,8 +682,10 @@ static struct alien_cache *__alloc_alien_cache(int node, int entries,
307 struct alien_cache *alc = NULL;
308
309 alc = kmalloc_node(memsize, gfp, node);
310 - init_arraycache(&alc->ac, entries, batch);
311 - spin_lock_init(&alc->lock);
312 + if (alc) {
313 + init_arraycache(&alc->ac, entries, batch);
314 + spin_lock_init(&alc->lock);
315 + }
316 return alc;
317 }
318
319 diff --git a/mm/util.c b/mm/util.c
320 index 8c755d05d4e6..07f467206186 100644
321 --- a/mm/util.c
322 +++ b/mm/util.c
323 @@ -389,7 +389,7 @@ bool page_mapped(struct page *page)
324 return true;
325 if (PageHuge(page))
326 return false;
327 - for (i = 0; i < hpage_nr_pages(page); i++) {
328 + for (i = 0; i < (1 << compound_order(page)); i++) {
329 if (atomic_read(&page[i]._mapcount) >= 0)
330 return true;
331 }
332 diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
333 index 272c34551979..eea18a124e4f 100644
334 --- a/net/sunrpc/svc.c
335 +++ b/net/sunrpc/svc.c
336 @@ -1137,6 +1137,8 @@ void svc_printk(struct svc_rqst *rqstp, const char *fmt, ...)
337 static __printf(2,3) void svc_printk(struct svc_rqst *rqstp, const char *fmt, ...) {}
338 #endif
339
340 +extern void svc_tcp_prep_reply_hdr(struct svc_rqst *);
341 +
342 /*
343 * Common routine for processing the RPC request.
344 */
345 @@ -1166,7 +1168,8 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
346 clear_bit(RQ_DROPME, &rqstp->rq_flags);
347
348 /* Setup reply header */
349 - rqstp->rq_xprt->xpt_ops->xpo_prep_reply_hdr(rqstp);
350 + if (rqstp->rq_prot == IPPROTO_TCP)
351 + svc_tcp_prep_reply_hdr(rqstp);
352
353 svc_putu32(resv, rqstp->rq_xid);
354
355 @@ -1312,7 +1315,7 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
356 return 0;
357
358 close:
359 - if (test_bit(XPT_TEMP, &rqstp->rq_xprt->xpt_flags))
360 + if (rqstp->rq_xprt && test_bit(XPT_TEMP, &rqstp->rq_xprt->xpt_flags))
361 svc_close_xprt(rqstp->rq_xprt);
362 dprintk("svc: svc_process close\n");
363 return 0;
364 @@ -1439,10 +1442,10 @@ bc_svc_process(struct svc_serv *serv, struct rpc_rqst *req,
365 dprintk("svc: %s(%p)\n", __func__, req);
366
367 /* Build the svc_rqst used by the common processing routine */
368 - rqstp->rq_xprt = serv->sv_bc_xprt;
369 rqstp->rq_xid = req->rq_xid;
370 rqstp->rq_prot = req->rq_xprt->prot;
371 rqstp->rq_server = serv;
372 + rqstp->rq_bc_net = req->rq_xprt->xprt_net;
373
374 rqstp->rq_addrlen = sizeof(req->rq_xprt->addr);
375 memcpy(&rqstp->rq_addr, &req->rq_xprt->addr, rqstp->rq_addrlen);
376 diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
377 index 064f20bb845a..42ce3ed21637 100644
378 --- a/net/sunrpc/svc_xprt.c
379 +++ b/net/sunrpc/svc_xprt.c
380 @@ -510,10 +510,11 @@ out:
381 */
382 void svc_reserve(struct svc_rqst *rqstp, int space)
383 {
384 + struct svc_xprt *xprt = rqstp->rq_xprt;
385 +
386 space += rqstp->rq_res.head[0].iov_len;
387
388 - if (space < rqstp->rq_reserved) {
389 - struct svc_xprt *xprt = rqstp->rq_xprt;
390 + if (xprt && space < rqstp->rq_reserved) {
391 atomic_sub((rqstp->rq_reserved - space), &xprt->xpt_reserved);
392 rqstp->rq_reserved = space;
393
394 diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
395 index 33f599cb0936..fd7fbe91955e 100644
396 --- a/net/sunrpc/svcsock.c
397 +++ b/net/sunrpc/svcsock.c
398 @@ -1195,7 +1195,7 @@ static int svc_tcp_sendto(struct svc_rqst *rqstp)
399 /*
400 * Setup response header. TCP has a 4B record length field.
401 */
402 -static void svc_tcp_prep_reply_hdr(struct svc_rqst *rqstp)
403 +void svc_tcp_prep_reply_hdr(struct svc_rqst *rqstp)
404 {
405 struct kvec *resv = &rqstp->rq_res.head[0];
406
407 diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
408 index 0fd31cff483e..0fc05ebdf81a 100644
409 --- a/sound/pci/hda/patch_realtek.c
410 +++ b/sound/pci/hda/patch_realtek.c
411 @@ -4841,6 +4841,13 @@ static void alc280_fixup_hp_9480m(struct hda_codec *codec,
412 }
413 }
414
415 +static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
416 + const struct hda_fixup *fix, int action)
417 +{
418 + if (action == HDA_FIXUP_ACT_PRE_PROBE)
419 + snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
420 +}
421 +
422 /* for hda_fixup_thinkpad_acpi() */
423 #include "thinkpad_helper.c"
424
425 @@ -4947,6 +4954,7 @@ enum {
426 ALC293_FIXUP_LENOVO_SPK_NOISE,
427 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
428 ALC255_FIXUP_DELL_SPK_NOISE,
429 + ALC225_FIXUP_DISABLE_MIC_VREF,
430 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
431 ALC295_FIXUP_DISABLE_DAC3,
432 ALC280_FIXUP_HP_HEADSET_MIC,
433 @@ -5605,6 +5613,12 @@ static const struct hda_fixup alc269_fixups[] = {
434 .chained = true,
435 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
436 },
437 + [ALC225_FIXUP_DISABLE_MIC_VREF] = {
438 + .type = HDA_FIXUP_FUNC,
439 + .v.func = alc_fixup_disable_mic_vref,
440 + .chained = true,
441 + .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
442 + },
443 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
444 .type = HDA_FIXUP_VERBS,
445 .v.verbs = (const struct hda_verb[]) {
446 @@ -5614,7 +5628,7 @@ static const struct hda_fixup alc269_fixups[] = {
447 {}
448 },
449 .chained = true,
450 - .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
451 + .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
452 },
453 [ALC280_FIXUP_HP_HEADSET_MIC] = {
454 .type = HDA_FIXUP_FUNC,