Merge 5.4.30 into android-5.4

Changes in 5.4.30
	mac80211: Check port authorization in the ieee80211_tx_dequeue() case
	mac80211: fix authentication with iwlwifi/mvm
	serial: sprd: Fix a dereference warning
	vt: selection, introduce vc_is_sel
	vt: ioctl, switch VT_IS_IN_USE and VT_BUSY to inlines
	vt: switch vt_dont_switch to bool
	vt: vt_ioctl: remove unnecessary console allocation checks
	vt: vt_ioctl: fix VT_DISALLOCATE freeing in-use virtual console
	vt: vt_ioctl: fix use-after-free in vt_in_use()
	platform/x86: pmc_atom: Add Lex 2I385SW to critclk_systems DMI table
	bpf: Explicitly memset the bpf_attr structure
	bpf: Explicitly memset some bpf info structures declared on the stack
	gpiolib: acpi: Add quirk to ignore EC wakeups on HP x2 10 CHT + AXP288 model
	net: ks8851-ml: Fix IO operations, again
	clk: imx: Align imx sc clock msg structs to 4
	clk: imx: Align imx sc clock parent msg structs to 4
	clk: ti: am43xx: Fix clock parent for RTC clock
	libceph: fix alloc_msg_with_page_vector() memory leaks
	arm64: alternative: fix build with clang integrated assembler
	perf map: Fix off by one in strncpy() size argument
	ARM: dts: oxnas: Fix clear-mask property
	ARM: bcm2835-rpi-zero-w: Add missing pinctrl name
	ARM: dts: imx6: phycore-som: fix arm and soc minimum voltage
	ARM: dts: N900: fix onenand timings
	ARM: dts: sun8i: r40: Move AHCI device node based on address order
	arm64: dts: ls1043a-rdb: correct RGMII delay mode to rgmii-id
	arm64: dts: ls1046ardb: set RGMII interfaces to RGMII_ID mode
	Linux 5.4.30

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Iccbb5cb60b867ab3339dad8de0d73559c8e27526
This commit is contained in:
Greg Kroah-Hartman
2020-04-02 16:38:08 +02:00
26 changed files with 241 additions and 109 deletions

View File

@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
VERSION = 5 VERSION = 5
PATCHLEVEL = 4 PATCHLEVEL = 4
SUBLEVEL = 29 SUBLEVEL = 30
EXTRAVERSION = EXTRAVERSION =
NAME = Kleptomaniac Octopus NAME = Kleptomaniac Octopus

View File

