[ALPS05156188] [Do NOT Sync]Merge branch android-4.14-stable into alps-trunk-r0.basic
[Detail] Parent:816f245a4eMerge 4.14.180 into android-4.14-stable Start:86556e67a9ANDROID: mmc: MMC crypto API Target:4f02b6c9acMerge 4.14.181 into android-4.14-stable MTK-Commit-Id: ad78d3f9beacdf2e30e0e08dddcc920d99577dbb Feature: Others Change-Id: Ic61391966091aeced2b31721f8b6aa098c0e4ee8 CR-Id: ALPS05156188 Signed-off-by: Breeze.Li <breeze.li@mediatek.com>
This commit is contained in:
23
Makefile
23
Makefile
@@ -1,7 +1,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
VERSION = 4
|
||||
PATCHLEVEL = 14
|
||||
SUBLEVEL = 180
|
||||
SUBLEVEL = 181
|
||||
EXTRAVERSION =
|
||||
NAME = Petit Gorille
|
||||
|
||||
@@ -685,20 +685,14 @@ KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
|
||||
KBUILD_CFLAGS += $(call cc-disable-warning, attribute-alias)
|
||||
|
||||
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
|
||||
KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,)
|
||||
else
|
||||
ifdef CONFIG_PROFILE_ALL_BRANCHES
|
||||
KBUILD_CFLAGS += -O2 $(call cc-disable-warning,maybe-uninitialized,)
|
||||
KBUILD_CFLAGS += -Os
|
||||
else
|
||||
KBUILD_CFLAGS += -O2
|
||||
endif
|
||||
endif
|
||||
|
||||
KBUILD_CFLAGS += $(call cc-ifversion, -lt, 0409, \
|
||||
$(call cc-disable-warning,maybe-uninitialized,))
|
||||
|
||||
# Tell gcc to never replace conditional load with a non-conditional one
|
||||
KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0)
|
||||
KBUILD_CFLAGS += $(call cc-option,-fno-allow-store-data-races)
|
||||
|
||||
# check for 'asm goto'
|
||||
ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y)
|
||||
@@ -913,6 +907,17 @@ KBUILD_CFLAGS += $(call cc-disable-warning, pointer-sign)
|
||||
# disable stringop warnings in gcc 8+
|
||||
KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation)
|
||||
|
||||
# We'll want to enable this eventually, but it's not going away for 5.7 at least
|
||||
KBUILD_CFLAGS += $(call cc-disable-warning, zero-length-bounds)
|
||||
KBUILD_CFLAGS += $(call cc-disable-warning, array-bounds)
|
||||
KBUILD_CFLAGS += $(call cc-disable-warning, stringop-overflow)
|
||||
|
||||
# Another good warning that we'll want to enable eventually
|
||||
KBUILD_CFLAGS += $(call cc-disable-warning, restrict)
|
||||
|
||||
# Enabled with W=2, disabled by default as noisy
|
||||
KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized)
|
||||
|
||||
# disable invalid "can't wrap" optimizations for signed / pointers
|
||||
KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow)
|
||||
|
||||
|
||||
@@ -289,6 +289,7 @@
|
||||
#address-cells = <1>;
|
||||
ranges = <0x51000000 0x51000000 0x3000
|
||||
0x0 0x20000000 0x10000000>;
|
||||
dma-ranges;
|
||||
/**
|
||||
* To enable PCI endpoint mode, disable the pcie1_rc
|
||||
* node and enable pcie1_ep mode.
|
||||
@@ -303,7 +304,6 @@
|
||||
device_type = "pci";
|
||||
ranges = <0x81000000 0 0 0x03000 0 0x00010000
|
||||
0x82000000 0 0x20013000 0x13000 0 0xffed000>;
|
||||
dma-ranges = <0x02000000 0x0 0x00000000 0x00000000 0x1 0x00000000>;
|
||||
bus-range = <0x00 0xff>;
|
||||
#interrupt-cells = <1>;
|
||||
num-lanes = <1>;
|
||||
@@ -347,6 +347,7 @@
|
||||
#address-cells = <1>;
|
||||
ranges = <0x51800000 0x51800000 0x3000
|
||||
0x0 0x30000000 0x10000000>;
|
||||
dma-ranges;
|
||||
status = "disabled";
|
||||
pcie@51800000 {
|
||||
compatible = "ti,dra7-pcie";
|
||||
@@ -358,7 +359,6 @@
|
||||
device_type = "pci";
|
||||
ranges = <0x81000000 0 0 0x03000 0 0x00010000
|
||||
0x82000000 0 0x30013000 0x13000 0 0xffed000>;
|
||||
dma-ranges = <0x02000000 0x0 0x00000000 0x00000000 0x1 0x00000000>;
|
||||
bus-range = <0x00 0xff>;
|
||||
#interrupt-cells = <1>;
|
||||
num-lanes = <1>;
|
||||
|
||||
@@ -81,8 +81,8 @@
|
||||
imx27-phycard-s-rdk {
|
||||
pinctrl_i2c1: i2c1grp {
|
||||
fsl,pins = <
|
||||
MX27_PAD_I2C2_SDA__I2C2_SDA 0x0
|
||||
MX27_PAD_I2C2_SCL__I2C2_SCL 0x0
|
||||
MX27_PAD_I2C_DATA__I2C_DATA 0x0
|
||||
MX27_PAD_I2C_CLK__I2C_CLK 0x0
|
||||
>;
|
||||
};
|
||||
|
||||
|
||||
@@ -133,7 +133,14 @@
|
||||
cmt1: timer@e6130000 {
|
||||
compatible = "renesas,cmt-48-r8a73a4", "renesas,cmt-48-gen2";
|
||||
reg = <0 0xe6130000 0 0x1004>;
|
||||
interrupts = <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>;
|
||||
interrupts = <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>,
|
||||
<GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>,
|
||||
<GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>,
|
||||
<GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>,
|
||||
<GIC_SPI 124 IRQ_TYPE_LEVEL_HIGH>,
|
||||
<GIC_SPI 125 IRQ_TYPE_LEVEL_HIGH>,
|
||||
<GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>,
|
||||
<GIC_SPI 127 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&mstp3_clks R8A73A4_CLK_CMT1>;
|
||||
clock-names = "fck";
|
||||
power-domains = <&pd_c5>;
|
||||
|
||||
@@ -467,7 +467,7 @@
|
||||
cpg_clocks: cpg_clocks@e6150000 {
|
||||
compatible = "renesas,r8a7740-cpg-clocks";
|
||||
reg = <0xe6150000 0x10000>;
|
||||
clocks = <&extal1_clk>, <&extalr_clk>;
|
||||
clocks = <&extal1_clk>, <&extal2_clk>, <&extalr_clk>;
|
||||
#clock-cells = <1>;
|
||||
clock-output-names = "system", "pllc0", "pllc1",
|
||||
"pllc2", "r",
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
&i2c1 {
|
||||
status = "okay";
|
||||
|
||||
rk805: rk805@18 {
|
||||
rk805: pmic@18 {
|
||||
compatible = "rockchip,rk805";
|
||||
reg = <0x18>;
|
||||
interrupt-parent = <&gpio2>;
|
||||
|
||||
@@ -149,7 +149,7 @@
|
||||
&i2c1 {
|
||||
status = "okay";
|
||||
|
||||
rk805: rk805@18 {
|
||||
rk805: pmic@18 {
|
||||
compatible = "rockchip,rk805";
|
||||
reg = <0x18>;
|
||||
interrupt-parent = <&gpio2>;
|
||||
|
||||
@@ -402,7 +402,7 @@
|
||||
"bus_clk", "grf_clk";
|
||||
status = "disabled";
|
||||
|
||||
usbdrd_dwc3_0: dwc3 {
|
||||
usbdrd_dwc3_0: usb@fe800000 {
|
||||
compatible = "snps,dwc3";
|
||||
reg = <0x0 0xfe800000 0x0 0x100000>;
|
||||
interrupts = <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH 0>;
|
||||
@@ -430,7 +430,7 @@
|
||||
"bus_clk", "grf_clk";
|
||||
status = "disabled";
|
||||
|
||||
usbdrd_dwc3_1: dwc3 {
|
||||
usbdrd_dwc3_1: usb@fe900000 {
|
||||
compatible = "snps,dwc3";
|
||||
reg = <0x0 0xfe900000 0x0 0x100000>;
|
||||
interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH 0>;
|
||||
|
||||
@@ -17,7 +17,6 @@ CONFIG_CPUSETS=y
|
||||
CONFIG_CGROUP_CPUACCT=y
|
||||
CONFIG_CGROUP_BPF=y
|
||||
CONFIG_NAMESPACES=y
|
||||
# CONFIG_UTS_NS is not set
|
||||
# CONFIG_PID_NS is not set
|
||||
CONFIG_SCHED_AUTOGROUP=y
|
||||
CONFIG_SCHED_TUNE=y
|
||||
@@ -95,7 +94,9 @@ CONFIG_INET=y
|
||||
CONFIG_IP_MULTICAST=y
|
||||
CONFIG_IP_ADVANCED_ROUTER=y
|
||||
CONFIG_IP_MULTIPLE_TABLES=y
|
||||
CONFIG_NET_IPIP=y
|
||||
CONFIG_NET_IPGRE_DEMUX=y
|
||||
CONFIG_NET_IPGRE=y
|
||||
CONFIG_NET_IPVTI=y
|
||||
CONFIG_INET_ESP=y
|
||||
# CONFIG_INET_XFRM_MODE_BEET is not set
|
||||
@@ -112,6 +113,7 @@ CONFIG_INET6_ESP=y
|
||||
CONFIG_INET6_IPCOMP=y
|
||||
CONFIG_IPV6_MIP6=y
|
||||
CONFIG_IPV6_VTI=y
|
||||
CONFIG_IPV6_GRE=y
|
||||
CONFIG_IPV6_MULTIPLE_TABLES=y
|
||||
CONFIG_NETFILTER=y
|
||||
CONFIG_NF_CONNTRACK=y
|
||||
@@ -231,6 +233,7 @@ CONFIG_DUMMY=y
|
||||
CONFIG_NETCONSOLE=y
|
||||
CONFIG_NETCONSOLE_DYNAMIC=y
|
||||
CONFIG_TUN=y
|
||||
CONFIG_VETH=y
|
||||
CONFIG_VIRTIO_NET=y
|
||||
# CONFIG_ETHERNET is not set
|
||||
CONFIG_PHYLIB=y
|
||||
@@ -389,6 +392,7 @@ CONFIG_MMC=y
|
||||
# CONFIG_PWRSEQ_EMMC is not set
|
||||
# CONFIG_PWRSEQ_SIMPLE is not set
|
||||
# CONFIG_MMC_BLOCK is not set
|
||||
CONFIG_MMC_CRYPTO=y
|
||||
CONFIG_RTC_CLASS=y
|
||||
# CONFIG_RTC_HCTOSYS is not set
|
||||
# CONFIG_RTC_SYSTOHC is not set
|
||||
@@ -460,6 +464,7 @@ CONFIG_SECURITY=y
|
||||
CONFIG_SECURITY_NETWORK=y
|
||||
CONFIG_LSM_MMAP_MIN_ADDR=65536
|
||||
CONFIG_HARDENED_USERCOPY=y
|
||||
CONFIG_STATIC_USERMODEHELPER=y
|
||||
CONFIG_SECURITY_SELINUX=y
|
||||
CONFIG_INIT_STACK_ALL=y
|
||||
CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y
|
||||
|
||||
@@ -22,7 +22,6 @@ CONFIG_CPUSETS=y
|
||||
CONFIG_CGROUP_CPUACCT=y
|
||||
CONFIG_CGROUP_BPF=y
|
||||
CONFIG_NAMESPACES=y
|
||||
# CONFIG_UTS_NS is not set
|
||||
# CONFIG_PID_NS is not set
|
||||
CONFIG_SCHED_TUNE=y
|
||||
CONFIG_BLK_DEV_INITRD=y
|
||||
@@ -102,7 +101,9 @@ CONFIG_IP_ADVANCED_ROUTER=y
|
||||
CONFIG_IP_MULTIPLE_TABLES=y
|
||||
CONFIG_IP_ROUTE_MULTIPATH=y
|
||||
CONFIG_IP_ROUTE_VERBOSE=y
|
||||
CONFIG_NET_IPIP=y
|
||||
CONFIG_NET_IPGRE_DEMUX=y
|
||||
CONFIG_NET_IPGRE=y
|
||||
CONFIG_IP_MROUTE=y
|
||||
CONFIG_IP_PIMSM_V1=y
|
||||
CONFIG_IP_PIMSM_V2=y
|
||||
@@ -125,6 +126,7 @@ CONFIG_INET6_ESP=y
|
||||
CONFIG_INET6_IPCOMP=y
|
||||
CONFIG_IPV6_MIP6=y
|
||||
CONFIG_IPV6_VTI=y
|
||||
CONFIG_IPV6_GRE=y
|
||||
CONFIG_IPV6_MULTIPLE_TABLES=y
|
||||
CONFIG_NETLABEL=y
|
||||
CONFIG_NETFILTER=y
|
||||
@@ -257,6 +259,7 @@ CONFIG_DUMMY=y
|
||||
CONFIG_NETCONSOLE=y
|
||||
CONFIG_NETCONSOLE_DYNAMIC=y
|
||||
CONFIG_TUN=y
|
||||
CONFIG_VETH=y
|
||||
CONFIG_VIRTIO_NET=y
|
||||
# CONFIG_ETHERNET is not set
|
||||
CONFIG_PPP=y
|
||||
@@ -503,6 +506,7 @@ CONFIG_SECURITY=y
|
||||
CONFIG_SECURITY_NETWORK=y
|
||||
CONFIG_SECURITY_PATH=y
|
||||
CONFIG_HARDENED_USERCOPY=y
|
||||
CONFIG_STATIC_USERMODEHELPER=y
|
||||
CONFIG_SECURITY_SELINUX=y
|
||||
CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE=1
|
||||
CONFIG_INIT_STACK_ALL=y
|
||||
|
||||
@@ -98,13 +98,6 @@ For 32-bit we have the following conventions - kernel is built with
|
||||
#define SIZEOF_PTREGS 21*8
|
||||
|
||||
.macro PUSH_AND_CLEAR_REGS rdx=%rdx rax=%rax save_ret=0
|
||||
/*
|
||||
* Push registers and sanitize registers of values that a
|
||||
* speculation attack might otherwise want to exploit. The
|
||||
* lower registers are likely clobbered well before they
|
||||
* could be put to use in a speculative execution gadget.
|
||||
* Interleave XOR with PUSH for better uop scheduling:
|
||||
*/
|
||||
.if \save_ret
|
||||
pushq %rsi /* pt_regs->si */
|
||||
movq 8(%rsp), %rsi /* temporarily store the return address in %rsi */
|
||||
@@ -117,29 +110,40 @@ For 32-bit we have the following conventions - kernel is built with
|
||||
pushq %rcx /* pt_regs->cx */
|
||||
pushq \rax /* pt_regs->ax */
|
||||
pushq %r8 /* pt_regs->r8 */
|
||||
xorl %r8d, %r8d /* nospec r8 */
|
||||
pushq %r9 /* pt_regs->r9 */
|
||||
xorl %r9d, %r9d /* nospec r9 */
|
||||
pushq %r10 /* pt_regs->r10 */
|
||||
xorl %r10d, %r10d /* nospec r10 */
|
||||
pushq %r11 /* pt_regs->r11 */
|
||||
xorl %r11d, %r11d /* nospec r11*/
|
||||
pushq %rbx /* pt_regs->rbx */
|
||||
xorl %ebx, %ebx /* nospec rbx*/
|
||||
pushq %rbp /* pt_regs->rbp */
|
||||
xorl %ebp, %ebp /* nospec rbp*/
|
||||
pushq %r12 /* pt_regs->r12 */
|
||||
xorl %r12d, %r12d /* nospec r12*/
|
||||
pushq %r13 /* pt_regs->r13 */
|
||||
xorl %r13d, %r13d /* nospec r13*/
|
||||
pushq %r14 /* pt_regs->r14 */
|
||||
xorl %r14d, %r14d /* nospec r14*/
|
||||
pushq %r15 /* pt_regs->r15 */
|
||||
xorl %r15d, %r15d /* nospec r15*/
|
||||
UNWIND_HINT_REGS
|
||||
|
||||
.if \save_ret
|
||||
pushq %rsi /* return address on top of stack */
|
||||
.endif
|
||||
|
||||
/*
|
||||
* Sanitize registers of values that a speculation attack might
|
||||
* otherwise want to exploit. The lower registers are likely clobbered
|
||||
* well before they could be put to use in a speculative execution
|
||||
* gadget.
|
||||
*/
|
||||
xorl %edx, %edx /* nospec dx */
|
||||
xorl %ecx, %ecx /* nospec cx */
|
||||
xorl %r8d, %r8d /* nospec r8 */
|
||||
xorl %r9d, %r9d /* nospec r9 */
|
||||
xorl %r10d, %r10d /* nospec r10 */
|
||||
xorl %r11d, %r11d /* nospec r11 */
|
||||
xorl %ebx, %ebx /* nospec rbx */
|
||||
xorl %ebp, %ebp /* nospec rbp */
|
||||
xorl %r12d, %r12d /* nospec r12 */
|
||||
xorl %r13d, %r13d /* nospec r13 */
|
||||
xorl %r14d, %r14d /* nospec r14 */
|
||||
xorl %r15d, %r15d /* nospec r15 */
|
||||
|
||||
.endm
|
||||
|
||||
.macro POP_REGS pop_rdi=1 skip_r11rcx=0
|
||||
|
||||
@@ -302,7 +302,6 @@ GLOBAL(entry_SYSCALL_64_after_hwframe)
|
||||
*/
|
||||
syscall_return_via_sysret:
|
||||
/* rcx and r11 are already restored (see code above) */
|
||||
UNWIND_HINT_EMPTY
|
||||
POP_REGS pop_rdi=0 skip_r11rcx=1
|
||||
|
||||
/*
|
||||
@@ -311,6 +310,7 @@ syscall_return_via_sysret:
|
||||
*/
|
||||
movq %rsp, %rdi
|
||||
movq PER_CPU_VAR(cpu_tss_rw + TSS_sp0), %rsp
|
||||
UNWIND_HINT_EMPTY
|
||||
|
||||
pushq RSP-RDI(%rdi) /* RSP */
|
||||
pushq (%rdi) /* RDI */
|
||||
@@ -606,6 +606,7 @@ GLOBAL(swapgs_restore_regs_and_return_to_usermode)
|
||||
*/
|
||||
movq %rsp, %rdi
|
||||
movq PER_CPU_VAR(cpu_tss_rw + TSS_sp0), %rsp
|
||||
UNWIND_HINT_EMPTY
|
||||
|
||||
/* Copy the IRET frame to the trampoline stack. */
|
||||
pushq 6*8(%rdi) /* SS */
|
||||
@@ -1648,7 +1649,7 @@ ENTRY(rewind_stack_do_exit)
|
||||
|
||||
movq PER_CPU_VAR(cpu_current_top_of_stack), %rax
|
||||
leaq -PTREGS_SIZE(%rax), %rsp
|
||||
UNWIND_HINT_FUNC sp_offset=PTREGS_SIZE
|
||||
UNWIND_HINT_REGS
|
||||
|
||||
call do_exit
|
||||
END(rewind_stack_do_exit)
|
||||
|
||||
@@ -78,7 +78,7 @@ set_bit(long nr, volatile unsigned long *addr)
|
||||
: "iq" ((u8)CONST_MASK(nr))
|
||||
: "memory");
|
||||
} else {
|
||||
asm volatile(LOCK_PREFIX "bts %1,%0"
|
||||
asm volatile(LOCK_PREFIX __ASM_SIZE(bts) " %1,%0"
|
||||
: BITOP_ADDR(addr) : "Ir" (nr) : "memory");
|
||||
}
|
||||
}
|
||||
@@ -94,7 +94,7 @@ set_bit(long nr, volatile unsigned long *addr)
|
||||
*/
|
||||
static __always_inline void __set_bit(long nr, volatile unsigned long *addr)
|
||||
{
|
||||
asm volatile("bts %1,%0" : ADDR : "Ir" (nr) : "memory");
|
||||
asm volatile(__ASM_SIZE(bts) " %1,%0" : ADDR : "Ir" (nr) : "memory");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,7 +115,7 @@ clear_bit(long nr, volatile unsigned long *addr)
|
||||
: CONST_MASK_ADDR(nr, addr)
|
||||
: "iq" ((u8)~CONST_MASK(nr)));
|
||||
} else {
|
||||
asm volatile(LOCK_PREFIX "btr %1,%0"
|
||||
asm volatile(LOCK_PREFIX __ASM_SIZE(btr) " %1,%0"
|
||||
: BITOP_ADDR(addr)
|
||||
: "Ir" (nr));
|
||||
}
|
||||
@@ -137,7 +137,7 @@ static __always_inline void clear_bit_unlock(long nr, volatile unsigned long *ad
|
||||
|
||||
static __always_inline void __clear_bit(long nr, volatile unsigned long *addr)
|
||||
{
|
||||
asm volatile("btr %1,%0" : ADDR : "Ir" (nr));
|
||||
asm volatile(__ASM_SIZE(btr) " %1,%0" : ADDR : "Ir" (nr));
|
||||
}
|
||||
|
||||
static __always_inline bool clear_bit_unlock_is_negative_byte(long nr, volatile unsigned long *addr)
|
||||
@@ -182,7 +182,7 @@ static __always_inline void __clear_bit_unlock(long nr, volatile unsigned long *
|
||||
*/
|
||||
static __always_inline void __change_bit(long nr, volatile unsigned long *addr)
|
||||
{
|
||||
asm volatile("btc %1,%0" : ADDR : "Ir" (nr));
|
||||
asm volatile(__ASM_SIZE(btc) " %1,%0" : ADDR : "Ir" (nr));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -201,7 +201,7 @@ static __always_inline void change_bit(long nr, volatile unsigned long *addr)
|
||||
: CONST_MASK_ADDR(nr, addr)
|
||||
: "iq" ((u8)CONST_MASK(nr)));
|
||||
} else {
|
||||
asm volatile(LOCK_PREFIX "btc %1,%0"
|
||||
asm volatile(LOCK_PREFIX __ASM_SIZE(btc) " %1,%0"
|
||||
: BITOP_ADDR(addr)
|
||||
: "Ir" (nr));
|
||||
}
|
||||
@@ -217,7 +217,8 @@ static __always_inline void change_bit(long nr, volatile unsigned long *addr)
|
||||
*/
|
||||
static __always_inline bool test_and_set_bit(long nr, volatile unsigned long *addr)
|
||||
{
|
||||
GEN_BINARY_RMWcc(LOCK_PREFIX "bts", *addr, "Ir", nr, "%0", c);
|
||||
GEN_BINARY_RMWcc(LOCK_PREFIX __ASM_SIZE(bts),
|
||||
*addr, "Ir", nr, "%0", c);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -246,7 +247,7 @@ static __always_inline bool __test_and_set_bit(long nr, volatile unsigned long *
|
||||
{
|
||||
bool oldbit;
|
||||
|
||||
asm("bts %2,%1"
|
||||
asm(__ASM_SIZE(bts) " %2,%1"
|
||||
CC_SET(c)
|
||||
: CC_OUT(c) (oldbit), ADDR
|
||||
: "Ir" (nr));
|
||||
@@ -263,7 +264,8 @@ static __always_inline bool __test_and_set_bit(long nr, volatile unsigned long *
|
||||
*/
|
||||
static __always_inline bool test_and_clear_bit(long nr, volatile unsigned long *addr)
|
||||
{
|
||||
GEN_BINARY_RMWcc(LOCK_PREFIX "btr", *addr, "Ir", nr, "%0", c);
|
||||
GEN_BINARY_RMWcc(LOCK_PREFIX __ASM_SIZE(btr),
|
||||
*addr, "Ir", nr, "%0", c);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -286,7 +288,7 @@ static __always_inline bool __test_and_clear_bit(long nr, volatile unsigned long
|
||||
{
|
||||
bool oldbit;
|
||||
|
||||
asm volatile("btr %2,%1"
|
||||
asm volatile(__ASM_SIZE(btr) " %2,%1"
|
||||
CC_SET(c)
|
||||
: CC_OUT(c) (oldbit), ADDR
|
||||
: "Ir" (nr));
|
||||
@@ -298,7 +300,7 @@ static __always_inline bool __test_and_change_bit(long nr, volatile unsigned lon
|
||||
{
|
||||
bool oldbit;
|
||||
|
||||
asm volatile("btc %2,%1"
|
||||
asm volatile(__ASM_SIZE(btc) " %2,%1"
|
||||
CC_SET(c)
|
||||
: CC_OUT(c) (oldbit), ADDR
|
||||
: "Ir" (nr) : "memory");
|
||||
@@ -316,7 +318,8 @@ static __always_inline bool __test_and_change_bit(long nr, volatile unsigned lon
|
||||
*/
|
||||
static __always_inline bool test_and_change_bit(long nr, volatile unsigned long *addr)
|
||||
{
|
||||
GEN_BINARY_RMWcc(LOCK_PREFIX "btc", *addr, "Ir", nr, "%0", c);
|
||||
GEN_BINARY_RMWcc(LOCK_PREFIX __ASM_SIZE(btc),
|
||||
*addr, "Ir", nr, "%0", c);
|
||||
}
|
||||
|
||||
static __always_inline bool constant_test_bit(long nr, const volatile unsigned long *addr)
|
||||
@@ -329,7 +332,7 @@ static __always_inline bool variable_test_bit(long nr, volatile const unsigned l
|
||||
{
|
||||
bool oldbit;
|
||||
|
||||
asm volatile("bt %2,%1"
|
||||
asm volatile(__ASM_SIZE(bt) " %2,%1"
|
||||
CC_SET(c)
|
||||
: CC_OUT(c) (oldbit)
|
||||
: "m" (*(unsigned long *)addr), "Ir" (nr));
|
||||
|
||||
@@ -526,7 +526,7 @@ static inline bool x86_this_cpu_variable_test_bit(int nr,
|
||||
{
|
||||
bool oldbit;
|
||||
|
||||
asm volatile("bt "__percpu_arg(2)",%1"
|
||||
asm volatile("btl "__percpu_arg(2)",%1"
|
||||
CC_SET(c)
|
||||
: CC_OUT(c) (oldbit)
|
||||
: "m" (*(unsigned long __percpu *)addr), "Ir" (nr));
|
||||
|
||||
@@ -55,8 +55,13 @@
|
||||
/*
|
||||
* Initialize the stackprotector canary value.
|
||||
*
|
||||
* NOTE: this must only be called from functions that never return,
|
||||
* NOTE: this must only be called from functions that never return
|
||||
* and it must always be inlined.
|
||||
*
|
||||
* In addition, it should be called from a compilation unit for which
|
||||
* stack protector is disabled. Alternatively, the caller should not end
|
||||
* with a function call which gets tail-call optimized as that would
|
||||
* lead to checking a modified canary value.
|
||||
*/
|
||||
static __always_inline void boot_init_stack_canary(void)
|
||||
{
|
||||
|
||||
@@ -270,6 +270,14 @@ static void notrace start_secondary(void *unused)
|
||||
|
||||
wmb();
|
||||
cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
|
||||
|
||||
/*
|
||||
* Prevent tail call to cpu_startup_entry() because the stack protector
|
||||
* guard has been changed a couple of function calls up, in
|
||||
* boot_init_stack_canary() and must not be checked before tail calling
|
||||
* another function.
|
||||
*/
|
||||
prevent_tail_call_optimization();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,10 +24,6 @@
|
||||
#include <asm/hpet.h>
|
||||
#include <asm/time.h>
|
||||
|
||||
#ifdef CONFIG_X86_64
|
||||
__visible volatile unsigned long jiffies __cacheline_aligned_in_smp = INITIAL_JIFFIES;
|
||||
#endif
|
||||
|
||||
unsigned long profile_pc(struct pt_regs *regs)
|
||||
{
|
||||
unsigned long pc = instruction_pointer(regs);
|
||||
|
||||
@@ -90,9 +90,6 @@ static struct orc_entry null_orc_entry = {
|
||||
|
||||
static struct orc_entry *orc_find(unsigned long ip)
|
||||
{
|
||||
if (!orc_init)
|
||||
return NULL;
|
||||
|
||||
if (ip == 0)
|
||||
return &null_orc_entry;
|
||||
|
||||
@@ -460,7 +457,7 @@ bool unwind_next_frame(struct unwind_state *state)
|
||||
default:
|
||||
orc_warn("unknown .orc_unwind entry type %d for ip %pB\n",
|
||||
orc->type, (void *)orig_ip);
|
||||
break;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Find BP: */
|
||||
@@ -511,17 +508,20 @@ void __unwind_start(struct unwind_state *state, struct task_struct *task,
|
||||
memset(state, 0, sizeof(*state));
|
||||
state->task = task;
|
||||
|
||||
if (!orc_init)
|
||||
goto err;
|
||||
|
||||
/*
|
||||
* Refuse to unwind the stack of a task while it's executing on another
|
||||
* CPU. This check is racy, but that's ok: the unwinder has other
|
||||
* checks to prevent it from going off the rails.
|
||||
*/
|
||||
if (task_on_another_cpu(task))
|
||||
goto done;
|
||||
goto err;
|
||||
|
||||
if (regs) {
|
||||
if (user_mode(regs))
|
||||
goto done;
|
||||
goto the_end;
|
||||
|
||||
state->ip = regs->ip;
|
||||
state->sp = kernel_stack_pointer(regs);
|
||||
@@ -554,6 +554,7 @@ void __unwind_start(struct unwind_state *state, struct task_struct *task,
|
||||
* generate some kind of backtrace if this happens.
|
||||
*/
|
||||
void *next_page = (void *)PAGE_ALIGN((unsigned long)state->sp);
|
||||
state->error = true;
|
||||
if (get_stack_info(next_page, state->task, &state->stack_info,
|
||||
&state->stack_mask))
|
||||
return;
|
||||
@@ -574,13 +575,14 @@ void __unwind_start(struct unwind_state *state, struct task_struct *task,
|
||||
/* Otherwise, skip ahead to the user-specified starting frame: */
|
||||
while (!unwind_done(state) &&
|
||||
(!on_stack(&state->stack_info, first_frame, sizeof(long)) ||
|
||||
state->sp <= (unsigned long)first_frame))
|
||||
state->sp < (unsigned long)first_frame))
|
||||
unwind_next_frame(state);
|
||||
|
||||
return;
|
||||
|
||||
done:
|
||||
err:
|
||||
state->error = true;
|
||||
the_end:
|
||||
state->stack_info.type = STACK_TYPE_UNKNOWN;
|
||||
return;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__unwind_start);
|
||||
|
||||
@@ -36,13 +36,13 @@ OUTPUT_FORMAT(CONFIG_OUTPUT_FORMAT, CONFIG_OUTPUT_FORMAT, CONFIG_OUTPUT_FORMAT)
|
||||
#ifdef CONFIG_X86_32
|
||||
OUTPUT_ARCH(i386)
|
||||
ENTRY(phys_startup_32)
|
||||
jiffies = jiffies_64;
|
||||
#else
|
||||
OUTPUT_ARCH(i386:x86-64)
|
||||
ENTRY(phys_startup_64)
|
||||
jiffies_64 = jiffies;
|
||||
#endif
|
||||
|
||||
jiffies = jiffies_64;
|
||||
|
||||
#if defined(CONFIG_X86_64)
|
||||
/*
|
||||
* On 64-bit, align RODATA to 2MB so we retain large page mappings for
|
||||
|
||||
@@ -3214,7 +3214,7 @@ static int kvm_vcpu_ioctl_x86_setup_mce(struct kvm_vcpu *vcpu,
|
||||
unsigned bank_num = mcg_cap & 0xff, bank;
|
||||
|
||||
r = -EINVAL;
|
||||
if (!bank_num || bank_num >= KVM_MAX_MCE_BANKS)
|
||||
if (!bank_num || bank_num > KVM_MAX_MCE_BANKS)
|
||||
goto out;
|
||||
if (mcg_cap & ~(kvm_mce_cap_supported | 0xff | 0xff0000))
|
||||
goto out;
|
||||
|
||||
@@ -89,6 +89,7 @@ asmlinkage __visible void cpu_bringup_and_idle(void)
|
||||
{
|
||||
cpu_bringup();
|
||||
cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
|
||||
prevent_tail_call_optimization();
|
||||
}
|
||||
|
||||
void xen_smp_intr_free_pv(unsigned int cpu)
|
||||
|
||||
@@ -108,9 +108,10 @@ int blk_crypto_submit_bio(struct bio **bio_ptr)
|
||||
|
||||
/* Get device keyslot if supported */
|
||||
if (keyslot_manager_crypto_mode_supported(q->ksm,
|
||||
bc->bc_key->crypto_mode,
|
||||
bc->bc_key->data_unit_size,
|
||||
bc->bc_key->is_hw_wrapped)) {
|
||||
bc->bc_key->crypto_mode,
|
||||
blk_crypto_key_dun_bytes(bc->bc_key),
|
||||
bc->bc_key->data_unit_size,
|
||||
bc->bc_key->is_hw_wrapped)) {
|
||||
err = bio_crypt_ctx_acquire_keyslot(bc, q->ksm);
|
||||
if (!err)
|
||||
return 0;
|
||||
@@ -180,6 +181,8 @@ bool blk_crypto_endio(struct bio *bio)
|
||||
* @is_hw_wrapped has to be set for such keys)
|
||||
* @is_hw_wrapped: Denotes @raw_key is wrapped.
|
||||
* @crypto_mode: identifier for the encryption algorithm to use
|
||||
* @dun_bytes: number of bytes that will be used to specify the DUN when this
|
||||
* key is used
|
||||
* @data_unit_size: the data unit size to use for en/decryption
|
||||
*
|
||||
* Return: The blk_crypto_key that was prepared, or an ERR_PTR() on error. When
|
||||
@@ -189,10 +192,12 @@ int blk_crypto_init_key(struct blk_crypto_key *blk_key,
|
||||
const u8 *raw_key, unsigned int raw_key_size,
|
||||
bool is_hw_wrapped,
|
||||
enum blk_crypto_mode_num crypto_mode,
|
||||
unsigned int dun_bytes,
|
||||
unsigned int data_unit_size)
|
||||
{
|
||||
const struct blk_crypto_mode *mode;
|
||||
static siphash_key_t hash_key;
|
||||
u32 hash;
|
||||
|
||||
memset(blk_key, 0, sizeof(*blk_key));
|
||||
|
||||
@@ -211,6 +216,9 @@ int blk_crypto_init_key(struct blk_crypto_key *blk_key,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (dun_bytes <= 0 || dun_bytes > BLK_CRYPTO_MAX_IV_SIZE)
|
||||
return -EINVAL;
|
||||
|
||||
if (!is_power_of_2(data_unit_size))
|
||||
return -EINVAL;
|
||||
|
||||
@@ -227,7 +235,8 @@ int blk_crypto_init_key(struct blk_crypto_key *blk_key,
|
||||
* precomputed here so that it only needs to be computed once per key.
|
||||
*/
|
||||
get_random_once(&hash_key, sizeof(hash_key));
|
||||
blk_key->hash = siphash(raw_key, raw_key_size, &hash_key);
|
||||
hash = (u32)siphash(raw_key, raw_key_size, &hash_key);
|
||||
blk_crypto_key_set_hash_and_dun_bytes(blk_key, hash, dun_bytes);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -236,6 +245,7 @@ EXPORT_SYMBOL_GPL(blk_crypto_init_key);
|
||||
/**
|
||||
* blk_crypto_start_using_mode() - Start using blk-crypto on a device
|
||||
* @crypto_mode: the crypto mode that will be used
|
||||
* @dun_bytes: number of bytes that will be used to specify the DUN
|
||||
* @data_unit_size: the data unit size that will be used
|
||||
* @is_hw_wrapped_key: whether the key will be hardware-wrapped
|
||||
* @q: the request queue for the device
|
||||
@@ -249,12 +259,13 @@ EXPORT_SYMBOL_GPL(blk_crypto_init_key);
|
||||
* algorithm is disabled in the crypto API; or another -errno code.
|
||||
*/
|
||||
int blk_crypto_start_using_mode(enum blk_crypto_mode_num crypto_mode,
|
||||
unsigned int dun_bytes,
|
||||
unsigned int data_unit_size,
|
||||
bool is_hw_wrapped_key,
|
||||
struct request_queue *q)
|
||||
{
|
||||
if (keyslot_manager_crypto_mode_supported(q->ksm, crypto_mode,
|
||||
data_unit_size,
|
||||
dun_bytes, data_unit_size,
|
||||
is_hw_wrapped_key))
|
||||
return 0;
|
||||
if (is_hw_wrapped_key) {
|
||||
@@ -285,6 +296,7 @@ int blk_crypto_evict_key(struct request_queue *q,
|
||||
{
|
||||
if (q->ksm &&
|
||||
keyslot_manager_crypto_mode_supported(q->ksm, key->crypto_mode,
|
||||
blk_crypto_key_dun_bytes(key),
|
||||
key->data_unit_size,
|
||||
key->is_hw_wrapped))
|
||||
return keyslot_manager_evict_key(q->ksm, key);
|
||||
|
||||
@@ -46,6 +46,7 @@ struct keyslot_manager {
|
||||
struct keyslot_mgmt_ll_ops ksm_ll_ops;
|
||||
unsigned int features;
|
||||
unsigned int crypto_mode_supported[BLK_ENCRYPTION_MODE_MAX];
|
||||
unsigned int max_dun_bytes_supported;
|
||||
void *ll_priv_data;
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
@@ -183,6 +184,7 @@ struct keyslot_manager *keyslot_manager_create(
|
||||
ksm->features = features;
|
||||
memcpy(ksm->crypto_mode_supported, crypto_mode_supported,
|
||||
sizeof(ksm->crypto_mode_supported));
|
||||
ksm->max_dun_bytes_supported = BLK_CRYPTO_MAX_IV_SIZE;
|
||||
ksm->ll_priv_data = ll_priv_data;
|
||||
keyslot_manager_set_dev(ksm, dev);
|
||||
|
||||
@@ -215,11 +217,19 @@ err_free_ksm:
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(keyslot_manager_create);
|
||||
|
||||
void keyslot_manager_set_max_dun_bytes(struct keyslot_manager *ksm,
|
||||
unsigned int max_dun_bytes)
|
||||
{
|
||||
ksm->max_dun_bytes_supported = max_dun_bytes;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(keyslot_manager_set_max_dun_bytes);
|
||||
|
||||
static inline struct hlist_head *
|
||||
hash_bucket_for_key(struct keyslot_manager *ksm,
|
||||
const struct blk_crypto_key *key)
|
||||
{
|
||||
return &ksm->slot_hashtable[key->hash & (ksm->slot_hashtable_size - 1)];
|
||||
return &ksm->slot_hashtable[blk_crypto_key_hash(key) &
|
||||
(ksm->slot_hashtable_size - 1)];
|
||||
}
|
||||
|
||||
static void remove_slot_from_lru_list(struct keyslot_manager *ksm, int slot)
|
||||
@@ -392,6 +402,7 @@ void keyslot_manager_put_slot(struct keyslot_manager *ksm, unsigned int slot)
|
||||
* combination is supported by a ksm.
|
||||
* @ksm: The keyslot manager to check
|
||||
* @crypto_mode: The crypto mode to check for.
|
||||
* @dun_bytes: The number of bytes that will be used to specify the DUN
|
||||
* @data_unit_size: The data_unit_size for the mode.
|
||||
* @is_hw_wrapped_key: Whether a hardware-wrapped key will be used.
|
||||
*
|
||||
@@ -403,6 +414,7 @@ void keyslot_manager_put_slot(struct keyslot_manager *ksm, unsigned int slot)
|
||||
*/
|
||||
bool keyslot_manager_crypto_mode_supported(struct keyslot_manager *ksm,
|
||||
enum blk_crypto_mode_num crypto_mode,
|
||||
unsigned int dun_bytes,
|
||||
unsigned int data_unit_size,
|
||||
bool is_hw_wrapped_key)
|
||||
{
|
||||
@@ -419,7 +431,10 @@ bool keyslot_manager_crypto_mode_supported(struct keyslot_manager *ksm,
|
||||
if (!(ksm->features & BLK_CRYPTO_FEATURE_STANDARD_KEYS))
|
||||
return false;
|
||||
}
|
||||
return ksm->crypto_mode_supported[crypto_mode] & data_unit_size;
|
||||
if (!(ksm->crypto_mode_supported[crypto_mode] & data_unit_size))
|
||||
return false;
|
||||
|
||||
return ksm->max_dun_bytes_supported >= dun_bytes;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -566,6 +581,7 @@ struct keyslot_manager *keyslot_manager_create_passthrough(
|
||||
ksm->features = features;
|
||||
memcpy(ksm->crypto_mode_supported, crypto_mode_supported,
|
||||
sizeof(ksm->crypto_mode_supported));
|
||||
ksm->max_dun_bytes_supported = BLK_CRYPTO_MAX_IV_SIZE;
|
||||
ksm->ll_priv_data = ll_priv_data;
|
||||
keyslot_manager_set_dev(ksm, dev);
|
||||
|
||||
@@ -593,12 +609,16 @@ void keyslot_manager_intersect_modes(struct keyslot_manager *parent,
|
||||
unsigned int i;
|
||||
|
||||
parent->features &= child->features;
|
||||
parent->max_dun_bytes_supported =
|
||||
min(parent->max_dun_bytes_supported,
|
||||
child->max_dun_bytes_supported);
|
||||
for (i = 0; i < ARRAY_SIZE(child->crypto_mode_supported); i++) {
|
||||
parent->crypto_mode_supported[i] &=
|
||||
child->crypto_mode_supported[i];
|
||||
}
|
||||
} else {
|
||||
parent->features = 0;
|
||||
parent->max_dun_bytes_supported = 0;
|
||||
memset(parent->crypto_mode_supported, 0,
|
||||
sizeof(parent->crypto_mode_supported));
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ KERNEL_DIR=common
|
||||
|
||||
CC=clang
|
||||
LD=ld.lld
|
||||
CLANG_PREBUILT_BIN=prebuilts-master/clang/host/linux-x86/clang-r377782c/bin
|
||||
CLANG_PREBUILT_BIN=prebuilts-master/clang/host/linux-x86/clang-r383902/bin
|
||||
BUILDTOOLS_PREBUILT_BIN=build/build-tools/path/linux-x86
|
||||
|
||||
EXTRA_CMDS=''
|
||||
|
||||
@@ -531,7 +531,7 @@ static void exit_tfm(struct crypto_skcipher *tfm)
|
||||
crypto_free_skcipher(ctx->child);
|
||||
}
|
||||
|
||||
static void free(struct skcipher_instance *inst)
|
||||
static void free_inst(struct skcipher_instance *inst)
|
||||
{
|
||||
crypto_drop_skcipher(skcipher_instance_ctx(inst));
|
||||
kfree(inst);
|
||||
@@ -642,7 +642,7 @@ static int create(struct crypto_template *tmpl, struct rtattr **tb)
|
||||
inst->alg.encrypt = encrypt;
|
||||
inst->alg.decrypt = decrypt;
|
||||
|
||||
inst->free = free;
|
||||
inst->free = free_inst;
|
||||
|
||||
err = skcipher_register_instance(tmpl, inst);
|
||||
if (err)
|
||||
|
||||
@@ -469,7 +469,7 @@ static void exit_tfm(struct crypto_skcipher *tfm)
|
||||
crypto_free_cipher(ctx->tweak);
|
||||
}
|
||||
|
||||
static void free(struct skcipher_instance *inst)
|
||||
static void free_inst(struct skcipher_instance *inst)
|
||||
{
|
||||
crypto_drop_skcipher(skcipher_instance_ctx(inst));
|
||||
kfree(inst);
|
||||
@@ -580,7 +580,7 @@ static int create(struct crypto_template *tmpl, struct rtattr **tb)
|
||||
inst->alg.encrypt = encrypt;
|
||||
inst->alg.decrypt = decrypt;
|
||||
|
||||
inst->free = free;
|
||||
inst->free = free_inst;
|
||||
|
||||
err = skcipher_register_instance(tmpl, inst);
|
||||
if (err)
|
||||
|
||||
@@ -31,6 +31,15 @@ struct virtio_blk_vq {
|
||||
} ____cacheline_aligned_in_smp;
|
||||
|
||||
struct virtio_blk {
|
||||
/*
|
||||
* This mutex must be held by anything that may run after
|
||||
* virtblk_remove() sets vblk->vdev to NULL.
|
||||
*
|
||||
* blk-mq, virtqueue processing, and sysfs attribute code paths are
|
||||
* shut down before vblk->vdev is set to NULL and therefore do not need
|
||||
* to hold this mutex.
|
||||
*/
|
||||
struct mutex vdev_mutex;
|
||||
struct virtio_device *vdev;
|
||||
|
||||
/* The disk structure for the kernel. */
|
||||
@@ -42,6 +51,13 @@ struct virtio_blk {
|
||||
/* Process context for config space updates */
|
||||
struct work_struct config_work;
|
||||
|
||||
/*
|
||||
* Tracks references from block_device_operations open/release and
|
||||
* virtio_driver probe/remove so this object can be freed once no
|
||||
* longer in use.
|
||||
*/
|
||||
refcount_t refs;
|
||||
|
||||
/* What host tells us, plus 2 for header & tailer. */
|
||||
unsigned int sg_elems;
|
||||
|
||||
@@ -315,10 +331,55 @@ out:
|
||||
return err;
|
||||
}
|
||||
|
||||
static void virtblk_get(struct virtio_blk *vblk)
|
||||
{
|
||||
refcount_inc(&vblk->refs);
|
||||
}
|
||||
|
||||
static void virtblk_put(struct virtio_blk *vblk)
|
||||
{
|
||||
if (refcount_dec_and_test(&vblk->refs)) {
|
||||
ida_simple_remove(&vd_index_ida, vblk->index);
|
||||
mutex_destroy(&vblk->vdev_mutex);
|
||||
kfree(vblk);
|
||||
}
|
||||
}
|
||||
|
||||
static int virtblk_open(struct block_device *bd, fmode_t mode)
|
||||
{
|
||||
struct virtio_blk *vblk = bd->bd_disk->private_data;
|
||||
int ret = 0;
|
||||
|
||||
mutex_lock(&vblk->vdev_mutex);
|
||||
|
||||
if (vblk->vdev)
|
||||
virtblk_get(vblk);
|
||||
else
|
||||
ret = -ENXIO;
|
||||
|
||||
mutex_unlock(&vblk->vdev_mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void virtblk_release(struct gendisk *disk, fmode_t mode)
|
||||
{
|
||||
struct virtio_blk *vblk = disk->private_data;
|
||||
|
||||
virtblk_put(vblk);
|
||||
}
|
||||
|
||||
/* We provide getgeo only to please some old bootloader/partitioning tools */
|
||||
static int virtblk_getgeo(struct block_device *bd, struct hd_geometry *geo)
|
||||
{
|
||||
struct virtio_blk *vblk = bd->bd_disk->private_data;
|
||||
int ret = 0;
|
||||
|
||||
mutex_lock(&vblk->vdev_mutex);
|
||||
|
||||
if (!vblk->vdev) {
|
||||
ret = -ENXIO;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* see if the host passed in geometry config */
|
||||
if (virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_GEOMETRY)) {
|
||||
@@ -334,12 +395,16 @@ static int virtblk_getgeo(struct block_device *bd, struct hd_geometry *geo)
|
||||
geo->sectors = 1 << 5;
|
||||
geo->cylinders = get_capacity(bd->bd_disk) >> 11;
|
||||
}
|
||||
return 0;
|
||||
out:
|
||||
mutex_unlock(&vblk->vdev_mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct block_device_operations virtblk_fops = {
|
||||
.ioctl = virtblk_ioctl,
|
||||
.owner = THIS_MODULE,
|
||||
.open = virtblk_open,
|
||||
.release = virtblk_release,
|
||||
.getgeo = virtblk_getgeo,
|
||||
};
|
||||
|
||||
@@ -659,6 +724,10 @@ static int virtblk_probe(struct virtio_device *vdev)
|
||||
goto out_free_index;
|
||||
}
|
||||
|
||||
/* This reference is dropped in virtblk_remove(). */
|
||||
refcount_set(&vblk->refs, 1);
|
||||
mutex_init(&vblk->vdev_mutex);
|
||||
|
||||
vblk->vdev = vdev;
|
||||
vblk->sg_elems = sg_elems;
|
||||
|
||||
@@ -821,8 +890,6 @@ out:
|
||||
static void virtblk_remove(struct virtio_device *vdev)
|
||||
{
|
||||
struct virtio_blk *vblk = vdev->priv;
|
||||
int index = vblk->index;
|
||||
int refc;
|
||||
|
||||
/* Make sure no work handler is accessing the device. */
|
||||
flush_work(&vblk->config_work);
|
||||
@@ -832,18 +899,21 @@ static void virtblk_remove(struct virtio_device *vdev)
|
||||
|
||||
blk_mq_free_tag_set(&vblk->tag_set);
|
||||
|
||||
mutex_lock(&vblk->vdev_mutex);
|
||||
|
||||
/* Stop all the virtqueues. */
|
||||
vdev->config->reset(vdev);
|
||||
|
||||
refc = kref_read(&disk_to_dev(vblk->disk)->kobj.kref);
|
||||
/* Virtqueues are stopped, nothing can use vblk->vdev anymore. */
|
||||
vblk->vdev = NULL;
|
||||
|
||||
put_disk(vblk->disk);
|
||||
vdev->config->del_vqs(vdev);
|
||||
kfree(vblk->vqs);
|
||||
kfree(vblk);
|
||||
|
||||
/* Only free device id if we don't have any users */
|
||||
if (refc == 1)
|
||||
ida_simple_remove(&vd_index_ida, index);
|
||||
mutex_unlock(&vblk->vdev_mutex);
|
||||
|
||||
virtblk_put(vblk);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
|
||||
@@ -1731,7 +1731,9 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id)
|
||||
|
||||
out:
|
||||
if (rv) {
|
||||
addr_info->client = NULL;
|
||||
if (addr_info)
|
||||
addr_info->client = NULL;
|
||||
|
||||
dev_err(&client->dev, "Unable to start IPMI SSIF: %d\n", rv);
|
||||
kfree(ssif_info);
|
||||
}
|
||||
|
||||
@@ -163,8 +163,6 @@ PNAME(mux_i2s_out_p) = { "i2s1_pre", "xin12m" };
|
||||
PNAME(mux_i2s2_p) = { "i2s2_src", "i2s2_frac", "xin12m" };
|
||||
PNAME(mux_sclk_spdif_p) = { "sclk_spdif_src", "spdif_frac", "xin12m" };
|
||||
|
||||
PNAME(mux_aclk_gpu_pre_p) = { "cpll_gpu", "gpll_gpu", "hdmiphy_gpu", "usb480m_gpu" };
|
||||
|
||||
PNAME(mux_uart0_p) = { "uart0_src", "uart0_frac", "xin24m" };
|
||||
PNAME(mux_uart1_p) = { "uart1_src", "uart1_frac", "xin24m" };
|
||||
PNAME(mux_uart2_p) = { "uart2_src", "uart2_frac", "xin24m" };
|
||||
@@ -475,16 +473,9 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = {
|
||||
RK2928_CLKSEL_CON(24), 6, 10, DFLAGS,
|
||||
RK2928_CLKGATE_CON(2), 8, GFLAGS),
|
||||
|
||||
GATE(0, "cpll_gpu", "cpll", 0,
|
||||
COMPOSITE(0, "aclk_gpu_pre", mux_pll_src_4plls_p, 0,
|
||||
RK2928_CLKSEL_CON(34), 5, 2, MFLAGS, 0, 5, DFLAGS,
|
||||
RK2928_CLKGATE_CON(3), 13, GFLAGS),
|
||||
GATE(0, "gpll_gpu", "gpll", 0,
|
||||
RK2928_CLKGATE_CON(3), 13, GFLAGS),
|
||||
GATE(0, "hdmiphy_gpu", "hdmiphy", 0,
|
||||
RK2928_CLKGATE_CON(3), 13, GFLAGS),
|
||||
GATE(0, "usb480m_gpu", "usb480m", 0,
|
||||
RK2928_CLKGATE_CON(3), 13, GFLAGS),
|
||||
COMPOSITE_NOGATE(0, "aclk_gpu_pre", mux_aclk_gpu_pre_p, 0,
|
||||
RK2928_CLKSEL_CON(34), 5, 2, MFLAGS, 0, 5, DFLAGS),
|
||||
|
||||
COMPOSITE(SCLK_SPI0, "sclk_spi0", mux_pll_src_2plls_p, 0,
|
||||
RK2928_CLKSEL_CON(25), 8, 1, MFLAGS, 0, 7, DFLAGS,
|
||||
@@ -589,8 +580,8 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = {
|
||||
GATE(0, "pclk_peri_noc", "pclk_peri", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(12), 2, GFLAGS),
|
||||
|
||||
/* PD_GPU */
|
||||
GATE(ACLK_GPU, "aclk_gpu", "aclk_gpu_pre", 0, RK2928_CLKGATE_CON(13), 14, GFLAGS),
|
||||
GATE(0, "aclk_gpu_noc", "aclk_gpu_pre", 0, RK2928_CLKGATE_CON(13), 15, GFLAGS),
|
||||
GATE(ACLK_GPU, "aclk_gpu", "aclk_gpu_pre", 0, RK2928_CLKGATE_CON(7), 14, GFLAGS),
|
||||
GATE(0, "aclk_gpu_noc", "aclk_gpu_pre", 0, RK2928_CLKGATE_CON(7), 15, GFLAGS),
|
||||
|
||||
/* PD_BUS */
|
||||
GATE(0, "sclk_initmem_mbist", "aclk_cpu", 0, RK2928_CLKGATE_CON(8), 1, GFLAGS),
|
||||
|
||||
@@ -935,7 +935,7 @@ static ssize_t store_no_turbo(struct kobject *a, struct kobj_attribute *b,
|
||||
|
||||
update_turbo_state();
|
||||
if (global.turbo_disabled) {
|
||||
pr_warn("Turbo disabled by BIOS or unavailable on processor\n");
|
||||
pr_notice_once("Turbo disabled by BIOS or unavailable on processor\n");
|
||||
mutex_unlock(&intel_pstate_limits_lock);
|
||||
mutex_unlock(&intel_pstate_driver_lock);
|
||||
return -EPERM;
|
||||
|
||||
@@ -362,6 +362,8 @@ static void mmp_tdma_free_descriptor(struct mmp_tdma_chan *tdmac)
|
||||
gen_pool_free(gpool, (unsigned long)tdmac->desc_arr,
|
||||
size);
|
||||
tdmac->desc_arr = NULL;
|
||||
if (tdmac->status == DMA_ERROR)
|
||||
tdmac->status = DMA_COMPLETE;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -873,6 +873,7 @@ static int pch_dma_probe(struct pci_dev *pdev,
|
||||
}
|
||||
|
||||
pci_set_master(pdev);
|
||||
pd->dma.dev = &pdev->dev;
|
||||
|
||||
err = request_irq(pdev->irq, pd_irq, IRQF_SHARED, DRV_NAME, pd);
|
||||
if (err) {
|
||||
@@ -888,7 +889,6 @@ static int pch_dma_probe(struct pci_dev *pdev,
|
||||
goto err_free_irq;
|
||||
}
|
||||
|
||||
pd->dma.dev = &pdev->dev;
|
||||
|
||||
INIT_LIST_HEAD(&pd->dma.channels);
|
||||
|
||||
|
||||
@@ -210,7 +210,8 @@ qxl_image_init_helper(struct qxl_device *qdev,
|
||||
break;
|
||||
default:
|
||||
DRM_ERROR("unsupported image bit depth\n");
|
||||
return -EINVAL; /* TODO: cleanup */
|
||||
qxl_bo_kunmap_atomic_page(qdev, image_bo, ptr);
|
||||
return -EINVAL;
|
||||
}
|
||||
image->u.bitmap.flags = QXL_BITMAP_TOP_DOWN;
|
||||
image->u.bitmap.x = width;
|
||||
|
||||
@@ -2460,7 +2460,6 @@ static const struct hid_device_id hid_have_special_driver[] = {
|
||||
#if IS_ENABLED(CONFIG_HID_STEAM)
|
||||
{ HID_USB_DEVICE(USB_VENDOR_ID_VALVE, USB_DEVICE_ID_STEAM_CONTROLLER) },
|
||||
{ HID_USB_DEVICE(USB_VENDOR_ID_VALVE, USB_DEVICE_ID_STEAM_CONTROLLER_WIRELESS) },
|
||||
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_VALVE, USB_DEVICE_ID_STEAM_CONTROLLER_BT) },
|
||||
#endif
|
||||
#if IS_ENABLED(CONFIG_HID_WALTOP)
|
||||
{ HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH) },
|
||||
|
||||
@@ -1002,7 +1002,6 @@
|
||||
#define USB_VENDOR_ID_VALVE 0x28de
|
||||
#define USB_DEVICE_ID_STEAM_CONTROLLER 0x1102
|
||||
#define USB_DEVICE_ID_STEAM_CONTROLLER_WIRELESS 0x1142
|
||||
#define USB_DEVICE_ID_STEAM_CONTROLLER_BT 0x1106
|
||||
|
||||
#define USB_VENDOR_ID_STEELSERIES 0x1038
|
||||
#define USB_DEVICE_ID_STEELSERIES_SRWS1 0x1410
|
||||
|
||||
@@ -768,8 +768,12 @@ static int steam_probe(struct hid_device *hdev,
|
||||
|
||||
if (steam->quirks & STEAM_QUIRK_WIRELESS) {
|
||||
hid_info(hdev, "Steam wireless receiver connected");
|
||||
/* If using a wireless adaptor ask for connection status */
|
||||
steam->connected = false;
|
||||
steam_request_conn_status(steam);
|
||||
} else {
|
||||
/* A wired connection is always present */
|
||||
steam->connected = true;
|
||||
ret = steam_register(steam);
|
||||
if (ret) {
|
||||
hid_err(hdev,
|
||||
|
||||
@@ -680,16 +680,21 @@ static int usbhid_open(struct hid_device *hid)
|
||||
struct usbhid_device *usbhid = hid->driver_data;
|
||||
int res;
|
||||
|
||||
mutex_lock(&usbhid->mutex);
|
||||
|
||||
set_bit(HID_OPENED, &usbhid->iofl);
|
||||
|
||||
if (hid->quirks & HID_QUIRK_ALWAYS_POLL)
|
||||
return 0;
|
||||
if (hid->quirks & HID_QUIRK_ALWAYS_POLL) {
|
||||
res = 0;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
res = usb_autopm_get_interface(usbhid->intf);
|
||||
/* the device must be awake to reliably request remote wakeup */
|
||||
if (res < 0) {
|
||||
clear_bit(HID_OPENED, &usbhid->iofl);
|
||||
return -EIO;
|
||||
res = -EIO;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
usbhid->intf->needs_remote_wakeup = 1;
|
||||
@@ -723,6 +728,9 @@ static int usbhid_open(struct hid_device *hid)
|
||||
msleep(50);
|
||||
|
||||
clear_bit(HID_RESUME_RUNNING, &usbhid->iofl);
|
||||
|
||||
Done:
|
||||
mutex_unlock(&usbhid->mutex);
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -730,6 +738,8 @@ static void usbhid_close(struct hid_device *hid)
|
||||
{
|
||||
struct usbhid_device *usbhid = hid->driver_data;
|
||||
|
||||
mutex_lock(&usbhid->mutex);
|
||||
|
||||
/*
|
||||
* Make sure we don't restart data acquisition due to
|
||||
* a resumption we no longer care about by avoiding racing
|
||||
@@ -741,12 +751,13 @@ static void usbhid_close(struct hid_device *hid)
|
||||
clear_bit(HID_IN_POLLING, &usbhid->iofl);
|
||||
spin_unlock_irq(&usbhid->lock);
|
||||
|
||||
if (hid->quirks & HID_QUIRK_ALWAYS_POLL)
|
||||
return;
|
||||
if (!(hid->quirks & HID_QUIRK_ALWAYS_POLL)) {
|
||||
hid_cancel_delayed_stuff(usbhid);
|
||||
usb_kill_urb(usbhid->urbin);
|
||||
usbhid->intf->needs_remote_wakeup = 0;
|
||||
}
|
||||
|
||||
hid_cancel_delayed_stuff(usbhid);
|
||||
usb_kill_urb(usbhid->urbin);
|
||||
usbhid->intf->needs_remote_wakeup = 0;
|
||||
mutex_unlock(&usbhid->mutex);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1056,6 +1067,8 @@ static int usbhid_start(struct hid_device *hid)
|
||||
unsigned int n, insize = 0;
|
||||
int ret;
|
||||
|
||||
mutex_lock(&usbhid->mutex);
|
||||
|
||||
clear_bit(HID_DISCONNECTED, &usbhid->iofl);
|
||||
|
||||
usbhid->bufsize = HID_MIN_BUFFER_SIZE;
|
||||
@@ -1170,6 +1183,8 @@ static int usbhid_start(struct hid_device *hid)
|
||||
usbhid_set_leds(hid);
|
||||
device_set_wakeup_enable(&dev->dev, 1);
|
||||
}
|
||||
|
||||
mutex_unlock(&usbhid->mutex);
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
@@ -1180,6 +1195,7 @@ fail:
|
||||
usbhid->urbout = NULL;
|
||||
usbhid->urbctrl = NULL;
|
||||
hid_free_buffers(dev, hid);
|
||||
mutex_unlock(&usbhid->mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1195,6 +1211,8 @@ static void usbhid_stop(struct hid_device *hid)
|
||||
usbhid->intf->needs_remote_wakeup = 0;
|
||||
}
|
||||
|
||||
mutex_lock(&usbhid->mutex);
|
||||
|
||||
clear_bit(HID_STARTED, &usbhid->iofl);
|
||||
spin_lock_irq(&usbhid->lock); /* Sync with error and led handlers */
|
||||
set_bit(HID_DISCONNECTED, &usbhid->iofl);
|
||||
@@ -1215,6 +1233,8 @@ static void usbhid_stop(struct hid_device *hid)
|
||||
usbhid->urbout = NULL;
|
||||
|
||||
hid_free_buffers(hid_to_usb_dev(hid), hid);
|
||||
|
||||
mutex_unlock(&usbhid->mutex);
|
||||
}
|
||||
|
||||
static int usbhid_power(struct hid_device *hid, int lvl)
|
||||
@@ -1375,6 +1395,7 @@ static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id *
|
||||
INIT_WORK(&usbhid->reset_work, hid_reset);
|
||||
setup_timer(&usbhid->io_retry, hid_retry_timeout, (unsigned long) hid);
|
||||
spin_lock_init(&usbhid->lock);
|
||||
mutex_init(&usbhid->mutex);
|
||||
|
||||
ret = hid_add_device(hid);
|
||||
if (ret) {
|
||||
|
||||
@@ -93,6 +93,7 @@ struct usbhid_device {
|
||||
dma_addr_t outbuf_dma; /* Output buffer dma */
|
||||
unsigned long last_out; /* record of last output for timeouts */
|
||||
|
||||
struct mutex mutex; /* start/stop/open/close */
|
||||
spinlock_t lock; /* fifo spinlock */
|
||||
unsigned long iofl; /* I/O flags (CTRL_RUNNING, OUT_RUNNING) */
|
||||
struct timer_list io_retry; /* Retry timer */
|
||||
|
||||
@@ -132,9 +132,11 @@ static void wacom_feature_mapping(struct hid_device *hdev,
|
||||
data[0] = field->report->id;
|
||||
ret = wacom_get_report(hdev, HID_FEATURE_REPORT,
|
||||
data, n, WAC_CMD_RETRIES);
|
||||
if (ret == n) {
|
||||
if (ret == n && features->type == HID_GENERIC) {
|
||||
ret = hid_report_raw_event(hdev,
|
||||
HID_FEATURE_REPORT, data, n, 0);
|
||||
} else if (ret == 2 && features->type != HID_GENERIC) {
|
||||
features->touch_max = data[1];
|
||||
} else {
|
||||
features->touch_max = 16;
|
||||
hid_warn(hdev, "wacom_feature_mapping: "
|
||||
|
||||
@@ -250,9 +250,9 @@ static ssize_t da9052_read_tsi(struct device *dev,
|
||||
int channel = to_sensor_dev_attr(devattr)->index;
|
||||
int ret;
|
||||
|
||||
mutex_lock(&hwmon->hwmon_lock);
|
||||
mutex_lock(&hwmon->da9052->auxadc_lock);
|
||||
ret = __da9052_read_tsi(dev, channel);
|
||||
mutex_unlock(&hwmon->hwmon_lock);
|
||||
mutex_unlock(&hwmon->da9052->auxadc_lock);
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@@ -450,16 +450,15 @@ static int addr6_resolve(struct sockaddr_in6 *src_in,
|
||||
struct flowi6 fl6;
|
||||
struct dst_entry *dst;
|
||||
struct rt6_info *rt;
|
||||
int ret;
|
||||
|
||||
memset(&fl6, 0, sizeof fl6);
|
||||
fl6.daddr = dst_in->sin6_addr;
|
||||
fl6.saddr = src_in->sin6_addr;
|
||||
fl6.flowi6_oif = addr->bound_dev_if;
|
||||
|
||||
ret = ipv6_stub->ipv6_dst_lookup(addr->net, NULL, &dst, &fl6);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
dst = ipv6_stub->ipv6_dst_lookup_flow(addr->net, NULL, &fl6, NULL);
|
||||
if (IS_ERR(dst))
|
||||
return PTR_ERR(dst);
|
||||
|
||||
rt = (struct rt6_info *)dst;
|
||||
if (ipv6_addr_any(&src_in->sin6_addr)) {
|
||||
|
||||
@@ -483,7 +483,7 @@ void i40iw_manage_arp_cache(struct i40iw_device *iwdev,
|
||||
int arp_index;
|
||||
|
||||
arp_index = i40iw_arp_table(iwdev, ip_addr, ipv4, mac_addr, action);
|
||||
if (arp_index == -1)
|
||||
if (arp_index < 0)
|
||||
return;
|
||||
cqp_request = i40iw_get_cqp_request(&iwdev->cqp, false);
|
||||
if (!cqp_request)
|
||||
|
||||
@@ -2917,6 +2917,7 @@ static int build_sriov_qp0_header(struct mlx4_ib_sqp *sqp,
|
||||
int send_size;
|
||||
int header_size;
|
||||
int spc;
|
||||
int err;
|
||||
int i;
|
||||
|
||||
if (wr->wr.opcode != IB_WR_SEND)
|
||||
@@ -2951,7 +2952,9 @@ static int build_sriov_qp0_header(struct mlx4_ib_sqp *sqp,
|
||||
|
||||
sqp->ud_header.lrh.virtual_lane = 0;
|
||||
sqp->ud_header.bth.solicited_event = !!(wr->wr.send_flags & IB_SEND_SOLICITED);
|
||||
ib_get_cached_pkey(ib_dev, sqp->qp.port, 0, &pkey);
|
||||
err = ib_get_cached_pkey(ib_dev, sqp->qp.port, 0, &pkey);
|
||||
if (err)
|
||||
return err;
|
||||
sqp->ud_header.bth.pkey = cpu_to_be16(pkey);
|
||||
if (sqp->qp.mlx4_ib_qp_type == MLX4_IB_QPT_TUN_SMI_OWNER)
|
||||
sqp->ud_header.bth.destination_qpn = cpu_to_be32(wr->remote_qpn);
|
||||
@@ -3240,9 +3243,14 @@ static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_ud_wr *wr,
|
||||
}
|
||||
sqp->ud_header.bth.solicited_event = !!(wr->wr.send_flags & IB_SEND_SOLICITED);
|
||||
if (!sqp->qp.ibqp.qp_num)
|
||||
ib_get_cached_pkey(ib_dev, sqp->qp.port, sqp->pkey_index, &pkey);
|
||||
err = ib_get_cached_pkey(ib_dev, sqp->qp.port, sqp->pkey_index,
|
||||
&pkey);
|
||||
else
|
||||
ib_get_cached_pkey(ib_dev, sqp->qp.port, wr->pkey_index, &pkey);
|
||||
err = ib_get_cached_pkey(ib_dev, sqp->qp.port, wr->pkey_index,
|
||||
&pkey);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
sqp->ud_header.bth.pkey = cpu_to_be16(pkey);
|
||||
sqp->ud_header.bth.destination_qpn = cpu_to_be32(wr->remote_qpn);
|
||||
sqp->ud_header.bth.psn = cpu_to_be32((sqp->send_psn++) & ((1 << 24) - 1));
|
||||
|
||||
@@ -154,10 +154,12 @@ static struct dst_entry *rxe_find_route6(struct net_device *ndev,
|
||||
memcpy(&fl6.daddr, daddr, sizeof(*daddr));
|
||||
fl6.flowi6_proto = IPPROTO_UDP;
|
||||
|
||||
if (unlikely(ipv6_stub->ipv6_dst_lookup(sock_net(recv_sockets.sk6->sk),
|
||||
recv_sockets.sk6->sk, &ndst, &fl6))) {
|
||||
ndst = ipv6_stub->ipv6_dst_lookup_flow(sock_net(recv_sockets.sk6->sk),
|
||||
recv_sockets.sk6->sk, &fl6,
|
||||
NULL);
|
||||
if (unlikely(IS_ERR(ndst))) {
|
||||
pr_err_ratelimited("no route to %pI6\n", daddr);
|
||||
goto put;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (unlikely(ndst->error)) {
|
||||
|
||||
@@ -40,6 +40,7 @@ static const struct dm_default_key_cipher {
|
||||
* @sector_size: crypto sector size in bytes (usually 4096)
|
||||
* @sector_bits: log2(sector_size)
|
||||
* @key: the encryption key to use
|
||||
* @max_dun: the maximum DUN that may be used (computed from other params)
|
||||
*/
|
||||
struct default_key_c {
|
||||
struct dm_dev *dev;
|
||||
@@ -50,6 +51,7 @@ struct default_key_c {
|
||||
unsigned int sector_bits;
|
||||
struct blk_crypto_key key;
|
||||
bool is_hw_wrapped;
|
||||
u64 max_dun;
|
||||
};
|
||||
|
||||
static const struct dm_default_key_cipher *
|
||||
@@ -149,6 +151,7 @@ static int default_key_ctr(struct dm_target *ti, unsigned int argc, char **argv)
|
||||
const struct dm_default_key_cipher *cipher;
|
||||
u8 raw_key[DM_DEFAULT_KEY_MAX_WRAPPED_KEY_SIZE];
|
||||
unsigned int raw_key_size;
|
||||
unsigned int dun_bytes;
|
||||
unsigned long long tmpll;
|
||||
char dummy;
|
||||
int err;
|
||||
@@ -232,16 +235,20 @@ static int default_key_ctr(struct dm_target *ti, unsigned int argc, char **argv)
|
||||
goto bad;
|
||||
}
|
||||
|
||||
err = blk_crypto_init_key(&dkc->key, raw_key, cipher->key_size,
|
||||
dkc->max_dun = (dkc->iv_offset + ti->len - 1) >>
|
||||
(dkc->sector_bits - SECTOR_SHIFT);
|
||||
dun_bytes = DIV_ROUND_UP(fls64(dkc->max_dun), 8);
|
||||
|
||||
err = blk_crypto_init_key(&dkc->key, raw_key, raw_key_size,
|
||||
dkc->is_hw_wrapped, cipher->mode_num,
|
||||
dkc->sector_size);
|
||||
dun_bytes, dkc->sector_size);
|
||||
if (err) {
|
||||
ti->error = "Error initializing blk-crypto key";
|
||||
goto bad;
|
||||
}
|
||||
|
||||
err = blk_crypto_start_using_mode(cipher->mode_num, dkc->sector_size,
|
||||
dkc->is_hw_wrapped,
|
||||
err = blk_crypto_start_using_mode(cipher->mode_num, dun_bytes,
|
||||
dkc->sector_size, dkc->is_hw_wrapped,
|
||||
dkc->dev->bdev->bd_queue);
|
||||
if (err) {
|
||||
ti->error = "Error starting to use blk-crypto";
|
||||
@@ -302,6 +309,13 @@ static int default_key_map(struct dm_target *ti, struct bio *bio)
|
||||
return DM_MAPIO_KILL;
|
||||
dun[0] >>= dkc->sector_bits - SECTOR_SHIFT; /* crypto sectors */
|
||||
|
||||
/*
|
||||
* This check isn't necessary as we should have calculated max_dun
|
||||
* correctly, but be safe.
|
||||
*/
|
||||
if (WARN_ON_ONCE(dun[0] > dkc->max_dun))
|
||||
return DM_MAPIO_KILL;
|
||||
|
||||
bio_crypt_set_ctx(bio, &dkc->key, dun, GFP_NOIO);
|
||||
|
||||
return DM_MAPIO_REMAPPED;
|
||||
|
||||
@@ -136,3 +136,13 @@ config MTK_MMC_PWR_WP
|
||||
|
||||
E.g. Kernel hard-code a partition named "system", User space use
|
||||
ioctl(fd, MMC_IOC_WP_CMD , &buf ) will set power-on write protect on it.
|
||||
|
||||
config MMC_CRYPTO
|
||||
bool "MMC Crypto Engine Support"
|
||||
depends on BLK_INLINE_ENCRYPTION
|
||||
help
|
||||
Enable Crypto Engine Support in MMC.
|
||||
Enabling this makes it possible for the kernel to use the crypto
|
||||
capabilities of the MMC device (if present) to perform crypto
|
||||
operations on data being transferred to/from the device.
|
||||
|
||||
|
||||
@@ -26,6 +26,5 @@ obj-$(CONFIG_MMC_TEST) += mmc_test.o
|
||||
obj-$(CONFIG_SDIO_UART) += sdio_uart.o
|
||||
obj-$(CONFIG_MMC_FFU) += ffu.o
|
||||
obj-$(CONFIG_MMC_BLOCK_IO_LOG) += mtk_mmc_block.o
|
||||
|
||||
obj-$(CONFIG_MTK_MMC_PWR_WP) += mtk_emmc_write_protect.o
|
||||
obj-$(CONFIG_MMC_CRYPTO) += mmc_crypto.o
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
#include "block.h"
|
||||
#include "core.h"
|
||||
#include "card.h"
|
||||
#include "crypto.h"
|
||||
#include "host.h"
|
||||
#include "bus.h"
|
||||
#include "mmc_ops.h"
|
||||
@@ -2300,6 +2301,8 @@ static void mmc_blk_data_prep(struct mmc_queue *mq, struct mmc_queue_req *mqrq,
|
||||
|
||||
memset(brq, 0, sizeof(struct mmc_blk_request));
|
||||
|
||||
/* mmc_crypto_prepare_req(mqrq); */
|
||||
|
||||
brq->mrq.data = &brq->data;
|
||||
|
||||
brq->stop.opcode = MMC_STOP_TRANSMISSION;
|
||||
|
||||
40
drivers/mmc/core/crypto.c
Normal file
40
drivers/mmc/core/crypto.c
Normal file
@@ -0,0 +1,40 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Copyright 2020 Google LLC
|
||||
*/
|
||||
|
||||
#include <linux/blk-crypto.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/keyslot-manager.h>
|
||||
#include <linux/mmc/host.h>
|
||||
|
||||
#include "core.h"
|
||||
#include "queue.h"
|
||||
|
||||
void mmc_crypto_setup_queue(struct mmc_host *host, struct request_queue *q)
|
||||
{
|
||||
if (host->caps2 & MMC_CAP2_CRYPTO)
|
||||
q->ksm = host->ksm;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mmc_crypto_setup_queue);
|
||||
|
||||
void mmc_crypto_free_host(struct mmc_host *host)
|
||||
{
|
||||
keyslot_manager_destroy(host->ksm);
|
||||
}
|
||||
|
||||
void mmc_crypto_prepare_req(struct mmc_queue_req *mqrq)
|
||||
{
|
||||
struct request *req = mmc_queue_req_to_req(mqrq);
|
||||
struct mmc_request *mrq = &mqrq->brq.mrq;
|
||||
const struct bio_crypt_ctx *bc;
|
||||
|
||||
if (!bio_crypt_should_process(req))
|
||||
return;
|
||||
|
||||
bc = req->bio->bi_crypt_context;
|
||||
mrq->crypto_key_slot = bc->bc_keyslot;
|
||||
mrq->data_unit_num = bc->bc_dun[0];
|
||||
mrq->crypto_key = bc->bc_key;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mmc_crypto_prepare_req);
|
||||
33
drivers/mmc/core/crypto.h
Normal file
33
drivers/mmc/core/crypto.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright 2020 Google LLC
|
||||
*/
|
||||
|
||||
#ifndef _MMC_CORE_CRYPTO_H
|
||||
#define _MMC_CORE_CRYPTO_H
|
||||
|
||||
struct mmc_host;
|
||||
struct mmc_queue_req;
|
||||
struct request;
|
||||
struct request_queue;
|
||||
|
||||
#ifdef CONFIG_MMC_CRYPTO
|
||||
|
||||
void mmc_crypto_setup_queue(struct mmc_host *host, struct request_queue *q);
|
||||
|
||||
void mmc_crypto_free_host(struct mmc_host *host);
|
||||
|
||||
void mmc_crypto_prepare_req(struct mmc_queue_req *mqrq);
|
||||
|
||||
#else /* CONFIG_MMC_CRYPTO */
|
||||
|
||||
static inline void mmc_crypto_setup_queue(struct mmc_host *host,
|
||||
struct request_queue *q) { }
|
||||
|
||||
static inline void mmc_crypto_free_host(struct mmc_host *host) { }
|
||||
|
||||
static inline void mmc_crypto_prepare_req(struct mmc_queue_req *mqrq) { }
|
||||
|
||||
#endif /* CONFIG_MMC_CRYPTO */
|
||||
|
||||
#endif /* _MMC_CORE_CRYPTO_H */
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <linux/mmc/slot-gpio.h>
|
||||
|
||||
#include "core.h"
|
||||
#include "crypto.h"
|
||||
#include "host.h"
|
||||
#include "slot-gpio.h"
|
||||
#include "pwrseq.h"
|
||||
@@ -488,6 +489,7 @@ EXPORT_SYMBOL(mmc_remove_host);
|
||||
*/
|
||||
void mmc_free_host(struct mmc_host *host)
|
||||
{
|
||||
/* mmc_crypto_free_host(host); */
|
||||
mmc_pwrseq_free(host);
|
||||
put_device(&host->class_dev);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "queue.h"
|
||||
#include "block.h"
|
||||
#include "core.h"
|
||||
#include "crypto.h"
|
||||
#include "card.h"
|
||||
#include "mmc_crypto.h"
|
||||
|
||||
@@ -450,9 +451,6 @@ void mmc_cmdq_setup_queue(struct mmc_queue *mq, struct mmc_card *card)
|
||||
host->max_req_size / 512));
|
||||
blk_queue_max_segment_size(mq->queue, host->max_seg_size);
|
||||
blk_queue_max_segments(mq->queue, host->max_segs);
|
||||
|
||||
if (host->caps2 & MMC_CAP2_INLINECRYPT)
|
||||
queue_flag_set_unlocked(QUEUE_FLAG_INLINECRYPT, mq->queue);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -591,8 +589,6 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card,
|
||||
blk_queue_prep_rq(mq->queue, mmc_prep_request);
|
||||
queue_flag_set_unlocked(QUEUE_FLAG_NONROT, mq->queue);
|
||||
queue_flag_clear_unlocked(QUEUE_FLAG_ADD_RANDOM, mq->queue);
|
||||
if (host->caps2 & MMC_CAP2_INLINECRYPT)
|
||||
queue_flag_set_unlocked(QUEUE_FLAG_INLINECRYPT, mq->queue);
|
||||
if (mmc_can_erase(card))
|
||||
mmc_queue_setup_discard(mq->queue, card);
|
||||
|
||||
@@ -627,6 +623,7 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card,
|
||||
goto cleanup_queue;
|
||||
}
|
||||
|
||||
/* mmc_crypto_setup_queue(host, mq->queue); */
|
||||
return 0;
|
||||
|
||||
cleanup_queue:
|
||||
|
||||
@@ -357,6 +357,7 @@ static void __exit dsa_loop_exit(void)
|
||||
}
|
||||
module_exit(dsa_loop_exit);
|
||||
|
||||
MODULE_SOFTDEP("pre: dsa_loop_bdinfo");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_AUTHOR("Florian Fainelli");
|
||||
MODULE_DESCRIPTION("DSA loopback driver");
|
||||
|
||||
@@ -6827,6 +6827,7 @@ static netdev_features_t bnxt_fix_features(struct net_device *dev,
|
||||
netdev_features_t features)
|
||||
{
|
||||
struct bnxt *bp = netdev_priv(dev);
|
||||
netdev_features_t vlan_features;
|
||||
|
||||
if ((features & NETIF_F_NTUPLE) && !bnxt_rfs_capable(bp))
|
||||
features &= ~NETIF_F_NTUPLE;
|
||||
@@ -6834,12 +6835,14 @@ static netdev_features_t bnxt_fix_features(struct net_device *dev,
|
||||
/* Both CTAG and STAG VLAN accelaration on the RX side have to be
|
||||
* turned on or off together.
|
||||
*/
|
||||
if ((features & (NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_RX)) !=
|
||||
(NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_RX)) {
|
||||
vlan_features = features & (NETIF_F_HW_VLAN_CTAG_RX |
|
||||
NETIF_F_HW_VLAN_STAG_RX);
|
||||
if (vlan_features != (NETIF_F_HW_VLAN_CTAG_RX |
|
||||
NETIF_F_HW_VLAN_STAG_RX)) {
|
||||
if (dev->features & NETIF_F_HW_VLAN_CTAG_RX)
|
||||
features &= ~(NETIF_F_HW_VLAN_CTAG_RX |
|
||||
NETIF_F_HW_VLAN_STAG_RX);
|
||||
else
|
||||
else if (vlan_features)
|
||||
features |= NETIF_F_HW_VLAN_CTAG_RX |
|
||||
NETIF_F_HW_VLAN_STAG_RX;
|
||||
}
|
||||
@@ -8420,8 +8423,11 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev)
|
||||
}
|
||||
}
|
||||
|
||||
if (result != PCI_ERS_RESULT_RECOVERED && netif_running(netdev))
|
||||
dev_close(netdev);
|
||||
if (result != PCI_ERS_RESULT_RECOVERED) {
|
||||
if (netif_running(netdev))
|
||||
dev_close(netdev);
|
||||
pci_disable_device(pdev);
|
||||
}
|
||||
|
||||
rtnl_unlock();
|
||||
|
||||
@@ -8432,7 +8438,7 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev)
|
||||
err); /* non-fatal, continue */
|
||||
}
|
||||
|
||||
return PCI_ERS_RESULT_RECOVERED;
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -774,7 +774,6 @@ struct bnxt_vf_info {
|
||||
#define BNXT_VF_SPOOFCHK 0x2
|
||||
#define BNXT_VF_LINK_FORCED 0x4
|
||||
#define BNXT_VF_LINK_UP 0x8
|
||||
u32 func_flags; /* func cfg flags */
|
||||
u32 min_tx_rate;
|
||||
u32 max_tx_rate;
|
||||
void *hwrm_cmd_req_addr;
|
||||
|
||||
@@ -99,11 +99,10 @@ int bnxt_set_vf_spoofchk(struct net_device *dev, int vf_id, bool setting)
|
||||
if (old_setting == setting)
|
||||
return 0;
|
||||
|
||||
func_flags = vf->func_flags;
|
||||
if (setting)
|
||||
func_flags |= FUNC_CFG_REQ_FLAGS_SRC_MAC_ADDR_CHECK_ENABLE;
|
||||
func_flags = FUNC_CFG_REQ_FLAGS_SRC_MAC_ADDR_CHECK_ENABLE;
|
||||
else
|
||||
func_flags |= FUNC_CFG_REQ_FLAGS_SRC_MAC_ADDR_CHECK_DISABLE;
|
||||
func_flags = FUNC_CFG_REQ_FLAGS_SRC_MAC_ADDR_CHECK_DISABLE;
|
||||
/*TODO: if the driver supports VLAN filter on guest VLAN,
|
||||
* the spoof check should also include vlan anti-spoofing
|
||||
*/
|
||||
@@ -112,7 +111,6 @@ int bnxt_set_vf_spoofchk(struct net_device *dev, int vf_id, bool setting)
|
||||
req.flags = cpu_to_le32(func_flags);
|
||||
rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
|
||||
if (!rc) {
|
||||
vf->func_flags = func_flags;
|
||||
if (setting)
|
||||
vf->flags |= BNXT_VF_SPOOFCHK;
|
||||
else
|
||||
@@ -176,7 +174,6 @@ int bnxt_set_vf_mac(struct net_device *dev, int vf_id, u8 *mac)
|
||||
memcpy(vf->mac_addr, mac, ETH_ALEN);
|
||||
bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_CFG, -1, -1);
|
||||
req.fid = cpu_to_le16(vf->fw_fid);
|
||||
req.flags = cpu_to_le32(vf->func_flags);
|
||||
req.enables = cpu_to_le32(FUNC_CFG_REQ_ENABLES_DFLT_MAC_ADDR);
|
||||
memcpy(req.dflt_mac_addr, mac, ETH_ALEN);
|
||||
return hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
|
||||
@@ -214,7 +211,6 @@ int bnxt_set_vf_vlan(struct net_device *dev, int vf_id, u16 vlan_id, u8 qos,
|
||||
|
||||
bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_CFG, -1, -1);
|
||||
req.fid = cpu_to_le16(vf->fw_fid);
|
||||
req.flags = cpu_to_le32(vf->func_flags);
|
||||
req.dflt_vlan = cpu_to_le16(vlan_tag);
|
||||
req.enables = cpu_to_le32(FUNC_CFG_REQ_ENABLES_DFLT_VLAN);
|
||||
rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
|
||||
@@ -253,7 +249,6 @@ int bnxt_set_vf_bw(struct net_device *dev, int vf_id, int min_tx_rate,
|
||||
return 0;
|
||||
bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_CFG, -1, -1);
|
||||
req.fid = cpu_to_le16(vf->fw_fid);
|
||||
req.flags = cpu_to_le32(vf->func_flags);
|
||||
req.enables = cpu_to_le32(FUNC_CFG_REQ_ENABLES_MAX_BW);
|
||||
req.max_bw = cpu_to_le32(max_tx_rate);
|
||||
req.enables |= cpu_to_le32(FUNC_CFG_REQ_ENABLES_MIN_BW);
|
||||
|
||||
@@ -54,6 +54,8 @@
|
||||
|
||||
#define MGMT_MSG_TIMEOUT 5000
|
||||
|
||||
#define SET_FUNC_PORT_MGMT_TIMEOUT 25000
|
||||
|
||||
#define mgmt_to_pfhwdev(pf_mgmt) \
|
||||
container_of(pf_mgmt, struct hinic_pfhwdev, pf_to_mgmt)
|
||||
|
||||
@@ -247,12 +249,13 @@ static int msg_to_mgmt_sync(struct hinic_pf_to_mgmt *pf_to_mgmt,
|
||||
u8 *buf_in, u16 in_size,
|
||||
u8 *buf_out, u16 *out_size,
|
||||
enum mgmt_direction_type direction,
|
||||
u16 resp_msg_id)
|
||||
u16 resp_msg_id, u32 timeout)
|
||||
{
|
||||
struct hinic_hwif *hwif = pf_to_mgmt->hwif;
|
||||
struct pci_dev *pdev = hwif->pdev;
|
||||
struct hinic_recv_msg *recv_msg;
|
||||
struct completion *recv_done;
|
||||
unsigned long timeo;
|
||||
u16 msg_id;
|
||||
int err;
|
||||
|
||||
@@ -276,8 +279,9 @@ static int msg_to_mgmt_sync(struct hinic_pf_to_mgmt *pf_to_mgmt,
|
||||
goto unlock_sync_msg;
|
||||
}
|
||||
|
||||
if (!wait_for_completion_timeout(recv_done,
|
||||
msecs_to_jiffies(MGMT_MSG_TIMEOUT))) {
|
||||
timeo = msecs_to_jiffies(timeout ? timeout : MGMT_MSG_TIMEOUT);
|
||||
|
||||
if (!wait_for_completion_timeout(recv_done, timeo)) {
|
||||
dev_err(&pdev->dev, "MGMT timeout, MSG id = %d\n", msg_id);
|
||||
err = -ETIMEDOUT;
|
||||
goto unlock_sync_msg;
|
||||
@@ -351,6 +355,7 @@ int hinic_msg_to_mgmt(struct hinic_pf_to_mgmt *pf_to_mgmt,
|
||||
{
|
||||
struct hinic_hwif *hwif = pf_to_mgmt->hwif;
|
||||
struct pci_dev *pdev = hwif->pdev;
|
||||
u32 timeout = 0;
|
||||
|
||||
if (sync != HINIC_MGMT_MSG_SYNC) {
|
||||
dev_err(&pdev->dev, "Invalid MGMT msg type\n");
|
||||
@@ -362,9 +367,12 @@ int hinic_msg_to_mgmt(struct hinic_pf_to_mgmt *pf_to_mgmt,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (cmd == HINIC_PORT_CMD_SET_FUNC_STATE)
|
||||
timeout = SET_FUNC_PORT_MGMT_TIMEOUT;
|
||||
|
||||
return msg_to_mgmt_sync(pf_to_mgmt, mod, cmd, buf_in, in_size,
|
||||
buf_out, out_size, MGMT_DIRECT_SEND,
|
||||
MSG_NOT_RESP);
|
||||
MSG_NOT_RESP, timeout);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -473,7 +473,6 @@ static int hinic_close(struct net_device *netdev)
|
||||
{
|
||||
struct hinic_dev *nic_dev = netdev_priv(netdev);
|
||||
unsigned int flags;
|
||||
int err;
|
||||
|
||||
down(&nic_dev->mgmt_lock);
|
||||
|
||||
@@ -487,20 +486,9 @@ static int hinic_close(struct net_device *netdev)
|
||||
|
||||
up(&nic_dev->mgmt_lock);
|
||||
|
||||
err = hinic_port_set_func_state(nic_dev, HINIC_FUNC_PORT_DISABLE);
|
||||
if (err) {
|
||||
netif_err(nic_dev, drv, netdev,
|
||||
"Failed to set func port state\n");
|
||||
nic_dev->flags |= (flags & HINIC_INTF_UP);
|
||||
return err;
|
||||
}
|
||||
hinic_port_set_state(nic_dev, HINIC_PORT_DISABLE);
|
||||
|
||||
err = hinic_port_set_state(nic_dev, HINIC_PORT_DISABLE);
|
||||
if (err) {
|
||||
netif_err(nic_dev, drv, netdev, "Failed to set port state\n");
|
||||
nic_dev->flags |= (flags & HINIC_INTF_UP);
|
||||
return err;
|
||||
}
|
||||
hinic_port_set_func_state(nic_dev, HINIC_FUNC_PORT_DISABLE);
|
||||
|
||||
free_rxqs(nic_dev);
|
||||
free_txqs(nic_dev);
|
||||
|
||||
@@ -2503,6 +2503,7 @@ static int mlx4_allocate_default_counters(struct mlx4_dev *dev)
|
||||
|
||||
if (!err || err == -ENOSPC) {
|
||||
priv->def_counter[port] = idx;
|
||||
err = 0;
|
||||
} else if (err == -ENOENT) {
|
||||
err = 0;
|
||||
continue;
|
||||
@@ -2553,7 +2554,8 @@ int mlx4_counter_alloc(struct mlx4_dev *dev, u32 *idx, u8 usage)
|
||||
MLX4_CMD_TIME_CLASS_A, MLX4_CMD_WRAPPED);
|
||||
if (!err)
|
||||
*idx = get_param_l(&out_param);
|
||||
|
||||
if (WARN_ON(err == -ENOSPC))
|
||||
err = -EINVAL;
|
||||
return err;
|
||||
}
|
||||
return __mlx4_counter_alloc(dev, idx);
|
||||
|
||||
@@ -831,7 +831,6 @@ static void cmd_work_handler(struct work_struct *work)
|
||||
}
|
||||
|
||||
cmd->ent_arr[ent->idx] = ent;
|
||||
set_bit(MLX5_CMD_ENT_STATE_PENDING_COMP, &ent->state);
|
||||
lay = get_inst(cmd, ent->idx);
|
||||
ent->lay = lay;
|
||||
memset(lay, 0, sizeof(*lay));
|
||||
@@ -853,6 +852,7 @@ static void cmd_work_handler(struct work_struct *work)
|
||||
|
||||
if (ent->callback)
|
||||
schedule_delayed_work(&ent->cb_timeout_work, cb_timeout);
|
||||
set_bit(MLX5_CMD_ENT_STATE_PENDING_COMP, &ent->state);
|
||||
|
||||
/* Skip sending command to fw if internal error */
|
||||
if (pci_channel_offline(dev->pdev) ||
|
||||
@@ -865,6 +865,10 @@ static void cmd_work_handler(struct work_struct *work)
|
||||
MLX5_SET(mbox_out, ent->out, syndrome, drv_synd);
|
||||
|
||||
mlx5_cmd_comp_handler(dev, 1UL << ent->idx, true);
|
||||
/* no doorbell, no need to keep the entry */
|
||||
free_ent(cmd, ent->idx);
|
||||
if (ent->callback)
|
||||
free_cmd(ent);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1550,12 +1550,11 @@ static int mlx5e_route_lookup_ipv6(struct mlx5e_priv *priv,
|
||||
|
||||
#if IS_ENABLED(CONFIG_INET) && IS_ENABLED(CONFIG_IPV6)
|
||||
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
|
||||
int ret;
|
||||
|
||||
ret = ipv6_stub->ipv6_dst_lookup(dev_net(mirred_dev), NULL, &dst,
|
||||
fl6);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
dst = ipv6_stub->ipv6_dst_lookup_flow(dev_net(mirred_dev), NULL, fl6,
|
||||
NULL);
|
||||
if (IS_ERR(dst))
|
||||
return PTR_ERR(dst);
|
||||
|
||||
*out_ttl = ip6_dst_hoplimit(dst);
|
||||
|
||||
@@ -1754,7 +1753,7 @@ static int mlx5e_create_encap_header_ipv6(struct mlx5e_priv *priv,
|
||||
int max_encap_size = MLX5_CAP_ESW(priv->mdev, max_encap_header_size);
|
||||
int ipv6_encap_size = ETH_HLEN + sizeof(struct ipv6hdr) + VXLAN_HLEN;
|
||||
struct ip_tunnel_key *tun_key = &e->tun_info.key;
|
||||
struct net_device *out_dev;
|
||||
struct net_device *out_dev = NULL;
|
||||
struct neighbour *n = NULL;
|
||||
struct flowi6 fl6 = {};
|
||||
char *encap_header;
|
||||
|
||||
@@ -561,7 +561,7 @@ static int moxart_remove(struct platform_device *pdev)
|
||||
struct net_device *ndev = platform_get_drvdata(pdev);
|
||||
|
||||
unregister_netdev(ndev);
|
||||
free_irq(ndev->irq, ndev);
|
||||
devm_free_irq(&pdev->dev, ndev->irq, ndev);
|
||||
moxart_mac_free_memory(ndev);
|
||||
free_netdev(ndev);
|
||||
|
||||
|
||||
@@ -247,13 +247,15 @@ static int jazz_sonic_probe(struct platform_device *pdev)
|
||||
goto out;
|
||||
err = register_netdev(dev);
|
||||
if (err)
|
||||
goto out1;
|
||||
goto undo_probe1;
|
||||
|
||||
printk("%s: MAC %pM IRQ %d\n", dev->name, dev->dev_addr, dev->irq);
|
||||
|
||||
return 0;
|
||||
|
||||
out1:
|
||||
undo_probe1:
|
||||
dma_free_coherent(lp->device, SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode),
|
||||
lp->descriptors, lp->descriptors_laddr);
|
||||
release_mem_region(dev->base_addr, SONIC_MEM_SIZE);
|
||||
out:
|
||||
free_netdev(dev);
|
||||
|
||||
@@ -96,7 +96,7 @@ struct stmmac_priv {
|
||||
struct net_device *dev;
|
||||
struct device *device;
|
||||
struct mac_device_info *hw;
|
||||
spinlock_t lock;
|
||||
struct mutex lock;
|
||||
|
||||
/* RX Queue */
|
||||
struct stmmac_rx_queue rx_queue[MTL_MAX_RX_QUEUES];
|
||||
|
||||
@@ -392,13 +392,13 @@ stmmac_ethtool_set_link_ksettings(struct net_device *dev,
|
||||
ADVERTISED_10baseT_Half |
|
||||
ADVERTISED_10baseT_Full);
|
||||
|
||||
spin_lock(&priv->lock);
|
||||
mutex_lock(&priv->lock);
|
||||
|
||||
if (priv->hw->mac->pcs_ctrl_ane)
|
||||
priv->hw->mac->pcs_ctrl_ane(priv->ioaddr, 1,
|
||||
priv->hw->ps, 0);
|
||||
|
||||
spin_unlock(&priv->lock);
|
||||
mutex_unlock(&priv->lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -615,12 +615,12 @@ static void stmmac_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
|
||||
{
|
||||
struct stmmac_priv *priv = netdev_priv(dev);
|
||||
|
||||
spin_lock_irq(&priv->lock);
|
||||
mutex_lock(&priv->lock);
|
||||
if (device_can_wakeup(priv->device)) {
|
||||
wol->supported = WAKE_MAGIC | WAKE_UCAST;
|
||||
wol->wolopts = priv->wolopts;
|
||||
}
|
||||
spin_unlock_irq(&priv->lock);
|
||||
mutex_unlock(&priv->lock);
|
||||
}
|
||||
|
||||
static int stmmac_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
|
||||
@@ -649,9 +649,9 @@ static int stmmac_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
|
||||
disable_irq_wake(priv->wol_irq);
|
||||
}
|
||||
|
||||
spin_lock_irq(&priv->lock);
|
||||
mutex_lock(&priv->lock);
|
||||
priv->wolopts = wol->wolopts;
|
||||
spin_unlock_irq(&priv->lock);
|
||||
mutex_unlock(&priv->lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -365,7 +365,6 @@ bool stmmac_eee_init(struct stmmac_priv *priv)
|
||||
{
|
||||
struct net_device *ndev = priv->dev;
|
||||
int interface = priv->plat->interface;
|
||||
unsigned long flags;
|
||||
bool ret = false;
|
||||
|
||||
if ((interface != PHY_INTERFACE_MODE_MII) &&
|
||||
@@ -392,7 +391,7 @@ bool stmmac_eee_init(struct stmmac_priv *priv)
|
||||
* changed).
|
||||
* In that case the driver disable own timers.
|
||||
*/
|
||||
spin_lock_irqsave(&priv->lock, flags);
|
||||
mutex_lock(&priv->lock);
|
||||
if (priv->eee_active) {
|
||||
netdev_dbg(priv->dev, "disable EEE\n");
|
||||
del_timer_sync(&priv->eee_ctrl_timer);
|
||||
@@ -400,11 +399,11 @@ bool stmmac_eee_init(struct stmmac_priv *priv)
|
||||
tx_lpi_timer);
|
||||
}
|
||||
priv->eee_active = 0;
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
mutex_unlock(&priv->lock);
|
||||
goto out;
|
||||
}
|
||||
/* Activate the EEE and start timers */
|
||||
spin_lock_irqsave(&priv->lock, flags);
|
||||
mutex_lock(&priv->lock);
|
||||
if (!priv->eee_active) {
|
||||
priv->eee_active = 1;
|
||||
setup_timer(&priv->eee_ctrl_timer,
|
||||
@@ -421,7 +420,7 @@ bool stmmac_eee_init(struct stmmac_priv *priv)
|
||||
priv->hw->mac->set_eee_pls(priv->hw, ndev->phydev->link);
|
||||
|
||||
ret = true;
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
mutex_unlock(&priv->lock);
|
||||
|
||||
netdev_dbg(priv->dev, "Energy-Efficient Ethernet initialized\n");
|
||||
}
|
||||
@@ -799,13 +798,12 @@ static void stmmac_adjust_link(struct net_device *dev)
|
||||
{
|
||||
struct stmmac_priv *priv = netdev_priv(dev);
|
||||
struct phy_device *phydev = dev->phydev;
|
||||
unsigned long flags;
|
||||
bool new_state = false;
|
||||
|
||||
if (!phydev)
|
||||
return;
|
||||
|
||||
spin_lock_irqsave(&priv->lock, flags);
|
||||
mutex_lock(&priv->lock);
|
||||
|
||||
if (phydev->link) {
|
||||
u32 ctrl = readl(priv->ioaddr + MAC_CTRL_REG);
|
||||
@@ -864,7 +862,7 @@ static void stmmac_adjust_link(struct net_device *dev)
|
||||
if (new_state && netif_msg_link(priv))
|
||||
phy_print_status(phydev);
|
||||
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
mutex_unlock(&priv->lock);
|
||||
|
||||
if (phydev->is_pseudo_fixed_link)
|
||||
/* Stop PHY layer to call the hook to adjust the link in case
|
||||
@@ -4284,7 +4282,7 @@ int stmmac_dvr_probe(struct device *device,
|
||||
(8 * priv->plat->rx_queues_to_use));
|
||||
}
|
||||
|
||||
spin_lock_init(&priv->lock);
|
||||
mutex_init(&priv->lock);
|
||||
|
||||
/* If a specific clk_csr value is passed from the platform
|
||||
* this means that the CSR Clock Range selection cannot be
|
||||
@@ -4375,6 +4373,7 @@ int stmmac_dvr_remove(struct device *dev)
|
||||
priv->hw->pcs != STMMAC_PCS_TBI &&
|
||||
priv->hw->pcs != STMMAC_PCS_RTBI)
|
||||
stmmac_mdio_unregister(ndev);
|
||||
mutex_destroy(&priv->lock);
|
||||
free_netdev(ndev);
|
||||
|
||||
return 0;
|
||||
@@ -4392,7 +4391,6 @@ int stmmac_suspend(struct device *dev)
|
||||
{
|
||||
struct net_device *ndev = dev_get_drvdata(dev);
|
||||
struct stmmac_priv *priv = netdev_priv(ndev);
|
||||
unsigned long flags;
|
||||
|
||||
if (!ndev || !netif_running(ndev))
|
||||
return 0;
|
||||
@@ -4400,7 +4398,7 @@ int stmmac_suspend(struct device *dev)
|
||||
if (ndev->phydev)
|
||||
phy_stop(ndev->phydev);
|
||||
|
||||
spin_lock_irqsave(&priv->lock, flags);
|
||||
mutex_lock(&priv->lock);
|
||||
|
||||
netif_device_detach(ndev);
|
||||
stmmac_stop_all_queues(priv);
|
||||
@@ -4423,7 +4421,7 @@ int stmmac_suspend(struct device *dev)
|
||||
clk_disable_unprepare(priv->plat->pclk);
|
||||
clk_disable_unprepare(priv->plat->stmmac_clk);
|
||||
}
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
mutex_unlock(&priv->lock);
|
||||
|
||||
priv->oldlink = false;
|
||||
priv->speed = SPEED_UNKNOWN;
|
||||
@@ -4467,7 +4465,6 @@ int stmmac_resume(struct device *dev)
|
||||
{
|
||||
struct net_device *ndev = dev_get_drvdata(dev);
|
||||
struct stmmac_priv *priv = netdev_priv(ndev);
|
||||
unsigned long flags;
|
||||
|
||||
if (!netif_running(ndev))
|
||||
return 0;
|
||||
@@ -4479,9 +4476,9 @@ int stmmac_resume(struct device *dev)
|
||||
* from another devices (e.g. serial console).
|
||||
*/
|
||||
if (device_may_wakeup(priv->device)) {
|
||||
spin_lock_irqsave(&priv->lock, flags);
|
||||
mutex_lock(&priv->lock);
|
||||
priv->hw->mac->pmt(priv->hw, 0);
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
mutex_unlock(&priv->lock);
|
||||
priv->irq_wake = 0;
|
||||
} else {
|
||||
pinctrl_pm_select_default_state(priv->device);
|
||||
@@ -4497,7 +4494,7 @@ int stmmac_resume(struct device *dev)
|
||||
|
||||
netif_device_attach(ndev);
|
||||
|
||||
spin_lock_irqsave(&priv->lock, flags);
|
||||
mutex_lock(&priv->lock);
|
||||
|
||||
stmmac_reset_queues_param(priv);
|
||||
|
||||
@@ -4516,7 +4513,7 @@ int stmmac_resume(struct device *dev)
|
||||
|
||||
stmmac_start_all_queues(priv);
|
||||
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
mutex_unlock(&priv->lock);
|
||||
|
||||
if (ndev->phydev)
|
||||
phy_start(ndev->phydev);
|
||||
|
||||
@@ -797,7 +797,9 @@ static struct dst_entry *geneve_get_v6_dst(struct sk_buff *skb,
|
||||
if (dst)
|
||||
return dst;
|
||||
}
|
||||
if (ipv6_stub->ipv6_dst_lookup(geneve->net, gs6->sock->sk, &dst, fl6)) {
|
||||
dst = ipv6_stub->ipv6_dst_lookup_flow(geneve->net, gs6->sock->sk, fl6,
|
||||
NULL);
|
||||
if (IS_ERR(dst)) {
|
||||
netdev_dbg(dev, "no route to %pI6\n", &fl6->daddr);
|
||||
return ERR_PTR(-ENETUNREACH);
|
||||
}
|
||||
@@ -1370,21 +1372,33 @@ static int geneve_nl2info(struct nlattr *tb[], struct nlattr *data[],
|
||||
}
|
||||
|
||||
if (data[IFLA_GENEVE_UDP_ZERO_CSUM6_TX]) {
|
||||
#if IS_ENABLED(CONFIG_IPV6)
|
||||
if (changelink) {
|
||||
attrtype = IFLA_GENEVE_UDP_ZERO_CSUM6_TX;
|
||||
goto change_notsup;
|
||||
}
|
||||
if (nla_get_u8(data[IFLA_GENEVE_UDP_ZERO_CSUM6_TX]))
|
||||
info->key.tun_flags &= ~TUNNEL_CSUM;
|
||||
#else
|
||||
NL_SET_ERR_MSG_ATTR(extack, data[IFLA_GENEVE_UDP_ZERO_CSUM6_TX],
|
||||
"IPv6 support not enabled in the kernel");
|
||||
return -EPFNOSUPPORT;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (data[IFLA_GENEVE_UDP_ZERO_CSUM6_RX]) {
|
||||
#if IS_ENABLED(CONFIG_IPV6)
|
||||
if (changelink) {
|
||||
attrtype = IFLA_GENEVE_UDP_ZERO_CSUM6_RX;
|
||||
goto change_notsup;
|
||||
}
|
||||
if (nla_get_u8(data[IFLA_GENEVE_UDP_ZERO_CSUM6_RX]))
|
||||
*use_udp6_rx_checksums = false;
|
||||
#else
|
||||
NL_SET_ERR_MSG_ATTR(extack, data[IFLA_GENEVE_UDP_ZERO_CSUM6_RX],
|
||||
"IPv6 support not enabled in the kernel");
|
||||
return -EPFNOSUPPORT;
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -1560,11 +1574,13 @@ static int geneve_fill_info(struct sk_buff *skb, const struct net_device *dev)
|
||||
goto nla_put_failure;
|
||||
|
||||
if (metadata && nla_put_flag(skb, IFLA_GENEVE_COLLECT_METADATA))
|
||||
goto nla_put_failure;
|
||||
goto nla_put_failure;
|
||||
|
||||
#if IS_ENABLED(CONFIG_IPV6)
|
||||
if (nla_put_u8(skb, IFLA_GENEVE_UDP_ZERO_CSUM6_RX,
|
||||
!geneve->use_udp6_rx_checksums))
|
||||
goto nla_put_failure;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
|
||||
@@ -1309,7 +1309,8 @@ static struct crypto_aead *macsec_alloc_tfm(char *key, int key_len, int icv_len)
|
||||
struct crypto_aead *tfm;
|
||||
int ret;
|
||||
|
||||
tfm = crypto_alloc_aead("gcm(aes)", 0, 0);
|
||||
/* Pick a sync gcm(aes) cipher to ensure order is preserved. */
|
||||
tfm = crypto_alloc_aead("gcm(aes)", 0, CRYPTO_ALG_ASYNC);
|
||||
|
||||
if (IS_ERR(tfm))
|
||||
return tfm;
|
||||
|
||||
@@ -1110,7 +1110,7 @@ static struct dp83640_clock *dp83640_clock_get_bus(struct mii_bus *bus)
|
||||
goto out;
|
||||
}
|
||||
dp83640_clock_init(clock, bus);
|
||||
list_add_tail(&phyter_clocks, &clock->list);
|
||||
list_add_tail(&clock->list, &phyter_clocks);
|
||||
out:
|
||||
mutex_unlock(&phyter_clocks_lock);
|
||||
|
||||
|
||||
@@ -674,8 +674,8 @@ static void kszphy_get_strings(struct phy_device *phydev, u8 *data)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(kszphy_hw_stats); i++) {
|
||||
memcpy(data + i * ETH_GSTRING_LEN,
|
||||
kszphy_hw_stats[i].string, ETH_GSTRING_LEN);
|
||||
strlcpy(data + i * ETH_GSTRING_LEN,
|
||||
kszphy_hw_stats[i].string, ETH_GSTRING_LEN);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1257,9 +1257,11 @@ int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_eee *data)
|
||||
/* Restart autonegotiation so the new modes get sent to the
|
||||
* link partner.
|
||||
*/
|
||||
ret = phy_restart_aneg(phydev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (phydev->autoneg == AUTONEG_ENABLE) {
|
||||
ret = phy_restart_aneg(phydev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -1283,6 +1283,7 @@ static const struct usb_device_id products[] = {
|
||||
{QMI_FIXED_INTF(0x413c, 0x81b3, 8)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card (rev3) */
|
||||
{QMI_FIXED_INTF(0x413c, 0x81b6, 8)}, /* Dell Wireless 5811e */
|
||||
{QMI_FIXED_INTF(0x413c, 0x81b6, 10)}, /* Dell Wireless 5811e */
|
||||
{QMI_FIXED_INTF(0x413c, 0x81cc, 8)}, /* Dell Wireless 5816e */
|
||||
{QMI_FIXED_INTF(0x413c, 0x81d7, 0)}, /* Dell Wireless 5821e */
|
||||
{QMI_FIXED_INTF(0x413c, 0x81d7, 1)}, /* Dell Wireless 5821e preproduction config */
|
||||
{QMI_FIXED_INTF(0x413c, 0x81e0, 0)}, /* Dell Wireless 5821e with eSIM support*/
|
||||
|
||||
@@ -1963,7 +1963,6 @@ static struct dst_entry *vxlan6_get_route(struct vxlan_dev *vxlan,
|
||||
bool use_cache = ip_tunnel_dst_cache_usable(skb, info);
|
||||
struct dst_entry *ndst;
|
||||
struct flowi6 fl6;
|
||||
int err;
|
||||
|
||||
if (!sock6)
|
||||
return ERR_PTR(-EIO);
|
||||
@@ -1986,10 +1985,9 @@ static struct dst_entry *vxlan6_get_route(struct vxlan_dev *vxlan,
|
||||
fl6.fl6_dport = dport;
|
||||
fl6.fl6_sport = sport;
|
||||
|
||||
err = ipv6_stub->ipv6_dst_lookup(vxlan->net,
|
||||
sock6->sock->sk,
|
||||
&ndst, &fl6);
|
||||
if (unlikely(err < 0)) {
|
||||
ndst = ipv6_stub->ipv6_dst_lookup_flow(vxlan->net, sock6->sock->sk,
|
||||
&fl6, NULL);
|
||||
if (unlikely(IS_ERR(ndst))) {
|
||||
netdev_dbg(dev, "no route to %pI6\n", daddr);
|
||||
return ERR_PTR(-ENETUNREACH);
|
||||
}
|
||||
|
||||
@@ -1503,6 +1503,7 @@ static const struct gpio_chip byt_gpio_chip = {
|
||||
.direction_output = byt_gpio_direction_output,
|
||||
.get = byt_gpio_get,
|
||||
.set = byt_gpio_set,
|
||||
.set_config = gpiochip_generic_config,
|
||||
.dbg_show = byt_gpio_dbg_show,
|
||||
};
|
||||
|
||||
|
||||
@@ -1514,11 +1514,15 @@ static void chv_gpio_irq_handler(struct irq_desc *desc)
|
||||
struct chv_pinctrl *pctrl = gpiochip_get_data(gc);
|
||||
struct irq_chip *chip = irq_desc_get_chip(desc);
|
||||
unsigned long pending;
|
||||
unsigned long flags;
|
||||
u32 intr_line;
|
||||
|
||||
chained_irq_enter(chip, desc);
|
||||
|
||||
raw_spin_lock_irqsave(&chv_lock, flags);
|
||||
pending = readl(pctrl->regs + CHV_INTSTAT);
|
||||
raw_spin_unlock_irqrestore(&chv_lock, flags);
|
||||
|
||||
for_each_set_bit(intr_line, &pending, pctrl->community->nirqs) {
|
||||
unsigned irq, offset;
|
||||
|
||||
|
||||
@@ -695,8 +695,10 @@ sg_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos)
|
||||
hp->flags = input_size; /* structure abuse ... */
|
||||
hp->pack_id = old_hdr.pack_id;
|
||||
hp->usr_ptr = NULL;
|
||||
if (__copy_from_user(cmnd, buf, cmd_size))
|
||||
if (__copy_from_user(cmnd, buf, cmd_size)) {
|
||||
sg_remove_request(sfp, srp);
|
||||
return -EFAULT;
|
||||
}
|
||||
/*
|
||||
* SG_DXFER_TO_FROM_DEV is functionally equivalent to SG_DXFER_FROM_DEV,
|
||||
* but is is possible that the app intended SG_DXFER_TO_DEV, because there
|
||||
|
||||
@@ -344,6 +344,7 @@ int ufshcd_hba_init_crypto_spec(struct ufs_hba *hba,
|
||||
err = -ENOMEM;
|
||||
goto out_free_caps;
|
||||
}
|
||||
keyslot_manager_set_max_dun_bytes(hba->ksm, sizeof(u64));
|
||||
|
||||
return 0;
|
||||
|
||||
|
||||
@@ -423,6 +423,7 @@ struct ufs_hba_crypto_variant_ops {
|
||||
struct scsi_cmnd *cmd,
|
||||
struct ufshcd_lrb *lrbp);
|
||||
void *priv;
|
||||
void *crypto_DO_NOT_USE[8];
|
||||
};
|
||||
|
||||
/* clock gating state */
|
||||
@@ -939,6 +940,7 @@ struct ufs_hba {
|
||||
union ufs_crypto_cap_entry *crypto_cap_array;
|
||||
u32 crypto_cfg_register;
|
||||
struct keyslot_manager *ksm;
|
||||
void *crypto_DO_NOT_USE[8];
|
||||
#endif /* CONFIG_SCSI_UFS_CRYPTO */
|
||||
};
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
|
||||
#define USB_VENDOR_GENESYS_LOGIC 0x05e3
|
||||
#define USB_VENDOR_SMSC 0x0424
|
||||
#define USB_PRODUCT_USB5534B 0x5534
|
||||
#define HUB_QUIRK_CHECK_PORT_AUTOSUSPEND 0x01
|
||||
#define HUB_QUIRK_DISABLE_AUTOSUSPEND 0x02
|
||||
|
||||
@@ -5322,8 +5323,11 @@ out_hdev_lock:
|
||||
}
|
||||
|
||||
static const struct usb_device_id hub_id_table[] = {
|
||||
{ .match_flags = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_INT_CLASS,
|
||||
{ .match_flags = USB_DEVICE_ID_MATCH_VENDOR
|
||||
| USB_DEVICE_ID_MATCH_PRODUCT
|
||||
| USB_DEVICE_ID_MATCH_INT_CLASS,
|
||||
.idVendor = USB_VENDOR_SMSC,
|
||||
.idProduct = USB_PRODUCT_USB5534B,
|
||||
.bInterfaceClass = USB_CLASS_HUB,
|
||||
.driver_info = HUB_QUIRK_DISABLE_AUTOSUSPEND},
|
||||
{ .match_flags = USB_DEVICE_ID_MATCH_VENDOR
|
||||
|
||||
@@ -310,6 +310,9 @@ static ssize_t gadget_dev_desc_UDC_store(struct config_item *item,
|
||||
char *name;
|
||||
int ret;
|
||||
|
||||
if (strlen(page) < len)
|
||||
return -EOVERFLOW;
|
||||
|
||||
name = kstrdup(page, GFP_KERNEL);
|
||||
if (!name)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -303,8 +303,10 @@ static int audio_bind(struct usb_composite_dev *cdev)
|
||||
struct usb_descriptor_header *usb_desc;
|
||||
|
||||
usb_desc = usb_otg_descriptor_alloc(cdev->gadget);
|
||||
if (!usb_desc)
|
||||
if (!usb_desc) {
|
||||
status = -ENOMEM;
|
||||
goto fail;
|
||||
}
|
||||
usb_otg_descriptor_init(cdev->gadget, usb_desc);
|
||||
otg_desc[0] = usb_desc;
|
||||
otg_desc[1] = NULL;
|
||||
|
||||
@@ -183,8 +183,10 @@ static int cdc_bind(struct usb_composite_dev *cdev)
|
||||
struct usb_descriptor_header *usb_desc;
|
||||
|
||||
usb_desc = usb_otg_descriptor_alloc(gadget);
|
||||
if (!usb_desc)
|
||||
if (!usb_desc) {
|
||||
status = -ENOMEM;
|
||||
goto fail1;
|
||||
}
|
||||
usb_otg_descriptor_init(gadget, usb_desc);
|
||||
otg_desc[0] = usb_desc;
|
||||
otg_desc[1] = NULL;
|
||||
|
||||
@@ -162,8 +162,10 @@ static int gncm_bind(struct usb_composite_dev *cdev)
|
||||
struct usb_descriptor_header *usb_desc;
|
||||
|
||||
usb_desc = usb_otg_descriptor_alloc(gadget);
|
||||
if (!usb_desc)
|
||||
if (!usb_desc) {
|
||||
status = -ENOMEM;
|
||||
goto fail;
|
||||
}
|
||||
usb_otg_descriptor_init(gadget, usb_desc);
|
||||
otg_desc[0] = usb_desc;
|
||||
otg_desc[1] = NULL;
|
||||
|
||||
@@ -2666,6 +2666,8 @@ net2272_plat_probe(struct platform_device *pdev)
|
||||
err_req:
|
||||
release_mem_region(base, len);
|
||||
err:
|
||||
kfree(dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -334,6 +334,7 @@ static int xhci_plat_remove(struct platform_device *dev)
|
||||
struct clk *clk = xhci->clk;
|
||||
struct usb_hcd *shared_hcd = xhci->shared_hcd;
|
||||
|
||||
pm_runtime_get_sync(&dev->dev);
|
||||
xhci->xhc_state |= XHCI_STATE_REMOVING;
|
||||
|
||||
usb_remove_hcd(shared_hcd);
|
||||
@@ -347,8 +348,9 @@ static int xhci_plat_remove(struct platform_device *dev)
|
||||
clk_disable_unprepare(clk);
|
||||
usb_put_hcd(hcd);
|
||||
|
||||
pm_runtime_set_suspended(&dev->dev);
|
||||
pm_runtime_disable(&dev->dev);
|
||||
pm_runtime_put_noidle(&dev->dev);
|
||||
pm_runtime_set_suspended(&dev->dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3408,8 +3408,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
|
||||
/* New sg entry */
|
||||
--num_sgs;
|
||||
sent_len -= block_len;
|
||||
if (num_sgs != 0) {
|
||||
sg = sg_next(sg);
|
||||
sg = sg_next(sg);
|
||||
if (num_sgs != 0 && sg) {
|
||||
block_len = sg_dma_len(sg);
|
||||
addr = (u64) sg_dma_address(sg);
|
||||
addr += sent_len;
|
||||
|
||||
@@ -1161,8 +1161,8 @@ static void garmin_read_process(struct garmin_data *garmin_data_p,
|
||||
send it directly to the tty port */
|
||||
if (garmin_data_p->flags & FLAGS_QUEUING) {
|
||||
pkt_add(garmin_data_p, data, data_length);
|
||||
} else if (bulk_data ||
|
||||
getLayerId(data) == GARMIN_LAYERID_APPL) {
|
||||
} else if (bulk_data || (data_length >= sizeof(u32) &&
|
||||
getLayerId(data) == GARMIN_LAYERID_APPL)) {
|
||||
|
||||
spin_lock_irqsave(&garmin_data_p->lock, flags);
|
||||
garmin_data_p->flags |= APP_RESP_SEEN;
|
||||
|
||||
@@ -177,6 +177,7 @@ static const struct usb_device_id id_table[] = {
|
||||
{DEVICE_SWI(0x413c, 0x81b3)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card (rev3) */
|
||||
{DEVICE_SWI(0x413c, 0x81b5)}, /* Dell Wireless 5811e QDL */
|
||||
{DEVICE_SWI(0x413c, 0x81b6)}, /* Dell Wireless 5811e QDL */
|
||||
{DEVICE_SWI(0x413c, 0x81cc)}, /* Dell Wireless 5816e */
|
||||
{DEVICE_SWI(0x413c, 0x81cf)}, /* Dell Wireless 5819 */
|
||||
{DEVICE_SWI(0x413c, 0x81d0)}, /* Dell Wireless 5819 */
|
||||
{DEVICE_SWI(0x413c, 0x81d1)}, /* Dell Wireless 5818 */
|
||||
|
||||
@@ -41,6 +41,13 @@
|
||||
* and don't forget to CC: the USB development list <linux-usb@vger.kernel.org>
|
||||
*/
|
||||
|
||||
/* Reported-by: Julian Groß <julian.g@posteo.de> */
|
||||
UNUSUAL_DEV(0x059f, 0x105f, 0x0000, 0x9999,
|
||||
"LaCie",
|
||||
"2Big Quadra USB3",
|
||||
USB_SC_DEVICE, USB_PR_DEVICE, NULL,
|
||||
US_FL_NO_REPORT_OPCODES),
|
||||
|
||||
/*
|
||||
* Apricorn USB3 dongle sometimes returns "USBSUSBSUSBS" in response to SCSI
|
||||
* commands in UAS mode. Observed with the 1.28 firmware; are there others?
|
||||
|
||||
@@ -830,6 +830,14 @@ void do_coredump(const siginfo_t *siginfo)
|
||||
if (displaced)
|
||||
put_files_struct(displaced);
|
||||
if (!dump_interrupted()) {
|
||||
/*
|
||||
* umh disabled with CONFIG_STATIC_USERMODEHELPER_PATH="" would
|
||||
* have this set to NULL.
|
||||
*/
|
||||
if (!cprm.file) {
|
||||
pr_info("Core dump to |%s disabled\n", cn.corename);
|
||||
goto close_fail;
|
||||
}
|
||||
file_start_write(cprm.file);
|
||||
core_dumped = binfmt->core_dump(&cprm);
|
||||
file_end_write(cprm.file);
|
||||
|
||||
@@ -42,6 +42,24 @@ static void fscrypt_get_devices(struct super_block *sb, int num_devs,
|
||||
sb->s_cop->get_devices(sb, devs);
|
||||
}
|
||||
|
||||
static unsigned int fscrypt_get_dun_bytes(const struct fscrypt_info *ci)
|
||||
{
|
||||
struct super_block *sb = ci->ci_inode->i_sb;
|
||||
unsigned int flags = fscrypt_policy_flags(&ci->ci_policy);
|
||||
int ino_bits = 64, lblk_bits = 64;
|
||||
|
||||
if (flags & FSCRYPT_POLICY_FLAG_DIRECT_KEY)
|
||||
return offsetofend(union fscrypt_iv, nonce);
|
||||
|
||||
if (flags & FSCRYPT_POLICY_FLAG_IV_INO_LBLK_64)
|
||||
return sizeof(__le64);
|
||||
|
||||
/* Default case: IVs are just the file logical block number */
|
||||
if (sb->s_cop->get_ino_and_lblk_bits)
|
||||
sb->s_cop->get_ino_and_lblk_bits(sb, &ino_bits, &lblk_bits);
|
||||
return DIV_ROUND_UP(lblk_bits, 8);
|
||||
}
|
||||
|
||||
/* Enable inline encryption for this file if supported. */
|
||||
int fscrypt_select_encryption_impl(struct fscrypt_info *ci,
|
||||
bool is_hw_wrapped_key)
|
||||
@@ -49,6 +67,7 @@ int fscrypt_select_encryption_impl(struct fscrypt_info *ci,
|
||||
const struct inode *inode = ci->ci_inode;
|
||||
struct super_block *sb = inode->i_sb;
|
||||
enum blk_crypto_mode_num crypto_mode = ci->ci_mode->blk_crypto_mode;
|
||||
unsigned int dun_bytes;
|
||||
struct request_queue **devs;
|
||||
int num_devs;
|
||||
int i;
|
||||
@@ -84,9 +103,12 @@ int fscrypt_select_encryption_impl(struct fscrypt_info *ci,
|
||||
|
||||
fscrypt_get_devices(sb, num_devs, devs);
|
||||
|
||||
dun_bytes = fscrypt_get_dun_bytes(ci);
|
||||
|
||||
for (i = 0; i < num_devs; i++) {
|
||||
if (!keyslot_manager_crypto_mode_supported(devs[i]->ksm,
|
||||
crypto_mode,
|
||||
dun_bytes,
|
||||
sb->s_blocksize,
|
||||
is_hw_wrapped_key))
|
||||
goto out_free_devs;
|
||||
@@ -107,6 +129,7 @@ int fscrypt_prepare_inline_crypt_key(struct fscrypt_prepared_key *prep_key,
|
||||
const struct inode *inode = ci->ci_inode;
|
||||
struct super_block *sb = inode->i_sb;
|
||||
enum blk_crypto_mode_num crypto_mode = ci->ci_mode->blk_crypto_mode;
|
||||
unsigned int dun_bytes;
|
||||
int num_devs;
|
||||
int queue_refs = 0;
|
||||
struct fscrypt_blk_crypto_key *blk_key;
|
||||
@@ -124,11 +147,14 @@ int fscrypt_prepare_inline_crypt_key(struct fscrypt_prepared_key *prep_key,
|
||||
blk_key->num_devs = num_devs;
|
||||
fscrypt_get_devices(sb, num_devs, blk_key->devs);
|
||||
|
||||
dun_bytes = fscrypt_get_dun_bytes(ci);
|
||||
|
||||
BUILD_BUG_ON(FSCRYPT_MAX_HW_WRAPPED_KEY_SIZE >
|
||||
BLK_CRYPTO_MAX_WRAPPED_KEY_SIZE);
|
||||
|
||||
err = blk_crypto_init_key(&blk_key->base, raw_key, raw_key_size,
|
||||
is_hw_wrapped, crypto_mode, sb->s_blocksize);
|
||||
is_hw_wrapped, crypto_mode, dun_bytes,
|
||||
sb->s_blocksize);
|
||||
if (err) {
|
||||
fscrypt_err(inode, "error %d initializing blk-crypto key", err);
|
||||
goto fail;
|
||||
@@ -149,7 +175,8 @@ int fscrypt_prepare_inline_crypt_key(struct fscrypt_prepared_key *prep_key,
|
||||
}
|
||||
queue_refs++;
|
||||
|
||||
err = blk_crypto_start_using_mode(crypto_mode, sb->s_blocksize,
|
||||
err = blk_crypto_start_using_mode(crypto_mode, dun_bytes,
|
||||
sb->s_blocksize,
|
||||
is_hw_wrapped,
|
||||
blk_key->devs[i]);
|
||||
if (err) {
|
||||
|
||||
@@ -1267,6 +1267,8 @@ int flush_old_exec(struct linux_binprm * bprm)
|
||||
*/
|
||||
set_mm_exe_file(bprm->mm, bprm->file);
|
||||
|
||||
would_dump(bprm, bprm->file);
|
||||
|
||||
/*
|
||||
* Release all of the old mmap stuff
|
||||
*/
|
||||
@@ -1800,8 +1802,6 @@ static int do_execveat_common(int fd, struct filename *filename,
|
||||
if (retval < 0)
|
||||
goto out;
|
||||
|
||||
would_dump(bprm, bprm->file);
|
||||
|
||||
retval = exec_binprm(bprm);
|
||||
if (retval < 0)
|
||||
goto out;
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#include <linux/file.h>
|
||||
#include <linux/ktime.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/pagemap.h>
|
||||
#include <linux/lz4.h>
|
||||
#include <linux/crc32.h>
|
||||
|
||||
@@ -15,6 +17,13 @@
|
||||
#include "format.h"
|
||||
#include "integrity.h"
|
||||
|
||||
static void log_wake_up_all(struct work_struct *work)
|
||||
{
|
||||
struct delayed_work *dw = container_of(work, struct delayed_work, work);
|
||||
struct read_log *rl = container_of(dw, struct read_log, ml_wakeup_work);
|
||||
wake_up_all(&rl->ml_notif_wq);
|
||||
}
|
||||
|
||||
struct mount_info *incfs_alloc_mount_info(struct super_block *sb,
|
||||
struct mount_options *options,
|
||||
struct path *backing_dir_path)
|
||||
@@ -34,6 +43,7 @@ struct mount_info *incfs_alloc_mount_info(struct super_block *sb,
|
||||
mutex_init(&mi->mi_pending_reads_mutex);
|
||||
init_waitqueue_head(&mi->mi_pending_reads_notif_wq);
|
||||
init_waitqueue_head(&mi->mi_log.ml_notif_wq);
|
||||
INIT_DELAYED_WORK(&mi->mi_log.ml_wakeup_work, log_wake_up_all);
|
||||
spin_lock_init(&mi->mi_log.rl_lock);
|
||||
INIT_LIST_HEAD(&mi->mi_reads_list_head);
|
||||
|
||||
@@ -94,6 +104,8 @@ void incfs_free_mount_info(struct mount_info *mi)
|
||||
if (!mi)
|
||||
return;
|
||||
|
||||
flush_delayed_work(&mi->mi_log.ml_wakeup_work);
|
||||
|
||||
dput(mi->mi_index_dir);
|
||||
path_put(&mi->mi_backing_dir_path);
|
||||
mutex_destroy(&mi->mi_dir_struct_mutex);
|
||||
@@ -296,11 +308,20 @@ static void log_block_read(struct mount_info *mi, incfs_uuid_t *id,
|
||||
{
|
||||
struct read_log *log = &mi->mi_log;
|
||||
struct read_log_state *head, *tail;
|
||||
s64 now_us = ktime_to_us(ktime_get());
|
||||
s64 now_us;
|
||||
s64 relative_us;
|
||||
union log_record record;
|
||||
size_t record_size;
|
||||
|
||||
/*
|
||||
* This may read the old value, but it's OK to delay the logging start
|
||||
* right after the configuration update.
|
||||
*/
|
||||
if (READ_ONCE(log->rl_size) == 0)
|
||||
return;
|
||||
|
||||
now_us = ktime_to_us(ktime_get());
|
||||
|
||||
spin_lock(&log->rl_lock);
|
||||
if (log->rl_size == 0) {
|
||||
spin_unlock(&log->rl_lock);
|
||||
@@ -319,6 +340,7 @@ static void log_block_read(struct mount_info *mi, incfs_uuid_t *id,
|
||||
.file_id = *id,
|
||||
.absolute_ts_us = now_us,
|
||||
};
|
||||
head->base_record.file_id = *id;
|
||||
record_size = sizeof(struct full_record);
|
||||
} else if (block_index != head->base_record.block_index + 1 ||
|
||||
relative_us >= 1 << 30) {
|
||||
@@ -343,7 +365,6 @@ static void log_block_read(struct mount_info *mi, incfs_uuid_t *id,
|
||||
record_size = sizeof(struct same_file_next_block_short);
|
||||
}
|
||||
|
||||
head->base_record.file_id = *id;
|
||||
head->base_record.block_index = block_index;
|
||||
head->base_record.absolute_ts_us = now_us;
|
||||
|
||||
@@ -362,11 +383,13 @@ static void log_block_read(struct mount_info *mi, incfs_uuid_t *id,
|
||||
++head->current_record_no;
|
||||
|
||||
spin_unlock(&log->rl_lock);
|
||||
wake_up_all(&log->ml_notif_wq);
|
||||
if (schedule_delayed_work(&log->ml_wakeup_work, msecs_to_jiffies(16)))
|
||||
pr_debug("incfs: scheduled a log pollers wakeup");
|
||||
}
|
||||
|
||||
static int validate_hash_tree(struct file *bf, struct data_file *df,
|
||||
int block_index, struct mem_range data, u8 *buf)
|
||||
int block_index, struct mem_range data,
|
||||
u8 *tmp_buf)
|
||||
{
|
||||
u8 digest[INCFS_MAX_HASH_SIZE] = {};
|
||||
struct mtree *tree = NULL;
|
||||
@@ -379,6 +402,7 @@ static int validate_hash_tree(struct file *bf, struct data_file *df,
|
||||
int hash_per_block;
|
||||
int lvl = 0;
|
||||
int res;
|
||||
struct page *saved_page = NULL;
|
||||
|
||||
tree = df->df_hash_tree;
|
||||
sig = df->df_signature;
|
||||
@@ -400,17 +424,39 @@ static int validate_hash_tree(struct file *bf, struct data_file *df,
|
||||
INCFS_DATA_FILE_BLOCK_SIZE);
|
||||
size_t hash_off_in_block = hash_block_index * digest_size
|
||||
% INCFS_DATA_FILE_BLOCK_SIZE;
|
||||
struct mem_range buf_range = range(buf,
|
||||
INCFS_DATA_FILE_BLOCK_SIZE);
|
||||
ssize_t read_res = incfs_kread(bf, buf,
|
||||
INCFS_DATA_FILE_BLOCK_SIZE, hash_block_off);
|
||||
struct mem_range buf_range;
|
||||
struct page *page = NULL;
|
||||
bool aligned = (hash_block_off &
|
||||
(INCFS_DATA_FILE_BLOCK_SIZE - 1)) == 0;
|
||||
u8 *actual_buf;
|
||||
|
||||
if (read_res < 0)
|
||||
return read_res;
|
||||
if (read_res != INCFS_DATA_FILE_BLOCK_SIZE)
|
||||
return -EIO;
|
||||
if (aligned) {
|
||||
page = read_mapping_page(
|
||||
bf->f_inode->i_mapping,
|
||||
hash_block_off / INCFS_DATA_FILE_BLOCK_SIZE,
|
||||
NULL);
|
||||
|
||||
saved_digest_rng = range(buf + hash_off_in_block, digest_size);
|
||||
if (IS_ERR(page))
|
||||
return PTR_ERR(page);
|
||||
|
||||
actual_buf = page_address(page);
|
||||
} else {
|
||||
size_t read_res =
|
||||
incfs_kread(bf, tmp_buf,
|
||||
INCFS_DATA_FILE_BLOCK_SIZE,
|
||||
hash_block_off);
|
||||
|
||||
if (read_res < 0)
|
||||
return read_res;
|
||||
if (read_res != INCFS_DATA_FILE_BLOCK_SIZE)
|
||||
return -EIO;
|
||||
|
||||
actual_buf = tmp_buf;
|
||||
}
|
||||
|
||||
buf_range = range(actual_buf, INCFS_DATA_FILE_BLOCK_SIZE);
|
||||
saved_digest_rng =
|
||||
range(actual_buf + hash_off_in_block, digest_size);
|
||||
if (!incfs_equal_ranges(calc_digest_rng, saved_digest_rng)) {
|
||||
int i;
|
||||
bool zero = true;
|
||||
@@ -425,9 +471,37 @@ static int validate_hash_tree(struct file *bf, struct data_file *df,
|
||||
|
||||
if (zero)
|
||||
pr_debug("incfs: Note saved_digest all zero - did you forget to load the hashes?\n");
|
||||
|
||||
if (saved_page)
|
||||
put_page(saved_page);
|
||||
if (page)
|
||||
put_page(page);
|
||||
return -EBADMSG;
|
||||
}
|
||||
|
||||
if (saved_page) {
|
||||
/*
|
||||
* This is something of a kludge. The PageChecked flag
|
||||
* is reserved for the file system, but we are setting
|
||||
* this on the pages belonging to the underlying file
|
||||
* system. incfs is only going to be used on f2fs and
|
||||
* ext4 which only use this flag when fs-verity is being
|
||||
* used, so this is safe for now, however a better
|
||||
* mechanism needs to be found.
|
||||
*/
|
||||
SetPageChecked(saved_page);
|
||||
put_page(saved_page);
|
||||
saved_page = NULL;
|
||||
}
|
||||
|
||||
if (page && PageChecked(page)) {
|
||||
put_page(page);
|
||||
return 0;
|
||||
}
|
||||
|
||||
saved_page = page;
|
||||
page = NULL;
|
||||
|
||||
res = incfs_calc_digest(tree->alg, buf_range, calc_digest_rng);
|
||||
if (res)
|
||||
return res;
|
||||
@@ -437,8 +511,15 @@ static int validate_hash_tree(struct file *bf, struct data_file *df,
|
||||
root_hash_rng = range(tree->root_hash, digest_size);
|
||||
if (!incfs_equal_ranges(calc_digest_rng, root_hash_rng)) {
|
||||
pr_debug("incfs: Root hash mismatch blk:%d\n", block_index);
|
||||
if (saved_page)
|
||||
put_page(saved_page);
|
||||
return -EBADMSG;
|
||||
}
|
||||
|
||||
if (saved_page) {
|
||||
SetPageChecked(saved_page);
|
||||
put_page(saved_page);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -89,6 +89,9 @@ struct read_log {
|
||||
|
||||
/* A queue of waiters who want to be notified about reads */
|
||||
wait_queue_head_t ml_notif_wq;
|
||||
|
||||
/* A work item to wake up those waiters without slowing down readers */
|
||||
struct delayed_work ml_wakeup_work;
|
||||
};
|
||||
|
||||
struct mount_options {
|
||||
|
||||
@@ -209,6 +209,8 @@ struct inode_search {
|
||||
unsigned long ino;
|
||||
|
||||
struct dentry *backing_dentry;
|
||||
|
||||
size_t size;
|
||||
};
|
||||
|
||||
enum parse_parameter {
|
||||
@@ -367,7 +369,7 @@ static int inode_set(struct inode *inode, void *opaque)
|
||||
|
||||
fsstack_copy_attr_all(inode, backing_inode);
|
||||
if (S_ISREG(inode->i_mode)) {
|
||||
u64 size = read_size_attr(backing_dentry);
|
||||
u64 size = search->size;
|
||||
|
||||
inode->i_size = size;
|
||||
inode->i_blocks = get_blocks_count_for_size(size);
|
||||
@@ -443,7 +445,8 @@ static struct inode *fetch_regular_inode(struct super_block *sb,
|
||||
struct inode *backing_inode = d_inode(backing_dentry);
|
||||
struct inode_search search = {
|
||||
.ino = backing_inode->i_ino,
|
||||
.backing_dentry = backing_dentry
|
||||
.backing_dentry = backing_dentry,
|
||||
.size = read_size_attr(backing_dentry),
|
||||
};
|
||||
struct inode *inode = iget5_locked(sb, search.ino, inode_test,
|
||||
inode_set, &search);
|
||||
|
||||
@@ -43,7 +43,15 @@ struct blk_crypto_key {
|
||||
unsigned int data_unit_size;
|
||||
unsigned int data_unit_size_bits;
|
||||
unsigned int size;
|
||||
|
||||
/*
|
||||
* Hack to avoid breaking KMI: pack both hash and dun_bytes into the
|
||||
* hash field...
|
||||
*/
|
||||
#define BLK_CRYPTO_KEY_HASH_MASK 0xffffff
|
||||
#define BLK_CRYPTO_KEY_DUN_BYTES_SHIFT 24
|
||||
unsigned int hash;
|
||||
|
||||
bool is_hw_wrapped;
|
||||
u8 raw[BLK_CRYPTO_MAX_WRAPPED_KEY_SIZE];
|
||||
};
|
||||
@@ -51,6 +59,26 @@ struct blk_crypto_key {
|
||||
#define BLK_CRYPTO_MAX_IV_SIZE 32
|
||||
#define BLK_CRYPTO_DUN_ARRAY_SIZE (BLK_CRYPTO_MAX_IV_SIZE/sizeof(u64))
|
||||
|
||||
static inline void
|
||||
blk_crypto_key_set_hash_and_dun_bytes(struct blk_crypto_key *key,
|
||||
u32 hash, unsigned int dun_bytes)
|
||||
{
|
||||
key->hash = (dun_bytes << BLK_CRYPTO_KEY_DUN_BYTES_SHIFT) |
|
||||
(hash & BLK_CRYPTO_KEY_HASH_MASK);
|
||||
}
|
||||
|
||||
static inline u32
|
||||
blk_crypto_key_hash(const struct blk_crypto_key *key)
|
||||
{
|
||||
return key->hash & BLK_CRYPTO_KEY_HASH_MASK;
|
||||
}
|
||||
|
||||
static inline unsigned int
|
||||
blk_crypto_key_dun_bytes(const struct blk_crypto_key *key)
|
||||
{
|
||||
return key->hash >> BLK_CRYPTO_KEY_DUN_BYTES_SHIFT;
|
||||
}
|
||||
|
||||
/**
|
||||
* struct bio_crypt_ctx - an inline encryption context
|
||||
* @bc_key: the key, algorithm, and data unit size to use
|
||||
|
||||
@@ -20,9 +20,11 @@ int blk_crypto_init_key(struct blk_crypto_key *blk_key,
|
||||
const u8 *raw_key, unsigned int raw_key_size,
|
||||
bool is_hw_wrapped,
|
||||
enum blk_crypto_mode_num crypto_mode,
|
||||
unsigned int dun_bytes,
|
||||
unsigned int data_unit_size);
|
||||
|
||||
int blk_crypto_start_using_mode(enum blk_crypto_mode_num crypto_mode,
|
||||
unsigned int dun_bytes,
|
||||
unsigned int data_unit_size,
|
||||
bool is_hw_wrapped_key,
|
||||
struct request_queue *q);
|
||||
|
||||
@@ -574,7 +574,7 @@ struct request_queue {
|
||||
unsigned int sg_reserved_size;
|
||||
int node;
|
||||
#ifdef CONFIG_BLK_DEV_IO_TRACE
|
||||
struct blk_trace *blk_trace;
|
||||
struct blk_trace __rcu *blk_trace;
|
||||
struct mutex blk_trace_mutex;
|
||||
#endif
|
||||
/*
|
||||
|
||||
@@ -51,9 +51,13 @@ void __trace_note_message(struct blk_trace *, struct blkcg *blkcg, const char *f
|
||||
**/
|
||||
#define blk_add_cgroup_trace_msg(q, cg, fmt, ...) \
|
||||
do { \
|
||||
struct blk_trace *bt = (q)->blk_trace; \
|
||||
struct blk_trace *bt; \
|
||||
\
|
||||
rcu_read_lock(); \
|
||||
bt = rcu_dereference((q)->blk_trace); \
|
||||
if (unlikely(bt)) \
|
||||
__trace_note_message(bt, cg, fmt, ##__VA_ARGS__);\
|
||||
rcu_read_unlock(); \
|
||||
} while (0)
|
||||
#define blk_add_trace_msg(q, fmt, ...) \
|
||||
blk_add_cgroup_trace_msg(q, NULL, fmt, ##__VA_ARGS__)
|
||||
@@ -61,10 +65,14 @@ void __trace_note_message(struct blk_trace *, struct blkcg *blkcg, const char *f
|
||||
|
||||
static inline bool blk_trace_note_message_enabled(struct request_queue *q)
|
||||
{
|
||||
struct blk_trace *bt = q->blk_trace;
|
||||
if (likely(!bt))
|
||||
return false;
|
||||
return bt->act_mask & BLK_TC_NOTIFY;
|
||||
struct blk_trace *bt;
|
||||
bool ret;
|
||||
|
||||
rcu_read_lock();
|
||||
bt = rcu_dereference(q->blk_trace);
|
||||
ret = bt && (bt->act_mask & BLK_TC_NOTIFY);
|
||||
rcu_read_unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
extern void blk_add_driver_data(struct request_queue *q, struct request *rq,
|
||||
|
||||
@@ -382,4 +382,10 @@ unsigned long read_word_at_a_time(const void *addr)
|
||||
(_________p1); \
|
||||
})
|
||||
|
||||
/*
|
||||
* This is needed in functions which generate the stack canary, see
|
||||
* arch/x86/kernel/smpboot.c::start_secondary() for an example.
|
||||
*/
|
||||
#define prevent_tail_call_optimization() mb()
|
||||
|
||||
#endif /* __LINUX_COMPILER_H */
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user