1 |
commit: 2bce271e6a928666d935d281a6dec9eb9f0f0f43 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Mar 2 13:07:50 2022 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Mar 2 13:07:50 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=2bce271e |
7 |
|
8 |
Linux patch 4.19.232 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1231_linux-4.19.232.patch | 1182 +++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 1186 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 67a0a028..a1760f41 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -963,6 +963,10 @@ Patch: 1230_linux-4.19.231.patch |
21 |
From: https://www.kernel.org |
22 |
Desc: Linux 4.19.231 |
23 |
|
24 |
+Patch: 1231_linux-4.19.232.patch |
25 |
+From: https://www.kernel.org |
26 |
+Desc: Linux 4.19.232 |
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/1231_linux-4.19.232.patch b/1231_linux-4.19.232.patch |
33 |
new file mode 100644 |
34 |
index 00000000..a5731480 |
35 |
--- /dev/null |
36 |
+++ b/1231_linux-4.19.232.patch |
37 |
@@ -0,0 +1,1182 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index 165660cd857e1..77a389ab3538c 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,7 +1,7 @@ |
43 |
+ # SPDX-License-Identifier: GPL-2.0 |
44 |
+ VERSION = 4 |
45 |
+ PATCHLEVEL = 19 |
46 |
+-SUBLEVEL = 231 |
47 |
++SUBLEVEL = 232 |
48 |
+ EXTRAVERSION = |
49 |
+ NAME = "People's Front" |
50 |
+ |
51 |
+diff --git a/arch/parisc/kernel/unaligned.c b/arch/parisc/kernel/unaligned.c |
52 |
+index 932bfc0b7cd87..c16af267362e4 100644 |
53 |
+--- a/arch/parisc/kernel/unaligned.c |
54 |
++++ b/arch/parisc/kernel/unaligned.c |
55 |
+@@ -354,7 +354,7 @@ static int emulate_stw(struct pt_regs *regs, int frreg, int flop) |
56 |
+ : "r" (val), "r" (regs->ior), "r" (regs->isr) |
57 |
+ : "r19", "r20", "r21", "r22", "r1", FIXUP_BRANCH_CLOBBER ); |
58 |
+ |
59 |
+- return 0; |
60 |
++ return ret; |
61 |
+ } |
62 |
+ static int emulate_std(struct pt_regs *regs, int frreg, int flop) |
63 |
+ { |
64 |
+@@ -411,7 +411,7 @@ static int emulate_std(struct pt_regs *regs, int frreg, int flop) |
65 |
+ __asm__ __volatile__ ( |
66 |
+ " mtsp %4, %%sr1\n" |
67 |
+ " zdep %2, 29, 2, %%r19\n" |
68 |
+-" dep %%r0, 31, 2, %2\n" |
69 |
++" dep %%r0, 31, 2, %3\n" |
70 |
+ " mtsar %%r19\n" |
71 |
+ " zvdepi -2, 32, %%r19\n" |
72 |
+ "1: ldw 0(%%sr1,%3),%%r20\n" |
73 |
+@@ -423,7 +423,7 @@ static int emulate_std(struct pt_regs *regs, int frreg, int flop) |
74 |
+ " andcm %%r21, %%r19, %%r21\n" |
75 |
+ " or %1, %%r20, %1\n" |
76 |
+ " or %2, %%r21, %2\n" |
77 |
+-"3: stw %1,0(%%sr1,%1)\n" |
78 |
++"3: stw %1,0(%%sr1,%3)\n" |
79 |
+ "4: stw %%r1,4(%%sr1,%3)\n" |
80 |
+ "5: stw %2,8(%%sr1,%3)\n" |
81 |
+ " copy %%r0, %0\n" |
82 |
+@@ -610,7 +610,6 @@ void handle_unaligned(struct pt_regs *regs) |
83 |
+ ret = ERR_NOTHANDLED; /* "undefined", but lets kill them. */ |
84 |
+ break; |
85 |
+ } |
86 |
+-#ifdef CONFIG_PA20 |
87 |
+ switch (regs->iir & OPCODE2_MASK) |
88 |
+ { |
89 |
+ case OPCODE_FLDD_L: |
90 |
+@@ -621,22 +620,23 @@ void handle_unaligned(struct pt_regs *regs) |
91 |
+ flop=1; |
92 |
+ ret = emulate_std(regs, R2(regs->iir),1); |
93 |
+ break; |
94 |
++#ifdef CONFIG_PA20 |
95 |
+ case OPCODE_LDD_L: |
96 |
+ ret = emulate_ldd(regs, R2(regs->iir),0); |
97 |
+ break; |
98 |
+ case OPCODE_STD_L: |
99 |
+ ret = emulate_std(regs, R2(regs->iir),0); |
100 |
+ break; |
101 |
+- } |
102 |
+ #endif |
103 |
++ } |
104 |
+ switch (regs->iir & OPCODE3_MASK) |
105 |
+ { |
106 |
+ case OPCODE_FLDW_L: |
107 |
+ flop=1; |
108 |
+- ret = emulate_ldw(regs, R2(regs->iir),0); |
109 |
++ ret = emulate_ldw(regs, R2(regs->iir), 1); |
110 |
+ break; |
111 |
+ case OPCODE_LDW_M: |
112 |
+- ret = emulate_ldw(regs, R2(regs->iir),1); |
113 |
++ ret = emulate_ldw(regs, R2(regs->iir), 0); |
114 |
+ break; |
115 |
+ |
116 |
+ case OPCODE_FSTW_L: |
117 |
+diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c |
118 |
+index ef8aaeb0c575a..f44136a3a1635 100644 |
119 |
+--- a/drivers/ata/pata_hpt37x.c |
120 |
++++ b/drivers/ata/pata_hpt37x.c |
121 |
+@@ -916,6 +916,20 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
122 |
+ irqmask &= ~0x10; |
123 |
+ pci_write_config_byte(dev, 0x5a, irqmask); |
124 |
+ |
125 |
++ /* |
126 |
++ * HPT371 chips physically have only one channel, the secondary one, |
127 |
++ * but the primary channel registers do exist! Go figure... |
128 |
++ * So, we manually disable the non-existing channel here |
129 |
++ * (if the BIOS hasn't done this already). |
130 |
++ */ |
131 |
++ if (dev->device == PCI_DEVICE_ID_TTI_HPT371) { |
132 |
++ u8 mcr1; |
133 |
++ |
134 |
++ pci_read_config_byte(dev, 0x50, &mcr1); |
135 |
++ mcr1 &= ~0x04; |
136 |
++ pci_write_config_byte(dev, 0x50, mcr1); |
137 |
++ } |
138 |
++ |
139 |
+ /* |
140 |
+ * default to pci clock. make sure MA15/16 are set to output |
141 |
+ * to prevent drives having problems with 40-pin cables. Needed |
142 |
+diff --git a/drivers/gpio/gpio-tegra186.c b/drivers/gpio/gpio-tegra186.c |
143 |
+index 9d0292c8a1999..4c9e7a201d899 100644 |
144 |
+--- a/drivers/gpio/gpio-tegra186.c |
145 |
++++ b/drivers/gpio/gpio-tegra186.c |
146 |
+@@ -237,9 +237,12 @@ static int tegra186_gpio_of_xlate(struct gpio_chip *chip, |
147 |
+ return offset + pin; |
148 |
+ } |
149 |
+ |
150 |
++#define to_tegra_gpio(x) container_of((x), struct tegra_gpio, gpio) |
151 |
++ |
152 |
+ static void tegra186_irq_ack(struct irq_data *data) |
153 |
+ { |
154 |
+- struct tegra_gpio *gpio = irq_data_get_irq_chip_data(data); |
155 |
++ struct gpio_chip *gc = irq_data_get_irq_chip_data(data); |
156 |
++ struct tegra_gpio *gpio = to_tegra_gpio(gc); |
157 |
+ void __iomem *base; |
158 |
+ |
159 |
+ base = tegra186_gpio_get_base(gpio, data->hwirq); |
160 |
+@@ -251,7 +254,8 @@ static void tegra186_irq_ack(struct irq_data *data) |
161 |
+ |
162 |
+ static void tegra186_irq_mask(struct irq_data *data) |
163 |
+ { |
164 |
+- struct tegra_gpio *gpio = irq_data_get_irq_chip_data(data); |
165 |
++ struct gpio_chip *gc = irq_data_get_irq_chip_data(data); |
166 |
++ struct tegra_gpio *gpio = to_tegra_gpio(gc); |
167 |
+ void __iomem *base; |
168 |
+ u32 value; |
169 |
+ |
170 |
+@@ -266,7 +270,8 @@ static void tegra186_irq_mask(struct irq_data *data) |
171 |
+ |
172 |
+ static void tegra186_irq_unmask(struct irq_data *data) |
173 |
+ { |
174 |
+- struct tegra_gpio *gpio = irq_data_get_irq_chip_data(data); |
175 |
++ struct gpio_chip *gc = irq_data_get_irq_chip_data(data); |
176 |
++ struct tegra_gpio *gpio = to_tegra_gpio(gc); |
177 |
+ void __iomem *base; |
178 |
+ u32 value; |
179 |
+ |
180 |
+@@ -281,7 +286,8 @@ static void tegra186_irq_unmask(struct irq_data *data) |
181 |
+ |
182 |
+ static int tegra186_irq_set_type(struct irq_data *data, unsigned int flow) |
183 |
+ { |
184 |
+- struct tegra_gpio *gpio = irq_data_get_irq_chip_data(data); |
185 |
++ struct gpio_chip *gc = irq_data_get_irq_chip_data(data); |
186 |
++ struct tegra_gpio *gpio = to_tegra_gpio(gc); |
187 |
+ void __iomem *base; |
188 |
+ u32 value; |
189 |
+ |
190 |
+diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c |
191 |
+index 108f542176b86..5c049483de23c 100644 |
192 |
+--- a/drivers/gpu/drm/drm_edid.c |
193 |
++++ b/drivers/gpu/drm/drm_edid.c |
194 |
+@@ -4622,6 +4622,7 @@ u32 drm_add_display_info(struct drm_connector *connector, const struct edid *edi |
195 |
+ if (!(edid->input & DRM_EDID_INPUT_DIGITAL)) |
196 |
+ return quirks; |
197 |
+ |
198 |
++ info->color_formats |= DRM_COLOR_FORMAT_RGB444; |
199 |
+ drm_parse_cea_ext(connector, edid); |
200 |
+ |
201 |
+ /* |
202 |
+@@ -4670,7 +4671,6 @@ u32 drm_add_display_info(struct drm_connector *connector, const struct edid *edi |
203 |
+ DRM_DEBUG("%s: Assigning EDID-1.4 digital sink color depth as %d bpc.\n", |
204 |
+ connector->name, info->bpc); |
205 |
+ |
206 |
+- info->color_formats |= DRM_COLOR_FORMAT_RGB444; |
207 |
+ if (edid->features & DRM_EDID_FEATURE_RGB_YCRCB444) |
208 |
+ info->color_formats |= DRM_COLOR_FORMAT_YCRCB444; |
209 |
+ if (edid->features & DRM_EDID_FEATURE_RGB_YCRCB422) |
210 |
+diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c |
211 |
+index 8cf3d1b4662de..ce70a193caa7f 100644 |
212 |
+--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c |
213 |
++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c |
214 |
+@@ -70,13 +70,20 @@ nvkm_pmu_fini(struct nvkm_subdev *subdev, bool suspend) |
215 |
+ return 0; |
216 |
+ } |
217 |
+ |
218 |
+-static void |
219 |
++static int |
220 |
+ nvkm_pmu_reset(struct nvkm_pmu *pmu) |
221 |
+ { |
222 |
+ struct nvkm_device *device = pmu->subdev.device; |
223 |
+ |
224 |
+ if (!pmu->func->enabled(pmu)) |
225 |
+- return; |
226 |
++ return 0; |
227 |
++ |
228 |
++ /* Inhibit interrupts, and wait for idle. */ |
229 |
++ nvkm_wr32(device, 0x10a014, 0x0000ffff); |
230 |
++ nvkm_msec(device, 2000, |
231 |
++ if (!nvkm_rd32(device, 0x10a04c)) |
232 |
++ break; |
233 |
++ ); |
234 |
+ |
235 |
+ /* Reset. */ |
236 |
+ if (pmu->func->reset) |
237 |
+@@ -87,37 +94,25 @@ nvkm_pmu_reset(struct nvkm_pmu *pmu) |
238 |
+ if (!(nvkm_rd32(device, 0x10a10c) & 0x00000006)) |
239 |
+ break; |
240 |
+ ); |
241 |
++ |
242 |
++ return 0; |
243 |
+ } |
244 |
+ |
245 |
+ static int |
246 |
+ nvkm_pmu_preinit(struct nvkm_subdev *subdev) |
247 |
+ { |
248 |
+ struct nvkm_pmu *pmu = nvkm_pmu(subdev); |
249 |
+- nvkm_pmu_reset(pmu); |
250 |
+- return 0; |
251 |
++ return nvkm_pmu_reset(pmu); |
252 |
+ } |
253 |
+ |
254 |
+ static int |
255 |
+ nvkm_pmu_init(struct nvkm_subdev *subdev) |
256 |
+ { |
257 |
+ struct nvkm_pmu *pmu = nvkm_pmu(subdev); |
258 |
+- struct nvkm_device *device = pmu->subdev.device; |
259 |
+- |
260 |
+- if (!pmu->func->init) |
261 |
+- return 0; |
262 |
+- |
263 |
+- if (pmu->func->enabled(pmu)) { |
264 |
+- /* Inhibit interrupts, and wait for idle. */ |
265 |
+- nvkm_wr32(device, 0x10a014, 0x0000ffff); |
266 |
+- nvkm_msec(device, 2000, |
267 |
+- if (!nvkm_rd32(device, 0x10a04c)) |
268 |
+- break; |
269 |
+- ); |
270 |
+- |
271 |
+- nvkm_pmu_reset(pmu); |
272 |
+- } |
273 |
+- |
274 |
+- return pmu->func->init(pmu); |
275 |
++ int ret = nvkm_pmu_reset(pmu); |
276 |
++ if (ret == 0 && pmu->func->init) |
277 |
++ ret = pmu->func->init(pmu); |
278 |
++ return ret; |
279 |
+ } |
280 |
+ |
281 |
+ static int |
282 |
+diff --git a/drivers/iio/adc/men_z188_adc.c b/drivers/iio/adc/men_z188_adc.c |
283 |
+index c80261748d8fd..49827bb648971 100644 |
284 |
+--- a/drivers/iio/adc/men_z188_adc.c |
285 |
++++ b/drivers/iio/adc/men_z188_adc.c |
286 |
+@@ -106,6 +106,7 @@ static int men_z188_probe(struct mcb_device *dev, |
287 |
+ struct z188_adc *adc; |
288 |
+ struct iio_dev *indio_dev; |
289 |
+ struct resource *mem; |
290 |
++ int ret; |
291 |
+ |
292 |
+ indio_dev = devm_iio_device_alloc(&dev->dev, sizeof(struct z188_adc)); |
293 |
+ if (!indio_dev) |
294 |
+@@ -132,8 +133,14 @@ static int men_z188_probe(struct mcb_device *dev, |
295 |
+ adc->mem = mem; |
296 |
+ mcb_set_drvdata(dev, indio_dev); |
297 |
+ |
298 |
+- return iio_device_register(indio_dev); |
299 |
++ ret = iio_device_register(indio_dev); |
300 |
++ if (ret) |
301 |
++ goto err_unmap; |
302 |
++ |
303 |
++ return 0; |
304 |
+ |
305 |
++err_unmap: |
306 |
++ iounmap(adc->base); |
307 |
+ err: |
308 |
+ mcb_release_mem(mem); |
309 |
+ return -ENXIO; |
310 |
+diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c |
311 |
+index 03ee53adaacd2..6dcdc42ed0819 100644 |
312 |
+--- a/drivers/infiniband/ulp/srp/ib_srp.c |
313 |
++++ b/drivers/infiniband/ulp/srp/ib_srp.c |
314 |
+@@ -4154,9 +4154,11 @@ static void srp_remove_one(struct ib_device *device, void *client_data) |
315 |
+ spin_unlock(&host->target_lock); |
316 |
+ |
317 |
+ /* |
318 |
+- * Wait for tl_err and target port removal tasks. |
319 |
++ * srp_queue_remove_work() queues a call to |
320 |
++ * srp_remove_target(). The latter function cancels |
321 |
++ * target->tl_err_work so waiting for the remove works to |
322 |
++ * finish is sufficient. |
323 |
+ */ |
324 |
+- flush_workqueue(system_long_wq); |
325 |
+ flush_workqueue(srp_remove_wq); |
326 |
+ |
327 |
+ kfree(host); |
328 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c |
329 |
+index 3d824c20d2a46..a5c4e4f0f5b6a 100644 |
330 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c |
331 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c |
332 |
+@@ -1357,7 +1357,7 @@ static int mlx5e_get_module_eeprom(struct net_device *netdev, |
333 |
+ if (size_read < 0) { |
334 |
+ netdev_err(priv->netdev, "%s: mlx5_query_eeprom failed:0x%x\n", |
335 |
+ __func__, size_read); |
336 |
+- return 0; |
337 |
++ return size_read; |
338 |
+ } |
339 |
+ |
340 |
+ i += size_read; |
341 |
+diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c |
342 |
+index 529c8fac15314..778bd9aaba9f1 100644 |
343 |
+--- a/drivers/net/usb/cdc_ether.c |
344 |
++++ b/drivers/net/usb/cdc_ether.c |
345 |
+@@ -584,6 +584,11 @@ static const struct usb_device_id products[] = { |
346 |
+ .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET, \ |
347 |
+ .bInterfaceProtocol = USB_CDC_PROTO_NONE |
348 |
+ |
349 |
++#define ZAURUS_FAKE_INTERFACE \ |
350 |
++ .bInterfaceClass = USB_CLASS_COMM, \ |
351 |
++ .bInterfaceSubClass = USB_CDC_SUBCLASS_MDLM, \ |
352 |
++ .bInterfaceProtocol = USB_CDC_PROTO_NONE |
353 |
++ |
354 |
+ /* SA-1100 based Sharp Zaurus ("collie"), or compatible; |
355 |
+ * wire-incompatible with true CDC Ethernet implementations. |
356 |
+ * (And, it seems, needlessly so...) |
357 |
+@@ -637,6 +642,13 @@ static const struct usb_device_id products[] = { |
358 |
+ .idProduct = 0x9032, /* SL-6000 */ |
359 |
+ ZAURUS_MASTER_INTERFACE, |
360 |
+ .driver_info = 0, |
361 |
++}, { |
362 |
++ .match_flags = USB_DEVICE_ID_MATCH_INT_INFO |
363 |
++ | USB_DEVICE_ID_MATCH_DEVICE, |
364 |
++ .idVendor = 0x04DD, |
365 |
++ .idProduct = 0x9032, /* SL-6000 */ |
366 |
++ ZAURUS_FAKE_INTERFACE, |
367 |
++ .driver_info = 0, |
368 |
+ }, { |
369 |
+ .match_flags = USB_DEVICE_ID_MATCH_INT_INFO |
370 |
+ | USB_DEVICE_ID_MATCH_DEVICE, |
371 |
+diff --git a/drivers/net/usb/sr9700.c b/drivers/net/usb/sr9700.c |
372 |
+index 6ac232e52bf7c..83640628c47dd 100644 |
373 |
+--- a/drivers/net/usb/sr9700.c |
374 |
++++ b/drivers/net/usb/sr9700.c |
375 |
+@@ -410,7 +410,7 @@ static int sr9700_rx_fixup(struct usbnet *dev, struct sk_buff *skb) |
376 |
+ /* ignore the CRC length */ |
377 |
+ len = (skb->data[1] | (skb->data[2] << 8)) - 4; |
378 |
+ |
379 |
+- if (len > ETH_FRAME_LEN) |
380 |
++ if (len > ETH_FRAME_LEN || len > skb->len) |
381 |
+ return 0; |
382 |
+ |
383 |
+ /* the last packet of current skb */ |
384 |
+diff --git a/drivers/net/usb/zaurus.c b/drivers/net/usb/zaurus.c |
385 |
+index 9c2196c3fd113..1f19fc5e6117e 100644 |
386 |
+--- a/drivers/net/usb/zaurus.c |
387 |
++++ b/drivers/net/usb/zaurus.c |
388 |
+@@ -268,6 +268,11 @@ static const struct usb_device_id products [] = { |
389 |
+ .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET, \ |
390 |
+ .bInterfaceProtocol = USB_CDC_PROTO_NONE |
391 |
+ |
392 |
++#define ZAURUS_FAKE_INTERFACE \ |
393 |
++ .bInterfaceClass = USB_CLASS_COMM, \ |
394 |
++ .bInterfaceSubClass = USB_CDC_SUBCLASS_MDLM, \ |
395 |
++ .bInterfaceProtocol = USB_CDC_PROTO_NONE |
396 |
++ |
397 |
+ /* SA-1100 based Sharp Zaurus ("collie"), or compatible. */ |
398 |
+ { |
399 |
+ .match_flags = USB_DEVICE_ID_MATCH_INT_INFO |
400 |
+@@ -325,6 +330,13 @@ static const struct usb_device_id products [] = { |
401 |
+ .idProduct = 0x9032, /* SL-6000 */ |
402 |
+ ZAURUS_MASTER_INTERFACE, |
403 |
+ .driver_info = ZAURUS_PXA_INFO, |
404 |
++}, { |
405 |
++ .match_flags = USB_DEVICE_ID_MATCH_INT_INFO |
406 |
++ | USB_DEVICE_ID_MATCH_DEVICE, |
407 |
++ .idVendor = 0x04DD, |
408 |
++ .idProduct = 0x9032, /* SL-6000 */ |
409 |
++ ZAURUS_FAKE_INTERFACE, |
410 |
++ .driver_info = (unsigned long)&bogus_mdlm_info, |
411 |
+ }, { |
412 |
+ .match_flags = USB_DEVICE_ID_MATCH_INT_INFO |
413 |
+ | USB_DEVICE_ID_MATCH_DEVICE, |
414 |
+diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c |
415 |
+index 294182cb71caf..4d581140b7a47 100644 |
416 |
+--- a/drivers/tty/n_gsm.c |
417 |
++++ b/drivers/tty/n_gsm.c |
418 |
+@@ -428,7 +428,7 @@ static u8 gsm_encode_modem(const struct gsm_dlci *dlci) |
419 |
+ modembits |= MDM_RTR; |
420 |
+ if (dlci->modem_tx & TIOCM_RI) |
421 |
+ modembits |= MDM_IC; |
422 |
+- if (dlci->modem_tx & TIOCM_CD) |
423 |
++ if (dlci->modem_tx & TIOCM_CD || dlci->gsm->initiator) |
424 |
+ modembits |= MDM_DV; |
425 |
+ return modembits; |
426 |
+ } |
427 |
+@@ -1490,7 +1490,7 @@ static void gsm_dlci_t1(struct timer_list *t) |
428 |
+ dlci->mode = DLCI_MODE_ADM; |
429 |
+ gsm_dlci_open(dlci); |
430 |
+ } else { |
431 |
+- gsm_dlci_close(dlci); |
432 |
++ gsm_dlci_begin_close(dlci); /* prevent half open link */ |
433 |
+ } |
434 |
+ |
435 |
+ break; |
436 |
+diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c |
437 |
+index bf40a2f36e976..ad2cb08b440fb 100644 |
438 |
+--- a/drivers/usb/dwc3/dwc3-pci.c |
439 |
++++ b/drivers/usb/dwc3/dwc3-pci.c |
440 |
+@@ -76,8 +76,8 @@ static const struct acpi_gpio_mapping acpi_dwc3_byt_gpios[] = { |
441 |
+ static struct gpiod_lookup_table platform_bytcr_gpios = { |
442 |
+ .dev_id = "0000:00:16.0", |
443 |
+ .table = { |
444 |
+- GPIO_LOOKUP("INT33FC:00", 54, "reset", GPIO_ACTIVE_HIGH), |
445 |
+- GPIO_LOOKUP("INT33FC:02", 14, "cs", GPIO_ACTIVE_HIGH), |
446 |
++ GPIO_LOOKUP("INT33FC:00", 54, "cs", GPIO_ACTIVE_HIGH), |
447 |
++ GPIO_LOOKUP("INT33FC:02", 14, "reset", GPIO_ACTIVE_HIGH), |
448 |
+ {} |
449 |
+ }, |
450 |
+ }; |
451 |
+diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c |
452 |
+index e7c753fbfbb04..8620ac8e33296 100644 |
453 |
+--- a/drivers/usb/dwc3/gadget.c |
454 |
++++ b/drivers/usb/dwc3/gadget.c |
455 |
+@@ -3181,9 +3181,11 @@ static irqreturn_t dwc3_thread_interrupt(int irq, void *_evt) |
456 |
+ unsigned long flags; |
457 |
+ irqreturn_t ret = IRQ_NONE; |
458 |
+ |
459 |
++ local_bh_disable(); |
460 |
+ spin_lock_irqsave(&dwc->lock, flags); |
461 |
+ ret = dwc3_process_event_buf(evt); |
462 |
+ spin_unlock_irqrestore(&dwc->lock, flags); |
463 |
++ local_bh_enable(); |
464 |
+ |
465 |
+ return ret; |
466 |
+ } |
467 |
+diff --git a/drivers/usb/gadget/function/rndis.c b/drivers/usb/gadget/function/rndis.c |
468 |
+index ab827c1badc50..970ed1514f0bc 100644 |
469 |
+--- a/drivers/usb/gadget/function/rndis.c |
470 |
++++ b/drivers/usb/gadget/function/rndis.c |
471 |
+@@ -922,6 +922,7 @@ struct rndis_params *rndis_register(void (*resp_avail)(void *v), void *v) |
472 |
+ params->resp_avail = resp_avail; |
473 |
+ params->v = v; |
474 |
+ INIT_LIST_HEAD(¶ms->resp_queue); |
475 |
++ spin_lock_init(¶ms->resp_lock); |
476 |
+ pr_debug("%s: configNr = %d\n", __func__, i); |
477 |
+ |
478 |
+ return params; |
479 |
+@@ -1015,12 +1016,14 @@ void rndis_free_response(struct rndis_params *params, u8 *buf) |
480 |
+ { |
481 |
+ rndis_resp_t *r, *n; |
482 |
+ |
483 |
++ spin_lock(¶ms->resp_lock); |
484 |
+ list_for_each_entry_safe(r, n, ¶ms->resp_queue, list) { |
485 |
+ if (r->buf == buf) { |
486 |
+ list_del(&r->list); |
487 |
+ kfree(r); |
488 |
+ } |
489 |
+ } |
490 |
++ spin_unlock(¶ms->resp_lock); |
491 |
+ } |
492 |
+ EXPORT_SYMBOL_GPL(rndis_free_response); |
493 |
+ |
494 |
+@@ -1030,14 +1033,17 @@ u8 *rndis_get_next_response(struct rndis_params *params, u32 *length) |
495 |
+ |
496 |
+ if (!length) return NULL; |
497 |
+ |
498 |
++ spin_lock(¶ms->resp_lock); |
499 |
+ list_for_each_entry_safe(r, n, ¶ms->resp_queue, list) { |
500 |
+ if (!r->send) { |
501 |
+ r->send = 1; |
502 |
+ *length = r->length; |
503 |
++ spin_unlock(¶ms->resp_lock); |
504 |
+ return r->buf; |
505 |
+ } |
506 |
+ } |
507 |
+ |
508 |
++ spin_unlock(¶ms->resp_lock); |
509 |
+ return NULL; |
510 |
+ } |
511 |
+ EXPORT_SYMBOL_GPL(rndis_get_next_response); |
512 |
+@@ -1054,7 +1060,9 @@ static rndis_resp_t *rndis_add_response(struct rndis_params *params, u32 length) |
513 |
+ r->length = length; |
514 |
+ r->send = 0; |
515 |
+ |
516 |
++ spin_lock(¶ms->resp_lock); |
517 |
+ list_add_tail(&r->list, ¶ms->resp_queue); |
518 |
++ spin_unlock(¶ms->resp_lock); |
519 |
+ return r; |
520 |
+ } |
521 |
+ |
522 |
+diff --git a/drivers/usb/gadget/function/rndis.h b/drivers/usb/gadget/function/rndis.h |
523 |
+index c7e3a70ce6c1f..c996ba28bcb77 100644 |
524 |
+--- a/drivers/usb/gadget/function/rndis.h |
525 |
++++ b/drivers/usb/gadget/function/rndis.h |
526 |
+@@ -174,6 +174,7 @@ typedef struct rndis_params { |
527 |
+ void (*resp_avail)(void *v); |
528 |
+ void *v; |
529 |
+ struct list_head resp_queue; |
530 |
++ spinlock_t resp_lock; |
531 |
+ } rndis_params; |
532 |
+ |
533 |
+ /* RNDIS Message parser and other useless functions */ |
534 |
+diff --git a/drivers/usb/gadget/udc/udc-xilinx.c b/drivers/usb/gadget/udc/udc-xilinx.c |
535 |
+index 6407e433bc78d..72f1bc6a680e3 100644 |
536 |
+--- a/drivers/usb/gadget/udc/udc-xilinx.c |
537 |
++++ b/drivers/usb/gadget/udc/udc-xilinx.c |
538 |
+@@ -1613,6 +1613,8 @@ static void xudc_getstatus(struct xusb_udc *udc) |
539 |
+ break; |
540 |
+ case USB_RECIP_ENDPOINT: |
541 |
+ epnum = udc->setup.wIndex & USB_ENDPOINT_NUMBER_MASK; |
542 |
++ if (epnum >= XUSB_MAX_ENDPOINTS) |
543 |
++ goto stall; |
544 |
+ target_ep = &udc->ep[epnum]; |
545 |
+ epcfgreg = udc->read_fn(udc->addr + target_ep->offset); |
546 |
+ halt = epcfgreg & XUSB_EP_CFG_STALL_MASK; |
547 |
+@@ -1680,6 +1682,10 @@ static void xudc_set_clear_feature(struct xusb_udc *udc) |
548 |
+ case USB_RECIP_ENDPOINT: |
549 |
+ if (!udc->setup.wValue) { |
550 |
+ endpoint = udc->setup.wIndex & USB_ENDPOINT_NUMBER_MASK; |
551 |
++ if (endpoint >= XUSB_MAX_ENDPOINTS) { |
552 |
++ xudc_ep0_stall(udc); |
553 |
++ return; |
554 |
++ } |
555 |
+ target_ep = &udc->ep[endpoint]; |
556 |
+ outinbit = udc->setup.wIndex & USB_ENDPOINT_DIR_MASK; |
557 |
+ outinbit = outinbit >> 7; |
558 |
+diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c |
559 |
+index 0c2b726b7797c..353a57f515223 100644 |
560 |
+--- a/drivers/usb/host/xhci.c |
561 |
++++ b/drivers/usb/host/xhci.c |
562 |
+@@ -1083,6 +1083,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) |
563 |
+ int retval = 0; |
564 |
+ bool comp_timer_running = false; |
565 |
+ bool pending_portevent = false; |
566 |
++ bool reinit_xhc = false; |
567 |
+ |
568 |
+ if (!hcd->state) |
569 |
+ return 0; |
570 |
+@@ -1099,10 +1100,11 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) |
571 |
+ set_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags); |
572 |
+ |
573 |
+ spin_lock_irq(&xhci->lock); |
574 |
+- if ((xhci->quirks & XHCI_RESET_ON_RESUME) || xhci->broken_suspend) |
575 |
+- hibernated = true; |
576 |
+ |
577 |
+- if (!hibernated) { |
578 |
++ if (hibernated || xhci->quirks & XHCI_RESET_ON_RESUME || xhci->broken_suspend) |
579 |
++ reinit_xhc = true; |
580 |
++ |
581 |
++ if (!reinit_xhc) { |
582 |
+ /* |
583 |
+ * Some controllers might lose power during suspend, so wait |
584 |
+ * for controller not ready bit to clear, just as in xHC init. |
585 |
+@@ -1135,12 +1137,17 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) |
586 |
+ spin_unlock_irq(&xhci->lock); |
587 |
+ return -ETIMEDOUT; |
588 |
+ } |
589 |
+- temp = readl(&xhci->op_regs->status); |
590 |
+ } |
591 |
+ |
592 |
+- /* If restore operation fails, re-initialize the HC during resume */ |
593 |
+- if ((temp & STS_SRE) || hibernated) { |
594 |
++ temp = readl(&xhci->op_regs->status); |
595 |
+ |
596 |
++ /* re-initialize the HC on Restore Error, or Host Controller Error */ |
597 |
++ if (temp & (STS_SRE | STS_HCE)) { |
598 |
++ reinit_xhc = true; |
599 |
++ xhci_warn(xhci, "xHC error in resume, USBSTS 0x%x, Reinit\n", temp); |
600 |
++ } |
601 |
++ |
602 |
++ if (reinit_xhc) { |
603 |
+ if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && |
604 |
+ !(xhci_all_ports_seen_u0(xhci))) { |
605 |
+ del_timer_sync(&xhci->comp_mode_recovery_timer); |
606 |
+@@ -1457,9 +1464,12 @@ static int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flag |
607 |
+ struct urb_priv *urb_priv; |
608 |
+ int num_tds; |
609 |
+ |
610 |
+- if (!urb || xhci_check_args(hcd, urb->dev, urb->ep, |
611 |
+- true, true, __func__) <= 0) |
612 |
++ if (!urb) |
613 |
+ return -EINVAL; |
614 |
++ ret = xhci_check_args(hcd, urb->dev, urb->ep, |
615 |
++ true, true, __func__); |
616 |
++ if (ret <= 0) |
617 |
++ return ret ? ret : -EINVAL; |
618 |
+ |
619 |
+ slot_id = urb->dev->slot_id; |
620 |
+ ep_index = xhci_get_endpoint_index(&urb->ep->desc); |
621 |
+@@ -3203,7 +3213,7 @@ static int xhci_check_streams_endpoint(struct xhci_hcd *xhci, |
622 |
+ return -EINVAL; |
623 |
+ ret = xhci_check_args(xhci_to_hcd(xhci), udev, ep, 1, true, __func__); |
624 |
+ if (ret <= 0) |
625 |
+- return -EINVAL; |
626 |
++ return ret ? ret : -EINVAL; |
627 |
+ if (usb_ss_max_streams(&ep->ss_ep_comp) == 0) { |
628 |
+ xhci_warn(xhci, "WARN: SuperSpeed Endpoint Companion" |
629 |
+ " descriptor for ep 0x%x does not support streams\n", |
630 |
+diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c |
631 |
+index c56e4ce2d6516..f789b60ed8c17 100644 |
632 |
+--- a/drivers/usb/serial/ch341.c |
633 |
++++ b/drivers/usb/serial/ch341.c |
634 |
+@@ -80,7 +80,6 @@ |
635 |
+ #define CH341_LCR_CS5 0x00 |
636 |
+ |
637 |
+ static const struct usb_device_id id_table[] = { |
638 |
+- { USB_DEVICE(0x1a86, 0x5512) }, |
639 |
+ { USB_DEVICE(0x1a86, 0x5523) }, |
640 |
+ { USB_DEVICE(0x1a86, 0x7522) }, |
641 |
+ { USB_DEVICE(0x1a86, 0x7523) }, |
642 |
+diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c |
643 |
+index 151d6601f1c18..37d3bc24c5cff 100644 |
644 |
+--- a/drivers/usb/serial/option.c |
645 |
++++ b/drivers/usb/serial/option.c |
646 |
+@@ -198,6 +198,8 @@ static void option_instat_callback(struct urb *urb); |
647 |
+ |
648 |
+ #define DELL_PRODUCT_5821E 0x81d7 |
649 |
+ #define DELL_PRODUCT_5821E_ESIM 0x81e0 |
650 |
++#define DELL_PRODUCT_5829E_ESIM 0x81e4 |
651 |
++#define DELL_PRODUCT_5829E 0x81e6 |
652 |
+ |
653 |
+ #define KYOCERA_VENDOR_ID 0x0c88 |
654 |
+ #define KYOCERA_PRODUCT_KPC650 0x17da |
655 |
+@@ -1063,6 +1065,10 @@ static const struct usb_device_id option_ids[] = { |
656 |
+ .driver_info = RSVD(0) | RSVD(1) | RSVD(6) }, |
657 |
+ { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5821E_ESIM), |
658 |
+ .driver_info = RSVD(0) | RSVD(1) | RSVD(6) }, |
659 |
++ { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5829E), |
660 |
++ .driver_info = RSVD(0) | RSVD(6) }, |
661 |
++ { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5829E_ESIM), |
662 |
++ .driver_info = RSVD(0) | RSVD(6) }, |
663 |
+ { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, /* ADU-E100, ADU-310 */ |
664 |
+ { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, |
665 |
+ { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_620UW) }, |
666 |
+@@ -1273,10 +1279,16 @@ static const struct usb_device_id option_ids[] = { |
667 |
+ .driver_info = NCTRL(2) }, |
668 |
+ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x7011, 0xff), /* Telit LE910-S1 (ECM) */ |
669 |
+ .driver_info = NCTRL(2) }, |
670 |
++ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x701a, 0xff), /* Telit LE910R1 (RNDIS) */ |
671 |
++ .driver_info = NCTRL(2) }, |
672 |
++ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x701b, 0xff), /* Telit LE910R1 (ECM) */ |
673 |
++ .driver_info = NCTRL(2) }, |
674 |
+ { USB_DEVICE(TELIT_VENDOR_ID, 0x9010), /* Telit SBL FN980 flashing device */ |
675 |
+ .driver_info = NCTRL(0) | ZLP }, |
676 |
+ { USB_DEVICE(TELIT_VENDOR_ID, 0x9200), /* Telit LE910S1 flashing device */ |
677 |
+ .driver_info = NCTRL(0) | ZLP }, |
678 |
++ { USB_DEVICE(TELIT_VENDOR_ID, 0x9201), /* Telit LE910R1 flashing device */ |
679 |
++ .driver_info = NCTRL(0) | ZLP }, |
680 |
+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */ |
681 |
+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0002, 0xff, 0xff, 0xff), |
682 |
+ .driver_info = RSVD(1) }, |
683 |
+diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c |
684 |
+index d61abf569dc1d..9f67717eaf453 100644 |
685 |
+--- a/drivers/vhost/vsock.c |
686 |
++++ b/drivers/vhost/vsock.c |
687 |
+@@ -569,16 +569,18 @@ err: |
688 |
+ return ret; |
689 |
+ } |
690 |
+ |
691 |
+-static int vhost_vsock_stop(struct vhost_vsock *vsock) |
692 |
++static int vhost_vsock_stop(struct vhost_vsock *vsock, bool check_owner) |
693 |
+ { |
694 |
+ size_t i; |
695 |
+- int ret; |
696 |
++ int ret = 0; |
697 |
+ |
698 |
+ mutex_lock(&vsock->dev.mutex); |
699 |
+ |
700 |
+- ret = vhost_dev_check_owner(&vsock->dev); |
701 |
+- if (ret) |
702 |
+- goto err; |
703 |
++ if (check_owner) { |
704 |
++ ret = vhost_dev_check_owner(&vsock->dev); |
705 |
++ if (ret) |
706 |
++ goto err; |
707 |
++ } |
708 |
+ |
709 |
+ for (i = 0; i < ARRAY_SIZE(vsock->vqs); i++) { |
710 |
+ struct vhost_virtqueue *vq = &vsock->vqs[i]; |
711 |
+@@ -693,7 +695,12 @@ static int vhost_vsock_dev_release(struct inode *inode, struct file *file) |
712 |
+ * inefficient. Room for improvement here. */ |
713 |
+ vsock_for_each_connected_socket(vhost_vsock_reset_orphans); |
714 |
+ |
715 |
+- vhost_vsock_stop(vsock); |
716 |
++ /* Don't check the owner, because we are in the release path, so we |
717 |
++ * need to stop the vsock device in any case. |
718 |
++ * vhost_vsock_stop() can not fail in this case, so we don't need to |
719 |
++ * check the return code. |
720 |
++ */ |
721 |
++ vhost_vsock_stop(vsock, false); |
722 |
+ vhost_vsock_flush(vsock); |
723 |
+ vhost_dev_stop(&vsock->dev); |
724 |
+ |
725 |
+@@ -791,7 +798,7 @@ static long vhost_vsock_dev_ioctl(struct file *f, unsigned int ioctl, |
726 |
+ if (start) |
727 |
+ return vhost_vsock_start(vsock); |
728 |
+ else |
729 |
+- return vhost_vsock_stop(vsock); |
730 |
++ return vhost_vsock_stop(vsock, true); |
731 |
+ case VHOST_GET_FEATURES: |
732 |
+ features = VHOST_VSOCK_FEATURES; |
733 |
+ if (copy_to_user(argp, &features, sizeof(features))) |
734 |
+diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c |
735 |
+index f9628fc20fec0..796a6cd5f302f 100644 |
736 |
+--- a/fs/configfs/dir.c |
737 |
++++ b/fs/configfs/dir.c |
738 |
+@@ -50,6 +50,14 @@ DECLARE_RWSEM(configfs_rename_sem); |
739 |
+ */ |
740 |
+ DEFINE_SPINLOCK(configfs_dirent_lock); |
741 |
+ |
742 |
++/* |
743 |
++ * All of link_obj/unlink_obj/link_group/unlink_group require that |
744 |
++ * subsys->su_mutex is held. |
745 |
++ * But parent configfs_subsystem is NULL when config_item is root. |
746 |
++ * Use this mutex when config_item is root. |
747 |
++ */ |
748 |
++static DEFINE_MUTEX(configfs_subsystem_mutex); |
749 |
++ |
750 |
+ static void configfs_d_iput(struct dentry * dentry, |
751 |
+ struct inode * inode) |
752 |
+ { |
753 |
+@@ -1937,7 +1945,9 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys) |
754 |
+ group->cg_item.ci_name = group->cg_item.ci_namebuf; |
755 |
+ |
756 |
+ sd = root->d_fsdata; |
757 |
++ mutex_lock(&configfs_subsystem_mutex); |
758 |
+ link_group(to_config_group(sd->s_element), group); |
759 |
++ mutex_unlock(&configfs_subsystem_mutex); |
760 |
+ |
761 |
+ inode_lock_nested(d_inode(root), I_MUTEX_PARENT); |
762 |
+ |
763 |
+@@ -1962,7 +1972,9 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys) |
764 |
+ inode_unlock(d_inode(root)); |
765 |
+ |
766 |
+ if (err) { |
767 |
++ mutex_lock(&configfs_subsystem_mutex); |
768 |
+ unlink_group(group); |
769 |
++ mutex_unlock(&configfs_subsystem_mutex); |
770 |
+ configfs_release_fs(); |
771 |
+ } |
772 |
+ put_fragment(frag); |
773 |
+@@ -2008,7 +2020,9 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys) |
774 |
+ |
775 |
+ dput(dentry); |
776 |
+ |
777 |
++ mutex_lock(&configfs_subsystem_mutex); |
778 |
+ unlink_group(group); |
779 |
++ mutex_unlock(&configfs_subsystem_mutex); |
780 |
+ configfs_release_fs(); |
781 |
+ } |
782 |
+ |
783 |
+diff --git a/fs/file.c b/fs/file.c |
784 |
+index 9a6a3bba53af1..d6ca500a10536 100644 |
785 |
+--- a/fs/file.c |
786 |
++++ b/fs/file.c |
787 |
+@@ -677,28 +677,69 @@ void do_close_on_exec(struct files_struct *files) |
788 |
+ spin_unlock(&files->file_lock); |
789 |
+ } |
790 |
+ |
791 |
+-static struct file *__fget(unsigned int fd, fmode_t mask, unsigned int refs) |
792 |
++static inline struct file *__fget_files_rcu(struct files_struct *files, |
793 |
++ unsigned int fd, fmode_t mask, unsigned int refs) |
794 |
+ { |
795 |
+- struct files_struct *files = current->files; |
796 |
+- struct file *file; |
797 |
++ for (;;) { |
798 |
++ struct file *file; |
799 |
++ struct fdtable *fdt = rcu_dereference_raw(files->fdt); |
800 |
++ struct file __rcu **fdentry; |
801 |
+ |
802 |
+- rcu_read_lock(); |
803 |
+-loop: |
804 |
+- file = fcheck_files(files, fd); |
805 |
+- if (file) { |
806 |
+- /* File object ref couldn't be taken. |
807 |
+- * dup2() atomicity guarantee is the reason |
808 |
+- * we loop to catch the new file (or NULL pointer) |
809 |
++ if (unlikely(fd >= fdt->max_fds)) |
810 |
++ return NULL; |
811 |
++ |
812 |
++ fdentry = fdt->fd + array_index_nospec(fd, fdt->max_fds); |
813 |
++ file = rcu_dereference_raw(*fdentry); |
814 |
++ if (unlikely(!file)) |
815 |
++ return NULL; |
816 |
++ |
817 |
++ if (unlikely(file->f_mode & mask)) |
818 |
++ return NULL; |
819 |
++ |
820 |
++ /* |
821 |
++ * Ok, we have a file pointer. However, because we do |
822 |
++ * this all locklessly under RCU, we may be racing with |
823 |
++ * that file being closed. |
824 |
++ * |
825 |
++ * Such a race can take two forms: |
826 |
++ * |
827 |
++ * (a) the file ref already went down to zero, |
828 |
++ * and get_file_rcu_many() fails. Just try |
829 |
++ * again: |
830 |
++ */ |
831 |
++ if (unlikely(!get_file_rcu_many(file, refs))) |
832 |
++ continue; |
833 |
++ |
834 |
++ /* |
835 |
++ * (b) the file table entry has changed under us. |
836 |
++ * Note that we don't need to re-check the 'fdt->fd' |
837 |
++ * pointer having changed, because it always goes |
838 |
++ * hand-in-hand with 'fdt'. |
839 |
++ * |
840 |
++ * If so, we need to put our refs and try again. |
841 |
+ */ |
842 |
+- if (file->f_mode & mask) |
843 |
+- file = NULL; |
844 |
+- else if (!get_file_rcu_many(file, refs)) |
845 |
+- goto loop; |
846 |
+- else if (__fcheck_files(files, fd) != file) { |
847 |
++ if (unlikely(rcu_dereference_raw(files->fdt) != fdt) || |
848 |
++ unlikely(rcu_dereference_raw(*fdentry) != file)) { |
849 |
+ fput_many(file, refs); |
850 |
+- goto loop; |
851 |
++ continue; |
852 |
+ } |
853 |
++ |
854 |
++ /* |
855 |
++ * Ok, we have a ref to the file, and checked that it |
856 |
++ * still exists. |
857 |
++ */ |
858 |
++ return file; |
859 |
+ } |
860 |
++} |
861 |
++ |
862 |
++ |
863 |
++static struct file *__fget(unsigned int fd, fmode_t mask, unsigned int refs) |
864 |
++{ |
865 |
++ struct files_struct *files = current->files; |
866 |
++ struct file *file; |
867 |
++ |
868 |
++ rcu_read_lock(); |
869 |
++ file = __fget_files_rcu(files, fd, mask, refs); |
870 |
+ rcu_read_unlock(); |
871 |
+ |
872 |
+ return file; |
873 |
+diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c |
874 |
+index 8834819c0791b..01b0eec4140d4 100644 |
875 |
+--- a/fs/tracefs/inode.c |
876 |
++++ b/fs/tracefs/inode.c |
877 |
+@@ -265,7 +265,6 @@ static int tracefs_parse_options(char *data, struct tracefs_mount_opts *opts) |
878 |
+ if (!gid_valid(gid)) |
879 |
+ return -EINVAL; |
880 |
+ opts->gid = gid; |
881 |
+- set_gid(tracefs_mount->mnt_root, gid); |
882 |
+ break; |
883 |
+ case Opt_mode: |
884 |
+ if (match_octal(&args[0], &option)) |
885 |
+@@ -292,7 +291,9 @@ static int tracefs_apply_options(struct super_block *sb) |
886 |
+ inode->i_mode |= opts->mode; |
887 |
+ |
888 |
+ inode->i_uid = opts->uid; |
889 |
+- inode->i_gid = opts->gid; |
890 |
++ |
891 |
++ /* Set all the group ids to the mount option */ |
892 |
++ set_gid(sb->s_root, opts->gid); |
893 |
+ |
894 |
+ return 0; |
895 |
+ } |
896 |
+diff --git a/include/net/checksum.h b/include/net/checksum.h |
897 |
+index aef2b2bb6603f..051307cc877f3 100644 |
898 |
+--- a/include/net/checksum.h |
899 |
++++ b/include/net/checksum.h |
900 |
+@@ -143,6 +143,11 @@ static inline void csum_replace2(__sum16 *sum, __be16 old, __be16 new) |
901 |
+ *sum = ~csum16_add(csum16_sub(~(*sum), old), new); |
902 |
+ } |
903 |
+ |
904 |
++static inline void csum_replace(__wsum *csum, __wsum old, __wsum new) |
905 |
++{ |
906 |
++ *csum = csum_add(csum_sub(*csum, old), new); |
907 |
++} |
908 |
++ |
909 |
+ struct sk_buff; |
910 |
+ void inet_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb, |
911 |
+ __be32 from, __be32 to, bool pseudohdr); |
912 |
+diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c |
913 |
+index ff956ccbb6dfb..d43d25acc95ad 100644 |
914 |
+--- a/kernel/cgroup/cpuset.c |
915 |
++++ b/kernel/cgroup/cpuset.c |
916 |
+@@ -1528,6 +1528,7 @@ static void cpuset_attach(struct cgroup_taskset *tset) |
917 |
+ cgroup_taskset_first(tset, &css); |
918 |
+ cs = css_cs(css); |
919 |
+ |
920 |
++ cpus_read_lock(); |
921 |
+ mutex_lock(&cpuset_mutex); |
922 |
+ |
923 |
+ /* prepare for attach */ |
924 |
+@@ -1583,6 +1584,7 @@ static void cpuset_attach(struct cgroup_taskset *tset) |
925 |
+ wake_up(&cpuset_attach_wq); |
926 |
+ |
927 |
+ mutex_unlock(&cpuset_mutex); |
928 |
++ cpus_read_unlock(); |
929 |
+ } |
930 |
+ |
931 |
+ /* The various types of files and directories in a cpuset file system */ |
932 |
+diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c |
933 |
+index 0c3b1551cfca2..32e573c42a68c 100644 |
934 |
+--- a/kernel/trace/trace_events_trigger.c |
935 |
++++ b/kernel/trace/trace_events_trigger.c |
936 |
+@@ -933,6 +933,16 @@ static void |
937 |
+ traceon_trigger(struct event_trigger_data *data, void *rec, |
938 |
+ struct ring_buffer_event *event) |
939 |
+ { |
940 |
++ struct trace_event_file *file = data->private_data; |
941 |
++ |
942 |
++ if (file) { |
943 |
++ if (tracer_tracing_is_on(file->tr)) |
944 |
++ return; |
945 |
++ |
946 |
++ tracer_tracing_on(file->tr); |
947 |
++ return; |
948 |
++ } |
949 |
++ |
950 |
+ if (tracing_is_on()) |
951 |
+ return; |
952 |
+ |
953 |
+@@ -943,8 +953,15 @@ static void |
954 |
+ traceon_count_trigger(struct event_trigger_data *data, void *rec, |
955 |
+ struct ring_buffer_event *event) |
956 |
+ { |
957 |
+- if (tracing_is_on()) |
958 |
+- return; |
959 |
++ struct trace_event_file *file = data->private_data; |
960 |
++ |
961 |
++ if (file) { |
962 |
++ if (tracer_tracing_is_on(file->tr)) |
963 |
++ return; |
964 |
++ } else { |
965 |
++ if (tracing_is_on()) |
966 |
++ return; |
967 |
++ } |
968 |
+ |
969 |
+ if (!data->count) |
970 |
+ return; |
971 |
+@@ -952,13 +969,26 @@ traceon_count_trigger(struct event_trigger_data *data, void *rec, |
972 |
+ if (data->count != -1) |
973 |
+ (data->count)--; |
974 |
+ |
975 |
+- tracing_on(); |
976 |
++ if (file) |
977 |
++ tracer_tracing_on(file->tr); |
978 |
++ else |
979 |
++ tracing_on(); |
980 |
+ } |
981 |
+ |
982 |
+ static void |
983 |
+ traceoff_trigger(struct event_trigger_data *data, void *rec, |
984 |
+ struct ring_buffer_event *event) |
985 |
+ { |
986 |
++ struct trace_event_file *file = data->private_data; |
987 |
++ |
988 |
++ if (file) { |
989 |
++ if (!tracer_tracing_is_on(file->tr)) |
990 |
++ return; |
991 |
++ |
992 |
++ tracer_tracing_off(file->tr); |
993 |
++ return; |
994 |
++ } |
995 |
++ |
996 |
+ if (!tracing_is_on()) |
997 |
+ return; |
998 |
+ |
999 |
+@@ -969,8 +999,15 @@ static void |
1000 |
+ traceoff_count_trigger(struct event_trigger_data *data, void *rec, |
1001 |
+ struct ring_buffer_event *event) |
1002 |
+ { |
1003 |
+- if (!tracing_is_on()) |
1004 |
+- return; |
1005 |
++ struct trace_event_file *file = data->private_data; |
1006 |
++ |
1007 |
++ if (file) { |
1008 |
++ if (!tracer_tracing_is_on(file->tr)) |
1009 |
++ return; |
1010 |
++ } else { |
1011 |
++ if (!tracing_is_on()) |
1012 |
++ return; |
1013 |
++ } |
1014 |
+ |
1015 |
+ if (!data->count) |
1016 |
+ return; |
1017 |
+@@ -978,7 +1015,10 @@ traceoff_count_trigger(struct event_trigger_data *data, void *rec, |
1018 |
+ if (data->count != -1) |
1019 |
+ (data->count)--; |
1020 |
+ |
1021 |
+- tracing_off(); |
1022 |
++ if (file) |
1023 |
++ tracer_tracing_off(file->tr); |
1024 |
++ else |
1025 |
++ tracing_off(); |
1026 |
+ } |
1027 |
+ |
1028 |
+ static int |
1029 |
+diff --git a/mm/memblock.c b/mm/memblock.c |
1030 |
+index 4f7c5c3c442c3..4d471da3cc479 100644 |
1031 |
+--- a/mm/memblock.c |
1032 |
++++ b/mm/memblock.c |
1033 |
+@@ -322,14 +322,20 @@ void __init memblock_discard(void) |
1034 |
+ addr = __pa(memblock.reserved.regions); |
1035 |
+ size = PAGE_ALIGN(sizeof(struct memblock_region) * |
1036 |
+ memblock.reserved.max); |
1037 |
+- __memblock_free_late(addr, size); |
1038 |
++ if (memblock_reserved_in_slab) |
1039 |
++ kfree(memblock.reserved.regions); |
1040 |
++ else |
1041 |
++ __memblock_free_late(addr, size); |
1042 |
+ } |
1043 |
+ |
1044 |
+ if (memblock.memory.regions != memblock_memory_init_regions) { |
1045 |
+ addr = __pa(memblock.memory.regions); |
1046 |
+ size = PAGE_ALIGN(sizeof(struct memblock_region) * |
1047 |
+ memblock.memory.max); |
1048 |
+- __memblock_free_late(addr, size); |
1049 |
++ if (memblock_memory_in_slab) |
1050 |
++ kfree(memblock.memory.regions); |
1051 |
++ else |
1052 |
++ __memblock_free_late(addr, size); |
1053 |
+ } |
1054 |
+ } |
1055 |
+ #endif |
1056 |
+diff --git a/net/core/skbuff.c b/net/core/skbuff.c |
1057 |
+index e1daab49b0eb0..c623c129d0ab6 100644 |
1058 |
+--- a/net/core/skbuff.c |
1059 |
++++ b/net/core/skbuff.c |
1060 |
+@@ -1977,7 +1977,7 @@ void *__pskb_pull_tail(struct sk_buff *skb, int delta) |
1061 |
+ /* Free pulled out fragments. */ |
1062 |
+ while ((list = skb_shinfo(skb)->frag_list) != insp) { |
1063 |
+ skb_shinfo(skb)->frag_list = list->next; |
1064 |
+- kfree_skb(list); |
1065 |
++ consume_skb(list); |
1066 |
+ } |
1067 |
+ /* And insert new clone at head. */ |
1068 |
+ if (clone) { |
1069 |
+@@ -5482,7 +5482,7 @@ static int pskb_carve_frag_list(struct sk_buff *skb, |
1070 |
+ /* Free pulled out fragments. */ |
1071 |
+ while ((list = shinfo->frag_list) != insp) { |
1072 |
+ shinfo->frag_list = list->next; |
1073 |
+- kfree_skb(list); |
1074 |
++ consume_skb(list); |
1075 |
+ } |
1076 |
+ /* And insert new clone at head. */ |
1077 |
+ if (clone) { |
1078 |
+diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c |
1079 |
+index 713eea9affaad..d8c22246629a6 100644 |
1080 |
+--- a/net/ipv4/af_inet.c |
1081 |
++++ b/net/ipv4/af_inet.c |
1082 |
+@@ -1338,8 +1338,11 @@ struct sk_buff *inet_gso_segment(struct sk_buff *skb, |
1083 |
+ } |
1084 |
+ |
1085 |
+ ops = rcu_dereference(inet_offloads[proto]); |
1086 |
+- if (likely(ops && ops->callbacks.gso_segment)) |
1087 |
++ if (likely(ops && ops->callbacks.gso_segment)) { |
1088 |
+ segs = ops->callbacks.gso_segment(skb, features); |
1089 |
++ if (!segs) |
1090 |
++ skb->network_header = skb_mac_header(skb) + nhoff - skb->head; |
1091 |
++ } |
1092 |
+ |
1093 |
+ if (IS_ERR_OR_NULL(segs)) |
1094 |
+ goto out; |
1095 |
+diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c |
1096 |
+index 28d171e6e10b9..b068eb01fe993 100644 |
1097 |
+--- a/net/ipv4/ping.c |
1098 |
++++ b/net/ipv4/ping.c |
1099 |
+@@ -192,7 +192,6 @@ static struct sock *ping_lookup(struct net *net, struct sk_buff *skb, u16 ident) |
1100 |
+ (int)ident, &ipv6_hdr(skb)->daddr, dif); |
1101 |
+ #endif |
1102 |
+ } else { |
1103 |
+- pr_err("ping: protocol(%x) is not supported\n", ntohs(skb->protocol)); |
1104 |
+ return NULL; |
1105 |
+ } |
1106 |
+ |
1107 |
+diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c |
1108 |
+index c7e495f120110..6c47cd0ef2401 100644 |
1109 |
+--- a/net/ipv6/ip6_offload.c |
1110 |
++++ b/net/ipv6/ip6_offload.c |
1111 |
+@@ -98,6 +98,8 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, |
1112 |
+ if (likely(ops && ops->callbacks.gso_segment)) { |
1113 |
+ skb_reset_transport_header(skb); |
1114 |
+ segs = ops->callbacks.gso_segment(skb, features); |
1115 |
++ if (!segs) |
1116 |
++ skb->network_header = skb_mac_header(skb) + nhoff - skb->head; |
1117 |
+ } |
1118 |
+ |
1119 |
+ if (IS_ERR_OR_NULL(segs)) |
1120 |
+diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c |
1121 |
+index 849fcf973c74b..100cc09c100d9 100644 |
1122 |
+--- a/net/openvswitch/actions.c |
1123 |
++++ b/net/openvswitch/actions.c |
1124 |
+@@ -493,12 +493,43 @@ static void set_ipv6_addr(struct sk_buff *skb, u8 l4_proto, |
1125 |
+ memcpy(addr, new_addr, sizeof(__be32[4])); |
1126 |
+ } |
1127 |
+ |
1128 |
+-static void set_ipv6_fl(struct ipv6hdr *nh, u32 fl, u32 mask) |
1129 |
++static void set_ipv6_dsfield(struct sk_buff *skb, struct ipv6hdr *nh, u8 ipv6_tclass, u8 mask) |
1130 |
+ { |
1131 |
++ u8 old_ipv6_tclass = ipv6_get_dsfield(nh); |
1132 |
++ |
1133 |
++ ipv6_tclass = OVS_MASKED(old_ipv6_tclass, ipv6_tclass, mask); |
1134 |
++ |
1135 |
++ if (skb->ip_summed == CHECKSUM_COMPLETE) |
1136 |
++ csum_replace(&skb->csum, (__force __wsum)(old_ipv6_tclass << 12), |
1137 |
++ (__force __wsum)(ipv6_tclass << 12)); |
1138 |
++ |
1139 |
++ ipv6_change_dsfield(nh, ~mask, ipv6_tclass); |
1140 |
++} |
1141 |
++ |
1142 |
++static void set_ipv6_fl(struct sk_buff *skb, struct ipv6hdr *nh, u32 fl, u32 mask) |
1143 |
++{ |
1144 |
++ u32 ofl; |
1145 |
++ |
1146 |
++ ofl = nh->flow_lbl[0] << 16 | nh->flow_lbl[1] << 8 | nh->flow_lbl[2]; |
1147 |
++ fl = OVS_MASKED(ofl, fl, mask); |
1148 |
++ |
1149 |
+ /* Bits 21-24 are always unmasked, so this retains their values. */ |
1150 |
+- OVS_SET_MASKED(nh->flow_lbl[0], (u8)(fl >> 16), (u8)(mask >> 16)); |
1151 |
+- OVS_SET_MASKED(nh->flow_lbl[1], (u8)(fl >> 8), (u8)(mask >> 8)); |
1152 |
+- OVS_SET_MASKED(nh->flow_lbl[2], (u8)fl, (u8)mask); |
1153 |
++ nh->flow_lbl[0] = (u8)(fl >> 16); |
1154 |
++ nh->flow_lbl[1] = (u8)(fl >> 8); |
1155 |
++ nh->flow_lbl[2] = (u8)fl; |
1156 |
++ |
1157 |
++ if (skb->ip_summed == CHECKSUM_COMPLETE) |
1158 |
++ csum_replace(&skb->csum, (__force __wsum)htonl(ofl), (__force __wsum)htonl(fl)); |
1159 |
++} |
1160 |
++ |
1161 |
++static void set_ipv6_ttl(struct sk_buff *skb, struct ipv6hdr *nh, u8 new_ttl, u8 mask) |
1162 |
++{ |
1163 |
++ new_ttl = OVS_MASKED(nh->hop_limit, new_ttl, mask); |
1164 |
++ |
1165 |
++ if (skb->ip_summed == CHECKSUM_COMPLETE) |
1166 |
++ csum_replace(&skb->csum, (__force __wsum)(nh->hop_limit << 8), |
1167 |
++ (__force __wsum)(new_ttl << 8)); |
1168 |
++ nh->hop_limit = new_ttl; |
1169 |
+ } |
1170 |
+ |
1171 |
+ static void set_ip_ttl(struct sk_buff *skb, struct iphdr *nh, u8 new_ttl, |
1172 |
+@@ -616,18 +647,17 @@ static int set_ipv6(struct sk_buff *skb, struct sw_flow_key *flow_key, |
1173 |
+ } |
1174 |
+ } |
1175 |
+ if (mask->ipv6_tclass) { |
1176 |
+- ipv6_change_dsfield(nh, ~mask->ipv6_tclass, key->ipv6_tclass); |
1177 |
++ set_ipv6_dsfield(skb, nh, key->ipv6_tclass, mask->ipv6_tclass); |
1178 |
+ flow_key->ip.tos = ipv6_get_dsfield(nh); |
1179 |
+ } |
1180 |
+ if (mask->ipv6_label) { |
1181 |
+- set_ipv6_fl(nh, ntohl(key->ipv6_label), |
1182 |
++ set_ipv6_fl(skb, nh, ntohl(key->ipv6_label), |
1183 |
+ ntohl(mask->ipv6_label)); |
1184 |
+ flow_key->ipv6.label = |
1185 |
+ *(__be32 *)nh & htonl(IPV6_FLOWINFO_FLOWLABEL); |
1186 |
+ } |
1187 |
+ if (mask->ipv6_hlimit) { |
1188 |
+- OVS_SET_MASKED(nh->hop_limit, key->ipv6_hlimit, |
1189 |
+- mask->ipv6_hlimit); |
1190 |
++ set_ipv6_ttl(skb, nh, key->ipv6_hlimit, mask->ipv6_hlimit); |
1191 |
+ flow_key->ip.ttl = nh->hop_limit; |
1192 |
+ } |
1193 |
+ return 0; |
1194 |
+diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c |
1195 |
+index 89993afe0fbd3..059ffb8b466a2 100644 |
1196 |
+--- a/net/tipc/name_table.c |
1197 |
++++ b/net/tipc/name_table.c |
1198 |
+@@ -812,7 +812,7 @@ static int __tipc_nl_add_nametable_publ(struct tipc_nl_msg *msg, |
1199 |
+ list_for_each_entry(p, &sr->all_publ, all_publ) |
1200 |
+ if (p->key == *last_key) |
1201 |
+ break; |
1202 |
+- if (p->key != *last_key) |
1203 |
++ if (list_entry_is_head(p, &sr->all_publ, all_publ)) |
1204 |
+ return -EPIPE; |
1205 |
+ } else { |
1206 |
+ p = list_first_entry(&sr->all_publ, |
1207 |
+diff --git a/net/tipc/socket.c b/net/tipc/socket.c |
1208 |
+index 848ae6dcbd822..6c18b4565ab51 100644 |
1209 |
+--- a/net/tipc/socket.c |
1210 |
++++ b/net/tipc/socket.c |
1211 |
+@@ -3487,7 +3487,7 @@ static int __tipc_nl_list_sk_publ(struct sk_buff *skb, |
1212 |
+ if (p->key == *last_publ) |
1213 |
+ break; |
1214 |
+ } |
1215 |
+- if (p->key != *last_publ) { |
1216 |
++ if (list_entry_is_head(p, &tsk->publications, binding_sock)) { |
1217 |
+ /* We never set seq or call nl_dump_check_consistent() |
1218 |
+ * this means that setting prev_seq here will cause the |
1219 |
+ * consistence check to fail in the netlink callback |