@@ -112,6 +112,7 @@
&sdhci { &sdhci {
#address-cells = <1>; #address-cells = <1>;
#size-cells = <0>; #size-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&emmc_gpio34 &gpclk2_gpio43>; pinctrl-0 = <&emmc_gpio34 &gpclk2_gpio43>;
bus-width = <4>; bus-width = <4>;
mmc-pwrseq = <&wifi_pwrseq>; mmc-pwrseq = <&wifi_pwrseq>;

View File

@@ -107,14 +107,14 @@
regulators { regulators {
vdd_arm: buck1 { vdd_arm: buck1 {
regulator-name = "vdd_arm"; regulator-name = "vdd_arm";
regulator-min-microvolt = <730000>; regulator-min-microvolt = <925000>;
regulator-max-microvolt = <1380000>; regulator-max-microvolt = <1380000>;
regulator-always-on; regulator-always-on;
}; };
vdd_soc: buck2 { vdd_soc: buck2 {
regulator-name = "vdd_soc"; regulator-name = "vdd_soc";
regulator-min-microvolt = <730000>; regulator-min-microvolt = <1150000>;
regulator-max-microvolt = <1380000>; regulator-max-microvolt = <1380000>;
regulator-always-on; regulator-always-on;
}; };

View File

@@ -849,34 +849,46 @@
compatible = "ti,omap2-onenand"; compatible = "ti,omap2-onenand";
reg = <0 0 0x20000>; /* CS0, offset 0, IO size 128K */ reg = <0 0 0x20000>; /* CS0, offset 0, IO size 128K */
/*
* These timings are based on CONFIG_OMAP_GPMC_DEBUG=y reported
* bootloader set values when booted with v5.1
* (OneNAND Manufacturer: Samsung):
*
* cs0 GPMC_CS_CONFIG1: 0xfb001202
* cs0 GPMC_CS_CONFIG2: 0x00111100
* cs0 GPMC_CS_CONFIG3: 0x00020200
* cs0 GPMC_CS_CONFIG4: 0x11001102
* cs0 GPMC_CS_CONFIG5: 0x03101616
* cs0 GPMC_CS_CONFIG6: 0x90060000
*/
gpmc,sync-read; gpmc,sync-read;
gpmc,sync-write; gpmc,sync-write;
gpmc,burst-length = <16>; gpmc,burst-length = <16>;
gpmc,burst-read; gpmc,burst-read;
gpmc,burst-wrap; gpmc,burst-wrap;
gpmc,burst-write; gpmc,burst-write;
gpmc,device-width = <2>; /* GPMC_DEVWIDTH_16BIT */ gpmc,device-width = <2>;
gpmc,mux-add-data = <2>; /* GPMC_MUX_AD */ gpmc,mux-add-data = <2>;
gpmc,cs-on-ns = <0>; gpmc,cs-on-ns = <0>;
gpmc,cs-rd-off-ns = <87>; gpmc,cs-rd-off-ns = <102>;
gpmc,cs-wr-off-ns = <87>; gpmc,cs-wr-off-ns = <102>;
gpmc,adv-on-ns = <0>; gpmc,adv-on-ns = <0>;
gpmc,adv-rd-off-ns = <10>; gpmc,adv-rd-off-ns = <12>;
gpmc,adv-wr-off-ns = <10>; gpmc,adv-wr-off-ns = <12>;
gpmc,oe-on-ns = <15>; gpmc,oe-on-ns = <12>;
gpmc,oe-off-ns = <87>; gpmc,oe-off-ns = <102>;
gpmc,we-on-ns = <0>; gpmc,we-on-ns = <0>;
gpmc,we-off-ns = <87>; gpmc,we-off-ns = <102>;
gpmc,rd-cycle-ns = <112>; gpmc,rd-cycle-ns = <132>;
gpmc,wr-cycle-ns = <112>; gpmc,wr-cycle-ns = <132>;
gpmc,access-ns = <81>; gpmc,access-ns = <96>;
gpmc,page-burst-access-ns = <15>; gpmc,page-burst-access-ns = <18>;
gpmc,bus-turnaround-ns = <0>; gpmc,bus-turnaround-ns = <0>;
gpmc,cycle2cycle-delay-ns = <0>; gpmc,cycle2cycle-delay-ns = <0>;
gpmc,wait-monitoring-ns = <0>; gpmc,wait-monitoring-ns = <0>;
gpmc,clk-activation-ns = <5>; gpmc,clk-activation-ns = <6>;
gpmc,wr-data-mux-bus-ns = <30>; gpmc,wr-data-mux-bus-ns = <36>;
gpmc,wr-access-ns = <81>; gpmc,wr-access-ns = <96>;
gpmc,sync-clk-ps = <15000>; gpmc,sync-clk-ps = <15000>;
/* /*

View File

@@ -323,8 +323,8 @@
interrupt-controller; interrupt-controller;
reg = <0 0x200>; reg = <0 0x200>;
#interrupt-cells = <1>; #interrupt-cells = <1>;
valid-mask = <0xFFFFFFFF>; valid-mask = <0xffffffff>;
clear-mask = <0>; clear-mask = <0xffffffff>;
}; };
timer0: timer@200 { timer0: timer@200 {

View File

@@ -240,8 +240,8 @@
reg = <0 0x200>; reg = <0 0x200>;
interrupts = <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>; interrupts = <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>;
#interrupt-cells = <1>; #interrupt-cells = <1>;
valid-mask = <0xFFFFFFFF>; valid-mask = <0xffffffff>;
clear-mask = <0>; clear-mask = <0xffffffff>;
}; };
timer0: timer@200 { timer0: timer@200 {

View File

@@ -266,6 +266,16 @@
#phy-cells = <1>; #phy-cells = <1>;
}; };
ahci: sata@1c18000 {
compatible = "allwinner,sun8i-r40-ahci";
reg = <0x01c18000 0x1000>;
interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&ccu CLK_BUS_SATA>, <&ccu CLK_SATA>;
resets = <&ccu RST_BUS_SATA>;
reset-names = "ahci";
status = "disabled";
};
ehci1: usb@1c19000 { ehci1: usb@1c19000 {
compatible = "allwinner,sun8i-r40-ehci", "generic-ehci"; compatible = "allwinner,sun8i-r40-ehci", "generic-ehci";
reg = <0x01c19000 0x100>; reg = <0x01c19000 0x100>;
@@ -557,17 +567,6 @@
#size-cells = <0>; #size-cells = <0>;
}; };
ahci: sata@1c18000 {
compatible = "allwinner,sun8i-r40-ahci";
reg = <0x01c18000 0x1000>;
interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&ccu CLK_BUS_SATA>, <&ccu CLK_SATA>;
resets = <&ccu RST_BUS_SATA>;
reset-names = "ahci";
status = "disabled";
};
gmac: ethernet@1c50000 { gmac: ethernet@1c50000 {
compatible = "allwinner,sun8i-r40-gmac"; compatible = "allwinner,sun8i-r40-gmac";
syscon = <&ccu>; syscon = <&ccu>;

View File

@@ -119,12 +119,12 @@
ethernet@e4000 { ethernet@e4000 {
phy-handle = <&rgmii_phy1>; phy-handle = <&rgmii_phy1>;
phy-connection-type = "rgmii-txid"; phy-connection-type = "rgmii-id";
}; };
ethernet@e6000 { ethernet@e6000 {
phy-handle = <&rgmii_phy2>; phy-handle = <&rgmii_phy2>;
phy-connection-type = "rgmii-txid"; phy-connection-type = "rgmii-id";
}; };
ethernet@e8000 { ethernet@e8000 {

View File

@@ -127,12 +127,12 @@
&fman0 { &fman0 {
ethernet@e4000 { ethernet@e4000 {
phy-handle = <&rgmii_phy1>; phy-handle = <&rgmii_phy1>;
phy-connection-type = "rgmii"; phy-connection-type = "rgmii-id";
}; };
ethernet@e6000 { ethernet@e6000 {
phy-handle = <&rgmii_phy2>; phy-handle = <&rgmii_phy2>;
phy-connection-type = "rgmii"; phy-connection-type = "rgmii-id";
}; };
ethernet@e8000 { ethernet@e8000 {

View File

@@ -221,7 +221,7 @@ alternative_endif
.macro user_alt, label, oldinstr, newinstr, cond .macro user_alt, label, oldinstr, newinstr, cond
9999: alternative_insn "\oldinstr", "\newinstr", \cond 9999: alternative_insn "\oldinstr", "\newinstr", \cond
_ASM_EXTABLE 9999b, \label _asm_extable 9999b, \label
.endm .endm
/* /*

View File

@@ -43,12 +43,12 @@ struct imx_sc_msg_req_set_clock_rate {
__le32 rate; __le32 rate;
__le16 resource; __le16 resource;
u8 clk; u8 clk;
} __packed; } __packed __aligned(4);
struct req_get_clock_rate { struct req_get_clock_rate {
__le16 resource; __le16 resource;
u8 clk; u8 clk;
} __packed; } __packed __aligned(4);
struct resp_get_clock_rate { struct resp_get_clock_rate {
__le32 rate; __le32 rate;
@@ -84,7 +84,7 @@ struct imx_sc_msg_get_clock_parent {
struct req_get_clock_parent { struct req_get_clock_parent {
__le16 resource; __le16 resource;
u8 clk; u8 clk;
} __packed req; } __packed __aligned(4) req;
struct resp_get_clock_parent { struct resp_get_clock_parent {
u8 parent; u8 parent;
} resp; } resp;
@@ -121,7 +121,7 @@ struct imx_sc_msg_req_clock_enable {
u8 clk; u8 clk;
u8 enable; u8 enable;
u8 autog; u8 autog;
} __packed; } __packed __aligned(4);
static inline struct clk_scu *to_clk_scu(struct clk_hw *hw) static inline struct clk_scu *to_clk_scu(struct clk_hw *hw)
{ {

View File

@@ -78,7 +78,7 @@ static const struct omap_clkctrl_reg_data am4_gfx_l3_clkctrl_regs[] __initconst
}; };
static const struct omap_clkctrl_reg_data am4_l4_rtc_clkctrl_regs[] __initconst = { static const struct omap_clkctrl_reg_data am4_l4_rtc_clkctrl_regs[] __initconst = {
{ AM4_L4_RTC_RTC_CLKCTRL, NULL, CLKF_SW_SUP, "clk_32768_ck" }, { AM4_L4_RTC_RTC_CLKCTRL, NULL, CLKF_SW_SUP, "clkdiv32k_ick" },
{ 0 }, { 0 },
}; };

View File

@@ -1430,6 +1430,21 @@ static const struct dmi_system_id gpiolib_acpi_quirks[] = {
.ignore_wake = "INT33FC:02@28", .ignore_wake = "INT33FC:02@28",
}, },
}, },
{
/*
* HP X2 10 models with Cherry Trail SoC + AXP288 PMIC use an
* external embedded-controller connected via I2C + an ACPI GPIO
* event handler on INT33FF:01 pin 0, causing spurious wakeups.
*/
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "HP"),
DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion x2 Detachable"),
DMI_MATCH(DMI_BOARD_NAME, "813E"),
},
.driver_data = &(struct acpi_gpiolib_dmi_quirk) {
.ignore_wake = "INT33FF:01@0",
},
},
{} /* Terminating entry */ {} /* Terminating entry */
}; };

