Magellan Linux

Annotation of /trunk/kernel-alx-legacy/patches-4.9/0385-4.9.286-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


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