1 |
commit: 0486329cfbf6f62348f4d49248593c730e723131 |
2 |
Author: Alice Ferrazzi <alicef <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Sep 8 13:00:20 2021 +0000 |
4 |
Commit: Alice Ferrazzi <alicef <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Sep 8 13:00:37 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=0486329c |
7 |
|
8 |
Linux patch 5.10.63 |
9 |
|
10 |
Signed-off-by: Alice Ferrazzi <alicef <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1062_linux-5.10.63.patch | 1105 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 1109 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index eaceece..0e463ca 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -291,6 +291,10 @@ Patch: 1061_linux-5.10.62.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.10.62 |
23 |
|
24 |
+Patch: 1062_linux-5.10.63.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.10.63 |
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/1062_linux-5.10.63.patch b/1062_linux-5.10.63.patch |
33 |
new file mode 100644 |
34 |
index 0000000..55177d3 |
35 |
--- /dev/null |
36 |
+++ b/1062_linux-5.10.63.patch |
37 |
@@ -0,0 +1,1105 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index 90c0cb3e4d3c2..b2d326f4dea68 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,7 +1,7 @@ |
43 |
+ # SPDX-License-Identifier: GPL-2.0 |
44 |
+ VERSION = 5 |
45 |
+ PATCHLEVEL = 10 |
46 |
+-SUBLEVEL = 62 |
47 |
++SUBLEVEL = 63 |
48 |
+ EXTRAVERSION = |
49 |
+ NAME = Dare mighty things |
50 |
+ |
51 |
+diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c |
52 |
+index 2ee527c002840..1026a816dcc02 100644 |
53 |
+--- a/arch/arm/mach-omap1/board-ams-delta.c |
54 |
++++ b/arch/arm/mach-omap1/board-ams-delta.c |
55 |
+@@ -458,20 +458,6 @@ static struct gpiod_lookup_table leds_gpio_table = { |
56 |
+ |
57 |
+ #ifdef CONFIG_LEDS_TRIGGERS |
58 |
+ DEFINE_LED_TRIGGER(ams_delta_camera_led_trigger); |
59 |
+- |
60 |
+-static int ams_delta_camera_power(struct device *dev, int power) |
61 |
+-{ |
62 |
+- /* |
63 |
+- * turn on camera LED |
64 |
+- */ |
65 |
+- if (power) |
66 |
+- led_trigger_event(ams_delta_camera_led_trigger, LED_FULL); |
67 |
+- else |
68 |
+- led_trigger_event(ams_delta_camera_led_trigger, LED_OFF); |
69 |
+- return 0; |
70 |
+-} |
71 |
+-#else |
72 |
+-#define ams_delta_camera_power NULL |
73 |
+ #endif |
74 |
+ |
75 |
+ static struct platform_device ams_delta_audio_device = { |
76 |
+diff --git a/arch/x86/events/amd/ibs.c b/arch/x86/events/amd/ibs.c |
77 |
+index 40669eac9d6db..921f47b9bb247 100644 |
78 |
+--- a/arch/x86/events/amd/ibs.c |
79 |
++++ b/arch/x86/events/amd/ibs.c |
80 |
+@@ -90,6 +90,7 @@ struct perf_ibs { |
81 |
+ unsigned long offset_mask[1]; |
82 |
+ int offset_max; |
83 |
+ unsigned int fetch_count_reset_broken : 1; |
84 |
++ unsigned int fetch_ignore_if_zero_rip : 1; |
85 |
+ struct cpu_perf_ibs __percpu *pcpu; |
86 |
+ |
87 |
+ struct attribute **format_attrs; |
88 |
+@@ -672,6 +673,10 @@ fail: |
89 |
+ if (check_rip && (ibs_data.regs[2] & IBS_RIP_INVALID)) { |
90 |
+ regs.flags &= ~PERF_EFLAGS_EXACT; |
91 |
+ } else { |
92 |
++ /* Workaround for erratum #1197 */ |
93 |
++ if (perf_ibs->fetch_ignore_if_zero_rip && !(ibs_data.regs[1])) |
94 |
++ goto out; |
95 |
++ |
96 |
+ set_linear_ip(®s, ibs_data.regs[1]); |
97 |
+ regs.flags |= PERF_EFLAGS_EXACT; |
98 |
+ } |
99 |
+@@ -769,6 +774,9 @@ static __init void perf_event_ibs_init(void) |
100 |
+ if (boot_cpu_data.x86 >= 0x16 && boot_cpu_data.x86 <= 0x18) |
101 |
+ perf_ibs_fetch.fetch_count_reset_broken = 1; |
102 |
+ |
103 |
++ if (boot_cpu_data.x86 == 0x19 && boot_cpu_data.x86_model < 0x10) |
104 |
++ perf_ibs_fetch.fetch_ignore_if_zero_rip = 1; |
105 |
++ |
106 |
+ perf_ibs_pmu_init(&perf_ibs_fetch, "ibs_fetch"); |
107 |
+ |
108 |
+ if (ibs_caps & IBS_CAPS_OPCNT) { |
109 |
+diff --git a/arch/x86/events/amd/power.c b/arch/x86/events/amd/power.c |
110 |
+index 16a2369c586e8..37d5b380516ec 100644 |
111 |
+--- a/arch/x86/events/amd/power.c |
112 |
++++ b/arch/x86/events/amd/power.c |
113 |
+@@ -213,6 +213,7 @@ static struct pmu pmu_class = { |
114 |
+ .stop = pmu_event_stop, |
115 |
+ .read = pmu_event_read, |
116 |
+ .capabilities = PERF_PMU_CAP_NO_EXCLUDE, |
117 |
++ .module = THIS_MODULE, |
118 |
+ }; |
119 |
+ |
120 |
+ static int power_cpu_exit(unsigned int cpu) |
121 |
+diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c |
122 |
+index e94af4a54d0d8..37129b76135a1 100644 |
123 |
+--- a/arch/x86/events/intel/pt.c |
124 |
++++ b/arch/x86/events/intel/pt.c |
125 |
+@@ -62,7 +62,7 @@ static struct pt_cap_desc { |
126 |
+ PT_CAP(single_range_output, 0, CPUID_ECX, BIT(2)), |
127 |
+ PT_CAP(output_subsys, 0, CPUID_ECX, BIT(3)), |
128 |
+ PT_CAP(payloads_lip, 0, CPUID_ECX, BIT(31)), |
129 |
+- PT_CAP(num_address_ranges, 1, CPUID_EAX, 0x3), |
130 |
++ PT_CAP(num_address_ranges, 1, CPUID_EAX, 0x7), |
131 |
+ PT_CAP(mtc_periods, 1, CPUID_EAX, 0xffff0000), |
132 |
+ PT_CAP(cycle_thresholds, 1, CPUID_EBX, 0xffff), |
133 |
+ PT_CAP(psb_periods, 1, CPUID_EBX, 0xffff0000), |
134 |
+diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig |
135 |
+index d0dfa50bd0bb4..87e08ad38ea71 100644 |
136 |
+--- a/arch/xtensa/Kconfig |
137 |
++++ b/arch/xtensa/Kconfig |
138 |
+@@ -30,7 +30,7 @@ config XTENSA |
139 |
+ select HAVE_DMA_CONTIGUOUS |
140 |
+ select HAVE_EXIT_THREAD |
141 |
+ select HAVE_FUNCTION_TRACER |
142 |
+- select HAVE_FUTEX_CMPXCHG if !MMU |
143 |
++ select HAVE_FUTEX_CMPXCHG if !MMU && FUTEX |
144 |
+ select HAVE_HW_BREAKPOINT if PERF_EVENTS |
145 |
+ select HAVE_IRQ_TIME_ACCOUNTING |
146 |
+ select HAVE_OPROFILE |
147 |
+diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig |
148 |
+index f40ebe9f50474..f2548049aa0e9 100644 |
149 |
+--- a/drivers/block/Kconfig |
150 |
++++ b/drivers/block/Kconfig |
151 |
+@@ -230,7 +230,7 @@ config BLK_DEV_LOOP_MIN_COUNT |
152 |
+ dynamically allocated with the /dev/loop-control interface. |
153 |
+ |
154 |
+ config BLK_DEV_CRYPTOLOOP |
155 |
+- tristate "Cryptoloop Support" |
156 |
++ tristate "Cryptoloop Support (DEPRECATED)" |
157 |
+ select CRYPTO |
158 |
+ select CRYPTO_CBC |
159 |
+ depends on BLK_DEV_LOOP |
160 |
+@@ -242,7 +242,7 @@ config BLK_DEV_CRYPTOLOOP |
161 |
+ WARNING: This device is not safe for journaled file systems like |
162 |
+ ext3 or Reiserfs. Please use the Device Mapper crypto module |
163 |
+ instead, which can be configured to be on-disk compatible with the |
164 |
+- cryptoloop device. |
165 |
++ cryptoloop device. cryptoloop support will be removed in Linux 5.16. |
166 |
+ |
167 |
+ source "drivers/block/drbd/Kconfig" |
168 |
+ |
169 |
+diff --git a/drivers/block/cryptoloop.c b/drivers/block/cryptoloop.c |
170 |
+index 3cabc335ae744..f0a91faa43a89 100644 |
171 |
+--- a/drivers/block/cryptoloop.c |
172 |
++++ b/drivers/block/cryptoloop.c |
173 |
+@@ -189,6 +189,8 @@ init_cryptoloop(void) |
174 |
+ |
175 |
+ if (rc) |
176 |
+ printk(KERN_ERR "cryptoloop: loop_register_transfer failed\n"); |
177 |
++ else |
178 |
++ pr_warn("the cryptoloop driver has been deprecated and will be removed in in Linux 5.16\n"); |
179 |
+ return rc; |
180 |
+ } |
181 |
+ |
182 |
+diff --git a/drivers/gpu/ipu-v3/ipu-cpmem.c b/drivers/gpu/ipu-v3/ipu-cpmem.c |
183 |
+index a1c85d1521f5c..82b244cb313e6 100644 |
184 |
+--- a/drivers/gpu/ipu-v3/ipu-cpmem.c |
185 |
++++ b/drivers/gpu/ipu-v3/ipu-cpmem.c |
186 |
+@@ -585,21 +585,21 @@ static const struct ipu_rgb def_bgra_16 = { |
187 |
+ .bits_per_pixel = 16, |
188 |
+ }; |
189 |
+ |
190 |
+-#define Y_OFFSET(pix, x, y) ((x) + pix->width * (y)) |
191 |
+-#define U_OFFSET(pix, x, y) ((pix->width * pix->height) + \ |
192 |
+- (pix->width * ((y) / 2) / 2) + (x) / 2) |
193 |
+-#define V_OFFSET(pix, x, y) ((pix->width * pix->height) + \ |
194 |
+- (pix->width * pix->height / 4) + \ |
195 |
+- (pix->width * ((y) / 2) / 2) + (x) / 2) |
196 |
+-#define U2_OFFSET(pix, x, y) ((pix->width * pix->height) + \ |
197 |
+- (pix->width * (y) / 2) + (x) / 2) |
198 |
+-#define V2_OFFSET(pix, x, y) ((pix->width * pix->height) + \ |
199 |
+- (pix->width * pix->height / 2) + \ |
200 |
+- (pix->width * (y) / 2) + (x) / 2) |
201 |
+-#define UV_OFFSET(pix, x, y) ((pix->width * pix->height) + \ |
202 |
+- (pix->width * ((y) / 2)) + (x)) |
203 |
+-#define UV2_OFFSET(pix, x, y) ((pix->width * pix->height) + \ |
204 |
+- (pix->width * y) + (x)) |
205 |
++#define Y_OFFSET(pix, x, y) ((x) + pix->bytesperline * (y)) |
206 |
++#define U_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \ |
207 |
++ (pix->bytesperline * ((y) / 2) / 2) + (x) / 2) |
208 |
++#define V_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \ |
209 |
++ (pix->bytesperline * pix->height / 4) + \ |
210 |
++ (pix->bytesperline * ((y) / 2) / 2) + (x) / 2) |
211 |
++#define U2_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \ |
212 |
++ (pix->bytesperline * (y) / 2) + (x) / 2) |
213 |
++#define V2_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \ |
214 |
++ (pix->bytesperline * pix->height / 2) + \ |
215 |
++ (pix->bytesperline * (y) / 2) + (x) / 2) |
216 |
++#define UV_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \ |
217 |
++ (pix->bytesperline * ((y) / 2)) + (x)) |
218 |
++#define UV2_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \ |
219 |
++ (pix->bytesperline * y) + (x)) |
220 |
+ |
221 |
+ #define NUM_ALPHA_CHANNELS 7 |
222 |
+ |
223 |
+diff --git a/drivers/media/usb/stkwebcam/stk-webcam.c b/drivers/media/usb/stkwebcam/stk-webcam.c |
224 |
+index a45d464427c4c..0e231e576dc3d 100644 |
225 |
+--- a/drivers/media/usb/stkwebcam/stk-webcam.c |
226 |
++++ b/drivers/media/usb/stkwebcam/stk-webcam.c |
227 |
+@@ -1346,7 +1346,7 @@ static int stk_camera_probe(struct usb_interface *interface, |
228 |
+ if (!dev->isoc_ep) { |
229 |
+ pr_err("Could not find isoc-in endpoint\n"); |
230 |
+ err = -ENODEV; |
231 |
+- goto error; |
232 |
++ goto error_put; |
233 |
+ } |
234 |
+ dev->vsettings.palette = V4L2_PIX_FMT_RGB565; |
235 |
+ dev->vsettings.mode = MODE_VGA; |
236 |
+@@ -1359,10 +1359,12 @@ static int stk_camera_probe(struct usb_interface *interface, |
237 |
+ |
238 |
+ err = stk_register_video_device(dev); |
239 |
+ if (err) |
240 |
+- goto error; |
241 |
++ goto error_put; |
242 |
+ |
243 |
+ return 0; |
244 |
+ |
245 |
++error_put: |
246 |
++ usb_put_intf(interface); |
247 |
+ error: |
248 |
+ v4l2_ctrl_handler_free(hdl); |
249 |
+ v4l2_device_unregister(&dev->v4l2_dev); |
250 |
+diff --git a/drivers/net/ethernet/cadence/macb_ptp.c b/drivers/net/ethernet/cadence/macb_ptp.c |
251 |
+index 283918aeb741d..09d64a29f56e3 100644 |
252 |
+--- a/drivers/net/ethernet/cadence/macb_ptp.c |
253 |
++++ b/drivers/net/ethernet/cadence/macb_ptp.c |
254 |
+@@ -275,6 +275,12 @@ void gem_ptp_rxstamp(struct macb *bp, struct sk_buff *skb, |
255 |
+ |
256 |
+ if (GEM_BFEXT(DMA_RXVALID, desc->addr)) { |
257 |
+ desc_ptp = macb_ptp_desc(bp, desc); |
258 |
++ /* Unlikely but check */ |
259 |
++ if (!desc_ptp) { |
260 |
++ dev_warn_ratelimited(&bp->pdev->dev, |
261 |
++ "Timestamp not supported in BD\n"); |
262 |
++ return; |
263 |
++ } |
264 |
+ gem_hw_timestamp(bp, desc_ptp->ts_1, desc_ptp->ts_2, &ts); |
265 |
+ memset(shhwtstamps, 0, sizeof(struct skb_shared_hwtstamps)); |
266 |
+ shhwtstamps->hwtstamp = ktime_set(ts.tv_sec, ts.tv_nsec); |
267 |
+@@ -307,8 +313,11 @@ int gem_ptp_txstamp(struct macb_queue *queue, struct sk_buff *skb, |
268 |
+ if (CIRC_SPACE(head, tail, PTP_TS_BUFFER_SIZE) == 0) |
269 |
+ return -ENOMEM; |
270 |
+ |
271 |
+- skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; |
272 |
+ desc_ptp = macb_ptp_desc(queue->bp, desc); |
273 |
++ /* Unlikely but check */ |
274 |
++ if (!desc_ptp) |
275 |
++ return -EINVAL; |
276 |
++ skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; |
277 |
+ tx_timestamp = &queue->tx_timestamps[head]; |
278 |
+ tx_timestamp->skb = skb; |
279 |
+ /* ensure ts_1/ts_2 is loaded after ctrl (TX_USED check) */ |
280 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_main.c b/drivers/net/ethernet/qlogic/qed/qed_main.c |
281 |
+index 5bd58c65e1631..6bb9ec98a12b5 100644 |
282 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_main.c |
283 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_main.c |
284 |
+@@ -616,7 +616,12 @@ static int qed_enable_msix(struct qed_dev *cdev, |
285 |
+ rc = cnt; |
286 |
+ } |
287 |
+ |
288 |
+- if (rc > 0) { |
289 |
++ /* For VFs, we should return with an error in case we didn't get the |
290 |
++ * exact number of msix vectors as we requested. |
291 |
++ * Not doing that will lead to a crash when starting queues for |
292 |
++ * this VF. |
293 |
++ */ |
294 |
++ if ((IS_PF(cdev) && rc > 0) || (IS_VF(cdev) && rc == cnt)) { |
295 |
+ /* MSI-x configuration was achieved */ |
296 |
+ int_params->out.int_mode = QED_INT_MODE_MSIX; |
297 |
+ int_params->out.num_vectors = rc; |
298 |
+diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c |
299 |
+index d9a3c811ac8b1..e93f06e4a1729 100644 |
300 |
+--- a/drivers/net/ethernet/qlogic/qede/qede_main.c |
301 |
++++ b/drivers/net/ethernet/qlogic/qede/qede_main.c |
302 |
+@@ -1869,6 +1869,7 @@ static void qede_sync_free_irqs(struct qede_dev *edev) |
303 |
+ } |
304 |
+ |
305 |
+ edev->int_info.used_cnt = 0; |
306 |
++ edev->int_info.msix_cnt = 0; |
307 |
+ } |
308 |
+ |
309 |
+ static int qede_req_msix_irqs(struct qede_dev *edev) |
310 |
+@@ -2409,7 +2410,6 @@ static int qede_load(struct qede_dev *edev, enum qede_load_mode mode, |
311 |
+ goto out; |
312 |
+ err4: |
313 |
+ qede_sync_free_irqs(edev); |
314 |
+- memset(&edev->int_info.msix_cnt, 0, sizeof(struct qed_int_info)); |
315 |
+ err3: |
316 |
+ qede_napi_disable_remove(edev); |
317 |
+ err2: |
318 |
+diff --git a/drivers/reset/reset-zynqmp.c b/drivers/reset/reset-zynqmp.c |
319 |
+index ebd433fa09dd7..8c51768e9a720 100644 |
320 |
+--- a/drivers/reset/reset-zynqmp.c |
321 |
++++ b/drivers/reset/reset-zynqmp.c |
322 |
+@@ -53,7 +53,8 @@ static int zynqmp_reset_status(struct reset_controller_dev *rcdev, |
323 |
+ unsigned long id) |
324 |
+ { |
325 |
+ struct zynqmp_reset_data *priv = to_zynqmp_reset_data(rcdev); |
326 |
+- int val, err; |
327 |
++ int err; |
328 |
++ u32 val; |
329 |
+ |
330 |
+ err = zynqmp_pm_reset_get_status(priv->data->reset_id + id, &val); |
331 |
+ if (err) |
332 |
+diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c |
333 |
+index 95e2d6de4f213..ad0549dac7d79 100644 |
334 |
+--- a/drivers/tty/serial/8250/8250_omap.c |
335 |
++++ b/drivers/tty/serial/8250/8250_omap.c |
336 |
+@@ -1211,6 +1211,7 @@ static int omap8250_no_handle_irq(struct uart_port *port) |
337 |
+ static const struct soc_device_attribute k3_soc_devices[] = { |
338 |
+ { .family = "AM65X", }, |
339 |
+ { .family = "J721E", .revision = "SR1.0" }, |
340 |
++ { /* sentinel */ } |
341 |
+ }; |
342 |
+ |
343 |
+ static struct omap8250_dma_params am654_dma = { |
344 |
+diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c |
345 |
+index ae0c38ad1fcbe..0791480bf922b 100644 |
346 |
+--- a/fs/9p/vfs_inode.c |
347 |
++++ b/fs/9p/vfs_inode.c |
348 |
+@@ -398,7 +398,7 @@ static int v9fs_test_inode(struct inode *inode, void *data) |
349 |
+ |
350 |
+ umode = p9mode2unixmode(v9ses, st, &rdev); |
351 |
+ /* don't match inode of different type */ |
352 |
+- if ((inode->i_mode & S_IFMT) != (umode & S_IFMT)) |
353 |
++ if (inode_wrong_type(inode, umode)) |
354 |
+ return 0; |
355 |
+ |
356 |
+ /* compare qid details */ |
357 |
+@@ -1360,7 +1360,7 @@ int v9fs_refresh_inode(struct p9_fid *fid, struct inode *inode) |
358 |
+ * Don't update inode if the file type is different |
359 |
+ */ |
360 |
+ umode = p9mode2unixmode(v9ses, st, &rdev); |
361 |
+- if ((inode->i_mode & S_IFMT) != (umode & S_IFMT)) |
362 |
++ if (inode_wrong_type(inode, umode)) |
363 |
+ goto out; |
364 |
+ |
365 |
+ /* |
366 |
+diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c |
367 |
+index 0028eccb665a6..72b67d810b8c2 100644 |
368 |
+--- a/fs/9p/vfs_inode_dotl.c |
369 |
++++ b/fs/9p/vfs_inode_dotl.c |
370 |
+@@ -59,7 +59,7 @@ static int v9fs_test_inode_dotl(struct inode *inode, void *data) |
371 |
+ struct p9_stat_dotl *st = (struct p9_stat_dotl *)data; |
372 |
+ |
373 |
+ /* don't match inode of different type */ |
374 |
+- if ((inode->i_mode & S_IFMT) != (st->st_mode & S_IFMT)) |
375 |
++ if (inode_wrong_type(inode, st->st_mode)) |
376 |
+ return 0; |
377 |
+ |
378 |
+ if (inode->i_generation != st->st_gen) |
379 |
+@@ -933,7 +933,7 @@ int v9fs_refresh_inode_dotl(struct p9_fid *fid, struct inode *inode) |
380 |
+ /* |
381 |
+ * Don't update inode if the file type is different |
382 |
+ */ |
383 |
+- if ((inode->i_mode & S_IFMT) != (st->st_mode & S_IFMT)) |
384 |
++ if (inode_wrong_type(inode, st->st_mode)) |
385 |
+ goto out; |
386 |
+ |
387 |
+ /* |
388 |
+diff --git a/fs/ceph/mdsmap.c b/fs/ceph/mdsmap.c |
389 |
+index 1096d1d3a84c4..47f2903bacb92 100644 |
390 |
+--- a/fs/ceph/mdsmap.c |
391 |
++++ b/fs/ceph/mdsmap.c |
392 |
+@@ -393,9 +393,11 @@ void ceph_mdsmap_destroy(struct ceph_mdsmap *m) |
393 |
+ { |
394 |
+ int i; |
395 |
+ |
396 |
+- for (i = 0; i < m->possible_max_rank; i++) |
397 |
+- kfree(m->m_info[i].export_targets); |
398 |
+- kfree(m->m_info); |
399 |
++ if (m->m_info) { |
400 |
++ for (i = 0; i < m->possible_max_rank; i++) |
401 |
++ kfree(m->m_info[i].export_targets); |
402 |
++ kfree(m->m_info); |
403 |
++ } |
404 |
+ kfree(m->m_data_pg_pools); |
405 |
+ kfree(m); |
406 |
+ } |
407 |
+diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c |
408 |
+index b1f0c05d6eaf8..b11a919b9cab0 100644 |
409 |
+--- a/fs/cifs/inode.c |
410 |
++++ b/fs/cifs/inode.c |
411 |
+@@ -425,8 +425,7 @@ int cifs_get_inode_info_unix(struct inode **pinode, |
412 |
+ } |
413 |
+ |
414 |
+ /* if filetype is different, return error */ |
415 |
+- if (unlikely(((*pinode)->i_mode & S_IFMT) != |
416 |
+- (fattr.cf_mode & S_IFMT))) { |
417 |
++ if (unlikely(inode_wrong_type(*pinode, fattr.cf_mode))) { |
418 |
+ CIFS_I(*pinode)->time = 0; /* force reval */ |
419 |
+ rc = -ESTALE; |
420 |
+ goto cgiiu_exit; |
421 |
+@@ -1243,7 +1242,7 @@ cifs_find_inode(struct inode *inode, void *opaque) |
422 |
+ return 0; |
423 |
+ |
424 |
+ /* don't match inode of different type */ |
425 |
+- if ((inode->i_mode & S_IFMT) != (fattr->cf_mode & S_IFMT)) |
426 |
++ if (inode_wrong_type(inode, fattr->cf_mode)) |
427 |
+ return 0; |
428 |
+ |
429 |
+ /* if it's not a directory or has no dentries, then flag it */ |
430 |
+diff --git a/fs/crypto/hooks.c b/fs/crypto/hooks.c |
431 |
+index 061418be4b086..4180371bf8642 100644 |
432 |
+--- a/fs/crypto/hooks.c |
433 |
++++ b/fs/crypto/hooks.c |
434 |
+@@ -379,3 +379,47 @@ err_kfree: |
435 |
+ return ERR_PTR(err); |
436 |
+ } |
437 |
+ EXPORT_SYMBOL_GPL(fscrypt_get_symlink); |
438 |
++ |
439 |
++/** |
440 |
++ * fscrypt_symlink_getattr() - set the correct st_size for encrypted symlinks |
441 |
++ * @path: the path for the encrypted symlink being queried |
442 |
++ * @stat: the struct being filled with the symlink's attributes |
443 |
++ * |
444 |
++ * Override st_size of encrypted symlinks to be the length of the decrypted |
445 |
++ * symlink target (or the no-key encoded symlink target, if the key is |
446 |
++ * unavailable) rather than the length of the encrypted symlink target. This is |
447 |
++ * necessary for st_size to match the symlink target that userspace actually |
448 |
++ * sees. POSIX requires this, and some userspace programs depend on it. |
449 |
++ * |
450 |
++ * This requires reading the symlink target from disk if needed, setting up the |
451 |
++ * inode's encryption key if possible, and then decrypting or encoding the |
452 |
++ * symlink target. This makes lstat() more heavyweight than is normally the |
453 |
++ * case. However, decrypted symlink targets will be cached in ->i_link, so |
454 |
++ * usually the symlink won't have to be read and decrypted again later if/when |
455 |
++ * it is actually followed, readlink() is called, or lstat() is called again. |
456 |
++ * |
457 |
++ * Return: 0 on success, -errno on failure |
458 |
++ */ |
459 |
++int fscrypt_symlink_getattr(const struct path *path, struct kstat *stat) |
460 |
++{ |
461 |
++ struct dentry *dentry = path->dentry; |
462 |
++ struct inode *inode = d_inode(dentry); |
463 |
++ const char *link; |
464 |
++ DEFINE_DELAYED_CALL(done); |
465 |
++ |
466 |
++ /* |
467 |
++ * To get the symlink target that userspace will see (whether it's the |
468 |
++ * decrypted target or the no-key encoded target), we can just get it in |
469 |
++ * the same way the VFS does during path resolution and readlink(). |
470 |
++ */ |
471 |
++ link = READ_ONCE(inode->i_link); |
472 |
++ if (!link) { |
473 |
++ link = inode->i_op->get_link(dentry, inode, &done); |
474 |
++ if (IS_ERR(link)) |
475 |
++ return PTR_ERR(link); |
476 |
++ } |
477 |
++ stat->size = strlen(link); |
478 |
++ do_delayed_call(&done); |
479 |
++ return 0; |
480 |
++} |
481 |
++EXPORT_SYMBOL_GPL(fscrypt_symlink_getattr); |
482 |
+diff --git a/fs/exec.c b/fs/exec.c |
483 |
+index c7a4ef8df3058..ca89e0e3ef10f 100644 |
484 |
+--- a/fs/exec.c |
485 |
++++ b/fs/exec.c |
486 |
+@@ -1347,10 +1347,6 @@ int begin_new_exec(struct linux_binprm * bprm) |
487 |
+ WRITE_ONCE(me->self_exec_id, me->self_exec_id + 1); |
488 |
+ flush_signal_handlers(me, 0); |
489 |
+ |
490 |
+- retval = set_cred_ucounts(bprm->cred); |
491 |
+- if (retval < 0) |
492 |
+- goto out_unlock; |
493 |
+- |
494 |
+ /* |
495 |
+ * install the new credentials for this executable |
496 |
+ */ |
497 |
+diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c |
498 |
+index b41512d1badc3..0f7b53d5edea6 100644 |
499 |
+--- a/fs/ext4/inline.c |
500 |
++++ b/fs/ext4/inline.c |
501 |
+@@ -750,6 +750,12 @@ int ext4_write_inline_data_end(struct inode *inode, loff_t pos, unsigned len, |
502 |
+ ext4_write_lock_xattr(inode, &no_expand); |
503 |
+ BUG_ON(!ext4_has_inline_data(inode)); |
504 |
+ |
505 |
++ /* |
506 |
++ * ei->i_inline_off may have changed since ext4_write_begin() |
507 |
++ * called ext4_try_to_write_inline_data() |
508 |
++ */ |
509 |
++ (void) ext4_find_inline_data_nolock(inode); |
510 |
++ |
511 |
+ kaddr = kmap_atomic(page); |
512 |
+ ext4_write_inline_data(inode, &iloc, kaddr, pos, len); |
513 |
+ kunmap_atomic(kaddr); |
514 |
+diff --git a/fs/ext4/symlink.c b/fs/ext4/symlink.c |
515 |
+index dd05af983092d..a9457fed351ed 100644 |
516 |
+--- a/fs/ext4/symlink.c |
517 |
++++ b/fs/ext4/symlink.c |
518 |
+@@ -52,10 +52,19 @@ static const char *ext4_encrypted_get_link(struct dentry *dentry, |
519 |
+ return paddr; |
520 |
+ } |
521 |
+ |
522 |
++static int ext4_encrypted_symlink_getattr(const struct path *path, |
523 |
++ struct kstat *stat, u32 request_mask, |
524 |
++ unsigned int query_flags) |
525 |
++{ |
526 |
++ ext4_getattr(path, stat, request_mask, query_flags); |
527 |
++ |
528 |
++ return fscrypt_symlink_getattr(path, stat); |
529 |
++} |
530 |
++ |
531 |
+ const struct inode_operations ext4_encrypted_symlink_inode_operations = { |
532 |
+ .get_link = ext4_encrypted_get_link, |
533 |
+ .setattr = ext4_setattr, |
534 |
+- .getattr = ext4_getattr, |
535 |
++ .getattr = ext4_encrypted_symlink_getattr, |
536 |
+ .listxattr = ext4_listxattr, |
537 |
+ }; |
538 |
+ |
539 |
+diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c |
540 |
+index 17d0e5f4efec8..710a6f73a6858 100644 |
541 |
+--- a/fs/f2fs/namei.c |
542 |
++++ b/fs/f2fs/namei.c |
543 |
+@@ -1307,9 +1307,18 @@ static const char *f2fs_encrypted_get_link(struct dentry *dentry, |
544 |
+ return target; |
545 |
+ } |
546 |
+ |
547 |
++static int f2fs_encrypted_symlink_getattr(const struct path *path, |
548 |
++ struct kstat *stat, u32 request_mask, |
549 |
++ unsigned int query_flags) |
550 |
++{ |
551 |
++ f2fs_getattr(path, stat, request_mask, query_flags); |
552 |
++ |
553 |
++ return fscrypt_symlink_getattr(path, stat); |
554 |
++} |
555 |
++ |
556 |
+ const struct inode_operations f2fs_encrypted_symlink_inode_operations = { |
557 |
+ .get_link = f2fs_encrypted_get_link, |
558 |
+- .getattr = f2fs_getattr, |
559 |
++ .getattr = f2fs_encrypted_symlink_getattr, |
560 |
+ .setattr = f2fs_setattr, |
561 |
+ .listxattr = f2fs_listxattr, |
562 |
+ }; |
563 |
+diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c |
564 |
+index 756bbdd563e08..2e300176cb889 100644 |
565 |
+--- a/fs/fuse/dir.c |
566 |
++++ b/fs/fuse/dir.c |
567 |
+@@ -252,7 +252,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags) |
568 |
+ if (ret == -ENOMEM) |
569 |
+ goto out; |
570 |
+ if (ret || fuse_invalid_attr(&outarg.attr) || |
571 |
+- (outarg.attr.mode ^ inode->i_mode) & S_IFMT) |
572 |
++ fuse_stale_inode(inode, outarg.generation, &outarg.attr)) |
573 |
+ goto invalid; |
574 |
+ |
575 |
+ forget_all_cached_acls(inode); |
576 |
+@@ -1062,7 +1062,7 @@ static int fuse_do_getattr(struct inode *inode, struct kstat *stat, |
577 |
+ err = fuse_simple_request(fm, &args); |
578 |
+ if (!err) { |
579 |
+ if (fuse_invalid_attr(&outarg.attr) || |
580 |
+- (inode->i_mode ^ outarg.attr.mode) & S_IFMT) { |
581 |
++ inode_wrong_type(inode, outarg.attr.mode)) { |
582 |
+ fuse_make_bad(inode); |
583 |
+ err = -EIO; |
584 |
+ } else { |
585 |
+@@ -1699,7 +1699,7 @@ int fuse_do_setattr(struct dentry *dentry, struct iattr *attr, |
586 |
+ } |
587 |
+ |
588 |
+ if (fuse_invalid_attr(&outarg.attr) || |
589 |
+- (inode->i_mode ^ outarg.attr.mode) & S_IFMT) { |
590 |
++ inode_wrong_type(inode, outarg.attr.mode)) { |
591 |
+ fuse_make_bad(inode); |
592 |
+ err = -EIO; |
593 |
+ goto error; |
594 |
+diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h |
595 |
+index 8150621101c6f..ff94da6840176 100644 |
596 |
+--- a/fs/fuse/fuse_i.h |
597 |
++++ b/fs/fuse/fuse_i.h |
598 |
+@@ -860,6 +860,13 @@ static inline u64 fuse_get_attr_version(struct fuse_conn *fc) |
599 |
+ return atomic64_read(&fc->attr_version); |
600 |
+ } |
601 |
+ |
602 |
++static inline bool fuse_stale_inode(const struct inode *inode, int generation, |
603 |
++ struct fuse_attr *attr) |
604 |
++{ |
605 |
++ return inode->i_generation != generation || |
606 |
++ inode_wrong_type(inode, attr->mode); |
607 |
++} |
608 |
++ |
609 |
+ static inline void fuse_make_bad(struct inode *inode) |
610 |
+ { |
611 |
+ remove_inode_hash(inode); |
612 |
+diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c |
613 |
+index f94b0bb57619c..053c56af3b6f3 100644 |
614 |
+--- a/fs/fuse/inode.c |
615 |
++++ b/fs/fuse/inode.c |
616 |
+@@ -340,8 +340,8 @@ retry: |
617 |
+ inode->i_generation = generation; |
618 |
+ fuse_init_inode(inode, attr); |
619 |
+ unlock_new_inode(inode); |
620 |
+- } else if ((inode->i_mode ^ attr->mode) & S_IFMT) { |
621 |
+- /* Inode has changed type, any I/O on the old should fail */ |
622 |
++ } else if (fuse_stale_inode(inode, generation, attr)) { |
623 |
++ /* nodeid was reused, any I/O on the old inode should fail */ |
624 |
+ fuse_make_bad(inode); |
625 |
+ iput(inode); |
626 |
+ goto retry; |
627 |
+diff --git a/fs/fuse/readdir.c b/fs/fuse/readdir.c |
628 |
+index 3441ffa740f3d..bc267832310c7 100644 |
629 |
+--- a/fs/fuse/readdir.c |
630 |
++++ b/fs/fuse/readdir.c |
631 |
+@@ -200,9 +200,12 @@ retry: |
632 |
+ if (!d_in_lookup(dentry)) { |
633 |
+ struct fuse_inode *fi; |
634 |
+ inode = d_inode(dentry); |
635 |
++ if (inode && get_node_id(inode) != o->nodeid) |
636 |
++ inode = NULL; |
637 |
+ if (!inode || |
638 |
+- get_node_id(inode) != o->nodeid || |
639 |
+- ((o->attr.mode ^ inode->i_mode) & S_IFMT)) { |
640 |
++ fuse_stale_inode(inode, o->generation, &o->attr)) { |
641 |
++ if (inode) |
642 |
++ fuse_make_bad(inode); |
643 |
+ d_invalidate(dentry); |
644 |
+ dput(dentry); |
645 |
+ goto retry; |
646 |
+diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c |
647 |
+index 9811880470a07..21addb78523d2 100644 |
648 |
+--- a/fs/nfs/inode.c |
649 |
++++ b/fs/nfs/inode.c |
650 |
+@@ -322,7 +322,7 @@ nfs_find_actor(struct inode *inode, void *opaque) |
651 |
+ |
652 |
+ if (NFS_FILEID(inode) != fattr->fileid) |
653 |
+ return 0; |
654 |
+- if ((S_IFMT & inode->i_mode) != (S_IFMT & fattr->mode)) |
655 |
++ if (inode_wrong_type(inode, fattr->mode)) |
656 |
+ return 0; |
657 |
+ if (nfs_compare_fh(NFS_FH(inode), fh)) |
658 |
+ return 0; |
659 |
+@@ -1446,7 +1446,7 @@ static int nfs_check_inode_attributes(struct inode *inode, struct nfs_fattr *fat |
660 |
+ return 0; |
661 |
+ return -ESTALE; |
662 |
+ } |
663 |
+- if ((fattr->valid & NFS_ATTR_FATTR_TYPE) && (inode->i_mode & S_IFMT) != (fattr->mode & S_IFMT)) |
664 |
++ if ((fattr->valid & NFS_ATTR_FATTR_TYPE) && inode_wrong_type(inode, fattr->mode)) |
665 |
+ return -ESTALE; |
666 |
+ |
667 |
+ |
668 |
+@@ -1861,7 +1861,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) |
669 |
+ /* |
670 |
+ * Make sure the inode's type hasn't changed. |
671 |
+ */ |
672 |
+- if ((fattr->valid & NFS_ATTR_FATTR_TYPE) && (inode->i_mode & S_IFMT) != (fattr->mode & S_IFMT)) { |
673 |
++ if ((fattr->valid & NFS_ATTR_FATTR_TYPE) && inode_wrong_type(inode, fattr->mode)) { |
674 |
+ /* |
675 |
+ * Big trouble! The inode has become a different object. |
676 |
+ */ |
677 |
+diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c |
678 |
+index 0d71549f9d42a..9c9de2b66e641 100644 |
679 |
+--- a/fs/nfsd/nfsproc.c |
680 |
++++ b/fs/nfsd/nfsproc.c |
681 |
+@@ -376,7 +376,7 @@ nfsd_proc_create(struct svc_rqst *rqstp) |
682 |
+ |
683 |
+ /* Make sure the type and device matches */ |
684 |
+ resp->status = nfserr_exist; |
685 |
+- if (inode && type != (inode->i_mode & S_IFMT)) |
686 |
++ if (inode && inode_wrong_type(inode, type)) |
687 |
+ goto out_unlock; |
688 |
+ } |
689 |
+ |
690 |
+diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c |
691 |
+index f3309e044f079..092812c2f118a 100644 |
692 |
+--- a/fs/overlayfs/namei.c |
693 |
++++ b/fs/overlayfs/namei.c |
694 |
+@@ -366,7 +366,7 @@ int ovl_check_origin_fh(struct ovl_fs *ofs, struct ovl_fh *fh, bool connected, |
695 |
+ return PTR_ERR(origin); |
696 |
+ |
697 |
+ if (upperdentry && !ovl_is_whiteout(upperdentry) && |
698 |
+- ((d_inode(origin)->i_mode ^ d_inode(upperdentry)->i_mode) & S_IFMT)) |
699 |
++ inode_wrong_type(d_inode(upperdentry), d_inode(origin)->i_mode)) |
700 |
+ goto invalid; |
701 |
+ |
702 |
+ if (!*stackp) |
703 |
+@@ -724,7 +724,7 @@ struct dentry *ovl_lookup_index(struct ovl_fs *ofs, struct dentry *upper, |
704 |
+ index = ERR_PTR(-ESTALE); |
705 |
+ goto out; |
706 |
+ } else if (ovl_dentry_weird(index) || ovl_is_whiteout(index) || |
707 |
+- ((inode->i_mode ^ d_inode(origin)->i_mode) & S_IFMT)) { |
708 |
++ inode_wrong_type(inode, d_inode(origin)->i_mode)) { |
709 |
+ /* |
710 |
+ * Index should always be of the same file type as origin |
711 |
+ * except for the case of a whiteout index. A whiteout |
712 |
+diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c |
713 |
+index b77d1637bbbc8..f4826b6da6828 100644 |
714 |
+--- a/fs/ubifs/file.c |
715 |
++++ b/fs/ubifs/file.c |
716 |
+@@ -1629,6 +1629,16 @@ static const char *ubifs_get_link(struct dentry *dentry, |
717 |
+ return fscrypt_get_symlink(inode, ui->data, ui->data_len, done); |
718 |
+ } |
719 |
+ |
720 |
++static int ubifs_symlink_getattr(const struct path *path, struct kstat *stat, |
721 |
++ u32 request_mask, unsigned int query_flags) |
722 |
++{ |
723 |
++ ubifs_getattr(path, stat, request_mask, query_flags); |
724 |
++ |
725 |
++ if (IS_ENCRYPTED(d_inode(path->dentry))) |
726 |
++ return fscrypt_symlink_getattr(path, stat); |
727 |
++ return 0; |
728 |
++} |
729 |
++ |
730 |
+ const struct address_space_operations ubifs_file_address_operations = { |
731 |
+ .readpage = ubifs_readpage, |
732 |
+ .writepage = ubifs_writepage, |
733 |
+@@ -1654,7 +1664,7 @@ const struct inode_operations ubifs_file_inode_operations = { |
734 |
+ const struct inode_operations ubifs_symlink_inode_operations = { |
735 |
+ .get_link = ubifs_get_link, |
736 |
+ .setattr = ubifs_setattr, |
737 |
+- .getattr = ubifs_getattr, |
738 |
++ .getattr = ubifs_symlink_getattr, |
739 |
+ #ifdef CONFIG_UBIFS_FS_XATTR |
740 |
+ .listxattr = ubifs_listxattr, |
741 |
+ #endif |
742 |
+diff --git a/include/linux/cred.h b/include/linux/cred.h |
743 |
+index ad160e5fe5c64..18639c069263f 100644 |
744 |
+--- a/include/linux/cred.h |
745 |
++++ b/include/linux/cred.h |
746 |
+@@ -144,7 +144,6 @@ struct cred { |
747 |
+ #endif |
748 |
+ struct user_struct *user; /* real user ID subscription */ |
749 |
+ struct user_namespace *user_ns; /* user_ns the caps and keyrings are relative to. */ |
750 |
+- struct ucounts *ucounts; |
751 |
+ struct group_info *group_info; /* supplementary groups for euid/fsgid */ |
752 |
+ /* RCU deletion */ |
753 |
+ union { |
754 |
+@@ -171,7 +170,6 @@ extern int set_security_override_from_ctx(struct cred *, const char *); |
755 |
+ extern int set_create_files_as(struct cred *, struct inode *); |
756 |
+ extern int cred_fscmp(const struct cred *, const struct cred *); |
757 |
+ extern void __init cred_init(void); |
758 |
+-extern int set_cred_ucounts(struct cred *); |
759 |
+ |
760 |
+ /* |
761 |
+ * check for validity of credentials |
762 |
+diff --git a/include/linux/fs.h b/include/linux/fs.h |
763 |
+index 8bde32cf97115..43bb6a51e42d9 100644 |
764 |
+--- a/include/linux/fs.h |
765 |
++++ b/include/linux/fs.h |
766 |
+@@ -2768,6 +2768,11 @@ static inline bool execute_ok(struct inode *inode) |
767 |
+ return (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode); |
768 |
+ } |
769 |
+ |
770 |
++static inline bool inode_wrong_type(const struct inode *inode, umode_t mode) |
771 |
++{ |
772 |
++ return (inode->i_mode ^ mode) & S_IFMT; |
773 |
++} |
774 |
++ |
775 |
+ static inline void file_start_write(struct file *file) |
776 |
+ { |
777 |
+ if (!S_ISREG(file_inode(file)->i_mode)) |
778 |
+diff --git a/include/linux/fscrypt.h b/include/linux/fscrypt.h |
779 |
+index 8e1d31c959bfa..d0a1b8edfd9db 100644 |
780 |
+--- a/include/linux/fscrypt.h |
781 |
++++ b/include/linux/fscrypt.h |
782 |
+@@ -252,6 +252,7 @@ int __fscrypt_encrypt_symlink(struct inode *inode, const char *target, |
783 |
+ const char *fscrypt_get_symlink(struct inode *inode, const void *caddr, |
784 |
+ unsigned int max_size, |
785 |
+ struct delayed_call *done); |
786 |
++int fscrypt_symlink_getattr(const struct path *path, struct kstat *stat); |
787 |
+ static inline void fscrypt_set_ops(struct super_block *sb, |
788 |
+ const struct fscrypt_operations *s_cop) |
789 |
+ { |
790 |
+@@ -575,6 +576,12 @@ static inline const char *fscrypt_get_symlink(struct inode *inode, |
791 |
+ return ERR_PTR(-EOPNOTSUPP); |
792 |
+ } |
793 |
+ |
794 |
++static inline int fscrypt_symlink_getattr(const struct path *path, |
795 |
++ struct kstat *stat) |
796 |
++{ |
797 |
++ return -EOPNOTSUPP; |
798 |
++} |
799 |
++ |
800 |
+ static inline void fscrypt_set_ops(struct super_block *sb, |
801 |
+ const struct fscrypt_operations *s_cop) |
802 |
+ { |
803 |
+diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h |
804 |
+index 2d906b9c14992..e1d88630ff243 100644 |
805 |
+--- a/include/linux/spi/spi.h |
806 |
++++ b/include/linux/spi/spi.h |
807 |
+@@ -646,8 +646,8 @@ struct spi_controller { |
808 |
+ int *cs_gpios; |
809 |
+ struct gpio_desc **cs_gpiods; |
810 |
+ bool use_gpio_descriptors; |
811 |
+- u8 unused_native_cs; |
812 |
+- u8 max_native_cs; |
813 |
++ s8 unused_native_cs; |
814 |
++ s8 max_native_cs; |
815 |
+ |
816 |
+ /* statistics */ |
817 |
+ struct spi_statistics statistics; |
818 |
+diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h |
819 |
+index e1bd560da1cd4..7616c7bf4b241 100644 |
820 |
+--- a/include/linux/user_namespace.h |
821 |
++++ b/include/linux/user_namespace.h |
822 |
+@@ -101,15 +101,11 @@ struct ucounts { |
823 |
+ }; |
824 |
+ |
825 |
+ extern struct user_namespace init_user_ns; |
826 |
+-extern struct ucounts init_ucounts; |
827 |
+ |
828 |
+ bool setup_userns_sysctls(struct user_namespace *ns); |
829 |
+ void retire_userns_sysctls(struct user_namespace *ns); |
830 |
+ struct ucounts *inc_ucount(struct user_namespace *ns, kuid_t uid, enum ucount_type type); |
831 |
+ void dec_ucount(struct ucounts *ucounts, enum ucount_type type); |
832 |
+-struct ucounts *alloc_ucounts(struct user_namespace *ns, kuid_t uid); |
833 |
+-struct ucounts *get_ucounts(struct ucounts *ucounts); |
834 |
+-void put_ucounts(struct ucounts *ucounts); |
835 |
+ |
836 |
+ #ifdef CONFIG_USER_NS |
837 |
+ |
838 |
+diff --git a/kernel/cred.c b/kernel/cred.c |
839 |
+index 8c0983fa794a7..421b1149c6516 100644 |
840 |
+--- a/kernel/cred.c |
841 |
++++ b/kernel/cred.c |
842 |
+@@ -60,7 +60,6 @@ struct cred init_cred = { |
843 |
+ .user = INIT_USER, |
844 |
+ .user_ns = &init_user_ns, |
845 |
+ .group_info = &init_groups, |
846 |
+- .ucounts = &init_ucounts, |
847 |
+ }; |
848 |
+ |
849 |
+ static inline void set_cred_subscribers(struct cred *cred, int n) |
850 |
+@@ -120,8 +119,6 @@ static void put_cred_rcu(struct rcu_head *rcu) |
851 |
+ if (cred->group_info) |
852 |
+ put_group_info(cred->group_info); |
853 |
+ free_uid(cred->user); |
854 |
+- if (cred->ucounts) |
855 |
+- put_ucounts(cred->ucounts); |
856 |
+ put_user_ns(cred->user_ns); |
857 |
+ kmem_cache_free(cred_jar, cred); |
858 |
+ } |
859 |
+@@ -225,7 +222,6 @@ struct cred *cred_alloc_blank(void) |
860 |
+ #ifdef CONFIG_DEBUG_CREDENTIALS |
861 |
+ new->magic = CRED_MAGIC; |
862 |
+ #endif |
863 |
+- new->ucounts = get_ucounts(&init_ucounts); |
864 |
+ |
865 |
+ if (security_cred_alloc_blank(new, GFP_KERNEL_ACCOUNT) < 0) |
866 |
+ goto error; |
867 |
+@@ -286,13 +282,8 @@ struct cred *prepare_creds(void) |
868 |
+ new->security = NULL; |
869 |
+ #endif |
870 |
+ |
871 |
+- new->ucounts = get_ucounts(new->ucounts); |
872 |
+- if (!new->ucounts) |
873 |
+- goto error; |
874 |
+- |
875 |
+ if (security_prepare_creds(new, old, GFP_KERNEL_ACCOUNT) < 0) |
876 |
+ goto error; |
877 |
+- |
878 |
+ validate_creds(new); |
879 |
+ return new; |
880 |
+ |
881 |
+@@ -372,9 +363,6 @@ int copy_creds(struct task_struct *p, unsigned long clone_flags) |
882 |
+ ret = create_user_ns(new); |
883 |
+ if (ret < 0) |
884 |
+ goto error_put; |
885 |
+- ret = set_cred_ucounts(new); |
886 |
+- if (ret < 0) |
887 |
+- goto error_put; |
888 |
+ } |
889 |
+ |
890 |
+ #ifdef CONFIG_KEYS |
891 |
+@@ -665,31 +653,6 @@ int cred_fscmp(const struct cred *a, const struct cred *b) |
892 |
+ } |
893 |
+ EXPORT_SYMBOL(cred_fscmp); |
894 |
+ |
895 |
+-int set_cred_ucounts(struct cred *new) |
896 |
+-{ |
897 |
+- struct task_struct *task = current; |
898 |
+- const struct cred *old = task->real_cred; |
899 |
+- struct ucounts *old_ucounts = new->ucounts; |
900 |
+- |
901 |
+- if (new->user == old->user && new->user_ns == old->user_ns) |
902 |
+- return 0; |
903 |
+- |
904 |
+- /* |
905 |
+- * This optimization is needed because alloc_ucounts() uses locks |
906 |
+- * for table lookups. |
907 |
+- */ |
908 |
+- if (old_ucounts && old_ucounts->ns == new->user_ns && uid_eq(old_ucounts->uid, new->euid)) |
909 |
+- return 0; |
910 |
+- |
911 |
+- if (!(new->ucounts = alloc_ucounts(new->user_ns, new->euid))) |
912 |
+- return -EAGAIN; |
913 |
+- |
914 |
+- if (old_ucounts) |
915 |
+- put_ucounts(old_ucounts); |
916 |
+- |
917 |
+- return 0; |
918 |
+-} |
919 |
+- |
920 |
+ /* |
921 |
+ * initialise the credentials stuff |
922 |
+ */ |
923 |
+@@ -753,10 +716,6 @@ struct cred *prepare_kernel_cred(struct task_struct *daemon) |
924 |
+ #ifdef CONFIG_SECURITY |
925 |
+ new->security = NULL; |
926 |
+ #endif |
927 |
+- new->ucounts = get_ucounts(new->ucounts); |
928 |
+- if (!new->ucounts) |
929 |
+- goto error; |
930 |
+- |
931 |
+ if (security_prepare_creds(new, old, GFP_KERNEL_ACCOUNT) < 0) |
932 |
+ goto error; |
933 |
+ |
934 |
+diff --git a/kernel/fork.c b/kernel/fork.c |
935 |
+index 096945ef49ad7..9705439439fe3 100644 |
936 |
+--- a/kernel/fork.c |
937 |
++++ b/kernel/fork.c |
938 |
+@@ -2960,12 +2960,6 @@ int ksys_unshare(unsigned long unshare_flags) |
939 |
+ if (err) |
940 |
+ goto bad_unshare_cleanup_cred; |
941 |
+ |
942 |
+- if (new_cred) { |
943 |
+- err = set_cred_ucounts(new_cred); |
944 |
+- if (err) |
945 |
+- goto bad_unshare_cleanup_cred; |
946 |
+- } |
947 |
+- |
948 |
+ if (new_fs || new_fd || do_sysvsem || new_cred || new_nsproxy) { |
949 |
+ if (do_sysvsem) { |
950 |
+ /* |
951 |
+diff --git a/kernel/static_call.c b/kernel/static_call.c |
952 |
+index b62a0c41c9050..dc5665b628140 100644 |
953 |
+--- a/kernel/static_call.c |
954 |
++++ b/kernel/static_call.c |
955 |
+@@ -165,13 +165,13 @@ void __static_call_update(struct static_call_key *key, void *tramp, void *func) |
956 |
+ |
957 |
+ stop = __stop_static_call_sites; |
958 |
+ |
959 |
+-#ifdef CONFIG_MODULES |
960 |
+ if (mod) { |
961 |
++#ifdef CONFIG_MODULES |
962 |
+ stop = mod->static_call_sites + |
963 |
+ mod->num_static_call_sites; |
964 |
+ init = mod->state == MODULE_STATE_COMING; |
965 |
+- } |
966 |
+ #endif |
967 |
++ } |
968 |
+ |
969 |
+ for (site = site_mod->sites; |
970 |
+ site < stop && static_call_key(site) == key; site++) { |
971 |
+diff --git a/kernel/sys.c b/kernel/sys.c |
972 |
+index 0670e824e0197..a730c03ee607c 100644 |
973 |
+--- a/kernel/sys.c |
974 |
++++ b/kernel/sys.c |
975 |
+@@ -552,10 +552,6 @@ long __sys_setreuid(uid_t ruid, uid_t euid) |
976 |
+ if (retval < 0) |
977 |
+ goto error; |
978 |
+ |
979 |
+- retval = set_cred_ucounts(new); |
980 |
+- if (retval < 0) |
981 |
+- goto error; |
982 |
+- |
983 |
+ return commit_creds(new); |
984 |
+ |
985 |
+ error: |
986 |
+@@ -614,10 +610,6 @@ long __sys_setuid(uid_t uid) |
987 |
+ if (retval < 0) |
988 |
+ goto error; |
989 |
+ |
990 |
+- retval = set_cred_ucounts(new); |
991 |
+- if (retval < 0) |
992 |
+- goto error; |
993 |
+- |
994 |
+ return commit_creds(new); |
995 |
+ |
996 |
+ error: |
997 |
+@@ -693,10 +685,6 @@ long __sys_setresuid(uid_t ruid, uid_t euid, uid_t suid) |
998 |
+ if (retval < 0) |
999 |
+ goto error; |
1000 |
+ |
1001 |
+- retval = set_cred_ucounts(new); |
1002 |
+- if (retval < 0) |
1003 |
+- goto error; |
1004 |
+- |
1005 |
+ return commit_creds(new); |
1006 |
+ |
1007 |
+ error: |
1008 |
+diff --git a/kernel/ucount.c b/kernel/ucount.c |
1009 |
+index 9894795043c42..11b1596e2542a 100644 |
1010 |
+--- a/kernel/ucount.c |
1011 |
++++ b/kernel/ucount.c |
1012 |
+@@ -8,12 +8,6 @@ |
1013 |
+ #include <linux/kmemleak.h> |
1014 |
+ #include <linux/user_namespace.h> |
1015 |
+ |
1016 |
+-struct ucounts init_ucounts = { |
1017 |
+- .ns = &init_user_ns, |
1018 |
+- .uid = GLOBAL_ROOT_UID, |
1019 |
+- .count = 1, |
1020 |
+-}; |
1021 |
+- |
1022 |
+ #define UCOUNTS_HASHTABLE_BITS 10 |
1023 |
+ static struct hlist_head ucounts_hashtable[(1 << UCOUNTS_HASHTABLE_BITS)]; |
1024 |
+ static DEFINE_SPINLOCK(ucounts_lock); |
1025 |
+@@ -131,15 +125,7 @@ static struct ucounts *find_ucounts(struct user_namespace *ns, kuid_t uid, struc |
1026 |
+ return NULL; |
1027 |
+ } |
1028 |
+ |
1029 |
+-static void hlist_add_ucounts(struct ucounts *ucounts) |
1030 |
+-{ |
1031 |
+- struct hlist_head *hashent = ucounts_hashentry(ucounts->ns, ucounts->uid); |
1032 |
+- spin_lock_irq(&ucounts_lock); |
1033 |
+- hlist_add_head(&ucounts->node, hashent); |
1034 |
+- spin_unlock_irq(&ucounts_lock); |
1035 |
+-} |
1036 |
+- |
1037 |
+-struct ucounts *alloc_ucounts(struct user_namespace *ns, kuid_t uid) |
1038 |
++static struct ucounts *get_ucounts(struct user_namespace *ns, kuid_t uid) |
1039 |
+ { |
1040 |
+ struct hlist_head *hashent = ucounts_hashentry(ns, uid); |
1041 |
+ struct ucounts *ucounts, *new; |
1042 |
+@@ -174,26 +160,7 @@ struct ucounts *alloc_ucounts(struct user_namespace *ns, kuid_t uid) |
1043 |
+ return ucounts; |
1044 |
+ } |
1045 |
+ |
1046 |
+-struct ucounts *get_ucounts(struct ucounts *ucounts) |
1047 |
+-{ |
1048 |
+- unsigned long flags; |
1049 |
+- |
1050 |
+- if (!ucounts) |
1051 |
+- return NULL; |
1052 |
+- |
1053 |
+- spin_lock_irqsave(&ucounts_lock, flags); |
1054 |
+- if (ucounts->count == INT_MAX) { |
1055 |
+- WARN_ONCE(1, "ucounts: counter has reached its maximum value"); |
1056 |
+- ucounts = NULL; |
1057 |
+- } else { |
1058 |
+- ucounts->count += 1; |
1059 |
+- } |
1060 |
+- spin_unlock_irqrestore(&ucounts_lock, flags); |
1061 |
+- |
1062 |
+- return ucounts; |
1063 |
+-} |
1064 |
+- |
1065 |
+-void put_ucounts(struct ucounts *ucounts) |
1066 |
++static void put_ucounts(struct ucounts *ucounts) |
1067 |
+ { |
1068 |
+ unsigned long flags; |
1069 |
+ |
1070 |
+@@ -227,7 +194,7 @@ struct ucounts *inc_ucount(struct user_namespace *ns, kuid_t uid, |
1071 |
+ { |
1072 |
+ struct ucounts *ucounts, *iter, *bad; |
1073 |
+ struct user_namespace *tns; |
1074 |
+- ucounts = alloc_ucounts(ns, uid); |
1075 |
++ ucounts = get_ucounts(ns, uid); |
1076 |
+ for (iter = ucounts; iter; iter = tns->ucounts) { |
1077 |
+ int max; |
1078 |
+ tns = iter->ns; |
1079 |
+@@ -270,7 +237,6 @@ static __init int user_namespace_sysctl_init(void) |
1080 |
+ BUG_ON(!user_header); |
1081 |
+ BUG_ON(!setup_userns_sysctls(&init_user_ns)); |
1082 |
+ #endif |
1083 |
+- hlist_add_ucounts(&init_ucounts); |
1084 |
+ return 0; |
1085 |
+ } |
1086 |
+ subsys_initcall(user_namespace_sysctl_init); |
1087 |
+diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c |
1088 |
+index 8206a13c81ebc..ce396ea4de608 100644 |
1089 |
+--- a/kernel/user_namespace.c |
1090 |
++++ b/kernel/user_namespace.c |
1091 |
+@@ -1340,9 +1340,6 @@ static int userns_install(struct nsset *nsset, struct ns_common *ns) |
1092 |
+ put_user_ns(cred->user_ns); |
1093 |
+ set_cred_user_ns(cred, get_user_ns(user_ns)); |
1094 |
+ |
1095 |
+- if (set_cred_ucounts(cred) < 0) |
1096 |
+- return -EINVAL; |
1097 |
+- |
1098 |
+ return 0; |
1099 |
+ } |
1100 |
+ |
1101 |
+diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c |
1102 |
+index bda3514c7b2d9..5e04c4b9e0239 100644 |
1103 |
+--- a/sound/core/pcm_lib.c |
1104 |
++++ b/sound/core/pcm_lib.c |
1105 |
+@@ -1746,7 +1746,7 @@ static int snd_pcm_lib_ioctl_fifo_size(struct snd_pcm_substream *substream, |
1106 |
+ channels = params_channels(params); |
1107 |
+ frame_size = snd_pcm_format_size(format, channels); |
1108 |
+ if (frame_size > 0) |
1109 |
+- params->fifo_size /= (unsigned)frame_size; |
1110 |
++ params->fifo_size /= frame_size; |
1111 |
+ } |
1112 |
+ return 0; |
1113 |
+ } |
1114 |
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
1115 |
+index 6219d0311c9a0..f47f639980dbb 100644 |
1116 |
+--- a/sound/pci/hda/patch_realtek.c |
1117 |
++++ b/sound/pci/hda/patch_realtek.c |
1118 |
+@@ -8364,6 +8364,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
1119 |
+ SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED), |
1120 |
+ SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED), |
1121 |
+ SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED), |
1122 |
++ SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP), |
1123 |
+ SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP), |
1124 |
+ SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED), |
1125 |
+ SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED), |
1126 |
+@@ -9440,6 +9441,16 @@ static int patch_alc269(struct hda_codec *codec) |
1127 |
+ |
1128 |
+ snd_hda_pick_fixup(codec, alc269_fixup_models, |
1129 |
+ alc269_fixup_tbl, alc269_fixups); |
1130 |
++ /* FIXME: both TX300 and ROG Strix G17 have the same SSID, and |
1131 |
++ * the quirk breaks the latter (bko#214101). |
1132 |
++ * Clear the wrong entry. |
1133 |
++ */ |
1134 |
++ if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 && |
1135 |
++ codec->core.vendor_id == 0x10ec0294) { |
1136 |
++ codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n"); |
1137 |
++ codec->fixup_id = HDA_FIXUP_ID_NOT_SET; |
1138 |
++ } |
1139 |
++ |
1140 |
+ snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true); |
1141 |
+ snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false); |
1142 |
+ snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl, |