View File

@@ -156,6 +156,50 @@ static int msg_enable;
* chip is busy transferring packet data (RX/TX FIFO accesses). * chip is busy transferring packet data (RX/TX FIFO accesses).
*/ */
/**
* ks_check_endian - Check whether endianness of the bus is correct
* @ks : The chip information
*
* The KS8851-16MLL EESK pin allows selecting the endianness of the 16bit
* bus. To maintain optimum performance, the bus endianness should be set
* such that it matches the endianness of the CPU.
*/
static int ks_check_endian(struct ks_net *ks)
{
u16 cider;
/*
* Read CIDER register first, however read it the "wrong" way around.
* If the endian strap on the KS8851-16MLL in incorrect and the chip
* is operating in different endianness than the CPU, then the meaning
* of BE[3:0] byte-enable bits is also swapped such that:
* BE[3,2,1,0] becomes BE[1,0,3,2]
*
* Luckily for us, the byte-enable bits are the top four MSbits of
* the address register and the CIDER register is at offset 0xc0.
* Hence, by reading address 0xc0c0, which is not impacted by endian
* swapping, we assert either BE[3:2] or BE[1:0] while reading the
* CIDER register.
*
* If the bus configuration is correct, reading 0xc0c0 asserts
* BE[3:2] and this read returns 0x0000, because to read register
* with bottom two LSbits of address set to 0, BE[1:0] must be
* asserted.
*
* If the bus configuration is NOT correct, reading 0xc0c0 asserts
* BE[1:0] and this read returns non-zero 0x8872 value.
*/
iowrite16(BE3 | BE2 | KS_CIDER, ks->hw_addr_cmd);
cider = ioread16(ks->hw_addr);
if (!cider)
return 0;
netdev_err(ks->netdev, "incorrect EESK endian strap setting\n");
return -EINVAL;
}
/** /**
* ks_rdreg16 - read 16 bit register from device * ks_rdreg16 - read 16 bit register from device
* @ks : The chip information * @ks : The chip information
@@ -166,7 +210,7 @@ static int msg_enable;
static u16 ks_rdreg16(struct ks_net *ks, int offset) static u16 ks_rdreg16(struct ks_net *ks, int offset)
{ {
ks->cmd_reg_cache = (u16)offset | ((BE3 | BE2) >> (offset & 0x02)); ks->cmd_reg_cache = (u16)offset | ((BE1 | BE0) << (offset & 0x02));
iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd); iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd);
return ioread16(ks->hw_addr); return ioread16(ks->hw_addr);
} }
@@ -181,7 +225,7 @@ static u16 ks_rdreg16(struct ks_net *ks, int offset)
static void ks_wrreg16(struct ks_net *ks, int offset, u16 value) static void ks_wrreg16(struct ks_net *ks, int offset, u16 value)
{ {
ks->cmd_reg_cache = (u16)offset | ((BE3 | BE2) >> (offset & 0x02)); ks->cmd_reg_cache = (u16)offset | ((BE1 | BE0) << (offset & 0x02));
iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd); iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd);
iowrite16(value, ks->hw_addr); iowrite16(value, ks->hw_addr);
} }
@@ -197,7 +241,7 @@ static inline void ks_inblk(struct ks_net *ks, u16 *wptr, u32 len)
{ {
len >>= 1; len >>= 1;
while (len--) while (len--)
*wptr++ = be16_to_cpu(ioread16(ks->hw_addr)); *wptr++ = (u16)ioread16(ks->hw_addr);
} }
/** /**
@@ -211,7 +255,7 @@ static inline void ks_outblk(struct ks_net *ks, u16 *wptr, u32 len)
{ {
len >>= 1; len >>= 1;
while (len--) while (len--)
iowrite16(cpu_to_be16(*wptr++), ks->hw_addr); iowrite16(*wptr++, ks->hw_addr);
} }
static void ks_disable_int(struct ks_net *ks) static void ks_disable_int(struct ks_net *ks)
@@ -1218,6 +1262,10 @@ static int ks8851_probe(struct platform_device *pdev)
goto err_free; goto err_free;
} }
err = ks_check_endian(ks);
if (err)
goto err_free;
netdev->irq = platform_get_irq(pdev, 0); netdev->irq = platform_get_irq(pdev, 0);
if ((int)netdev->irq < 0) { if ((int)netdev->irq < 0) {

View File

@@ -383,6 +383,14 @@ static const struct dmi_system_id critclk_systems[] = {
DMI_MATCH(DMI_PRODUCT_NAME, "3I380D"), DMI_MATCH(DMI_PRODUCT_NAME, "3I380D"),
}, },
}, },
{
/* pmc_plt_clk* - are used for ethernet controllers */
.ident = "Lex 2I385SW",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Lex BayTrail"),
DMI_MATCH(DMI_PRODUCT_NAME, "2I385SW"),
},
},
{ {
/* pmc_plt_clk* - are used for ethernet controllers */ /* pmc_plt_clk* - are used for ethernet controllers */
.ident = "Beckhoff CB3163", .ident = "Beckhoff CB3163",

View File

@@ -1136,14 +1136,13 @@ static int sprd_remove(struct platform_device *dev)
if (sup) { if (sup) {
uart_remove_one_port(&sprd_uart_driver, &sup->port); uart_remove_one_port(&sprd_uart_driver, &sup->port);
sprd_port[sup->port.line] = NULL; sprd_port[sup->port.line] = NULL;
sprd_rx_free_buf(sup);
sprd_ports_num--; sprd_ports_num--;
} }
if (!sprd_ports_num) if (!sprd_ports_num)
uart_unregister_driver(&sprd_uart_driver); uart_unregister_driver(&sprd_uart_driver);
sprd_rx_free_buf(sup);
return 0; return 0;
} }

