Magellan Linux

Contents of /trunk/kernel-alx/patches-5.4/0260-5.4.161-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3635 - (show annotations) (download)
Mon Oct 24 12:34:12 2022 UTC (19 months, 1 week ago) by niro
File size: 10414 byte(s)
-sync kernel patches
1 diff --git a/Makefile b/Makefile
2 index e938662dab289..f552556966f1d 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,7 +1,7 @@
6 # SPDX-License-Identifier: GPL-2.0
7 VERSION = 5
8 PATCHLEVEL = 4
9 -SUBLEVEL = 160
10 +SUBLEVEL = 161
11 EXTRAVERSION =
12 NAME = Kleptomaniac Octopus
13
14 diff --git a/arch/mips/include/asm/cmpxchg.h b/arch/mips/include/asm/cmpxchg.h
15 index f6136871561dc..9182ce828f540 100644
16 --- a/arch/mips/include/asm/cmpxchg.h
17 +++ b/arch/mips/include/asm/cmpxchg.h
18 @@ -239,6 +239,7 @@ static inline unsigned long __cmpxchg64(volatile void *ptr,
19 " .set " MIPS_ISA_ARCH_LEVEL " \n"
20 /* Load 64 bits from ptr */
21 "1: lld %L0, %3 # __cmpxchg64 \n"
22 + " .set pop \n"
23 /*
24 * Split the 64 bit value we loaded into the 2 registers that hold the
25 * ret variable.
26 @@ -266,6 +267,8 @@ static inline unsigned long __cmpxchg64(volatile void *ptr,
27 " or %L1, %L1, $at \n"
28 " .set at \n"
29 # endif
30 + " .set push \n"
31 + " .set " MIPS_ISA_ARCH_LEVEL " \n"
32 /* Attempt to store new at ptr */
33 " scd %L1, %2 \n"
34 /* If we failed, loop! */
35 diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S
36 index 7d14e9ae18fb1..2f64f112934b6 100644
37 --- a/arch/parisc/kernel/entry.S
38 +++ b/arch/parisc/kernel/entry.S
39 @@ -1842,7 +1842,7 @@ syscall_restore:
40
41 /* Are we being ptraced? */
42 LDREG TI_FLAGS-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r19
43 - ldi _TIF_SYSCALL_TRACE_MASK,%r2
44 + ldi _TIF_SINGLESTEP|_TIF_BLOCKSTEP,%r2
45 and,COND(=) %r19,%r2,%r0
46 b,n syscall_restore_rfi
47
48 diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
49 index c8bd243717b7b..d0cc6c0d74d6b 100644
50 --- a/drivers/pci/msi.c
51 +++ b/drivers/pci/msi.c
52 @@ -395,18 +395,6 @@ static void free_msi_irqs(struct pci_dev *dev)
53 for (i = 0; i < entry->nvec_used; i++)
54 BUG_ON(irq_has_action(entry->irq + i));
55
56 - pci_msi_teardown_msi_irqs(dev);
57 -
58 - list_for_each_entry_safe(entry, tmp, msi_list, list) {
59 - if (entry->msi_attrib.is_msix) {
60 - if (list_is_last(&entry->list, msi_list))
61 - iounmap(entry->mask_base);
62 - }
63 -
64 - list_del(&entry->list);
65 - free_msi_entry(entry);
66 - }
67 -
68 if (dev->msi_irq_groups) {
69 sysfs_remove_groups(&dev->dev.kobj, dev->msi_irq_groups);
70 msi_attrs = dev->msi_irq_groups[0]->attrs;
71 @@ -422,6 +410,18 @@ static void free_msi_irqs(struct pci_dev *dev)
72 kfree(dev->msi_irq_groups);
73 dev->msi_irq_groups = NULL;
74 }
75 +
76 + pci_msi_teardown_msi_irqs(dev);
77 +
78 + list_for_each_entry_safe(entry, tmp, msi_list, list) {
79 + if (entry->msi_attrib.is_msix) {
80 + if (list_is_last(&entry->list, msi_list))
81 + iounmap(entry->mask_base);
82 + }
83 +
84 + list_del(&entry->list);
85 + free_msi_entry(entry);
86 + }
87 }
88
89 static void pci_intx_for_msi(struct pci_dev *dev, int enable)
90 @@ -591,6 +591,9 @@ msi_setup_entry(struct pci_dev *dev, int nvec, struct irq_affinity *affd)
91 goto out;
92
93 pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &control);
94 + /* Lies, damned lies, and MSIs */
95 + if (dev->dev_flags & PCI_DEV_FLAGS_HAS_MSI_MASKING)
96 + control |= PCI_MSI_FLAGS_MASKBIT;
97
98 entry->msi_attrib.is_msix = 0;
99 entry->msi_attrib.is_64 = !!(control & PCI_MSI_FLAGS_64BIT);
100 diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
101 index fb7c5518447da..cf3986d4413f7 100644
102 --- a/drivers/pci/quirks.c
103 +++ b/drivers/pci/quirks.c
104 @@ -5777,3 +5777,9 @@ static void apex_pci_fixup_class(struct pci_dev *pdev)
105 }
106 DECLARE_PCI_FIXUP_CLASS_HEADER(0x1ac1, 0x089a,
107 PCI_CLASS_NOT_DEFINED, 8, apex_pci_fixup_class);
108 +
109 +static void nvidia_ion_ahci_fixup(struct pci_dev *pdev)
110 +{
111 + pdev->dev_flags |= PCI_DEV_FLAGS_HAS_MSI_MASKING;
112 +}
113 +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, 0x0ab8, nvidia_ion_ahci_fixup);
114 diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
115 index 24396f4d5f2d3..29c7a76d2c658 100644
116 --- a/drivers/scsi/ufs/ufshcd.c
117 +++ b/drivers/scsi/ufs/ufshcd.c
118 @@ -4748,7 +4748,8 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)
119 break;
120 } /* end of switch */
121
122 - if ((host_byte(result) != DID_OK) && !hba->silence_err_logs)
123 + if ((host_byte(result) != DID_OK) &&
124 + (host_byte(result) != DID_REQUEUE) && !hba->silence_err_logs)
125 ufshcd_print_trs(hba, 1 << lrbp->task_tag, true);
126 return result;
127 }
128 @@ -5661,9 +5662,12 @@ static irqreturn_t ufshcd_intr(int irq, void *__hba)
129 intr_status = ufshcd_readl(hba, REG_INTERRUPT_STATUS);
130 }
131
132 - if (retval == IRQ_NONE) {
133 - dev_err(hba->dev, "%s: Unhandled interrupt 0x%08x\n",
134 - __func__, intr_status);
135 + if (enabled_intr_status && retval == IRQ_NONE &&
136 + !ufshcd_eh_in_progress(hba)) {
137 + dev_err(hba->dev, "%s: Unhandled interrupt 0x%08x (-, 0x%08x)\n",
138 + __func__,
139 + intr_status,
140 + enabled_intr_status);
141 ufshcd_dump_regs(hba, 0, UFSHCI_REG_SPACE_SIZE, "host_regs: ");
142 }
143
144 @@ -5705,7 +5709,10 @@ static int __ufshcd_issue_tm_cmd(struct ufs_hba *hba,
145 /*
146 * blk_get_request() is used here only to get a free tag.
147 */
148 - req = blk_get_request(q, REQ_OP_DRV_OUT, BLK_MQ_REQ_RESERVED);
149 + req = blk_get_request(q, REQ_OP_DRV_OUT, 0);
150 + if (IS_ERR(req))
151 + return PTR_ERR(req);
152 +
153 req->end_io_data = &wait;
154 ufshcd_hold(hba, false);
155
156 diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
157 index ab75f41e9c0c9..d11320a4dfcf9 100644
158 --- a/drivers/soc/tegra/pmc.c
159 +++ b/drivers/soc/tegra/pmc.c
160 @@ -579,7 +579,7 @@ static int tegra_powergate_power_up(struct tegra_powergate *pg,
161
162 err = tegra_powergate_enable_clocks(pg);
163 if (err)
164 - goto disable_clks;
165 + goto powergate_off;
166
167 usleep_range(10, 20);
168
169 diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c
170 index fad80c97d2476..fdd18c2508115 100644
171 --- a/fs/erofs/zdata.c
172 +++ b/fs/erofs/zdata.c
173 @@ -288,11 +288,10 @@ static inline bool z_erofs_try_inplace_io(struct z_erofs_collector *clt,
174
175 /* callers must be with collection lock held */
176 static int z_erofs_attach_page(struct z_erofs_collector *clt,
177 - struct page *page,
178 - enum z_erofs_page_type type)
179 + struct page *page, enum z_erofs_page_type type,
180 + bool pvec_safereuse)
181 {
182 int ret;
183 - bool occupied;
184
185 /* give priority for inplaceio */
186 if (clt->mode >= COLLECT_PRIMARY &&
187 @@ -300,10 +299,9 @@ static int z_erofs_attach_page(struct z_erofs_collector *clt,
188 z_erofs_try_inplace_io(clt, page))
189 return 0;
190
191 - ret = z_erofs_pagevec_enqueue(&clt->vector,
192 - page, type, &occupied);
193 + ret = z_erofs_pagevec_enqueue(&clt->vector, page, type,
194 + pvec_safereuse);
195 clt->cl->vcnt += (unsigned int)ret;
196 -
197 return ret ? 0 : -EAGAIN;
198 }
199
200 @@ -654,14 +652,15 @@ hitted:
201 tight &= (clt->mode >= COLLECT_PRIMARY_FOLLOWED);
202
203 retry:
204 - err = z_erofs_attach_page(clt, page, page_type);
205 + err = z_erofs_attach_page(clt, page, page_type,
206 + clt->mode >= COLLECT_PRIMARY_FOLLOWED);
207 /* should allocate an additional staging page for pagevec */
208 if (err == -EAGAIN) {
209 struct page *const newpage =
210 __stagingpage_alloc(pagepool, GFP_NOFS);
211
212 err = z_erofs_attach_page(clt, newpage,
213 - Z_EROFS_PAGE_TYPE_EXCLUSIVE);
214 + Z_EROFS_PAGE_TYPE_EXCLUSIVE, true);
215 if (!err)
216 goto retry;
217 }
218 diff --git a/fs/erofs/zpvec.h b/fs/erofs/zpvec.h
219 index 58556903aa945..6a20b2c3a24cd 100644
220 --- a/fs/erofs/zpvec.h
221 +++ b/fs/erofs/zpvec.h
222 @@ -108,12 +108,17 @@ static inline void z_erofs_pagevec_ctor_init(struct z_erofs_pagevec_ctor *ctor,
223 static inline bool z_erofs_pagevec_enqueue(struct z_erofs_pagevec_ctor *ctor,
224 struct page *page,
225 enum z_erofs_page_type type,
226 - bool *occupied)
227 + bool pvec_safereuse)
228 {
229 - *occupied = false;
230 - if (!ctor->next && type)
231 - if (ctor->index + 1 == ctor->nr)
232 + if (!ctor->next) {
233 + /* some pages cannot be reused as pvec safely without I/O */
234 + if (type == Z_EROFS_PAGE_TYPE_EXCLUSIVE && !pvec_safereuse)
235 + type = Z_EROFS_VLE_PAGE_TYPE_TAIL_SHARED;
236 +
237 + if (type != Z_EROFS_PAGE_TYPE_EXCLUSIVE &&
238 + ctor->index + 1 == ctor->nr)
239 return false;
240 + }
241
242 if (ctor->index >= ctor->nr)
243 z_erofs_pagevec_ctor_pagedown(ctor, false);
244 @@ -125,7 +130,6 @@ static inline bool z_erofs_pagevec_enqueue(struct z_erofs_pagevec_ctor *ctor,
245 /* should remind that collector->next never equal to 1, 2 */
246 if (type == (uintptr_t)ctor->next) {
247 ctor->next = page;
248 - *occupied = true;
249 }
250 ctor->pages[ctor->index++] = tagptr_fold(erofs_vtptr_t, page, type);
251 return true;
252 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
253 index 1211ae203face..f68dfef5939f4 100644
254 --- a/fs/ext4/super.c
255 +++ b/fs/ext4/super.c
256 @@ -3071,8 +3071,8 @@ static int ext4_run_li_request(struct ext4_li_request *elr)
257 struct ext4_group_desc *gdp = NULL;
258 ext4_group_t group, ngroups;
259 struct super_block *sb;
260 - unsigned long timeout = 0;
261 int ret = 0;
262 + u64 start_time;
263
264 sb = elr->lr_super;
265 ngroups = EXT4_SB(sb)->s_groups_count;
266 @@ -3092,13 +3092,12 @@ static int ext4_run_li_request(struct ext4_li_request *elr)
267 ret = 1;
268
269 if (!ret) {
270 - timeout = jiffies;
271 + start_time = ktime_get_real_ns();
272 ret = ext4_init_inode_table(sb, group,
273 elr->lr_timeout ? 0 : 1);
274 if (elr->lr_timeout == 0) {
275 - timeout = (jiffies - timeout) *
276 - elr->lr_sbi->s_li_wait_mult;
277 - elr->lr_timeout = timeout;
278 + elr->lr_timeout = nsecs_to_jiffies((ktime_get_real_ns() - start_time) *
279 + elr->lr_sbi->s_li_wait_mult);
280 }
281 elr->lr_next_sched = jiffies + elr->lr_timeout;
282 elr->lr_next_group = group + 1;
283 diff --git a/include/linux/pci.h b/include/linux/pci.h
284 index 9a937f8b27838..bc35b15efadd0 100644
285 --- a/include/linux/pci.h
286 +++ b/include/linux/pci.h
287 @@ -208,6 +208,8 @@ enum pci_dev_flags {
288 PCI_DEV_FLAGS_NO_FLR_RESET = (__force pci_dev_flags_t) (1 << 10),
289 /* Don't use Relaxed Ordering for TLPs directed at this device */
290 PCI_DEV_FLAGS_NO_RELAXED_ORDERING = (__force pci_dev_flags_t) (1 << 11),
291 + /* Device does honor MSI masking despite saying otherwise */
292 + PCI_DEV_FLAGS_HAS_MSI_MASKING = (__force pci_dev_flags_t) (1 << 12),
293 };
294
295 enum pci_irq_reroute_variant {
296 diff --git a/security/Kconfig b/security/Kconfig
297 index 2a1a2d3962281..52e5109f2c1b6 100644
298 --- a/security/Kconfig
299 +++ b/security/Kconfig
300 @@ -191,6 +191,9 @@ config HARDENED_USERCOPY_PAGESPAN
301 config FORTIFY_SOURCE
302 bool "Harden common str/mem functions against buffer overflows"
303 depends on ARCH_HAS_FORTIFY_SOURCE
304 + # https://bugs.llvm.org/show_bug.cgi?id=50322
305 + # https://bugs.llvm.org/show_bug.cgi?id=41459
306 + depends on !CC_IS_CLANG
307 help
308 Detect overflows of buffers in common string and memory functions
309 where the compiler can determine and validate the buffer sizes.