Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.9 commit in: /
Date: Sat, 09 Oct 2021 21:35:39
Message-Id: 1633815322.ab189c9d7916043d00a1f0f1d1d381c318991a7e.mpagano@gentoo
1 commit: ab189c9d7916043d00a1f0f1d1d381c318991a7e
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Sat Oct 9 21:35:22 2021 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Sat Oct 9 21:35:22 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=ab189c9d
7
8 Linux patch 4.9.286
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1285_linux-4.9.286.patch | 365 +++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 369 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 313a228..af7e135 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -1183,6 +1183,10 @@ Patch: 1284_linux-4.9.285.patch
21 From: http://www.kernel.org
22 Desc: Linux 4.9.285
23
24 +Patch: 1285_linux-4.9.286.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 4.9.286
27 +
28 Patch: 1500_XATTR_USER_PREFIX.patch
29 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
30 Desc: Support for namespace user.pax.* on tmpfs.
31
32 diff --git a/1285_linux-4.9.286.patch b/1285_linux-4.9.286.patch
33 new file mode 100644
34 index 0000000..7f0dff0
35 --- /dev/null
36 +++ b/1285_linux-4.9.286.patch
37 @@ -0,0 +1,365 @@
38 +diff --git a/Makefile b/Makefile
39 +index 2ed953d8e0f2a..68f2c6f3869e2 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,6 +1,6 @@
43 + VERSION = 4
44 + PATCHLEVEL = 9
45 +-SUBLEVEL = 285
46 ++SUBLEVEL = 286
47 + EXTRAVERSION =
48 + NAME = Roaring Lionus
49 +
50 +diff --git a/arch/sparc/lib/iomap.c b/arch/sparc/lib/iomap.c
51 +index c4d42a50ebc06..fa4abbaf27de3 100644
52 +--- a/arch/sparc/lib/iomap.c
53 ++++ b/arch/sparc/lib/iomap.c
54 +@@ -18,8 +18,10 @@ void ioport_unmap(void __iomem *addr)
55 + EXPORT_SYMBOL(ioport_map);
56 + EXPORT_SYMBOL(ioport_unmap);
57 +
58 ++#ifdef CONFIG_PCI
59 + void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
60 + {
61 + /* nothing to do */
62 + }
63 + EXPORT_SYMBOL(pci_iounmap);
64 ++#endif
65 +diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
66 +index adbf0486422b8..d3804b215ffa6 100644
67 +--- a/drivers/ata/libata-core.c
68 ++++ b/drivers/ata/libata-core.c
69 +@@ -2157,6 +2157,25 @@ static void ata_dev_config_ncq_non_data(struct ata_device *dev)
70 + }
71 + }
72 +
73 ++static bool ata_dev_check_adapter(struct ata_device *dev,
74 ++ unsigned short vendor_id)
75 ++{
76 ++ struct pci_dev *pcidev = NULL;
77 ++ struct device *parent_dev = NULL;
78 ++
79 ++ for (parent_dev = dev->tdev.parent; parent_dev != NULL;
80 ++ parent_dev = parent_dev->parent) {
81 ++ if (dev_is_pci(parent_dev)) {
82 ++ pcidev = to_pci_dev(parent_dev);
83 ++ if (pcidev->vendor == vendor_id)
84 ++ return true;
85 ++ break;
86 ++ }
87 ++ }
88 ++
89 ++ return false;
90 ++}
91 ++
92 + static int ata_dev_config_ncq(struct ata_device *dev,
93 + char *desc, size_t desc_sz)
94 + {
95 +@@ -2173,6 +2192,13 @@ static int ata_dev_config_ncq(struct ata_device *dev,
96 + snprintf(desc, desc_sz, "NCQ (not used)");
97 + return 0;
98 + }
99 ++
100 ++ if (dev->horkage & ATA_HORKAGE_NO_NCQ_ON_ATI &&
101 ++ ata_dev_check_adapter(dev, PCI_VENDOR_ID_ATI)) {
102 ++ snprintf(desc, desc_sz, "NCQ (not used)");
103 ++ return 0;
104 ++ }
105 ++
106 + if (ap->flags & ATA_FLAG_NCQ) {
107 + hdepth = min(ap->scsi_host->can_queue, ATA_MAX_QUEUE - 1);
108 + dev->flags |= ATA_DFLAG_NCQ;
109 +@@ -4448,9 +4474,11 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
110 + { "Samsung SSD 850*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
111 + ATA_HORKAGE_ZERO_AFTER_TRIM, },
112 + { "Samsung SSD 860*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
113 +- ATA_HORKAGE_ZERO_AFTER_TRIM, },
114 ++ ATA_HORKAGE_ZERO_AFTER_TRIM |
115 ++ ATA_HORKAGE_NO_NCQ_ON_ATI, },
116 + { "Samsung SSD 870*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
117 +- ATA_HORKAGE_ZERO_AFTER_TRIM, },
118 ++ ATA_HORKAGE_ZERO_AFTER_TRIM |
119 ++ ATA_HORKAGE_NO_NCQ_ON_ATI, },
120 + { "FCCT*M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
121 + ATA_HORKAGE_ZERO_AFTER_TRIM, },
122 +
123 +@@ -6734,6 +6762,8 @@ static int __init ata_parse_force_one(char **cur,
124 + { "ncq", .horkage_off = ATA_HORKAGE_NONCQ },
125 + { "noncqtrim", .horkage_on = ATA_HORKAGE_NO_NCQ_TRIM },
126 + { "ncqtrim", .horkage_off = ATA_HORKAGE_NO_NCQ_TRIM },
127 ++ { "noncqati", .horkage_on = ATA_HORKAGE_NO_NCQ_ON_ATI },
128 ++ { "ncqati", .horkage_off = ATA_HORKAGE_NO_NCQ_ON_ATI },
129 + { "dump_id", .horkage_on = ATA_HORKAGE_DUMP_ID },
130 + { "pio0", .xfer_mask = 1 << (ATA_SHIFT_PIO + 0) },
131 + { "pio1", .xfer_mask = 1 << (ATA_SHIFT_PIO + 1) },
132 +diff --git a/drivers/net/phy/mdio_device.c b/drivers/net/phy/mdio_device.c
133 +index 9c88e6749b9a4..34600b0061bb7 100644
134 +--- a/drivers/net/phy/mdio_device.c
135 ++++ b/drivers/net/phy/mdio_device.c
136 +@@ -135,6 +135,16 @@ static int mdio_remove(struct device *dev)
137 + return 0;
138 + }
139 +
140 ++static void mdio_shutdown(struct device *dev)
141 ++{
142 ++ struct mdio_device *mdiodev = to_mdio_device(dev);
143 ++ struct device_driver *drv = mdiodev->dev.driver;
144 ++ struct mdio_driver *mdiodrv = to_mdio_driver(drv);
145 ++
146 ++ if (mdiodrv->shutdown)
147 ++ mdiodrv->shutdown(mdiodev);
148 ++}
149 ++
150 + /**
151 + * mdio_driver_register - register an mdio_driver with the MDIO layer
152 + * @new_driver: new mdio_driver to register
153 +@@ -149,6 +159,7 @@ int mdio_driver_register(struct mdio_driver *drv)
154 + mdiodrv->driver.bus = &mdio_bus_type;
155 + mdiodrv->driver.probe = mdio_probe;
156 + mdiodrv->driver.remove = mdio_remove;
157 ++ mdiodrv->driver.shutdown = mdio_shutdown;
158 +
159 + retval = driver_register(&mdiodrv->driver);
160 + if (retval) {
161 +diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
162 +index f7fd8b5a6a8cf..3016869b4afdc 100644
163 +--- a/drivers/net/xen-netback/netback.c
164 ++++ b/drivers/net/xen-netback/netback.c
165 +@@ -492,7 +492,7 @@ check_frags:
166 + * the header's copy failed, and they are
167 + * sharing a slot, send an error
168 + */
169 +- if (i == 0 && sharedslot)
170 ++ if (i == 0 && !first_shinfo && sharedslot)
171 + xenvif_idx_release(queue, pending_idx,
172 + XEN_NETIF_RSP_ERROR);
173 + else
174 +diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
175 +index 671bf1e03ee1f..426f1b3aa15e2 100644
176 +--- a/drivers/scsi/sd.c
177 ++++ b/drivers/scsi/sd.c
178 +@@ -3179,15 +3179,16 @@ static int sd_probe(struct device *dev)
179 + }
180 +
181 + device_initialize(&sdkp->dev);
182 +- sdkp->dev.parent = dev;
183 ++ sdkp->dev.parent = get_device(dev);
184 + sdkp->dev.class = &sd_disk_class;
185 + dev_set_name(&sdkp->dev, "%s", dev_name(dev));
186 +
187 + error = device_add(&sdkp->dev);
188 +- if (error)
189 +- goto out_free_index;
190 ++ if (error) {
191 ++ put_device(&sdkp->dev);
192 ++ goto out;
193 ++ }
194 +
195 +- get_device(dev);
196 + dev_set_drvdata(dev, sdkp);
197 +
198 + get_device(&sdkp->dev); /* prevent release before async_schedule */
199 +diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c
200 +index 4c40c0786e168..bd32140bdfee5 100644
201 +--- a/fs/ext2/balloc.c
202 ++++ b/fs/ext2/balloc.c
203 +@@ -46,10 +46,9 @@ struct ext2_group_desc * ext2_get_group_desc(struct super_block * sb,
204 + struct ext2_sb_info *sbi = EXT2_SB(sb);
205 +
206 + if (block_group >= sbi->s_groups_count) {
207 +- ext2_error (sb, "ext2_get_group_desc",
208 +- "block_group >= groups_count - "
209 +- "block_group = %d, groups_count = %lu",
210 +- block_group, sbi->s_groups_count);
211 ++ WARN(1, "block_group >= groups_count - "
212 ++ "block_group = %d, groups_count = %lu",
213 ++ block_group, sbi->s_groups_count);
214 +
215 + return NULL;
216 + }
217 +@@ -57,10 +56,9 @@ struct ext2_group_desc * ext2_get_group_desc(struct super_block * sb,
218 + group_desc = block_group >> EXT2_DESC_PER_BLOCK_BITS(sb);
219 + offset = block_group & (EXT2_DESC_PER_BLOCK(sb) - 1);
220 + if (!sbi->s_group_desc[group_desc]) {
221 +- ext2_error (sb, "ext2_get_group_desc",
222 +- "Group descriptor not loaded - "
223 +- "block_group = %d, group_desc = %lu, desc = %lu",
224 +- block_group, group_desc, offset);
225 ++ WARN(1, "Group descriptor not loaded - "
226 ++ "block_group = %d, group_desc = %lu, desc = %lu",
227 ++ block_group, group_desc, offset);
228 + return NULL;
229 + }
230 +
231 +diff --git a/include/linux/libata.h b/include/linux/libata.h
232 +index 3fabf57fd6e0d..de770d11a5c18 100644
233 +--- a/include/linux/libata.h
234 ++++ b/include/linux/libata.h
235 +@@ -436,6 +436,7 @@ enum {
236 + ATA_HORKAGE_NOTRIM = (1 << 24), /* don't use TRIM */
237 + ATA_HORKAGE_MAX_SEC_1024 = (1 << 25), /* Limit max sects to 1024 */
238 + ATA_HORKAGE_MAX_TRIM_128M = (1 << 26), /* Limit max trim size to 128M */
239 ++ ATA_HORKAGE_NO_NCQ_ON_ATI = (1 << 27), /* Disable NCQ on ATI chipset */
240 +
241 + /* DMA mask for user DMA control: User visible values; DO NOT
242 + renumber */
243 +diff --git a/include/linux/mdio.h b/include/linux/mdio.h
244 +index bf9d1d7506935..78b3cf50566f5 100644
245 +--- a/include/linux/mdio.h
246 ++++ b/include/linux/mdio.h
247 +@@ -61,6 +61,9 @@ struct mdio_driver {
248 +
249 + /* Clears up any memory if needed */
250 + void (*remove)(struct mdio_device *mdiodev);
251 ++
252 ++ /* Quiesces the device on system shutdown, turns off interrupts etc */
253 ++ void (*shutdown)(struct mdio_device *mdiodev);
254 + };
255 + #define to_mdio_driver(d) \
256 + container_of(to_mdio_common_driver(d), struct mdio_driver, mdiodrv)
257 +diff --git a/include/net/sock.h b/include/net/sock.h
258 +index cf27f3688c39c..78c292f15ffc1 100644
259 +--- a/include/net/sock.h
260 ++++ b/include/net/sock.h
261 +@@ -420,8 +420,10 @@ struct sock {
262 + u32 sk_max_ack_backlog;
263 + __u32 sk_priority;
264 + __u32 sk_mark;
265 ++ spinlock_t sk_peer_lock;
266 + struct pid *sk_peer_pid;
267 + const struct cred *sk_peer_cred;
268 ++
269 + long sk_rcvtimeo;
270 + long sk_sndtimeo;
271 + struct timer_list sk_timer;
272 +diff --git a/net/core/sock.c b/net/core/sock.c
273 +index d468ffb5a31c6..1845a37d9f7e1 100644
274 +--- a/net/core/sock.c
275 ++++ b/net/core/sock.c
276 +@@ -1011,7 +1011,6 @@ set_rcvbuf:
277 + }
278 + EXPORT_SYMBOL(sock_setsockopt);
279 +
280 +-
281 + static void cred_to_ucred(struct pid *pid, const struct cred *cred,
282 + struct ucred *ucred)
283 + {
284 +@@ -1171,7 +1170,11 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
285 + struct ucred peercred;
286 + if (len > sizeof(peercred))
287 + len = sizeof(peercred);
288 ++
289 ++ spin_lock(&sk->sk_peer_lock);
290 + cred_to_ucred(sk->sk_peer_pid, sk->sk_peer_cred, &peercred);
291 ++ spin_unlock(&sk->sk_peer_lock);
292 ++
293 + if (copy_to_user(optval, &peercred, len))
294 + return -EFAULT;
295 + goto lenout;
296 +@@ -1439,9 +1442,10 @@ static void __sk_destruct(struct rcu_head *head)
297 + sk->sk_frag.page = NULL;
298 + }
299 +
300 +- if (sk->sk_peer_cred)
301 +- put_cred(sk->sk_peer_cred);
302 ++ /* We do not need to acquire sk->sk_peer_lock, we are the last user. */
303 ++ put_cred(sk->sk_peer_cred);
304 + put_pid(sk->sk_peer_pid);
305 ++
306 + if (likely(sk->sk_net_refcnt))
307 + put_net(sock_net(sk));
308 + sk_prot_free(sk->sk_prot_creator, sk);
309 +@@ -2490,6 +2494,8 @@ void sock_init_data(struct socket *sock, struct sock *sk)
310 +
311 + sk->sk_peer_pid = NULL;
312 + sk->sk_peer_cred = NULL;
313 ++ spin_lock_init(&sk->sk_peer_lock);
314 ++
315 + sk->sk_write_pending = 0;
316 + sk->sk_rcvlowat = 1;
317 + sk->sk_rcvtimeo = MAX_SCHEDULE_TIMEOUT;
318 +diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
319 +index 2c643e1919aab..e7e012933714f 100644
320 +--- a/net/unix/af_unix.c
321 ++++ b/net/unix/af_unix.c
322 +@@ -594,20 +594,42 @@ static void unix_release_sock(struct sock *sk, int embrion)
323 +
324 + static void init_peercred(struct sock *sk)
325 + {
326 +- put_pid(sk->sk_peer_pid);
327 +- if (sk->sk_peer_cred)
328 +- put_cred(sk->sk_peer_cred);
329 ++ const struct cred *old_cred;
330 ++ struct pid *old_pid;
331 ++
332 ++ spin_lock(&sk->sk_peer_lock);
333 ++ old_pid = sk->sk_peer_pid;
334 ++ old_cred = sk->sk_peer_cred;
335 + sk->sk_peer_pid = get_pid(task_tgid(current));
336 + sk->sk_peer_cred = get_current_cred();
337 ++ spin_unlock(&sk->sk_peer_lock);
338 ++
339 ++ put_pid(old_pid);
340 ++ put_cred(old_cred);
341 + }
342 +
343 + static void copy_peercred(struct sock *sk, struct sock *peersk)
344 + {
345 +- put_pid(sk->sk_peer_pid);
346 +- if (sk->sk_peer_cred)
347 +- put_cred(sk->sk_peer_cred);
348 ++ const struct cred *old_cred;
349 ++ struct pid *old_pid;
350 ++
351 ++ if (sk < peersk) {
352 ++ spin_lock(&sk->sk_peer_lock);
353 ++ spin_lock_nested(&peersk->sk_peer_lock, SINGLE_DEPTH_NESTING);
354 ++ } else {
355 ++ spin_lock(&peersk->sk_peer_lock);
356 ++ spin_lock_nested(&sk->sk_peer_lock, SINGLE_DEPTH_NESTING);
357 ++ }
358 ++ old_pid = sk->sk_peer_pid;
359 ++ old_cred = sk->sk_peer_cred;
360 + sk->sk_peer_pid = get_pid(peersk->sk_peer_pid);
361 + sk->sk_peer_cred = get_cred(peersk->sk_peer_cred);
362 ++
363 ++ spin_unlock(&sk->sk_peer_lock);
364 ++ spin_unlock(&peersk->sk_peer_lock);
365 ++
366 ++ put_pid(old_pid);
367 ++ put_cred(old_cred);
368 + }
369 +
370 + static int unix_listen(struct socket *sock, int backlog)
371 +diff --git a/tools/usb/testusb.c b/tools/usb/testusb.c
372 +index 0692d99b6d8f3..18c895654e767 100644
373 +--- a/tools/usb/testusb.c
374 ++++ b/tools/usb/testusb.c
375 +@@ -278,12 +278,6 @@ nomem:
376 + }
377 +
378 + entry->ifnum = ifnum;
379 +-
380 +- /* FIXME update USBDEVFS_CONNECTINFO so it tells about high speed etc */
381 +-
382 +- fprintf(stderr, "%s speed\t%s\t%u\n",
383 +- speed(entry->speed), entry->name, entry->ifnum);
384 +-
385 + entry->next = testdevs;
386 + testdevs = entry;
387 + return 0;
388 +@@ -312,6 +306,14 @@ static void *handle_testdev (void *arg)
389 + return 0;
390 + }
391 +
392 ++ status = ioctl(fd, USBDEVFS_GET_SPEED, NULL);
393 ++ if (status < 0)
394 ++ fprintf(stderr, "USBDEVFS_GET_SPEED failed %d\n", status);
395 ++ else
396 ++ dev->speed = status;
397 ++ fprintf(stderr, "%s speed\t%s\t%u\n",
398 ++ speed(dev->speed), dev->name, dev->ifnum);
399 ++
400 + restart:
401 + for (i = 0; i < TEST_CASES; i++) {
402 + if (dev->test != -1 && dev->test != i)