View File

@@ -88,6 +88,11 @@ void clear_selection(void)
} }
EXPORT_SYMBOL_GPL(clear_selection); EXPORT_SYMBOL_GPL(clear_selection);
bool vc_is_sel(struct vc_data *vc)
{
return vc == sel_cons;
}
/* /*
* User settable table: what characters are to be considered alphabetic? * User settable table: what characters are to be considered alphabetic?
* 128 bits. Locked by the console lock. * 128 bits. Locked by the console lock.

View File

@@ -890,8 +890,9 @@ static void hide_softcursor(struct vc_data *vc)
static void hide_cursor(struct vc_data *vc) static void hide_cursor(struct vc_data *vc)
{ {
if (vc == sel_cons) if (vc_is_sel(vc))
clear_selection(); clear_selection();
vc->vc_sw->con_cursor(vc, CM_ERASE); vc->vc_sw->con_cursor(vc, CM_ERASE);
hide_softcursor(vc); hide_softcursor(vc);
} }
@@ -901,7 +902,7 @@ static void set_cursor(struct vc_data *vc)
if (!con_is_fg(vc) || console_blanked || vc->vc_mode == KD_GRAPHICS) if (!con_is_fg(vc) || console_blanked || vc->vc_mode == KD_GRAPHICS)
return; return;
if (vc->vc_deccm) { if (vc->vc_deccm) {
if (vc == sel_cons) if (vc_is_sel(vc))
clear_selection(); clear_selection();
add_softcursor(vc); add_softcursor(vc);
if ((vc->vc_cursor_type & 0x0f) != 1) if ((vc->vc_cursor_type & 0x0f) != 1)
@@ -1074,6 +1075,17 @@ static void visual_deinit(struct vc_data *vc)
module_put(vc->vc_sw->owner); module_put(vc->vc_sw->owner);
} }
static void vc_port_destruct(struct tty_port *port)
{
struct vc_data *vc = container_of(port, struct vc_data, port);
kfree(vc);
}
static const struct tty_port_operations vc_port_ops = {
.destruct = vc_port_destruct,
};
int vc_allocate(unsigned int currcons) /* return 0 on success */ int vc_allocate(unsigned int currcons) /* return 0 on success */
{ {
struct vt_notifier_param param; struct vt_notifier_param param;
@@ -1099,6 +1111,7 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */
vc_cons[currcons].d = vc; vc_cons[currcons].d = vc;
tty_port_init(&vc->port); tty_port_init(&vc->port);
vc->port.ops = &vc_port_ops;
INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK); INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK);
visual_init(vc, currcons, 1); visual_init(vc, currcons, 1);
@@ -1207,7 +1220,7 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc,
} }
} }
if (vc == sel_cons) if (vc_is_sel(vc))
clear_selection(); clear_selection();
old_rows = vc->vc_rows; old_rows = vc->vc_rows;
@@ -3253,6 +3266,7 @@ static int con_install(struct tty_driver *driver, struct tty_struct *tty)
tty->driver_data = vc; tty->driver_data = vc;
vc->port.tty = tty; vc->port.tty = tty;
tty_port_get(&vc->port);
if (!tty->winsize.ws_row && !tty->winsize.ws_col) { if (!tty->winsize.ws_row && !tty->winsize.ws_col) {
tty->winsize.ws_row = vc_cons[currcons].d->vc_rows; tty->winsize.ws_row = vc_cons[currcons].d->vc_rows;
@@ -3288,6 +3302,13 @@ static void con_shutdown(struct tty_struct *tty)
console_unlock(); console_unlock();
} }
static void con_cleanup(struct tty_struct *tty)
{
struct vc_data *vc = tty->driver_data;
tty_port_put(&vc->port);
}
static int default_color = 7; /* white */ static int default_color = 7; /* white */
static int default_italic_color = 2; // green (ASCII) static int default_italic_color = 2; // green (ASCII)
static int default_underline_color = 3; // cyan (ASCII) static int default_underline_color = 3; // cyan (ASCII)
@@ -3412,7 +3433,8 @@ static const struct tty_operations con_ops = {
.throttle = con_throttle, .throttle = con_throttle,
.unthrottle = con_unthrottle, .unthrottle = con_unthrottle,
.resize = vt_resize, .resize = vt_resize,
.shutdown = con_shutdown .shutdown = con_shutdown,
.cleanup = con_cleanup,
}; };
static struct cdev vc0_cdev; static struct cdev vc0_cdev;

