Magellan Linux

Contents of /trunk/kernel-alx/patches-5.4/0129-5.4.30-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3510 - (show annotations) (download)
Mon May 11 14:36:33 2020 UTC (3 years, 11 months ago) by niro
File size: 30487 byte(s)
-linux-5.4.30
1 diff --git a/Makefile b/Makefile
2 index 8cb72071a842..e1f41756f475 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,7 +1,7 @@
6 # SPDX-License-Identifier: GPL-2.0
7 VERSION = 5
8 PATCHLEVEL = 4
9 -SUBLEVEL = 29
10 +SUBLEVEL = 30
11 EXTRAVERSION =
12 NAME = Kleptomaniac Octopus
13
14 diff --git a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts
15 index b75af21069f9..4c3f606e5b8d 100644
16 --- a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts
17 +++ b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts
18 @@ -112,6 +112,7 @@
19 &sdhci {
20 #address-cells = <1>;
21 #size-cells = <0>;
22 + pinctrl-names = "default";
23 pinctrl-0 = <&emmc_gpio34 &gpclk2_gpio43>;
24 bus-width = <4>;
25 mmc-pwrseq = <&wifi_pwrseq>;
26 diff --git a/arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi b/arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi
27 index 881cea0b61ba..31fa37d2fe47 100644
28 --- a/arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi
29 +++ b/arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi
30 @@ -107,14 +107,14 @@
31 regulators {
32 vdd_arm: buck1 {
33 regulator-name = "vdd_arm";
34 - regulator-min-microvolt = <730000>;
35 + regulator-min-microvolt = <925000>;
36 regulator-max-microvolt = <1380000>;
37 regulator-always-on;
38 };
39
40 vdd_soc: buck2 {
41 regulator-name = "vdd_soc";
42 - regulator-min-microvolt = <730000>;
43 + regulator-min-microvolt = <1150000>;
44 regulator-max-microvolt = <1380000>;
45 regulator-always-on;
46 };
47 diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts
48 index 63659880eeb3..7f2ddb78da5f 100644
49 --- a/arch/arm/boot/dts/omap3-n900.dts
50 +++ b/arch/arm/boot/dts/omap3-n900.dts
51 @@ -849,34 +849,46 @@
52 compatible = "ti,omap2-onenand";
53 reg = <0 0 0x20000>; /* CS0, offset 0, IO size 128K */
54
55 + /*
56 + * These timings are based on CONFIG_OMAP_GPMC_DEBUG=y reported
57 + * bootloader set values when booted with v5.1
58 + * (OneNAND Manufacturer: Samsung):
59 + *
60 + * cs0 GPMC_CS_CONFIG1: 0xfb001202
61 + * cs0 GPMC_CS_CONFIG2: 0x00111100
62 + * cs0 GPMC_CS_CONFIG3: 0x00020200
63 + * cs0 GPMC_CS_CONFIG4: 0x11001102
64 + * cs0 GPMC_CS_CONFIG5: 0x03101616
65 + * cs0 GPMC_CS_CONFIG6: 0x90060000
66 + */
67 gpmc,sync-read;
68 gpmc,sync-write;
69 gpmc,burst-length = <16>;
70 gpmc,burst-read;
71 gpmc,burst-wrap;
72 gpmc,burst-write;
73 - gpmc,device-width = <2>; /* GPMC_DEVWIDTH_16BIT */
74 - gpmc,mux-add-data = <2>; /* GPMC_MUX_AD */
75 + gpmc,device-width = <2>;
76 + gpmc,mux-add-data = <2>;
77 gpmc,cs-on-ns = <0>;
78 - gpmc,cs-rd-off-ns = <87>;
79 - gpmc,cs-wr-off-ns = <87>;
80 + gpmc,cs-rd-off-ns = <102>;
81 + gpmc,cs-wr-off-ns = <102>;
82 gpmc,adv-on-ns = <0>;
83 - gpmc,adv-rd-off-ns = <10>;
84 - gpmc,adv-wr-off-ns = <10>;
85 - gpmc,oe-on-ns = <15>;
86 - gpmc,oe-off-ns = <87>;
87 + gpmc,adv-rd-off-ns = <12>;
88 + gpmc,adv-wr-off-ns = <12>;
89 + gpmc,oe-on-ns = <12>;
90 + gpmc,oe-off-ns = <102>;
91 gpmc,we-on-ns = <0>;
92 - gpmc,we-off-ns = <87>;
93 - gpmc,rd-cycle-ns = <112>;
94 - gpmc,wr-cycle-ns = <112>;
95 - gpmc,access-ns = <81>;
96 - gpmc,page-burst-access-ns = <15>;
97 + gpmc,we-off-ns = <102>;
98 + gpmc,rd-cycle-ns = <132>;
99 + gpmc,wr-cycle-ns = <132>;
100 + gpmc,access-ns = <96>;
101 + gpmc,page-burst-access-ns = <18>;
102 gpmc,bus-turnaround-ns = <0>;
103 gpmc,cycle2cycle-delay-ns = <0>;
104 gpmc,wait-monitoring-ns = <0>;
105 - gpmc,clk-activation-ns = <5>;
106 - gpmc,wr-data-mux-bus-ns = <30>;
107 - gpmc,wr-access-ns = <81>;
108 + gpmc,clk-activation-ns = <6>;
109 + gpmc,wr-data-mux-bus-ns = <36>;
110 + gpmc,wr-access-ns = <96>;
111 gpmc,sync-clk-ps = <15000>;
112
113 /*
114 diff --git a/arch/arm/boot/dts/ox810se.dtsi b/arch/arm/boot/dts/ox810se.dtsi
115 index 9f6c2b660ed3..0755e5864c4a 100644
116 --- a/arch/arm/boot/dts/ox810se.dtsi
117 +++ b/arch/arm/boot/dts/ox810se.dtsi
118 @@ -323,8 +323,8 @@
119 interrupt-controller;
120 reg = <0 0x200>;
121 #interrupt-cells = <1>;
122 - valid-mask = <0xFFFFFFFF>;
123 - clear-mask = <0>;
124 + valid-mask = <0xffffffff>;
125 + clear-mask = <0xffffffff>;
126 };
127
128 timer0: timer@200 {
129 diff --git a/arch/arm/boot/dts/ox820.dtsi b/arch/arm/boot/dts/ox820.dtsi
130 index c9b327732063..90846a7655b4 100644
131 --- a/arch/arm/boot/dts/ox820.dtsi
132 +++ b/arch/arm/boot/dts/ox820.dtsi
133 @@ -240,8 +240,8 @@
134 reg = <0 0x200>;
135 interrupts = <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>;
136 #interrupt-cells = <1>;
137 - valid-mask = <0xFFFFFFFF>;
138 - clear-mask = <0>;
139 + valid-mask = <0xffffffff>;
140 + clear-mask = <0xffffffff>;
141 };
142
143 timer0: timer@200 {
144 diff --git a/arch/arm/boot/dts/sun8i-r40.dtsi b/arch/arm/boot/dts/sun8i-r40.dtsi
145 index c9c2688db66d..80f4dc34df34 100644
146 --- a/arch/arm/boot/dts/sun8i-r40.dtsi
147 +++ b/arch/arm/boot/dts/sun8i-r40.dtsi
148 @@ -266,6 +266,16 @@
149 #phy-cells = <1>;
150 };
151
152 + ahci: sata@1c18000 {
153 + compatible = "allwinner,sun8i-r40-ahci";
154 + reg = <0x01c18000 0x1000>;
155 + interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>;
156 + clocks = <&ccu CLK_BUS_SATA>, <&ccu CLK_SATA>;
157 + resets = <&ccu RST_BUS_SATA>;
158 + reset-names = "ahci";
159 + status = "disabled";
160 + };
161 +
162 ehci1: usb@1c19000 {
163 compatible = "allwinner,sun8i-r40-ehci", "generic-ehci";
164 reg = <0x01c19000 0x100>;
165 @@ -557,17 +567,6 @@
166 #size-cells = <0>;
167 };
168
169 - ahci: sata@1c18000 {
170 - compatible = "allwinner,sun8i-r40-ahci";
171 - reg = <0x01c18000 0x1000>;
172 - interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>;
173 - clocks = <&ccu CLK_BUS_SATA>, <&ccu CLK_SATA>;
174 - resets = <&ccu RST_BUS_SATA>;
175 - reset-names = "ahci";
176 - status = "disabled";
177 -
178 - };
179 -
180 gmac: ethernet@1c50000 {
181 compatible = "allwinner,sun8i-r40-gmac";
182 syscon = <&ccu>;
183 diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1043a-rdb.dts b/arch/arm64/boot/dts/freescale/fsl-ls1043a-rdb.dts
184 index 4223a2352d45..dde50c88f5e3 100644
185 --- a/arch/arm64/boot/dts/freescale/fsl-ls1043a-rdb.dts
186 +++ b/arch/arm64/boot/dts/freescale/fsl-ls1043a-rdb.dts
187 @@ -119,12 +119,12 @@
188
189 ethernet@e4000 {
190 phy-handle = <&rgmii_phy1>;
191 - phy-connection-type = "rgmii-txid";
192 + phy-connection-type = "rgmii-id";
193 };
194
195 ethernet@e6000 {
196 phy-handle = <&rgmii_phy2>;
197 - phy-connection-type = "rgmii-txid";
198 + phy-connection-type = "rgmii-id";
199 };
200
201 ethernet@e8000 {
202 diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts b/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts
203 index 6a6514d0e5a9..274339759114 100644
204 --- a/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts
205 +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts
206 @@ -127,12 +127,12 @@
207 &fman0 {
208 ethernet@e4000 {
209 phy-handle = <&rgmii_phy1>;
210 - phy-connection-type = "rgmii";
211 + phy-connection-type = "rgmii-id";
212 };
213
214 ethernet@e6000 {
215 phy-handle = <&rgmii_phy2>;
216 - phy-connection-type = "rgmii";
217 + phy-connection-type = "rgmii-id";
218 };
219
220 ethernet@e8000 {
221 diff --git a/arch/arm64/include/asm/alternative.h b/arch/arm64/include/asm/alternative.h
222 index 324e7d5ab37e..5e5dc05d63a0 100644
223 --- a/arch/arm64/include/asm/alternative.h
224 +++ b/arch/arm64/include/asm/alternative.h
225 @@ -221,7 +221,7 @@ alternative_endif
226
227 .macro user_alt, label, oldinstr, newinstr, cond
228 9999: alternative_insn "\oldinstr", "\newinstr", \cond
229 - _ASM_EXTABLE 9999b, \label
230 + _asm_extable 9999b, \label
231 .endm
232
233 /*
234 diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c
235 index fbef740704d0..b8b2072742a5 100644
236 --- a/drivers/clk/imx/clk-scu.c
237 +++ b/drivers/clk/imx/clk-scu.c
238 @@ -43,12 +43,12 @@ struct imx_sc_msg_req_set_clock_rate {
239 __le32 rate;
240 __le16 resource;
241 u8 clk;
242 -} __packed;
243 +} __packed __aligned(4);
244
245 struct req_get_clock_rate {
246 __le16 resource;
247 u8 clk;
248 -} __packed;
249 +} __packed __aligned(4);
250
251 struct resp_get_clock_rate {
252 __le32 rate;
253 @@ -84,7 +84,7 @@ struct imx_sc_msg_get_clock_parent {
254 struct req_get_clock_parent {
255 __le16 resource;
256 u8 clk;
257 - } __packed req;
258 + } __packed __aligned(4) req;
259 struct resp_get_clock_parent {
260 u8 parent;
261 } resp;
262 @@ -121,7 +121,7 @@ struct imx_sc_msg_req_clock_enable {
263 u8 clk;
264 u8 enable;
265 u8 autog;
266 -} __packed;
267 +} __packed __aligned(4);
268
269 static inline struct clk_scu *to_clk_scu(struct clk_hw *hw)
270 {
271 diff --git a/drivers/clk/ti/clk-43xx.c b/drivers/clk/ti/clk-43xx.c
272 index 2782d91838ac..2cca1ced913d 100644
273 --- a/drivers/clk/ti/clk-43xx.c
274 +++ b/drivers/clk/ti/clk-43xx.c
275 @@ -78,7 +78,7 @@ static const struct omap_clkctrl_reg_data am4_gfx_l3_clkctrl_regs[] __initconst
276 };
277
278 static const struct omap_clkctrl_reg_data am4_l4_rtc_clkctrl_regs[] __initconst = {
279 - { AM4_L4_RTC_RTC_CLKCTRL, NULL, CLKF_SW_SUP, "clk_32768_ck" },
280 + { AM4_L4_RTC_RTC_CLKCTRL, NULL, CLKF_SW_SUP, "clkdiv32k_ick" },
281 { 0 },
282 };
283
284 diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
285 index a3fb450a9ca8..b2e186047014 100644
286 --- a/drivers/gpio/gpiolib-acpi.c
287 +++ b/drivers/gpio/gpiolib-acpi.c
288 @@ -1430,6 +1430,21 @@ static const struct dmi_system_id gpiolib_acpi_quirks[] = {
289 .ignore_wake = "INT33FC:02@28",
290 },
291 },
292 + {
293 + /*
294 + * HP X2 10 models with Cherry Trail SoC + AXP288 PMIC use an
295 + * external embedded-controller connected via I2C + an ACPI GPIO
296 + * event handler on INT33FF:01 pin 0, causing spurious wakeups.
297 + */
298 + .matches = {
299 + DMI_MATCH(DMI_SYS_VENDOR, "HP"),
300 + DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion x2 Detachable"),
301 + DMI_MATCH(DMI_BOARD_NAME, "813E"),
302 + },
303 + .driver_data = &(struct acpi_gpiolib_dmi_quirk) {
304 + .ignore_wake = "INT33FF:01@0",
305 + },
306 + },
307 {} /* Terminating entry */
308 };
309
310 diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c b/drivers/net/ethernet/micrel/ks8851_mll.c
311 index 58579baf3f7a..45cc840d8e2e 100644
312 --- a/drivers/net/ethernet/micrel/ks8851_mll.c
313 +++ b/drivers/net/ethernet/micrel/ks8851_mll.c
314 @@ -156,6 +156,50 @@ static int msg_enable;
315 * chip is busy transferring packet data (RX/TX FIFO accesses).
316 */
317
318 +/**
319 + * ks_check_endian - Check whether endianness of the bus is correct
320 + * @ks : The chip information
321 + *
322 + * The KS8851-16MLL EESK pin allows selecting the endianness of the 16bit
323 + * bus. To maintain optimum performance, the bus endianness should be set
324 + * such that it matches the endianness of the CPU.
325 + */
326 +
327 +static int ks_check_endian(struct ks_net *ks)
328 +{
329 + u16 cider;
330 +
331 + /*
332 + * Read CIDER register first, however read it the "wrong" way around.
333 + * If the endian strap on the KS8851-16MLL in incorrect and the chip
334 + * is operating in different endianness than the CPU, then the meaning
335 + * of BE[3:0] byte-enable bits is also swapped such that:
336 + * BE[3,2,1,0] becomes BE[1,0,3,2]
337 + *
338 + * Luckily for us, the byte-enable bits are the top four MSbits of
339 + * the address register and the CIDER register is at offset 0xc0.
340 + * Hence, by reading address 0xc0c0, which is not impacted by endian
341 + * swapping, we assert either BE[3:2] or BE[1:0] while reading the
342 + * CIDER register.
343 + *
344 + * If the bus configuration is correct, reading 0xc0c0 asserts
345 + * BE[3:2] and this read returns 0x0000, because to read register
346 + * with bottom two LSbits of address set to 0, BE[1:0] must be
347 + * asserted.
348 + *
349 + * If the bus configuration is NOT correct, reading 0xc0c0 asserts
350 + * BE[1:0] and this read returns non-zero 0x8872 value.
351 + */
352 + iowrite16(BE3 | BE2 | KS_CIDER, ks->hw_addr_cmd);
353 + cider = ioread16(ks->hw_addr);
354 + if (!cider)
355 + return 0;
356 +
357 + netdev_err(ks->netdev, "incorrect EESK endian strap setting\n");
358 +
359 + return -EINVAL;
360 +}
361 +
362 /**
363 * ks_rdreg16 - read 16 bit register from device
364 * @ks : The chip information
365 @@ -166,7 +210,7 @@ static int msg_enable;
366
367 static u16 ks_rdreg16(struct ks_net *ks, int offset)
368 {
369 - ks->cmd_reg_cache = (u16)offset | ((BE3 | BE2) >> (offset & 0x02));
370 + ks->cmd_reg_cache = (u16)offset | ((BE1 | BE0) << (offset & 0x02));
371 iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd);
372 return ioread16(ks->hw_addr);
373 }
374 @@ -181,7 +225,7 @@ static u16 ks_rdreg16(struct ks_net *ks, int offset)
375
376 static void ks_wrreg16(struct ks_net *ks, int offset, u16 value)
377 {
378 - ks->cmd_reg_cache = (u16)offset | ((BE3 | BE2) >> (offset & 0x02));
379 + ks->cmd_reg_cache = (u16)offset | ((BE1 | BE0) << (offset & 0x02));
380 iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd);
381 iowrite16(value, ks->hw_addr);
382 }
383 @@ -197,7 +241,7 @@ static inline void ks_inblk(struct ks_net *ks, u16 *wptr, u32 len)
384 {
385 len >>= 1;
386 while (len--)
387 - *wptr++ = be16_to_cpu(ioread16(ks->hw_addr));
388 + *wptr++ = (u16)ioread16(ks->hw_addr);
389 }
390
391 /**
392 @@ -211,7 +255,7 @@ static inline void ks_outblk(struct ks_net *ks, u16 *wptr, u32 len)
393 {
394 len >>= 1;
395 while (len--)
396 - iowrite16(cpu_to_be16(*wptr++), ks->hw_addr);
397 + iowrite16(*wptr++, ks->hw_addr);
398 }
399
400 static void ks_disable_int(struct ks_net *ks)
401 @@ -1218,6 +1262,10 @@ static int ks8851_probe(struct platform_device *pdev)
402 goto err_free;
403 }
404
405 + err = ks_check_endian(ks);
406 + if (err)
407 + goto err_free;
408 +
409 netdev->irq = platform_get_irq(pdev, 0);
410
411 if ((int)netdev->irq < 0) {
412 diff --git a/drivers/platform/x86/pmc_atom.c b/drivers/platform/x86/pmc_atom.c
413 index 52ef1419b671..2b1a3a6ee8db 100644
414 --- a/drivers/platform/x86/pmc_atom.c
415 +++ b/drivers/platform/x86/pmc_atom.c
416 @@ -383,6 +383,14 @@ static const struct dmi_system_id critclk_systems[] = {
417 DMI_MATCH(DMI_PRODUCT_NAME, "3I380D"),
418 },
419 },
420 + {
421 + /* pmc_plt_clk* - are used for ethernet controllers */
422 + .ident = "Lex 2I385SW",
423 + .matches = {
424 + DMI_MATCH(DMI_SYS_VENDOR, "Lex BayTrail"),
425 + DMI_MATCH(DMI_PRODUCT_NAME, "2I385SW"),
426 + },
427 + },
428 {
429 /* pmc_plt_clk* - are used for ethernet controllers */
430 .ident = "Beckhoff CB3163",
431 diff --git a/drivers/tty/serial/sprd_serial.c b/drivers/tty/serial/sprd_serial.c
432 index 494e2672ebd7..07573de70445 100644
433 --- a/drivers/tty/serial/sprd_serial.c
434 +++ b/drivers/tty/serial/sprd_serial.c
435 @@ -1103,14 +1103,13 @@ static int sprd_remove(struct platform_device *dev)
436 if (sup) {
437 uart_remove_one_port(&sprd_uart_driver, &sup->port);
438 sprd_port[sup->port.line] = NULL;
439 + sprd_rx_free_buf(sup);
440 sprd_ports_num--;
441 }
442
443 if (!sprd_ports_num)
444 uart_unregister_driver(&sprd_uart_driver);
445
446 - sprd_rx_free_buf(sup);
447 -
448 return 0;
449 }
450
451 diff --git a/drivers/tty/vt/selection.c b/drivers/tty/vt/selection.c
452 index d7d2e4b844bc..7556139cd0da 100644
453 --- a/drivers/tty/vt/selection.c
454 +++ b/drivers/tty/vt/selection.c
455 @@ -88,6 +88,11 @@ void clear_selection(void)
456 }
457 EXPORT_SYMBOL_GPL(clear_selection);
458
459 +bool vc_is_sel(struct vc_data *vc)
460 +{
461 + return vc == sel_cons;
462 +}
463 +
464 /*
465 * User settable table: what characters are to be considered alphabetic?
466 * 128 bits. Locked by the console lock.
467 diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
468 index e9e27ba69d5d..fa9433e6cdc7 100644
469 --- a/drivers/tty/vt/vt.c
470 +++ b/drivers/tty/vt/vt.c
471 @@ -890,8 +890,9 @@ static void hide_softcursor(struct vc_data *vc)
472
473 static void hide_cursor(struct vc_data *vc)
474 {
475 - if (vc == sel_cons)
476 + if (vc_is_sel(vc))
477 clear_selection();
478 +
479 vc->vc_sw->con_cursor(vc, CM_ERASE);
480 hide_softcursor(vc);
481 }
482 @@ -901,7 +902,7 @@ static void set_cursor(struct vc_data *vc)
483 if (!con_is_fg(vc) || console_blanked || vc->vc_mode == KD_GRAPHICS)
484 return;
485 if (vc->vc_deccm) {
486 - if (vc == sel_cons)
487 + if (vc_is_sel(vc))
488 clear_selection();
489 add_softcursor(vc);
490 if ((vc->vc_cursor_type & 0x0f) != 1)
491 @@ -1074,6 +1075,17 @@ static void visual_deinit(struct vc_data *vc)
492 module_put(vc->vc_sw->owner);
493 }
494
495 +static void vc_port_destruct(struct tty_port *port)
496 +{
497 + struct vc_data *vc = container_of(port, struct vc_data, port);
498 +
499 + kfree(vc);
500 +}
501 +
502 +static const struct tty_port_operations vc_port_ops = {
503 + .destruct = vc_port_destruct,
504 +};
505 +
506 int vc_allocate(unsigned int currcons) /* return 0 on success */
507 {
508 struct vt_notifier_param param;
509 @@ -1099,6 +1111,7 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */
510
511 vc_cons[currcons].d = vc;
512 tty_port_init(&vc->port);
513 + vc->port.ops = &vc_port_ops;
514 INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK);
515
516 visual_init(vc, currcons, 1);
517 @@ -1207,7 +1220,7 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc,
518 }
519 }
520
521 - if (vc == sel_cons)
522 + if (vc_is_sel(vc))
523 clear_selection();
524
525 old_rows = vc->vc_rows;
526 @@ -3253,6 +3266,7 @@ static int con_install(struct tty_driver *driver, struct tty_struct *tty)
527
528 tty->driver_data = vc;
529 vc->port.tty = tty;
530 + tty_port_get(&vc->port);
531
532 if (!tty->winsize.ws_row && !tty->winsize.ws_col) {
533 tty->winsize.ws_row = vc_cons[currcons].d->vc_rows;
534 @@ -3288,6 +3302,13 @@ static void con_shutdown(struct tty_struct *tty)
535 console_unlock();
536 }
537
538 +static void con_cleanup(struct tty_struct *tty)
539 +{
540 + struct vc_data *vc = tty->driver_data;
541 +
542 + tty_port_put(&vc->port);
543 +}
544 +
545 static int default_color = 7; /* white */
546 static int default_italic_color = 2; // green (ASCII)
547 static int default_underline_color = 3; // cyan (ASCII)
548 @@ -3412,7 +3433,8 @@ static const struct tty_operations con_ops = {
549 .throttle = con_throttle,
550 .unthrottle = con_unthrottle,
551 .resize = vt_resize,
552 - .shutdown = con_shutdown
553 + .shutdown = con_shutdown,
554 + .cleanup = con_cleanup,
555 };
556
557 static struct cdev vc0_cdev;
558 diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c
559 index ee6c91ef1f6c..daf61c28ba76 100644
560 --- a/drivers/tty/vt/vt_ioctl.c
561 +++ b/drivers/tty/vt/vt_ioctl.c
562 @@ -39,11 +39,32 @@
563 #include <linux/kbd_diacr.h>
564 #include <linux/selection.h>
565
566 -char vt_dont_switch;
567 -extern struct tty_driver *console_driver;
568 +bool vt_dont_switch;
569
570 -#define VT_IS_IN_USE(i) (console_driver->ttys[i] && console_driver->ttys[i]->count)
571 -#define VT_BUSY(i) (VT_IS_IN_USE(i) || i == fg_console || vc_cons[i].d == sel_cons)
572 +static inline bool vt_in_use(unsigned int i)
573 +{
574 + const struct vc_data *vc = vc_cons[i].d;
575 +
576 + /*
577 + * console_lock must be held to prevent the vc from being deallocated
578 + * while we're checking whether it's in-use.
579 + */
580 + WARN_CONSOLE_UNLOCKED();
581 +
582 + return vc && kref_read(&vc->port.kref) > 1;
583 +}
584 +
585 +static inline bool vt_busy(int i)
586 +{
587 + if (vt_in_use(i))
588 + return true;
589 + if (i == fg_console)
590 + return true;
591 + if (vc_is_sel(vc_cons[i].d))
592 + return true;
593 +
594 + return false;
595 +}
596
597 /*
598 * Console (vt and kd) routines, as defined by USL SVR4 manual, and by
599 @@ -289,16 +310,14 @@ static int vt_disallocate(unsigned int vc_num)
600 int ret = 0;
601
602 console_lock();
603 - if (VT_BUSY(vc_num))
604 + if (vt_busy(vc_num))
605 ret = -EBUSY;
606 else if (vc_num)
607 vc = vc_deallocate(vc_num);
608 console_unlock();
609
610 - if (vc && vc_num >= MIN_NR_CONSOLES) {
611 - tty_port_destroy(&vc->port);
612 - kfree(vc);
613 - }
614 + if (vc && vc_num >= MIN_NR_CONSOLES)
615 + tty_port_put(&vc->port);
616
617 return ret;
618 }
619 @@ -311,17 +330,15 @@ static void vt_disallocate_all(void)
620
621 console_lock();
622 for (i = 1; i < MAX_NR_CONSOLES; i++)
623 - if (!VT_BUSY(i))
624 + if (!vt_busy(i))
625 vc[i] = vc_deallocate(i);
626 else
627 vc[i] = NULL;
628 console_unlock();
629
630 for (i = 1; i < MAX_NR_CONSOLES; i++) {
631 - if (vc[i] && i >= MIN_NR_CONSOLES) {
632 - tty_port_destroy(&vc[i]->port);
633 - kfree(vc[i]);
634 - }
635 + if (vc[i] && i >= MIN_NR_CONSOLES)
636 + tty_port_put(&vc[i]->port);
637 }
638 }
639
640 @@ -335,22 +352,13 @@ int vt_ioctl(struct tty_struct *tty,
641 {
642 struct vc_data *vc = tty->driver_data;
643 struct console_font_op op; /* used in multiple places here */
644 - unsigned int console;
645 + unsigned int console = vc->vc_num;
646 unsigned char ucval;
647 unsigned int uival;
648 void __user *up = (void __user *)arg;
649 int i, perm;
650 int ret = 0;
651
652 - console = vc->vc_num;
653 -
654 -
655 - if (!vc_cons_allocated(console)) { /* impossible? */
656 - ret = -ENOIOCTLCMD;
657 - goto out;
658 - }
659 -
660 -
661 /*
662 * To have permissions to do most of the vt ioctls, we either have
663 * to be the owner of the tty, or have CAP_SYS_TTY_CONFIG.
664 @@ -641,15 +649,16 @@ int vt_ioctl(struct tty_struct *tty,
665 struct vt_stat __user *vtstat = up;
666 unsigned short state, mask;
667
668 - /* Review: FIXME: Console lock ? */
669 if (put_user(fg_console + 1, &vtstat->v_active))
670 ret = -EFAULT;
671 else {
672 state = 1; /* /dev/tty0 is always open */
673 + console_lock(); /* required by vt_in_use() */
674 for (i = 0, mask = 2; i < MAX_NR_CONSOLES && mask;
675 ++i, mask <<= 1)
676 - if (VT_IS_IN_USE(i))
677 + if (vt_in_use(i))
678 state |= mask;
679 + console_unlock();
680 ret = put_user(state, &vtstat->v_state);
681 }
682 break;
683 @@ -659,10 +668,11 @@ int vt_ioctl(struct tty_struct *tty,
684 * Returns the first available (non-opened) console.
685 */
686 case VT_OPENQRY:
687 - /* FIXME: locking ? - but then this is a stupid API */
688 + console_lock(); /* required by vt_in_use() */
689 for (i = 0; i < MAX_NR_CONSOLES; ++i)
690 - if (! VT_IS_IN_USE(i))
691 + if (!vt_in_use(i))
692 break;
693 + console_unlock();
694 uival = i < MAX_NR_CONSOLES ? (i+1) : -1;
695 goto setint;
696
697 @@ -1011,12 +1021,12 @@ int vt_ioctl(struct tty_struct *tty,
698 case VT_LOCKSWITCH:
699 if (!capable(CAP_SYS_TTY_CONFIG))
700 return -EPERM;
701 - vt_dont_switch = 1;
702 + vt_dont_switch = true;
703 break;
704 case VT_UNLOCKSWITCH:
705 if (!capable(CAP_SYS_TTY_CONFIG))
706 return -EPERM;
707 - vt_dont_switch = 0;
708 + vt_dont_switch = false;
709 break;
710 case VT_GETHIFONTMASK:
711 ret = put_user(vc->vc_hi_font_mask,
712 @@ -1180,14 +1190,9 @@ long vt_compat_ioctl(struct tty_struct *tty,
713 {
714 struct vc_data *vc = tty->driver_data;
715 struct console_font_op op; /* used in multiple places here */
716 - unsigned int console = vc->vc_num;
717 void __user *up = compat_ptr(arg);
718 int perm;
719
720 -
721 - if (!vc_cons_allocated(console)) /* impossible? */
722 - return -ENOIOCTLCMD;
723 -
724 /*
725 * To have permissions to do most of the vt ioctls, we either have
726 * to be the owner of the tty, or have CAP_SYS_TTY_CONFIG.
727 diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h
728 index c4458dc6a757..76371aaae2d1 100644
729 --- a/include/linux/ceph/messenger.h
730 +++ b/include/linux/ceph/messenger.h
731 @@ -175,9 +175,10 @@ struct ceph_msg_data {
732 #endif /* CONFIG_BLOCK */
733 struct ceph_bvec_iter bvec_pos;
734 struct {
735 - struct page **pages; /* NOT OWNER. */
736 + struct page **pages;
737 size_t length; /* total # bytes */
738 unsigned int alignment; /* first page */
739 + bool own_pages;
740 };
741 struct ceph_pagelist *pagelist;
742 };
743 @@ -356,8 +357,8 @@ extern void ceph_con_keepalive(struct ceph_connection *con);
744 extern bool ceph_con_keepalive_expired(struct ceph_connection *con,
745 unsigned long interval);
746
747 -extern void ceph_msg_data_add_pages(struct ceph_msg *msg, struct page **pages,
748 - size_t length, size_t alignment);
749 +void ceph_msg_data_add_pages(struct ceph_msg *msg, struct page **pages,
750 + size_t length, size_t alignment, bool own_pages);
751 extern void ceph_msg_data_add_pagelist(struct ceph_msg *msg,
752 struct ceph_pagelist *pagelist);
753 #ifdef CONFIG_BLOCK
754 diff --git a/include/linux/selection.h b/include/linux/selection.h
755 index e2c1f96bf059..5b890ef5b59f 100644
756 --- a/include/linux/selection.h
757 +++ b/include/linux/selection.h
758 @@ -11,8 +11,8 @@
759 #include <linux/tiocl.h>
760 #include <linux/vt_buffer.h>
761
762 -extern struct vc_data *sel_cons;
763 struct tty_struct;
764 +struct vc_data;
765
766 extern void clear_selection(void);
767 extern int set_selection_user(const struct tiocl_selection __user *sel,
768 @@ -24,6 +24,8 @@ extern int sel_loadlut(char __user *p);
769 extern int mouse_reporting(void);
770 extern void mouse_report(struct tty_struct * tty, int butt, int mrx, int mry);
771
772 +bool vc_is_sel(struct vc_data *vc);
773 +
774 extern int console_blanked;
775
776 extern const unsigned char color_table[];
777 diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
778 index 8dc77e40bc03..ded5c48598f3 100644
779 --- a/include/linux/vt_kern.h
780 +++ b/include/linux/vt_kern.h
781 @@ -135,7 +135,7 @@ extern int do_unbind_con_driver(const struct consw *csw, int first, int last,
782 int deflt);
783 int vty_init(const struct file_operations *console_fops);
784
785 -extern char vt_dont_switch;
786 +extern bool vt_dont_switch;
787 extern int default_utf8;
788 extern int global_cursor_default;
789
790 diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
791 index b774e2210f7d..b03087f110eb 100644
792 --- a/kernel/bpf/btf.c
793 +++ b/kernel/bpf/btf.c
794 @@ -3460,7 +3460,7 @@ int btf_get_info_by_fd(const struct btf *btf,
795 union bpf_attr __user *uattr)
796 {
797 struct bpf_btf_info __user *uinfo;
798 - struct bpf_btf_info info = {};
799 + struct bpf_btf_info info;
800 u32 info_copy, btf_copy;
801 void __user *ubtf;
802 u32 uinfo_len;
803 @@ -3469,6 +3469,7 @@ int btf_get_info_by_fd(const struct btf *btf,
804 uinfo_len = attr->info.info_len;
805
806 info_copy = min_t(u32, uinfo_len, sizeof(info));
807 + memset(&info, 0, sizeof(info));
808 if (copy_from_user(&info, uinfo, info_copy))
809 return -EFAULT;
810
811 diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
812 index ace1cfaa24b6..14f4a76b44d5 100644
813 --- a/kernel/bpf/syscall.c
814 +++ b/kernel/bpf/syscall.c
815 @@ -2325,7 +2325,7 @@ static int bpf_prog_get_info_by_fd(struct bpf_prog *prog,
816 union bpf_attr __user *uattr)
817 {
818 struct bpf_prog_info __user *uinfo = u64_to_user_ptr(attr->info.info);
819 - struct bpf_prog_info info = {};
820 + struct bpf_prog_info info;
821 u32 info_len = attr->info.info_len;
822 struct bpf_prog_stats stats;
823 char __user *uinsns;
824 @@ -2337,6 +2337,7 @@ static int bpf_prog_get_info_by_fd(struct bpf_prog *prog,
825 return err;
826 info_len = min_t(u32, sizeof(info), info_len);
827
828 + memset(&info, 0, sizeof(info));
829 if (copy_from_user(&info, uinfo, info_len))
830 return -EFAULT;
831
832 @@ -2600,7 +2601,7 @@ static int bpf_map_get_info_by_fd(struct bpf_map *map,
833 union bpf_attr __user *uattr)
834 {
835 struct bpf_map_info __user *uinfo = u64_to_user_ptr(attr->info.info);
836 - struct bpf_map_info info = {};
837 + struct bpf_map_info info;
838 u32 info_len = attr->info.info_len;
839 int err;
840
841 @@ -2609,6 +2610,7 @@ static int bpf_map_get_info_by_fd(struct bpf_map *map,
842 return err;
843 info_len = min_t(u32, sizeof(info), info_len);
844
845 + memset(&info, 0, sizeof(info));
846 info.type = map->map_type;
847 info.id = map->id;
848 info.key_size = map->key_size;
849 @@ -2836,7 +2838,7 @@ out:
850
851 SYSCALL_DEFINE3(bpf, int, cmd, union bpf_attr __user *, uattr, unsigned int, size)
852 {
853 - union bpf_attr attr = {};
854 + union bpf_attr attr;
855 int err;
856
857 if (sysctl_unprivileged_bpf_disabled && !capable(CAP_SYS_ADMIN))
858 @@ -2848,6 +2850,7 @@ SYSCALL_DEFINE3(bpf, int, cmd, union bpf_attr __user *, uattr, unsigned int, siz
859 size = min_t(u32, size, sizeof(attr));
860
861 /* copy attributes from user space, may be less than sizeof(bpf_attr) */
862 + memset(&attr, 0, sizeof(attr));
863 if (copy_from_user(&attr, uattr, size) != 0)
864 return -EFAULT;
865
866 diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
867 index e4cb3db2ee77..3d2e9f944e0f 100644
868 --- a/net/ceph/messenger.c
869 +++ b/net/ceph/messenger.c
870 @@ -3250,12 +3250,16 @@ static struct ceph_msg_data *ceph_msg_data_add(struct ceph_msg *msg)
871
872 static void ceph_msg_data_destroy(struct ceph_msg_data *data)
873 {
874 - if (data->type == CEPH_MSG_DATA_PAGELIST)
875 + if (data->type == CEPH_MSG_DATA_PAGES && data->own_pages) {
876 + int num_pages = calc_pages_for(data->alignment, data->length);
877 + ceph_release_page_vector(data->pages, num_pages);
878 + } else if (data->type == CEPH_MSG_DATA_PAGELIST) {
879 ceph_pagelist_release(data->pagelist);
880 + }
881 }
882
883 void ceph_msg_data_add_pages(struct ceph_msg *msg, struct page **pages,
884 - size_t length, size_t alignment)
885 + size_t length, size_t alignment, bool own_pages)
886 {
887 struct ceph_msg_data *data;
888
889 @@ -3267,6 +3271,7 @@ void ceph_msg_data_add_pages(struct ceph_msg *msg, struct page **pages,
890 data->pages = pages;
891 data->length = length;
892 data->alignment = alignment & ~PAGE_MASK;
893 + data->own_pages = own_pages;
894
895 msg->data_length += length;
896 }
897 diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
898 index ba45b074a362..2352afa62d1f 100644
899 --- a/net/ceph/osd_client.c
900 +++ b/net/ceph/osd_client.c
901 @@ -962,7 +962,7 @@ static void ceph_osdc_msg_data_add(struct ceph_msg *msg,
902 BUG_ON(length > (u64) SIZE_MAX);
903 if (length)
904 ceph_msg_data_add_pages(msg, osd_data->pages,
905 - length, osd_data->alignment);
906 + length, osd_data->alignment, false);
907 } else if (osd_data->type == CEPH_OSD_DATA_TYPE_PAGELIST) {
908 BUG_ON(!length);
909 ceph_msg_data_add_pagelist(msg, osd_data->pagelist);
910 @@ -4436,9 +4436,7 @@ static void handle_watch_notify(struct ceph_osd_client *osdc,
911 CEPH_MSG_DATA_PAGES);
912 *lreq->preply_pages = data->pages;
913 *lreq->preply_len = data->length;
914 - } else {
915 - ceph_release_page_vector(data->pages,
916 - calc_pages_for(0, data->length));
917 + data->own_pages = false;
918 }
919 }
920 lreq->notify_finish_error = return_code;
921 @@ -5500,9 +5498,6 @@ out_unlock_osdc:
922 return m;
923 }
924
925 -/*
926 - * TODO: switch to a msg-owned pagelist
927 - */
928 static struct ceph_msg *alloc_msg_with_page_vector(struct ceph_msg_header *hdr)
929 {
930 struct ceph_msg *m;
931 @@ -5516,7 +5511,6 @@ static struct ceph_msg *alloc_msg_with_page_vector(struct ceph_msg_header *hdr)
932
933 if (data_len) {
934 struct page **pages;
935 - struct ceph_osd_data osd_data;
936
937 pages = ceph_alloc_page_vector(calc_pages_for(0, data_len),
938 GFP_NOIO);
939 @@ -5525,9 +5519,7 @@ static struct ceph_msg *alloc_msg_with_page_vector(struct ceph_msg_header *hdr)
940 return NULL;
941 }
942
943 - ceph_osd_data_pages_init(&osd_data, pages, data_len, 0, false,
944 - false);
945 - ceph_osdc_msg_data_add(m, &osd_data);
946 + ceph_msg_data_add_pages(m, pages, data_len, 0, true);
947 }
948
949 return m;
950 diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
951 index c8fc29f0efcf..41da41cb5c40 100644
952 --- a/net/mac80211/tx.c
953 +++ b/net/mac80211/tx.c
954 @@ -3596,8 +3596,26 @@ begin:
955 tx.skb = skb;
956 tx.sdata = vif_to_sdata(info->control.vif);
957
958 - if (txq->sta)
959 + if (txq->sta) {
960 tx.sta = container_of(txq->sta, struct sta_info, sta);
961 + /*
962 + * Drop unicast frames to unauthorised stations unless they are
963 + * EAPOL frames from the local station.
964 + */
965 + if (unlikely(ieee80211_is_data(hdr->frame_control) &&
966 + !ieee80211_vif_is_mesh(&tx.sdata->vif) &&
967 + tx.sdata->vif.type != NL80211_IFTYPE_OCB &&
968 + !is_multicast_ether_addr(hdr->addr1) &&
969 + !test_sta_flag(tx.sta, WLAN_STA_AUTHORIZED) &&
970 + (!(info->control.flags &
971 + IEEE80211_TX_CTRL_PORT_CTRL_PROTO) ||
972 + !ether_addr_equal(tx.sdata->vif.addr,
973 + hdr->addr2)))) {
974 + I802_DEBUG_INC(local->tx_handlers_drop_unauth_port);
975 + ieee80211_free_txskb(&local->hw, skb);
976 + goto begin;
977 + }
978 + }
979
980 /*
981 * The key can be removed while the packet was queued, so need to call
982 diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
983 index eec9b282c047..4b07b1cc22dc 100644
984 --- a/tools/perf/util/map.c
985 +++ b/tools/perf/util/map.c
986 @@ -90,7 +90,7 @@ static inline bool replace_android_lib(const char *filename, char *newfilename)
987 return true;
988 }
989
990 - if (!strncmp(filename, "/system/lib/", 11)) {
991 + if (!strncmp(filename, "/system/lib/", 12)) {
992 char *ndk, *app;
993 const char *arch;
994 size_t ndk_length;