View File

@@ -39,11 +39,32 @@
#include <linux/kbd_diacr.h> #include <linux/kbd_diacr.h>
#include <linux/selection.h> #include <linux/selection.h>
char vt_dont_switch; bool vt_dont_switch;
extern struct tty_driver *console_driver;
#define VT_IS_IN_USE(i) (console_driver->ttys[i] && console_driver->ttys[i]->count) static inline bool vt_in_use(unsigned int i)
#define VT_BUSY(i) (VT_IS_IN_USE(i) || i == fg_console || vc_cons[i].d == sel_cons) {
const struct vc_data *vc = vc_cons[i].d;
/*
* console_lock must be held to prevent the vc from being deallocated
* while we're checking whether it's in-use.
*/
WARN_CONSOLE_UNLOCKED();
return vc && kref_read(&vc->port.kref) > 1;
}
static inline bool vt_busy(int i)
{
if (vt_in_use(i))
return true;
if (i == fg_console)
return true;
if (vc_is_sel(vc_cons[i].d))
return true;
return false;
}
/* /*
* Console (vt and kd) routines, as defined by USL SVR4 manual, and by * Console (vt and kd) routines, as defined by USL SVR4 manual, and by
@@ -289,16 +310,14 @@ static int vt_disallocate(unsigned int vc_num)
int ret = 0; int ret = 0;
console_lock(); console_lock();
if (VT_BUSY(vc_num)) if (vt_busy(vc_num))
ret = -EBUSY; ret = -EBUSY;
else if (vc_num) else if (vc_num)
vc = vc_deallocate(vc_num); vc = vc_deallocate(vc_num);
console_unlock(); console_unlock();
if (vc && vc_num >= MIN_NR_CONSOLES) { if (vc && vc_num >= MIN_NR_CONSOLES)
tty_port_destroy(&vc->port); tty_port_put(&vc->port);
kfree(vc);
}
return ret; return ret;
} }
@@ -311,17 +330,15 @@ static void vt_disallocate_all(void)
console_lock(); console_lock();
for (i = 1; i < MAX_NR_CONSOLES; i++) for (i = 1; i < MAX_NR_CONSOLES; i++)
if (!VT_BUSY(i)) if (!vt_busy(i))
vc[i] = vc_deallocate(i); vc[i] = vc_deallocate(i);
else else
vc[i] = NULL; vc[i] = NULL;
console_unlock(); console_unlock();
for (i = 1; i < MAX_NR_CONSOLES; i++) { for (i = 1; i < MAX_NR_CONSOLES; i++) {
if (vc[i] && i >= MIN_NR_CONSOLES) { if (vc[i] && i >= MIN_NR_CONSOLES)
tty_port_destroy(&vc[i]->port); tty_port_put(&vc[i]->port);
kfree(vc[i]);
}
} }
} }
@@ -335,22 +352,13 @@ int vt_ioctl(struct tty_struct *tty,
{ {
struct vc_data *vc = tty->driver_data; struct vc_data *vc = tty->driver_data;
struct console_font_op op; /* used in multiple places here */ struct console_font_op op; /* used in multiple places here */
unsigned int console; unsigned int console = vc->vc_num;
unsigned char ucval; unsigned char ucval;
unsigned int uival; unsigned int uival;
void __user *up = (void __user *)arg; void __user *up = (void __user *)arg;
int i, perm; int i, perm;
int ret = 0; int ret = 0;
console = vc->vc_num;
if (!vc_cons_allocated(console)) { /* impossible? */
ret = -ENOIOCTLCMD;
goto out;
}
/* /*
* To have permissions to do most of the vt ioctls, we either have * To have permissions to do most of the vt ioctls, we either have
* to be the owner of the tty, or have CAP_SYS_TTY_CONFIG. * to be the owner of the tty, or have CAP_SYS_TTY_CONFIG.
@@ -641,15 +649,16 @@ int vt_ioctl(struct tty_struct *tty,
struct vt_stat __user *vtstat = up; struct vt_stat __user *vtstat = up;
unsigned short state, mask; unsigned short state, mask;
/* Review: FIXME: Console lock ? */
if (put_user(fg_console + 1, &vtstat->v_active)) if (put_user(fg_console + 1, &vtstat->v_active))
ret = -EFAULT; ret = -EFAULT;
else { else {
state = 1; /* /dev/tty0 is always open */ state = 1; /* /dev/tty0 is always open */
console_lock(); /* required by vt_in_use() */
for (i = 0, mask = 2; i < MAX_NR_CONSOLES && mask; for (i = 0, mask = 2; i < MAX_NR_CONSOLES && mask;
++i, mask <<= 1) ++i, mask <<= 1)
if (VT_IS_IN_USE(i)) if (vt_in_use(i))
state |= mask; state |= mask;
console_unlock();
ret = put_user(state, &vtstat->v_state); ret = put_user(state, &vtstat->v_state);
} }
break; break;
@@ -659,10 +668,11 @@ int vt_ioctl(struct tty_struct *tty,
* Returns the first available (non-opened) console. * Returns the first available (non-opened) console.
*/ */
case VT_OPENQRY: case VT_OPENQRY:
/* FIXME: locking ? - but then this is a stupid API */ console_lock(); /* required by vt_in_use() */
for (i = 0; i < MAX_NR_CONSOLES; ++i) for (i = 0; i < MAX_NR_CONSOLES; ++i)
if (! VT_IS_IN_USE(i)) if (!vt_in_use(i))
break; break;
console_unlock();
uival = i < MAX_NR_CONSOLES ? (i+1) : -1; uival = i < MAX_NR_CONSOLES ? (i+1) : -1;
goto setint; goto setint;
@@ -1011,12 +1021,12 @@ int vt_ioctl(struct tty_struct *tty,
case VT_LOCKSWITCH: case VT_LOCKSWITCH:
if (!capable(CAP_SYS_TTY_CONFIG)) if (!capable(CAP_SYS_TTY_CONFIG))
return -EPERM; return -EPERM;
vt_dont_switch = 1; vt_dont_switch = true;
break; break;
case VT_UNLOCKSWITCH: case VT_UNLOCKSWITCH:
if (!capable(CAP_SYS_TTY_CONFIG)) if (!capable(CAP_SYS_TTY_CONFIG))
return -EPERM; return -EPERM;
vt_dont_switch = 0; vt_dont_switch = false;
break; break;
case VT_GETHIFONTMASK: case VT_GETHIFONTMASK:
ret = put_user(vc->vc_hi_font_mask, ret = put_user(vc->vc_hi_font_mask,
@@ -1180,14 +1190,9 @@ long vt_compat_ioctl(struct tty_struct *tty,
{ {
struct vc_data *vc = tty->driver_data; struct vc_data *vc = tty->driver_data;
struct console_font_op op; /* used in multiple places here */ struct console_font_op op; /* used in multiple places here */
unsigned int console = vc->vc_num;
void __user *up = compat_ptr(arg); void __user *up = compat_ptr(arg);
int perm; int perm;
if (!vc_cons_allocated(console)) /* impossible? */
return -ENOIOCTLCMD;
/* /*
* To have permissions to do most of the vt ioctls, we either have * To have permissions to do most of the vt ioctls, we either have
* to be the owner of the tty, or have CAP_SYS_TTY_CONFIG. * to be the owner of the tty, or have CAP_SYS_TTY_CONFIG.

View File

@@ -175,9 +175,10 @@ struct ceph_msg_data {
#endif /* CONFIG_BLOCK */ #endif /* CONFIG_BLOCK */
struct ceph_bvec_iter bvec_pos; struct ceph_bvec_iter bvec_pos;
struct { struct {
struct page **pages; /* NOT OWNER. */ struct page **pages;
size_t length; /* total # bytes */ size_t length; /* total # bytes */
unsigned int alignment; /* first page */ unsigned int alignment; /* first page */
bool own_pages;
}; };
struct ceph_pagelist *pagelist; struct ceph_pagelist *pagelist;
}; };
@@ -356,8 +357,8 @@ extern void ceph_con_keepalive(struct ceph_connection *con);
extern bool ceph_con_keepalive_expired(struct ceph_connection *con, extern bool ceph_con_keepalive_expired(struct ceph_connection *con,
unsigned long interval); unsigned long interval);
extern void ceph_msg_data_add_pages(struct ceph_msg *msg, struct page **pages, void ceph_msg_data_add_pages(struct ceph_msg *msg, struct page **pages,
size_t length, size_t alignment); size_t length, size_t alignment, bool own_pages);
extern void ceph_msg_data_add_pagelist(struct ceph_msg *msg, extern void ceph_msg_data_add_pagelist(struct ceph_msg *msg,
struct ceph_pagelist *pagelist); struct ceph_pagelist *pagelist);
#ifdef CONFIG_BLOCK #ifdef CONFIG_BLOCK

View File

@@ -11,8 +11,8 @@
#include <linux/tiocl.h> #include <linux/tiocl.h>
#include <linux/vt_buffer.h> #include <linux/vt_buffer.h>
extern struct vc_data *sel_cons;
struct tty_struct; struct tty_struct;
struct vc_data;
extern void clear_selection(void); extern void clear_selection(void);
extern int set_selection_user(const struct tiocl_selection __user *sel, extern int set_selection_user(const struct tiocl_selection __user *sel,
@@ -24,6 +24,8 @@ extern int sel_loadlut(char __user *p);
extern int mouse_reporting(void); extern int mouse_reporting(void);
extern void mouse_report(struct tty_struct * tty, int butt, int mrx, int mry); extern void mouse_report(struct tty_struct * tty, int butt, int mrx, int mry);
bool vc_is_sel(struct vc_data *vc);
extern int console_blanked; extern int console_blanked;
extern const unsigned char color_table[]; extern const unsigned char color_table[];

View File

@@ -135,7 +135,7 @@ extern int do_unbind_con_driver(const struct consw *csw, int first, int last,
int deflt); int deflt);
int vty_init(const struct file_operations *console_fops); int vty_init(const struct file_operations *console_fops);
extern char vt_dont_switch; extern bool vt_dont_switch;
extern int default_utf8; extern int default_utf8;
extern int global_cursor_default; extern int global_cursor_default;

View File

@@ -3250,12 +3250,16 @@ static struct ceph_msg_data *ceph_msg_data_add(struct ceph_msg *msg)
static void ceph_msg_data_destroy(struct ceph_msg_data *data) static void ceph_msg_data_destroy(struct ceph_msg_data *data)
{ {
if (data->type == CEPH_MSG_DATA_PAGELIST) if (data->type == CEPH_MSG_DATA_PAGES && data->own_pages) {
int num_pages = calc_pages_for(data->alignment, data->length);
ceph_release_page_vector(data->pages, num_pages);
} else if (data->type == CEPH_MSG_DATA_PAGELIST) {
ceph_pagelist_release(data->pagelist); ceph_pagelist_release(data->pagelist);
}
} }
void ceph_msg_data_add_pages(struct ceph_msg *msg, struct page **pages, void ceph_msg_data_add_pages(struct ceph_msg *msg, struct page **pages,
size_t length, size_t alignment) size_t length, size_t alignment, bool own_pages)
{ {
struct ceph_msg_data *data; struct ceph_msg_data *data;
@@ -3267,6 +3271,7 @@ void ceph_msg_data_add_pages(struct ceph_msg *msg, struct page **pages,
data->pages = pages; data->pages = pages;
data->length = length; data->length = length;
data->alignment = alignment & ~PAGE_MASK; data->alignment = alignment & ~PAGE_MASK;
data->own_pages = own_pages;
msg->data_length += length; msg->data_length += length;
} }

View File

@@ -962,7 +962,7 @@ static void ceph_osdc_msg_data_add(struct ceph_msg *msg,
BUG_ON(length > (u64) SIZE_MAX); BUG_ON(length > (u64) SIZE_MAX);
if (length) if (length)
ceph_msg_data_add_pages(msg, osd_data->pages, ceph_msg_data_add_pages(msg, osd_data->pages,
length, osd_data->alignment); length, osd_data->alignment, false);
} else if (osd_data->type == CEPH_OSD_DATA_TYPE_PAGELIST) { } else if (osd_data->type == CEPH_OSD_DATA_TYPE_PAGELIST) {
BUG_ON(!length); BUG_ON(!length);
ceph_msg_data_add_pagelist(msg, osd_data->pagelist); ceph_msg_data_add_pagelist(msg, osd_data->pagelist);
@@ -4436,9 +4436,7 @@ static void handle_watch_notify(struct ceph_osd_client *osdc,
CEPH_MSG_DATA_PAGES); CEPH_MSG_DATA_PAGES);
*lreq->preply_pages = data->pages; *lreq->preply_pages = data->pages;
*lreq->preply_len = data->length; *lreq->preply_len = data->length;
} else { data->own_pages = false;
ceph_release_page_vector(data->pages,
calc_pages_for(0, data->length));
} }
} }
lreq->notify_finish_error = return_code; lreq->notify_finish_error = return_code;
@@ -5500,9 +5498,6 @@ out_unlock_osdc:
return m; return m;
} }
/*
* TODO: switch to a msg-owned pagelist
*/
static struct ceph_msg *alloc_msg_with_page_vector(struct ceph_msg_header *hdr) static struct ceph_msg *alloc_msg_with_page_vector(struct ceph_msg_header *hdr)
{ {
struct ceph_msg *m; struct ceph_msg *m;
@@ -5516,7 +5511,6 @@ static struct ceph_msg *alloc_msg_with_page_vector(struct ceph_msg_header *hdr)
if (data_len) { if (data_len) {
struct page **pages; struct page **pages;
struct ceph_osd_data osd_data;
pages = ceph_alloc_page_vector(calc_pages_for(0, data_len), pages = ceph_alloc_page_vector(calc_pages_for(0, data_len),
GFP_NOIO); GFP_NOIO);
@@ -5525,9 +5519,7 @@ static struct ceph_msg *alloc_msg_with_page_vector(struct ceph_msg_header *hdr)
return NULL; return NULL;
} }
ceph_osd_data_pages_init(&osd_data, pages, data_len, 0, false, ceph_msg_data_add_pages(m, pages, data_len, 0, true);
false);
ceph_osdc_msg_data_add(m, &osd_data);
} }
return m; return m;

View File

@@ -3596,8 +3596,26 @@ begin:
tx.skb = skb; tx.skb = skb;
tx.sdata = vif_to_sdata(info->control.vif); tx.sdata = vif_to_sdata(info->control.vif);
if (txq->sta) if (txq->sta) {
tx.sta = container_of(txq->sta, struct sta_info, sta); tx.sta = container_of(txq->sta, struct sta_info, sta);
/*
* Drop unicast frames to unauthorised stations unless they are
* EAPOL frames from the local station.
*/
if (unlikely(ieee80211_is_data(hdr->frame_control) &&
!ieee80211_vif_is_mesh(&tx.sdata->vif) &&
tx.sdata->vif.type != NL80211_IFTYPE_OCB &&
!is_multicast_ether_addr(hdr->addr1) &&
!test_sta_flag(tx.sta, WLAN_STA_AUTHORIZED) &&
(!(info->control.flags &
IEEE80211_TX_CTRL_PORT_CTRL_PROTO) ||
!ether_addr_equal(tx.sdata->vif.addr,
hdr->addr2)))) {
I802_DEBUG_INC(local->tx_handlers_drop_unauth_port);
ieee80211_free_txskb(&local->hw, skb);
goto begin;
}
}
/* /*
* The key can be removed while the packet was queued, so need to call * The key can be removed while the packet was queued, so need to call

View File

@@ -90,7 +90,7 @@ static inline bool replace_android_lib(const char *filename, char *newfilename)
return true; return true;
} }
if (!strncmp(filename, "/system/lib/", 11)) { if (!strncmp(filename, "/system/lib/", 12)) {
char *ndk, *app; char *ndk, *app;
const char *arch; const char *arch;
size_t ndk_length; size_t ndk_length;