History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

David S. Miller committed 7 years ago

Commit 310655b2 parents 7f301cf 869e330146 files · +1478 −1109Browse files

Unified · Split

146 files
  1. Documentation/accounting/psi.txt +6 −6
  2. Documentation/devicetree/bindings/arm/cpus.yaml +1 −1
  3. Documentation/lzo.txt +5 −3
  4. MAINTAINERS +4 −3
  5. Makefile +1 −1
  6. arch/arc/include/asm/syscall.h +3 −4
  7. arch/arm/boot/dts/am335x-evm.dts +22 −4
  8. arch/arm/boot/dts/am335x-evmsk.dts +22 −4
  9. arch/arm/boot/dts/am33xx-l4.dtsi +2 −2
  10. arch/arm/boot/dts/rk3288-tinker.dtsi +2 −1
  11. arch/arm/boot/dts/rk3288-veyron.dtsi +0 −2
  12. arch/arm/boot/dts/rk3288.dtsi +9 −11
  13. arch/arm/boot/dts/sama5d2-pinfunc.h +1 −1
  14. arch/arm/boot/dts/ste-nomadik-nhk15.dts +4 −5
  15. arch/arm/include/asm/syscall.h +8 −39
  16. arch/arm/mach-at91/pm.c +4 −2
  17. arch/arm/mach-iop13xx/setup.c +4 −4
  18. arch/arm/mach-iop13xx/tpmi.c +5 −5
  19. arch/arm/mach-milbeaut/platsmp.c +4 −0
  20. arch/arm/mach-omap1/board-ams-delta.c +2 −0
  21. arch/arm/mach-omap2/display.c +3 −1
  22. arch/arm/plat-iop/adma.c +3 −3
  23. arch/arm/plat-orion/common.c +2 −2
  24. arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi +3 −0
  25. arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts +2 −2
  26. arch/arm64/boot/dts/rockchip/rk3328-rock64.dts +1 −2
  27. arch/arm64/boot/dts/rockchip/rk3328.dtsi +29 −29
  28. arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dts +1 −0
  29. arch/arm64/include/asm/syscall.h +8 −38
  30. arch/arm64/kernel/sdei.c +6 −0
  31. arch/c6x/include/asm/syscall.h +14 −65
  32. arch/csky/include/asm/syscall.h +8 −18
  33. arch/h8300/include/asm/syscall.h +7 −27
  34. arch/hexagon/include/asm/syscall.h +1 −3
  35. arch/ia64/include/asm/syscall.h +3 −10
  36. arch/ia64/kernel/ptrace.c +3 −4
  37. arch/microblaze/include/asm/syscall.h +6 −2
  38. arch/mips/include/asm/syscall.h +2 −1
  39. arch/mips/kernel/ptrace.c +1 −1
  40. arch/nds32/include/asm/syscall.h +11 −51
  41. arch/nios2/include/asm/syscall.h +14 −70
  42. arch/openrisc/include/asm/syscall.h +4 −8
  43. arch/parisc/include/asm/ptrace.h +3 −2
  44. arch/parisc/include/asm/syscall.h +8 −22
  45. arch/parisc/kernel/process.c +0 −6
  46. arch/parisc/kernel/setup.c +3 −0
  47. arch/powerpc/include/asm/syscall.h +5 −10
  48. arch/powerpc/kernel/kvm.c +7 −0
  49. arch/riscv/include/asm/syscall.h +6 −18
  50. arch/s390/include/asm/syscall.h +10 −18
  51. arch/sh/boards/of-generic.c +2 −2
  52. arch/sh/include/asm/syscall_32.h +12 −35
  53. arch/sh/include/asm/syscall_64.h +2 −6
  54. arch/sparc/include/asm/syscall.h +5 −6
  55. arch/um/include/asm/syscall-generic.h +12 −66
  56. arch/x86/include/asm/syscall.h +33 −109
  57. arch/x86/include/asm/xen/hypercall.h +3 −0
  58. arch/x86/kvm/svm.c +14 −8
  59. arch/x86/kvm/vmx/nested.c +45 −29
  60. arch/xtensa/include/asm/processor.h +12 −9
  61. arch/xtensa/include/asm/syscall.h +6 −27
  62. arch/xtensa/kernel/entry.S +6 −0
  63. arch/xtensa/kernel/stacktrace.c +5 −1
  64. arch/xtensa/mm/mmu.c +1 −1
  65. block/bfq-iosched.c +1 −1
  66. block/bfq-wf2q.c +1 −1
  67. block/blk-core.c +1 −3
  68. block/blk-mq-sched.c +5 −3
  69. block/blk-mq.c +68 −61
  70. block/blk-mq.h +2 −4
  71. drivers/block/null_blk_main.c +5 −0
  72. drivers/block/paride/pcd.c +13 −1
  73. drivers/block/paride/pf.c +11 −1
  74. drivers/block/xsysace.c +2 −0
  75. drivers/char/tpm/eventlog/tpm2.c +2 −2
  76. drivers/char/tpm/tpm-dev-common.c +8 −1
  77. drivers/char/tpm/tpm-interface.c +6 −8
  78. drivers/crypto/caam/caamhash.c +6 −7
  79. drivers/i2c/busses/i2c-imx.c +3 −1
  80. drivers/md/dm-core.h +1 −0
  81. drivers/md/dm-init.c +1 −1
  82. drivers/md/dm-integrity.c +7 −9
  83. drivers/md/dm-rq.c +7 −4
  84. drivers/md/dm-table.c +39 −0
  85. drivers/md/dm.c +17 −13
  86. drivers/mtd/chips/cfi_cmdset_0002.c +5 −1
  87. drivers/net/ethernet/broadcom/bnxt/bnxt.c +13 −3
  88. drivers/net/ethernet/broadcom/tg3.c +4 −4
  89. drivers/net/ethernet/broadcom/tg3.h +2 −2
  90. drivers/net/ethernet/cadence/macb_main.c +3 −1
  91. drivers/net/ethernet/qlogic/qlcnic/qlcnic.h +1 −1
  92. drivers/net/ethernet/realtek/r8169.c +6 −0
  93. drivers/net/vrf.c +6 −2
  94. drivers/parisc/iosapic.c +5 −1
  95. drivers/reset/reset-meson-audio-arb.c +1 −0
  96. drivers/rtc/Kconfig +2 −2
  97. drivers/rtc/rtc-cros-ec.c +2 −2
  98. drivers/rtc/rtc-da9063.c +7 −0
  99. drivers/rtc/rtc-sh.c +1 −1
  100. drivers/scsi/lpfc/lpfc_scsi.c +3 −4
  101. drivers/scsi/qedi/qedi_main.c +2 −5
  102. drivers/scsi/scsi_devinfo.c +1 −0
  103. drivers/scsi/scsi_dh.c +1 −0
  104. drivers/scsi/storvsc_drv.c +12 −3
  105. drivers/vfio/pci/vfio_pci.c +2 −2
  106. drivers/vfio/vfio_iommu_spapr_tce.c +1 −1
  107. drivers/vfio/vfio_iommu_type1.c +14 −0
  108. drivers/xen/privcmd-buf.c +1 −2
  109. drivers/xen/xenbus/xenbus_dev_frontend.c +1 −3
  110. fs/hugetlbfs/inode.c +14 −6
  111. fs/io_uring.c +1 −0
  112. fs/open.c +18 −0
  113. fs/proc/base.c +9 −8
  114. fs/read_write.c +3 −2
  115. include/asm-generic/syscall.h +5 −16
  116. include/dt-bindings/reset/amlogic,meson-g12a-reset.h +4 −1
  117. include/keys/trusted.h +1 −1
  118. include/linux/bitrev.h +23 −23
  119. include/linux/fs.h +4 −0
  120. include/linux/memcontrol.h +4 −1
  121. include/linux/mm_types.h +1 −1
  122. include/linux/ptrace.h +8 −3
  123. include/linux/string.h +3 −0
  124. include/net/nfc/nci_core.h +1 −1
  125. include/trace/events/syscalls.h +1 −1
  126. include/uapi/linux/ethtool.h +1 −1
  127. kernel/seccomp.c +1 −1
  128. kernel/sysctl.c +2 −1
  129. kernel/trace/trace_syscalls.c +6 −3
  130. lib/lzo/lzo1x_compress.c +6 −3
  131. lib/lzo/lzo1x_decompress_safe.c +1 −3
  132. lib/string.c +20 −0
  133. lib/syscall.c +25 −32
  134. mm/huge_memory.c +36 −0
  135. mm/kmemleak.c +11 −5
  136. mm/memcontrol.c +18 −2
  137. mm/slab.c +2 −1
  138. mm/util.c +1 −1
  139. net/ipv4/ip_gre.c +10 −5
  140. net/ipv6/ip6_gre.c +13 −7
  141. net/nfc/nci/hci.c +8 −0
  142. scripts/coccinelle/api/stream_open.cocci +363 −0
  143. security/keys/trusted.c +25 −7
  144. tools/testing/selftests/tc-testing/tc-tests/filters/tests.json +20 −0
  145. tools/testing/selftests/tpm2/tpm2.py +3 −2
  146. tools/testing/selftests/tpm2/tpm2_tests.py +63 −0
Documentation/accounting/psi.txt+6−6
@@ -56,12 +56,12 @@ situation from a state where some tasks are stalled but the CPU is · 55 unmodified lines
56still doing productive work. As such, time spent in this subset of the56still doing productive work. As such, time spent in this subset of the
57stall state is tracked separately and exported in the "full" averages.57stall state is tracked separately and exported in the "full" averages.
58 58
59The ratios are tracked as recent trends over ten, sixty, and three59The ratios (in %) are tracked as recent trends over ten, sixty, and
60hundred second windows, which gives insight into short term events as60three hundred second windows, which gives insight into short term events
61well as medium and long term trends. The total absolute stall time is61as well as medium and long term trends. The total absolute stall time
62tracked and exported as well, to allow detection of latency spikes62(in us) is tracked and exported as well, to allow detection of latency
63which wouldn't necessarily make a dent in the time averages, or to63spikes which wouldn't necessarily make a dent in the time averages,
64average trends over custom time frames.64or to average trends over custom time frames.
65 65
66Cgroup2 interface66Cgroup2 interface
67=================67=================
Documentation/devicetree/bindings/arm/cpus.yaml+1−1
@@ -228,7 +228,7 @@ patternProperties: · 227 unmodified lines
228 - renesas,r9a06g032-smp228 - renesas,r9a06g032-smp
229 - rockchip,rk3036-smp229 - rockchip,rk3036-smp
230 - rockchip,rk3066-smp230 - rockchip,rk3066-smp
231 - socionext,milbeaut-m10v-smp231 - socionext,milbeaut-m10v-smp
232 - ste,dbx500-smp232 - ste,dbx500-smp
233 233
234 cpu-release-addr:234 cpu-release-addr:
Documentation/lzo.txt+5−3
@@ -102,9 +102,11 @@ Byte sequences · 101 unmodified lines
102 dictionary which is empty, and that it will always be102 dictionary which is empty, and that it will always be
103 invalid at this place.103 invalid at this place.
104 104
105 17 : bitstream version. If the first byte is 17, the next byte105 17 : bitstream version. If the first byte is 17, and compressed
106 gives the bitstream version (version 1 only). If the first byte106 stream length is at least 5 bytes (length of shortest possible
107 is not 17, the bitstream version is 0.107 versioned bitstream), the next byte gives the bitstream version
108 (version 1 only).
109 Otherwise, the bitstream version is 0.
108 110
109 18..21 : copy 0..3 literals111 18..21 : copy 0..3 literals
110 state = (byte - 17) = 0..3 [ copy <state> literals ]112 state = (byte - 17) = 0..3 [ copy <state> literals ]
MAINTAINERS+4−3
@@ -1893,14 +1893,15 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-nomadik.git · 1892 unmodified lines
1893ARM/NUVOTON NPCM ARCHITECTURE1893ARM/NUVOTON NPCM ARCHITECTURE
1894M: Avi Fishman <avifishman70@gmail.com>1894M: Avi Fishman <avifishman70@gmail.com>
1895M: Tomer Maimon <tmaimon77@gmail.com>1895M: Tomer Maimon <tmaimon77@gmail.com>
1896M: Tali Perry <tali.perry1@gmail.com>
1896R: Patrick Venture <venture@google.com>1897R: Patrick Venture <venture@google.com>
1897R: Nancy Yuen <yuenn@google.com>1898R: Nancy Yuen <yuenn@google.com>
1898R: Brendan Higgins <brendanhiggins@google.com>1899R: Benjamin Fair <benjaminfair@google.com>
1899L: openbmc@lists.ozlabs.org (moderated for non-subscribers)1900L: openbmc@lists.ozlabs.org (moderated for non-subscribers)
1900S: Supported1901S: Supported
1901F: arch/arm/mach-npcm/1902F: arch/arm/mach-npcm/
1902F: arch/arm/boot/dts/nuvoton-npcm*1903F: arch/arm/boot/dts/nuvoton-npcm*
1903F: include/dt-bindings/clock/nuvoton,npcm7xx-clks.h1904F: include/dt-bindings/clock/nuvoton,npcm7xx-clock.h
1904F: drivers/*/*npcm*1905F: drivers/*/*npcm*
1905F: Documentation/devicetree/bindings/*/*npcm*1906F: Documentation/devicetree/bindings/*/*npcm*
1906F: Documentation/devicetree/bindings/*/*/*npcm*1907F: Documentation/devicetree/bindings/*/*/*npcm*
@@ -7518,7 +7519,7 @@ F: include/net/mac802154.h · 5611 unmodified lines
7518F: include/net/af_ieee802154.h7519F: include/net/af_ieee802154.h
7519F: include/net/cfg802154.h7520F: include/net/cfg802154.h
7520F: include/net/ieee802154_netdev.h7521F: include/net/ieee802154_netdev.h
7521F: Documentation/networking/ieee802154.txt7522F: Documentation/networking/ieee802154.rst
7522 7523
7523IFE PROTOCOL7524IFE PROTOCOL
7524M: Yotam Gigi <yotam.gi@gmail.com>7525M: Yotam Gigi <yotam.gi@gmail.com>
Makefile+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
2VERSION = 52VERSION = 5
3PATCHLEVEL = 13PATCHLEVEL = 1
4SUBLEVEL = 04SUBLEVEL = 0
5EXTRAVERSION = -rc35EXTRAVERSION = -rc4
6NAME = Shy Crocodile6NAME = Shy Crocodile
7 7
8# *DOCUMENTATION*8# *DOCUMENTATION*
arch/arc/include/asm/syscall.h+3−4
@@ -55,12 +55,11 @@ syscall_set_return_value(struct task_struct *task, struct pt_regs *regs, · 54 unmodified lines
55 */55 */
56static inline void56static inline void
57syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,57syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
58 unsigned int i, unsigned int n, unsigned long *args)58 unsigned long *args)
59{59{
60 unsigned long *inside_ptregs = &(regs->r0);60 unsigned long *inside_ptregs = &(regs->r0);
61 inside_ptregs -= i;61 unsigned int n = 6;
62 62 unsigned int i = 0;
63 BUG_ON((i + n) > 6);
64 63
65 while (n--) {64 while (n--) {
66 args[i++] = (*inside_ptregs);65 args[i++] = (*inside_ptregs);
arch/arm/boot/dts/am335x-evm.dts+22−4
@@ -57,6 +57,24 @@ · 56 unmodified lines
57 enable-active-high;57 enable-active-high;
58 };58 };
59 59
60 /* TPS79501 */
61 v1_8d_reg: fixedregulator-v1_8d {
62 compatible = "regulator-fixed";
63 regulator-name = "v1_8d";
64 vin-supply = <&vbat>;
65 regulator-min-microvolt = <1800000>;
66 regulator-max-microvolt = <1800000>;
67 };
68
69 /* TPS79501 */
70 v3_3d_reg: fixedregulator-v3_3d {
71 compatible = "regulator-fixed";
72 regulator-name = "v3_3d";
73 vin-supply = <&vbat>;
74 regulator-min-microvolt = <3300000>;
75 regulator-max-microvolt = <3300000>;
76 };
77
60 matrix_keypad: matrix_keypad0 {78 matrix_keypad: matrix_keypad0 {
61 compatible = "gpio-matrix-keypad";79 compatible = "gpio-matrix-keypad";
62 debounce-delay-ms = <5>;80 debounce-delay-ms = <5>;
@@ -499,10 +517,10 @@ · 436 unmodified lines
499 status = "okay";517 status = "okay";
500 518
501 /* Regulators */519 /* Regulators */
502 AVDD-supply = <&vaux2_reg>;520 AVDD-supply = <&v3_3d_reg>;
503 IOVDD-supply = <&vaux2_reg>;521 IOVDD-supply = <&v3_3d_reg>;
504 DRVDD-supply = <&vaux2_reg>;522 DRVDD-supply = <&v3_3d_reg>;
505 DVDD-supply = <&vbat>;523 DVDD-supply = <&v1_8d_reg>;
506 };524 };
507};525};
508 526
arch/arm/boot/dts/am335x-evmsk.dts+22−4
@@ -73,6 +73,24 @@ · 72 unmodified lines
73 enable-active-high;73 enable-active-high;
74 };74 };
75 75
76 /* TPS79518 */
77 v1_8d_reg: fixedregulator-v1_8d {
78 compatible = "regulator-fixed";
79 regulator-name = "v1_8d";
80 vin-supply = <&vbat>;
81 regulator-min-microvolt = <1800000>;
82 regulator-max-microvolt = <1800000>;
83 };
84
85 /* TPS78633 */
86 v3_3d_reg: fixedregulator-v3_3d {
87 compatible = "regulator-fixed";
88 regulator-name = "v3_3d";
89 vin-supply = <&vbat>;
90 regulator-min-microvolt = <3300000>;
91 regulator-max-microvolt = <3300000>;
92 };
93
76 leds {94 leds {
77 pinctrl-names = "default";95 pinctrl-names = "default";
78 pinctrl-0 = <&user_leds_s0>;96 pinctrl-0 = <&user_leds_s0>;
@@ -501,10 +519,10 @@ · 422 unmodified lines
501 status = "okay";519 status = "okay";
502 520
503 /* Regulators */521 /* Regulators */
504 AVDD-supply = <&vaux2_reg>;522 AVDD-supply = <&v3_3d_reg>;
505 IOVDD-supply = <&vaux2_reg>;523 IOVDD-supply = <&v3_3d_reg>;
506 DRVDD-supply = <&vaux2_reg>;524 DRVDD-supply = <&v3_3d_reg>;
507 DVDD-supply = <&vbat>;525 DVDD-supply = <&v1_8d_reg>;
508 };526 };
509};527};
510 528
arch/arm/boot/dts/am33xx-l4.dtsi+2−2
@@ -1762,7 +1762,7 @@ · 1761 unmodified lines
1762 reg = <0xcc000 0x4>;1762 reg = <0xcc000 0x4>;
1763 reg-names = "rev";1763 reg-names = "rev";
1764 /* Domains (P, C): per_pwrdm, l4ls_clkdm */1764 /* Domains (P, C): per_pwrdm, l4ls_clkdm */
1765 clocks = <&l4ls_clkctrl AM3_D_CAN0_CLKCTRL 0>;1765 clocks = <&l4ls_clkctrl AM3_L4LS_D_CAN0_CLKCTRL 0>;
1766 clock-names = "fck";1766 clock-names = "fck";
1767 #address-cells = <1>;1767 #address-cells = <1>;
1768 #size-cells = <1>;1768 #size-cells = <1>;
@@ -1785,7 +1785,7 @@ · 16 unmodified lines
1785 reg = <0xd0000 0x4>;1785 reg = <0xd0000 0x4>;
1786 reg-names = "rev";1786 reg-names = "rev";
1787 /* Domains (P, C): per_pwrdm, l4ls_clkdm */1787 /* Domains (P, C): per_pwrdm, l4ls_clkdm */
1788 clocks = <&l4ls_clkctrl AM3_D_CAN1_CLKCTRL 0>;1788 clocks = <&l4ls_clkctrl AM3_L4LS_D_CAN1_CLKCTRL 0>;
1789 clock-names = "fck";1789 clock-names = "fck";
1790 #address-cells = <1>;1790 #address-cells = <1>;
1791 #size-cells = <1>;1791 #size-cells = <1>;
arch/arm/boot/dts/rk3288-tinker.dtsi+2−1
@@ -254,6 +254,7 @@ · 253 unmodified lines
254 };254 };
255 255
256 vccio_sd: LDO_REG5 {256 vccio_sd: LDO_REG5 {
257 regulator-boot-on;
257 regulator-min-microvolt = <1800000>;258 regulator-min-microvolt = <1800000>;
258 regulator-max-microvolt = <3300000>;259 regulator-max-microvolt = <3300000>;
259 regulator-name = "vccio_sd";260 regulator-name = "vccio_sd";
@@ -430,7 +431,7 @@ · 170 unmodified lines
430 bus-width = <4>;431 bus-width = <4>;
431 cap-mmc-highspeed;432 cap-mmc-highspeed;
432 cap-sd-highspeed;433 cap-sd-highspeed;
433 card-detect-delay = <200>;434 broken-cd;
434 disable-wp; /* wp not hooked up */435 disable-wp; /* wp not hooked up */
435 pinctrl-names = "default";436 pinctrl-names = "default";
436 pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;437 pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
arch/arm/boot/dts/rk3288-veyron.dtsi+0−2
@@ -25,8 +25,6 @@ · 24 unmodified lines
25 25
26 gpio_keys: gpio-keys {26 gpio_keys: gpio-keys {
27 compatible = "gpio-keys";27 compatible = "gpio-keys";
28 #address-cells = <1>;
29 #size-cells = <0>;
30 28
31 pinctrl-names = "default";29 pinctrl-names = "default";
32 pinctrl-0 = <&pwr_key_l>;30 pinctrl-0 = <&pwr_key_l>;
arch/arm/boot/dts/rk3288.dtsi+9−11
@@ -70,7 +70,7 @@ · 69 unmodified lines
70 compatible = "arm,cortex-a12";70 compatible = "arm,cortex-a12";
71 reg = <0x501>;71 reg = <0x501>;
72 resets = <&cru SRST_CORE1>;72 resets = <&cru SRST_CORE1>;
73 operating-points = <&cpu_opp_table>;73 operating-points-v2 = <&cpu_opp_table>;
74 #cooling-cells = <2>; /* min followed by max */74 #cooling-cells = <2>; /* min followed by max */
75 clock-latency = <40000>;75 clock-latency = <40000>;
76 clocks = <&cru ARMCLK>;76 clocks = <&cru ARMCLK>;
@@ -80,7 +80,7 @@ · 3 unmodified lines
80 compatible = "arm,cortex-a12";80 compatible = "arm,cortex-a12";
81 reg = <0x502>;81 reg = <0x502>;
82 resets = <&cru SRST_CORE2>;82 resets = <&cru SRST_CORE2>;
83 operating-points = <&cpu_opp_table>;83 operating-points-v2 = <&cpu_opp_table>;
84 #cooling-cells = <2>; /* min followed by max */84 #cooling-cells = <2>; /* min followed by max */
85 clock-latency = <40000>;85 clock-latency = <40000>;
86 clocks = <&cru ARMCLK>;86 clocks = <&cru ARMCLK>;
@@ -90,7 +90,7 @@ · 3 unmodified lines
90 compatible = "arm,cortex-a12";90 compatible = "arm,cortex-a12";
91 reg = <0x503>;91 reg = <0x503>;
92 resets = <&cru SRST_CORE3>;92 resets = <&cru SRST_CORE3>;
93 operating-points = <&cpu_opp_table>;93 operating-points-v2 = <&cpu_opp_table>;
94 #cooling-cells = <2>; /* min followed by max */94 #cooling-cells = <2>; /* min followed by max */
95 clock-latency = <40000>;95 clock-latency = <40000>;
96 clocks = <&cru ARMCLK>;96 clocks = <&cru ARMCLK>;
@@ -1119,8 +1119,6 @@ · 1022 unmodified lines
1119 clock-names = "ref", "pclk";1119 clock-names = "ref", "pclk";
1120 power-domains = <&power RK3288_PD_VIO>;1120 power-domains = <&power RK3288_PD_VIO>;
1121 rockchip,grf = <&grf>;1121 rockchip,grf = <&grf>;
1122 #address-cells = <1>;
1123 #size-cells = <0>;
1124 status = "disabled";1122 status = "disabled";
1125 1123
1126 ports {1124 ports {
@@ -1282,27 +1280,27 @@ · 155 unmodified lines
1282 gpu_opp_table: gpu-opp-table {1280 gpu_opp_table: gpu-opp-table {
1283 compatible = "operating-points-v2";1281 compatible = "operating-points-v2";
1284 1282
1285 opp@100000000 {1283 opp-100000000 {
1286 opp-hz = /bits/ 64 <100000000>;1284 opp-hz = /bits/ 64 <100000000>;
1287 opp-microvolt = <950000>;1285 opp-microvolt = <950000>;
1288 };1286 };
1289 opp@200000000 {1287 opp-200000000 {
1290 opp-hz = /bits/ 64 <200000000>;1288 opp-hz = /bits/ 64 <200000000>;
1291 opp-microvolt = <950000>;1289 opp-microvolt = <950000>;
1292 };1290 };
1293 opp@300000000 {1291 opp-300000000 {
1294 opp-hz = /bits/ 64 <300000000>;1292 opp-hz = /bits/ 64 <300000000>;
1295 opp-microvolt = <1000000>;1293 opp-microvolt = <1000000>;
1296 };1294 };
1297 opp@400000000 {1295 opp-400000000 {
1298 opp-hz = /bits/ 64 <400000000>;1296 opp-hz = /bits/ 64 <400000000>;
1299 opp-microvolt = <1100000>;1297 opp-microvolt = <1100000>;
1300 };1298 };
1301 opp@500000000 {1299 opp-500000000 {
1302 opp-hz = /bits/ 64 <500000000>;1300 opp-hz = /bits/ 64 <500000000>;
1303 opp-microvolt = <1200000>;1301 opp-microvolt = <1200000>;
1304 };1302 };
1305 opp@600000000 {1303 opp-600000000 {
1306 opp-hz = /bits/ 64 <600000000>;1304 opp-hz = /bits/ 64 <600000000>;
1307 opp-microvolt = <1250000>;1305 opp-microvolt = <1250000>;
1308 };1306 };
arch/arm/boot/dts/sama5d2-pinfunc.h+1−1
@@ -518,7 +518,7 @@ · 517 unmodified lines
518#define PIN_PC9__GPIO PINMUX_PIN(PIN_PC9, 0, 0)518#define PIN_PC9__GPIO PINMUX_PIN(PIN_PC9, 0, 0)
519#define PIN_PC9__FIQ PINMUX_PIN(PIN_PC9, 1, 3)519#define PIN_PC9__FIQ PINMUX_PIN(PIN_PC9, 1, 3)
520#define PIN_PC9__GTSUCOMP PINMUX_PIN(PIN_PC9, 2, 1)520#define PIN_PC9__GTSUCOMP PINMUX_PIN(PIN_PC9, 2, 1)
521#define PIN_PC9__ISC_D0 PINMUX_PIN(PIN_PC9, 2, 1)521#define PIN_PC9__ISC_D0 PINMUX_PIN(PIN_PC9, 3, 1)
522#define PIN_PC9__TIOA4 PINMUX_PIN(PIN_PC9, 4, 2)522#define PIN_PC9__TIOA4 PINMUX_PIN(PIN_PC9, 4, 2)
523#define PIN_PC10 74523#define PIN_PC10 74
524#define PIN_PC10__GPIO PINMUX_PIN(PIN_PC10, 0, 0)524#define PIN_PC10__GPIO PINMUX_PIN(PIN_PC10, 0, 0)
arch/arm/boot/dts/ste-nomadik-nhk15.dts+4−5
@@ -213,13 +213,12 @@ · 212 unmodified lines
213 gpio-sck = <&gpio0 5 GPIO_ACTIVE_HIGH>;213 gpio-sck = <&gpio0 5 GPIO_ACTIVE_HIGH>;
214 gpio-mosi = <&gpio0 4 GPIO_ACTIVE_HIGH>;214 gpio-mosi = <&gpio0 4 GPIO_ACTIVE_HIGH>;
215 /*215 /*
216 * This chipselect is active high. Just setting the flags216 * It's not actually active high, but the frameworks assume
217 * to GPIO_ACTIVE_HIGH is not enough for the SPI DT bindings,217 * the polarity of the passed-in GPIO is "normal" (active
218 * it will be ignored, only the special "spi-cs-high" flag218 * high) then actively drives the line low to select the
219 * really counts.219 * chip.
220 */220 */
221 cs-gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>;221 cs-gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>;
222 spi-cs-high;
223 num-chipselects = <1>;222 num-chipselects = <1>;
224 223
225 /*224 /*
arch/arm/include/asm/syscall.h+8−39
@@ -55,53 +55,22 @@ static inline void syscall_set_return_value(struct task_struct *task, · 54 unmodified lines
55 55
56static inline void syscall_get_arguments(struct task_struct *task,56static inline void syscall_get_arguments(struct task_struct *task,
57 struct pt_regs *regs,57 struct pt_regs *regs,
58 unsigned int i, unsigned int n,
59 unsigned long *args)58 unsigned long *args)
60{59{
61 if (n == 0)60 args[0] = regs->ARM_ORIG_r0;
62 return;61 args++;
63 62
64 if (i + n > SYSCALL_MAX_ARGS) {63 memcpy(args, &regs->ARM_r0 + 1, 5 * sizeof(args[0]));
65 unsigned long *args_bad = args + SYSCALL_MAX_ARGS - i;
66 unsigned int n_bad = n + i - SYSCALL_MAX_ARGS;
67 pr_warn("%s called with max args %d, handling only %d\n",
68 __func__, i + n, SYSCALL_MAX_ARGS);
69 memset(args_bad, 0, n_bad * sizeof(args[0]));
70 n = SYSCALL_MAX_ARGS - i;
71 }
72
73 if (i == 0) {
74 args[0] = regs->ARM_ORIG_r0;
75 args++;
76 i++;
77 n--;
78 }
79
80 memcpy(args, &regs->ARM_r0 + i, n * sizeof(args[0]));
81}64}
82 65
83static inline void syscall_set_arguments(struct task_struct *task,66static inline void syscall_set_arguments(struct task_struct *task,
84 struct pt_regs *regs,67 struct pt_regs *regs,
85 unsigned int i, unsigned int n,
86 const unsigned long *args)68 const unsigned long *args)
87{69{
88 if (n == 0)70 regs->ARM_ORIG_r0 = args[0];
89 return;71 args++;
90 72
91 if (i + n > SYSCALL_MAX_ARGS) {73 memcpy(&regs->ARM_r0 + 1, args, 5 * sizeof(args[0]));
92 pr_warn("%s called with max args %d, handling only %d\n",
93 __func__, i + n, SYSCALL_MAX_ARGS);
94 n = SYSCALL_MAX_ARGS - i;
95 }
96
97 if (i == 0) {
98 regs->ARM_ORIG_r0 = args[0];
99 args++;
100 i++;
101 n--;
102 }
103
104 memcpy(&regs->ARM_r0 + i, args, n * sizeof(args[0]));
105}74}
106 75
107static inline int syscall_get_arch(void)76static inline int syscall_get_arch(void)
arch/arm/mach-at91/pm.c+4−2
@@ -591,13 +591,13 @@ static int __init at91_pm_backup_init(void) · 590 unmodified lines
591 591
592 np = of_find_compatible_node(NULL, NULL, "atmel,sama5d2-securam");592 np = of_find_compatible_node(NULL, NULL, "atmel,sama5d2-securam");
593 if (!np)593 if (!np)
594 goto securam_fail;594 goto securam_fail_no_ref_dev;
595 595
596 pdev = of_find_device_by_node(np);596 pdev = of_find_device_by_node(np);
597 of_node_put(np);597 of_node_put(np);
598 if (!pdev) {598 if (!pdev) {
599 pr_warn("%s: failed to find securam device!\n", __func__);599 pr_warn("%s: failed to find securam device!\n", __func__);
600 goto securam_fail;600 goto securam_fail_no_ref_dev;
601 }601 }
602 602
603 sram_pool = gen_pool_get(&pdev->dev, NULL);603 sram_pool = gen_pool_get(&pdev->dev, NULL);
@@ -620,6 +620,8 @@ static int __init at91_pm_backup_init(void) · 16 unmodified lines
620 return 0;620 return 0;
621 621
622securam_fail:622securam_fail:
623 put_device(&pdev->dev);
624securam_fail_no_ref_dev:
623 iounmap(pm_data.sfrbu);625 iounmap(pm_data.sfrbu);
624 pm_data.sfrbu = NULL;626 pm_data.sfrbu = NULL;
625 return ret;627 return ret;
arch/arm/mach-iop13xx/setup.c+4−4
@@ -300,7 +300,7 @@ static struct resource iop13xx_adma_2_resources[] = { · 299 unmodified lines
300 }300 }
301};301};
302 302
303static u64 iop13xx_adma_dmamask = DMA_BIT_MASK(64);303static u64 iop13xx_adma_dmamask = DMA_BIT_MASK(32);
304static struct iop_adma_platform_data iop13xx_adma_0_data = {304static struct iop_adma_platform_data iop13xx_adma_0_data = {
305 .hw_id = 0,305 .hw_id = 0,
306 .pool_size = PAGE_SIZE,306 .pool_size = PAGE_SIZE,
@@ -324,7 +324,7 @@ static struct platform_device iop13xx_adma_0_channel = { · 17 unmodified lines
324 .resource = iop13xx_adma_0_resources,324 .resource = iop13xx_adma_0_resources,
325 .dev = {325 .dev = {
326 .dma_mask = &iop13xx_adma_dmamask,326 .dma_mask = &iop13xx_adma_dmamask,
327 .coherent_dma_mask = DMA_BIT_MASK(64),327 .coherent_dma_mask = DMA_BIT_MASK(32),
328 .platform_data = (void *) &iop13xx_adma_0_data,328 .platform_data = (void *) &iop13xx_adma_0_data,
329 },329 },
330};330};
@@ -336,7 +336,7 @@ static struct platform_device iop13xx_adma_1_channel = { · 5 unmodified lines
336 .resource = iop13xx_adma_1_resources,336 .resource = iop13xx_adma_1_resources,
337 .dev = {337 .dev = {
338 .dma_mask = &iop13xx_adma_dmamask,338 .dma_mask = &iop13xx_adma_dmamask,
339 .coherent_dma_mask = DMA_BIT_MASK(64),339 .coherent_dma_mask = DMA_BIT_MASK(32),
340 .platform_data = (void *) &iop13xx_adma_1_data,340 .platform_data = (void *) &iop13xx_adma_1_data,
341 },341 },
342};342};
@@ -348,7 +348,7 @@ static struct platform_device iop13xx_adma_2_channel = { · 5 unmodified lines
348 .resource = iop13xx_adma_2_resources,348 .resource = iop13xx_adma_2_resources,
349 .dev = {349 .dev = {
350 .dma_mask = &iop13xx_adma_dmamask,350 .dma_mask = &iop13xx_adma_dmamask,
351 .coherent_dma_mask = DMA_BIT_MASK(64),351 .coherent_dma_mask = DMA_BIT_MASK(32),
352 .platform_data = (void *) &iop13xx_adma_2_data,352 .platform_data = (void *) &iop13xx_adma_2_data,
353 },353 },
354};354};
arch/arm/mach-iop13xx/tpmi.c+5−5
@@ -152,7 +152,7 @@ static struct resource iop13xx_tpmi_3_resources[] = { · 151 unmodified lines
152 }152 }
153};153};
154 154
155u64 iop13xx_tpmi_mask = DMA_BIT_MASK(64);155u64 iop13xx_tpmi_mask = DMA_BIT_MASK(32);
156static struct platform_device iop13xx_tpmi_0_device = {156static struct platform_device iop13xx_tpmi_0_device = {
157 .name = "iop-tpmi",157 .name = "iop-tpmi",
158 .id = 0,158 .id = 0,
@@ -160,7 +160,7 @@ static struct platform_device iop13xx_tpmi_0_device = { · 1 unmodified line
160 .resource = iop13xx_tpmi_0_resources,160 .resource = iop13xx_tpmi_0_resources,
161 .dev = {161 .dev = {
162 .dma_mask = &iop13xx_tpmi_mask,162 .dma_mask = &iop13xx_tpmi_mask,
163 .coherent_dma_mask = DMA_BIT_MASK(64),163 .coherent_dma_mask = DMA_BIT_MASK(32),
164 },164 },
165};165};
166 166
@@ -171,7 +171,7 @@ static struct platform_device iop13xx_tpmi_1_device = { · 4 unmodified lines
171 .resource = iop13xx_tpmi_1_resources,171 .resource = iop13xx_tpmi_1_resources,
172 .dev = {172 .dev = {
173 .dma_mask = &iop13xx_tpmi_mask,173 .dma_mask = &iop13xx_tpmi_mask,
174 .coherent_dma_mask = DMA_BIT_MASK(64),174 .coherent_dma_mask = DMA_BIT_MASK(32),
175 },175 },
176};176};
177 177
@@ -182,7 +182,7 @@ static struct platform_device iop13xx_tpmi_2_device = { · 4 unmodified lines
182 .resource = iop13xx_tpmi_2_resources,182 .resource = iop13xx_tpmi_2_resources,
183 .dev = {183 .dev = {
184 .dma_mask = &iop13xx_tpmi_mask,184 .dma_mask = &iop13xx_tpmi_mask,
185 .coherent_dma_mask = DMA_BIT_MASK(64),185 .coherent_dma_mask = DMA_BIT_MASK(32),
186 },186 },
187};187};
188 188
@@ -193,7 +193,7 @@ static struct platform_device iop13xx_tpmi_3_device = { · 4 unmodified lines
193 .resource = iop13xx_tpmi_3_resources,193 .resource = iop13xx_tpmi_3_resources,
194 .dev = {194 .dev = {
195 .dma_mask = &iop13xx_tpmi_mask,195 .dma_mask = &iop13xx_tpmi_mask,
196 .coherent_dma_mask = DMA_BIT_MASK(64),196 .coherent_dma_mask = DMA_BIT_MASK(32),
197 },197 },
198};198};
199 199
arch/arm/mach-milbeaut/platsmp.c+4−0
@@ -65,6 +65,7 @@ static void m10v_smp_init(unsigned int max_cpus) · 64 unmodified lines
65 writel(KERNEL_UNBOOT_FLAG, m10v_smp_base + cpu * 4);65 writel(KERNEL_UNBOOT_FLAG, m10v_smp_base + cpu * 4);
66}66}
67 67
68#ifdef CONFIG_HOTPLUG_CPU
68static void m10v_cpu_die(unsigned int l_cpu)69static void m10v_cpu_die(unsigned int l_cpu)
69{70{
70 gic_cpu_if_down(0);71 gic_cpu_if_down(0);
@@ -83,12 +84,15 @@ static int m10v_cpu_kill(unsigned int l_cpu) · 12 unmodified lines
83 84
84 return 1;85 return 1;
85}86}
87#endif
86 88
87static struct smp_operations m10v_smp_ops __initdata = {89static struct smp_operations m10v_smp_ops __initdata = {
88 .smp_prepare_cpus = m10v_smp_init,90 .smp_prepare_cpus = m10v_smp_init,
89 .smp_boot_secondary = m10v_boot_secondary,91 .smp_boot_secondary = m10v_boot_secondary,
92#ifdef CONFIG_HOTPLUG_CPU
90 .cpu_die = m10v_cpu_die,93 .cpu_die = m10v_cpu_die,
91 .cpu_kill = m10v_cpu_kill,94 .cpu_kill = m10v_cpu_kill,
95#endif
92};96};
93CPU_METHOD_OF_DECLARE(m10v_smp, "socionext,milbeaut-m10v-smp", &m10v_smp_ops);97CPU_METHOD_OF_DECLARE(m10v_smp, "socionext,milbeaut-m10v-smp", &m10v_smp_ops);
94 98
arch/arm/mach-omap1/board-ams-delta.c+2−0
@@ -182,6 +182,7 @@ static struct resource latch1_resources[] = { · 181 unmodified lines
182 182
183static struct bgpio_pdata latch1_pdata = {183static struct bgpio_pdata latch1_pdata = {
184 .label = LATCH1_LABEL,184 .label = LATCH1_LABEL,
185 .base = -1,
185 .ngpio = LATCH1_NGPIO,186 .ngpio = LATCH1_NGPIO,
186};187};
187 188
@@ -219,6 +220,7 @@ static struct resource latch2_resources[] = { · 31 unmodified lines
219 220
220static struct bgpio_pdata latch2_pdata = {221static struct bgpio_pdata latch2_pdata = {
221 .label = LATCH2_LABEL,222 .label = LATCH2_LABEL,
223 .base = -1,
222 .ngpio = LATCH2_NGPIO,224 .ngpio = LATCH2_NGPIO,
223};225};
224 226
arch/arm/mach-omap2/display.c+3−1
@@ -250,8 +250,10 @@ static int __init omapdss_init_of(void) · 249 unmodified lines
250 if (!node)250 if (!node)
251 return 0;251 return 0;
252 252
253 if (!of_device_is_available(node))253 if (!of_device_is_available(node)) {
254 of_node_put(node);
254 return 0;255 return 0;
256 }
255 257
256 pdev = of_find_device_by_node(node);258 pdev = of_find_device_by_node(node);
257 259
arch/arm/plat-iop/adma.c+3−3
@@ -143,7 +143,7 @@ struct platform_device iop3xx_dma_0_channel = { · 142 unmodified lines
143 .resource = iop3xx_dma_0_resources,143 .resource = iop3xx_dma_0_resources,
144 .dev = {144 .dev = {
145 .dma_mask = &iop3xx_adma_dmamask,145 .dma_mask = &iop3xx_adma_dmamask,
146 .coherent_dma_mask = DMA_BIT_MASK(64),146 .coherent_dma_mask = DMA_BIT_MASK(32),
147 .platform_data = (void *) &iop3xx_dma_0_data,147 .platform_data = (void *) &iop3xx_dma_0_data,
148 },148 },
149};149};
@@ -155,7 +155,7 @@ struct platform_device iop3xx_dma_1_channel = { · 5 unmodified lines
155 .resource = iop3xx_dma_1_resources,155 .resource = iop3xx_dma_1_resources,
156 .dev = {156 .dev = {
157 .dma_mask = &iop3xx_adma_dmamask,157 .dma_mask = &iop3xx_adma_dmamask,
158 .coherent_dma_mask = DMA_BIT_MASK(64),158 .coherent_dma_mask = DMA_BIT_MASK(32),
159 .platform_data = (void *) &iop3xx_dma_1_data,159 .platform_data = (void *) &iop3xx_dma_1_data,
160 },160 },
161};161};
@@ -167,7 +167,7 @@ struct platform_device iop3xx_aau_channel = { · 5 unmodified lines
167 .resource = iop3xx_aau_resources,167 .resource = iop3xx_aau_resources,
168 .dev = {168 .dev = {
169 .dma_mask = &iop3xx_adma_dmamask,169 .dma_mask = &iop3xx_adma_dmamask,
170 .coherent_dma_mask = DMA_BIT_MASK(64),170 .coherent_dma_mask = DMA_BIT_MASK(32),
171 .platform_data = (void *) &iop3xx_aau_data,171 .platform_data = (void *) &iop3xx_aau_data,
172 },172 },
173};173};
arch/arm/plat-orion/common.c+2−2
@@ -622,7 +622,7 @@ static struct platform_device orion_xor0_shared = { · 621 unmodified lines
622 .resource = orion_xor0_shared_resources,622 .resource = orion_xor0_shared_resources,
623 .dev = {623 .dev = {
624 .dma_mask = &orion_xor_dmamask,624 .dma_mask = &orion_xor_dmamask,
625 .coherent_dma_mask = DMA_BIT_MASK(64),625 .coherent_dma_mask = DMA_BIT_MASK(32),
626 .platform_data = &orion_xor0_pdata,626 .platform_data = &orion_xor0_pdata,
627 },627 },
628};628};
@@ -683,7 +683,7 @@ static struct platform_device orion_xor1_shared = { · 54 unmodified lines
683 .resource = orion_xor1_shared_resources,683 .resource = orion_xor1_shared_resources,
684 .dev = {684 .dev = {
685 .dma_mask = &orion_xor_dmamask,685 .dma_mask = &orion_xor_dmamask,
686 .coherent_dma_mask = DMA_BIT_MASK(64),686 .coherent_dma_mask = DMA_BIT_MASK(32),
687 .platform_data = &orion_xor1_pdata,687 .platform_data = &orion_xor1_pdata,
688 },688 },
689};689};
arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi+3−0
@@ -162,6 +162,7 @@ · 161 unmodified lines
162 rx-fifo-depth = <16384>;162 rx-fifo-depth = <16384>;
163 snps,multicast-filter-bins = <256>;163 snps,multicast-filter-bins = <256>;
164 iommus = <&smmu 1>;164 iommus = <&smmu 1>;
165 altr,sysmgr-syscon = <&sysmgr 0x44 0>;
165 status = "disabled";166 status = "disabled";
166 };167 };
167 168
@@ -179,6 +180,7 @@ · 11 unmodified lines
179 rx-fifo-depth = <16384>;180 rx-fifo-depth = <16384>;
180 snps,multicast-filter-bins = <256>;181 snps,multicast-filter-bins = <256>;
181 iommus = <&smmu 2>;182 iommus = <&smmu 2>;
183 altr,sysmgr-syscon = <&sysmgr 0x48 0>;
182 status = "disabled";184 status = "disabled";
183 };185 };
184 186
@@ -196,6 +198,7 @@ · 11 unmodified lines
196 rx-fifo-depth = <16384>;198 rx-fifo-depth = <16384>;
197 snps,multicast-filter-bins = <256>;199 snps,multicast-filter-bins = <256>;
198 iommus = <&smmu 3>;200 iommus = <&smmu 3>;
201 altr,sysmgr-syscon = <&sysmgr 0x4c 0>;
199 status = "disabled";202 status = "disabled";
200 };203 };
201 204
arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts+2−2
@@ -108,8 +108,8 @@ · 107 unmodified lines
108 snps,reset-gpio = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>;108 snps,reset-gpio = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>;
109 snps,reset-active-low;109 snps,reset-active-low;
110 snps,reset-delays-us = <0 10000 50000>;110 snps,reset-delays-us = <0 10000 50000>;
111 tx_delay = <0x25>;111 tx_delay = <0x24>;
112 rx_delay = <0x11>;112 rx_delay = <0x18>;
113 status = "okay";113 status = "okay";
114};114};
115 115
arch/arm64/boot/dts/rockchip/rk3328-rock64.dts+1−2
@@ -46,8 +46,7 @@ · 45 unmodified lines
46 46
47 vcc_host1_5v: vcc_otg_5v: vcc-host1-5v-regulator {47 vcc_host1_5v: vcc_otg_5v: vcc-host1-5v-regulator {
48 compatible = "regulator-fixed";48 compatible = "regulator-fixed";
49 enable-active-high;49 gpio = <&gpio0 RK_PA2 GPIO_ACTIVE_LOW>;
50 gpio = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>;
51 pinctrl-names = "default";50 pinctrl-names = "default";
52 pinctrl-0 = <&usb20_host_drv>;51 pinctrl-0 = <&usb20_host_drv>;
53 regulator-name = "vcc_host1_5v";52 regulator-name = "vcc_host1_5v";
arch/arm64/boot/dts/rockchip/rk3328.dtsi+29−29
@@ -1445,11 +1445,11 @@ · 1444 unmodified lines
1445 1445
1446 sdmmc0 {1446 sdmmc0 {
1447 sdmmc0_clk: sdmmc0-clk {1447 sdmmc0_clk: sdmmc0-clk {
1448 rockchip,pins = <1 RK_PA6 1 &pcfg_pull_none_4ma>;1448 rockchip,pins = <1 RK_PA6 1 &pcfg_pull_none_8ma>;
1449 };1449 };
1450 1450
1451 sdmmc0_cmd: sdmmc0-cmd {1451 sdmmc0_cmd: sdmmc0-cmd {
1452 rockchip,pins = <1 RK_PA4 1 &pcfg_pull_up_4ma>;1452 rockchip,pins = <1 RK_PA4 1 &pcfg_pull_up_8ma>;
1453 };1453 };
1454 1454
1455 sdmmc0_dectn: sdmmc0-dectn {1455 sdmmc0_dectn: sdmmc0-dectn {
@@ -1461,14 +1461,14 @@ · 5 unmodified lines
1461 };1461 };
1462 1462
1463 sdmmc0_bus1: sdmmc0-bus1 {1463 sdmmc0_bus1: sdmmc0-bus1 {
1464 rockchip,pins = <1 RK_PA0 1 &pcfg_pull_up_4ma>;1464 rockchip,pins = <1 RK_PA0 1 &pcfg_pull_up_8ma>;
1465 };1465 };
1466 1466
1467 sdmmc0_bus4: sdmmc0-bus4 {1467 sdmmc0_bus4: sdmmc0-bus4 {
1468 rockchip,pins = <1 RK_PA0 1 &pcfg_pull_up_4ma>,1468 rockchip,pins = <1 RK_PA0 1 &pcfg_pull_up_8ma>,
1469 <1 RK_PA1 1 &pcfg_pull_up_4ma>,1469 <1 RK_PA1 1 &pcfg_pull_up_8ma>,
1470 <1 RK_PA2 1 &pcfg_pull_up_4ma>,1470 <1 RK_PA2 1 &pcfg_pull_up_8ma>,
1471 <1 RK_PA3 1 &pcfg_pull_up_4ma>;1471 <1 RK_PA3 1 &pcfg_pull_up_8ma>;
1472 };1472 };
1473 1473
1474 sdmmc0_gpio: sdmmc0-gpio {1474 sdmmc0_gpio: sdmmc0-gpio {
@@ -1642,50 +1642,50 @@ · 167 unmodified lines
1642 rgmiim1_pins: rgmiim1-pins {1642 rgmiim1_pins: rgmiim1-pins {
1643 rockchip,pins =1643 rockchip,pins =
1644 /* mac_txclk */1644 /* mac_txclk */
1645 <1 RK_PB4 2 &pcfg_pull_none_12ma>,1645 <1 RK_PB4 2 &pcfg_pull_none_8ma>,
1646 /* mac_rxclk */1646 /* mac_rxclk */
1647 <1 RK_PB5 2 &pcfg_pull_none_2ma>,1647 <1 RK_PB5 2 &pcfg_pull_none_4ma>,
1648 /* mac_mdio */1648 /* mac_mdio */
1649 <1 RK_PC3 2 &pcfg_pull_none_2ma>,1649 <1 RK_PC3 2 &pcfg_pull_none_4ma>,
1650 /* mac_txen */1650 /* mac_txen */
1651 <1 RK_PD1 2 &pcfg_pull_none_12ma>,1651 <1 RK_PD1 2 &pcfg_pull_none_8ma>,
1652 /* mac_clk */1652 /* mac_clk */
1653 <1 RK_PC5 2 &pcfg_pull_none_2ma>,1653 <1 RK_PC5 2 &pcfg_pull_none_4ma>,
1654 /* mac_rxdv */1654 /* mac_rxdv */
1655 <1 RK_PC6 2 &pcfg_pull_none_2ma>,1655 <1 RK_PC6 2 &pcfg_pull_none_4ma>,
1656 /* mac_mdc */1656 /* mac_mdc */
1657 <1 RK_PC7 2 &pcfg_pull_none_2ma>,1657 <1 RK_PC7 2 &pcfg_pull_none_4ma>,
1658 /* mac_rxd1 */1658 /* mac_rxd1 */
1659 <1 RK_PB2 2 &pcfg_pull_none_2ma>,1659 <1 RK_PB2 2 &pcfg_pull_none_4ma>,
1660 /* mac_rxd0 */1660 /* mac_rxd0 */
1661 <1 RK_PB3 2 &pcfg_pull_none_2ma>,1661 <1 RK_PB3 2 &pcfg_pull_none_4ma>,
1662 /* mac_txd1 */1662 /* mac_txd1 */
1663 <1 RK_PB0 2 &pcfg_pull_none_12ma>,1663 <1 RK_PB0 2 &pcfg_pull_none_8ma>,
1664 /* mac_txd0 */1664 /* mac_txd0 */
1665 <1 RK_PB1 2 &pcfg_pull_none_12ma>,1665 <1 RK_PB1 2 &pcfg_pull_none_8ma>,
1666 /* mac_rxd3 */1666 /* mac_rxd3 */
1667 <1 RK_PB6 2 &pcfg_pull_none_2ma>,1667 <1 RK_PB6 2 &pcfg_pull_none_4ma>,
1668 /* mac_rxd2 */1668 /* mac_rxd2 */
1669 <1 RK_PB7 2 &pcfg_pull_none_2ma>,1669 <1 RK_PB7 2 &pcfg_pull_none_4ma>,
1670 /* mac_txd3 */1670 /* mac_txd3 */
1671 <1 RK_PC0 2 &pcfg_pull_none_12ma>,1671 <1 RK_PC0 2 &pcfg_pull_none_8ma>,
1672 /* mac_txd2 */1672 /* mac_txd2 */
1673 <1 RK_PC1 2 &pcfg_pull_none_12ma>,1673 <1 RK_PC1 2 &pcfg_pull_none_8ma>,
1674 1674
1675 /* mac_txclk */1675 /* mac_txclk */
1676 <0 RK_PB0 1 &pcfg_pull_none>,1676 <0 RK_PB0 1 &pcfg_pull_none_8ma>,
1677 /* mac_txen */1677 /* mac_txen */
1678 <0 RK_PB4 1 &pcfg_pull_none>,1678 <0 RK_PB4 1 &pcfg_pull_none_8ma>,
1679 /* mac_clk */1679 /* mac_clk */
1680 <0 RK_PD0 1 &pcfg_pull_none>,1680 <0 RK_PD0 1 &pcfg_pull_none_4ma>,
1681 /* mac_txd1 */1681 /* mac_txd1 */
1682 <0 RK_PC0 1 &pcfg_pull_none>,1682 <0 RK_PC0 1 &pcfg_pull_none_8ma>,
1683 /* mac_txd0 */1683 /* mac_txd0 */
1684 <0 RK_PC1 1 &pcfg_pull_none>,1684 <0 RK_PC1 1 &pcfg_pull_none_8ma>,
1685 /* mac_txd3 */1685 /* mac_txd3 */
1686 <0 RK_PC7 1 &pcfg_pull_none>,1686 <0 RK_PC7 1 &pcfg_pull_none_8ma>,
1687 /* mac_txd2 */1687 /* mac_txd2 */
1688 <0 RK_PC6 1 &pcfg_pull_none>;1688 <0 RK_PC6 1 &pcfg_pull_none_8ma>;
1689 };1689 };
1690 1690
1691 rmiim1_pins: rmiim1-pins {1691 rmiim1_pins: rmiim1-pins {
arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dts+1−0
@@ -158,6 +158,7 @@ · 157 unmodified lines
158};158};
159 159
160&hdmi {160&hdmi {
161 ddc-i2c-bus = <&i2c3>;
161 pinctrl-names = "default";162 pinctrl-names = "default";
162 pinctrl-0 = <&hdmi_cec>;163 pinctrl-0 = <&hdmi_cec>;
163 status = "okay";164 status = "okay";
arch/arm64/include/asm/syscall.h+8−38
@@ -65,52 +65,22 @@ static inline void syscall_set_return_value(struct task_struct *task, · 64 unmodified lines
65 65
66static inline void syscall_get_arguments(struct task_struct *task,66static inline void syscall_get_arguments(struct task_struct *task,
67 struct pt_regs *regs,67 struct pt_regs *regs,
68 unsigned int i, unsigned int n,
69 unsigned long *args)68 unsigned long *args)
70{69{
71 if (n == 0)70 args[0] = regs->orig_x0;
72 return;71 args++;
73 72
74 if (i + n > SYSCALL_MAX_ARGS) {73 memcpy(args, &regs->regs[1], 5 * sizeof(args[0]));
75 unsigned long *args_bad = args + SYSCALL_MAX_ARGS - i;
76 unsigned int n_bad = n + i - SYSCALL_MAX_ARGS;
77 pr_warning("%s called with max args %d, handling only %d\n",
78 __func__, i + n, SYSCALL_MAX_ARGS);
79 memset(args_bad, 0, n_bad * sizeof(args[0]));
80 }
81
82 if (i == 0) {
83 args[0] = regs->orig_x0;
84 args++;
85 i++;
86 n--;
87 }
88
89 memcpy(args, &regs->regs[i], n * sizeof(args[0]));
90}74}
91 75
92static inline void syscall_set_arguments(struct task_struct *task,76static inline void syscall_set_arguments(struct task_struct *task,
93 struct pt_regs *regs,77 struct pt_regs *regs,
94 unsigned int i, unsigned int n,
95 const unsigned long *args)78 const unsigned long *args)
96{79{
97 if (n == 0)80 regs->orig_x0 = args[0];
98 return;81 args++;
99 82
100 if (i + n > SYSCALL_MAX_ARGS) {83 memcpy(&regs->regs[1], args, 5 * sizeof(args[0]));
101 pr_warning("%s called with max args %d, handling only %d\n",
102 __func__, i + n, SYSCALL_MAX_ARGS);
103 n = SYSCALL_MAX_ARGS - i;
104 }
105
106 if (i == 0) {
107 regs->orig_x0 = args[0];
108 args++;
109 i++;
110 n--;
111 }
112
113 memcpy(&regs->regs[i], args, n * sizeof(args[0]));
114}84}
115 85
116/*86/*
arch/arm64/kernel/sdei.c+6−0
@@ -94,6 +94,9 @@ static bool on_sdei_normal_stack(unsigned long sp, struct stack_info *info) · 93 unmodified lines
94 unsigned long low = (unsigned long)raw_cpu_read(sdei_stack_normal_ptr);94 unsigned long low = (unsigned long)raw_cpu_read(sdei_stack_normal_ptr);
95 unsigned long high = low + SDEI_STACK_SIZE;95 unsigned long high = low + SDEI_STACK_SIZE;
96 96
97 if (!low)
98 return false;
99
97 if (sp < low || sp >= high)100 if (sp < low || sp >= high)
98 return false;101 return false;
99 102
@@ -111,6 +114,9 @@ static bool on_sdei_critical_stack(unsigned long sp, struct stack_info *info) · 11 unmodified lines
111 unsigned long low = (unsigned long)raw_cpu_read(sdei_stack_critical_ptr);114 unsigned long low = (unsigned long)raw_cpu_read(sdei_stack_critical_ptr);
112 unsigned long high = low + SDEI_STACK_SIZE;115 unsigned long high = low + SDEI_STACK_SIZE;
113 116
117 if (!low)
118 return false;
119
114 if (sp < low || sp >= high)120 if (sp < low || sp >= high)
115 return false;121 return false;
116 122
arch/c6x/include/asm/syscall.h+14−65
@@ -46,78 +46,27 @@ static inline void syscall_set_return_value(struct task_struct *task, · 45 unmodified lines
46}46}
47 47
48static inline void syscall_get_arguments(struct task_struct *task,48static inline void syscall_get_arguments(struct task_struct *task,
49 struct pt_regs *regs, unsigned int i,49 struct pt_regs *regs,
50 unsigned int n, unsigned long *args)50 unsigned long *args)
51{51{
52 switch (i) {52 *args++ = regs->a4;
53 case 0:53 *args++ = regs->b4;
54 if (!n--)54 *args++ = regs->a6;
55 break;55 *args++ = regs->b6;
56 *args++ = regs->a4;56 *args++ = regs->a8;
57 case 1:57 *args = regs->b8;
58 if (!n--)
59 break;
60 *args++ = regs->b4;
61 case 2:
62 if (!n--)
63 break;
64 *args++ = regs->a6;
65 case 3:
66 if (!n--)
67 break;
68 *args++ = regs->b6;
69 case 4:
70 if (!n--)
71 break;
72 *args++ = regs->a8;
73 case 5:
74 if (!n--)
75 break;
76 *args++ = regs->b8;
77 case 6:
78 if (!n--)
79 break;
80 default:
81 BUG();
82 }
83}58}
84 59
85static inline void syscall_set_arguments(struct task_struct *task,60static inline void syscall_set_arguments(struct task_struct *task,
86 struct pt_regs *regs,61 struct pt_regs *regs,
87 unsigned int i, unsigned int n,
88 const unsigned long *args)62 const unsigned long *args)
89{63{
90 switch (i) {64 regs->a4 = *args++;
91 case 0:65 regs->b4 = *args++;
92 if (!n--)66 regs->a6 = *args++;
93 break;67 regs->b6 = *args++;
94 regs->a4 = *args++;68 regs->a8 = *args++;
95 case 1:69 regs->a9 = *args;
96 if (!n--)
97 break;
98 regs->b4 = *args++;
99 case 2:
100 if (!n--)
101 break;
102 regs->a6 = *args++;
103 case 3:
104 if (!n--)
105 break;
106 regs->b6 = *args++;
107 case 4:
108 if (!n--)
109 break;
110 regs->a8 = *args++;
111 case 5:
112 if (!n--)
113 break;
114 regs->a9 = *args++;
115 case 6:
116 if (!n)
117 break;
118 default:
119 BUG();
120 }
121}70}
122 71
123#endif /* __ASM_C6X_SYSCALLS_H */72#endif /* __ASM_C6X_SYSCALLS_H */
arch/csky/include/asm/syscall.h+8−18
@@ -43,30 +43,20 @@ syscall_set_return_value(struct task_struct *task, struct pt_regs *regs, · 42 unmodified lines
43 43
44static inline void44static inline void
45syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,45syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
46 unsigned int i, unsigned int n, unsigned long *args)46 unsigned long *args)
47{47{
48 BUG_ON(i + n > 6);48 args[0] = regs->orig_a0;
49 if (i == 0) {49 args++;
50 args[0] = regs->orig_a0;50 memcpy(args, &regs->a1, 5 * sizeof(args[0]));
51 args++;
52 i++;
53 n--;
54 }
55 memcpy(args, &regs->a1 + i * sizeof(regs->a1), n * sizeof(args[0]));
56}51}
57 52
58static inline void53static inline void
59syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,54syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
60 unsigned int i, unsigned int n, const unsigned long *args)55 const unsigned long *args)
61{56{
62 BUG_ON(i + n > 6);57 regs->orig_a0 = args[0];
63 if (i == 0) {58 args++;
64 regs->orig_a0 = args[0];59 memcpy(&regs->a1, args, 5 * sizeof(regs->a1));
65 args++;
66 i++;
67 n--;
68 }
69 memcpy(&regs->a1 + i * sizeof(regs->a1), args, n * sizeof(regs->a0));
70}60}
71 61
72static inline int62static inline int
arch/h8300/include/asm/syscall.h+7−27
@@ -17,34 +17,14 @@ syscall_get_nr(struct task_struct *task, struct pt_regs *regs) · 16 unmodified lines
17 17
18static inline void18static inline void
19syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,19syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
20 unsigned int i, unsigned int n, unsigned long *args)20 unsigned long *args)
21{21{
22 BUG_ON(i + n > 6);22 *args++ = regs->er1;
23 23 *args++ = regs->er2;
24 while (n > 0) {24 *args++ = regs->er3;
25 switch (i) {25 *args++ = regs->er4;
26 case 0:26 *args++ = regs->er5;
27 *args++ = regs->er1;27 *args = regs->er6;
28 break;
29 case 1:
30 *args++ = regs->er2;
31 break;
32 case 2:
33 *args++ = regs->er3;
34 break;
35 case 3:
36 *args++ = regs->er4;
37 break;
38 case 4:
39 *args++ = regs->er5;
40 break;
41 case 5:
42 *args++ = regs->er6;
43 break;
44 }
45 i++;
46 n--;
47 }
48}28}
49 29
50 30
arch/hexagon/include/asm/syscall.h+1−3
@@ -37,10 +37,8 @@ static inline long syscall_get_nr(struct task_struct *task, · 36 unmodified lines
37 37
38static inline void syscall_get_arguments(struct task_struct *task,38static inline void syscall_get_arguments(struct task_struct *task,
39 struct pt_regs *regs,39 struct pt_regs *regs,
40 unsigned int i, unsigned int n,
41 unsigned long *args)40 unsigned long *args)
42{41{
43 BUG_ON(i + n > 6);42 memcpy(args, &(&regs->r00)[0], 6 * sizeof(args[0]));
44 memcpy(args, &(&regs->r00)[i], n * sizeof(args[0]));
45}43}
46#endif44#endif
arch/ia64/include/asm/syscall.h+3−10
@@ -59,26 +59,19 @@ static inline void syscall_set_return_value(struct task_struct *task, · 58 unmodified lines
59}59}
60 60
61extern void ia64_syscall_get_set_arguments(struct task_struct *task,61extern void ia64_syscall_get_set_arguments(struct task_struct *task,
62 struct pt_regs *regs, unsigned int i, unsigned int n,62 struct pt_regs *regs, unsigned long *args, int rw);
63 unsigned long *args, int rw);
64static inline void syscall_get_arguments(struct task_struct *task,63static inline void syscall_get_arguments(struct task_struct *task,
65 struct pt_regs *regs,64 struct pt_regs *regs,
66 unsigned int i, unsigned int n,
67 unsigned long *args)65 unsigned long *args)
68{66{
69 BUG_ON(i + n > 6);67 ia64_syscall_get_set_arguments(task, regs, args, 0);
70
71 ia64_syscall_get_set_arguments(task, regs, i, n, args, 0);
72}68}
73 69
74static inline void syscall_set_arguments(struct task_struct *task,70static inline void syscall_set_arguments(struct task_struct *task,
75 struct pt_regs *regs,71 struct pt_regs *regs,
76 unsigned int i, unsigned int n,
77 unsigned long *args)72 unsigned long *args)
78{73{
79 BUG_ON(i + n > 6);74 ia64_syscall_get_set_arguments(task, regs, args, 1);
80
81 ia64_syscall_get_set_arguments(task, regs, i, n, args, 1);
82}75}
83 76
84static inline int syscall_get_arch(void)77static inline int syscall_get_arch(void)
arch/ia64/kernel/ptrace.c+3−4
@@ -2179,12 +2179,11 @@ static void syscall_get_set_args_cb(struct unw_frame_info *info, void *data) · 2178 unmodified lines
2179}2179}
2180 2180
2181void ia64_syscall_get_set_arguments(struct task_struct *task,2181void ia64_syscall_get_set_arguments(struct task_struct *task,
2182 struct pt_regs *regs, unsigned int i, unsigned int n,2182 struct pt_regs *regs, unsigned long *args, int rw)
2183 unsigned long *args, int rw)
2184{2183{
2185 struct syscall_get_set_args data = {2184 struct syscall_get_set_args data = {
2186 .i = i,2185 .i = 0,
2187 .n = n,2186 .n = 6,
2188 .args = args,2187 .args = args,
2189 .regs = regs,2188 .regs = regs,
2190 .rw = rw,2189 .rw = rw,
arch/microblaze/include/asm/syscall.h+6−2
@@ -82,18 +82,22 @@ static inline void microblaze_set_syscall_arg(struct pt_regs *regs, · 81 unmodified lines
82 82
83static inline void syscall_get_arguments(struct task_struct *task,83static inline void syscall_get_arguments(struct task_struct *task,
84 struct pt_regs *regs,84 struct pt_regs *regs,
85 unsigned int i, unsigned int n,
86 unsigned long *args)85 unsigned long *args)
87{86{
87 unsigned int i = 0;
88 unsigned int n = 6;
89
88 while (n--)90 while (n--)
89 *args++ = microblaze_get_syscall_arg(regs, i++);91 *args++ = microblaze_get_syscall_arg(regs, i++);
90}92}
91 93
92static inline void syscall_set_arguments(struct task_struct *task,94static inline void syscall_set_arguments(struct task_struct *task,
93 struct pt_regs *regs,95 struct pt_regs *regs,
94 unsigned int i, unsigned int n,
95 const unsigned long *args)96 const unsigned long *args)
96{97{
98 unsigned int i = 0;
99 unsigned int n = 6;
100
97 while (n--)101 while (n--)
98 microblaze_set_syscall_arg(regs, i++, *args++);102 microblaze_set_syscall_arg(regs, i++, *args++);
99}103}
arch/mips/include/asm/syscall.h+2−1
@@ -116,9 +116,10 @@ static inline void syscall_set_return_value(struct task_struct *task, · 115 unmodified lines
116 116
117static inline void syscall_get_arguments(struct task_struct *task,117static inline void syscall_get_arguments(struct task_struct *task,
118 struct pt_regs *regs,118 struct pt_regs *regs,
119 unsigned int i, unsigned int n,
120 unsigned long *args)119 unsigned long *args)
121{120{
121 unsigned int i = 0;
122 unsigned int n = 6;
122 int ret;123 int ret;
123 124
124 /* O32 ABI syscall() */125 /* O32 ABI syscall() */
arch/mips/kernel/ptrace.c+1−1
@@ -1419,7 +1419,7 @@ asmlinkage long syscall_trace_enter(struct pt_regs *regs, long syscall) · 1418 unmodified lines
1419 1419
1420 sd.nr = syscall;1420 sd.nr = syscall;
1421 sd.arch = syscall_get_arch();1421 sd.arch = syscall_get_arch();
1422 syscall_get_arguments(current, regs, 0, 6, args);1422 syscall_get_arguments(current, regs, args);
1423 for (i = 0; i < 6; i++)1423 for (i = 0; i < 6; i++)
1424 sd.args[i] = args[i];1424 sd.args[i] = args[i];
1425 sd.instruction_pointer = KSTK_EIP(current);1425 sd.instruction_pointer = KSTK_EIP(current);
arch/nds32/include/asm/syscall.h+11−51
@@ -108,81 +108,41 @@ void syscall_set_return_value(struct task_struct *task, struct pt_regs *regs, · 107 unmodified lines
108 * syscall_get_arguments - extract system call parameter values108 * syscall_get_arguments - extract system call parameter values
109 * @task: task of interest, must be blocked109 * @task: task of interest, must be blocked
110 * @regs: task_pt_regs() of @task110 * @regs: task_pt_regs() of @task
111 * @i: argument index [0,5]
112 * @n: number of arguments; n+i must be [1,6].
113 * @args: array filled with argument values111 * @args: array filled with argument values
114 *112 *
115 * Fetches @n arguments to the system call starting with the @i'th argument113 * Fetches 6 arguments to the system call (from 0 through 5). The first
116 * (from 0 through 5). Argument @i is stored in @args[0], and so on.114 * argument is stored in @args[0], and so on.
117 * An arch inline version is probably optimal when @i and @n are constants.
118 *115 *
119 * It's only valid to call this when @task is stopped for tracing on116 * It's only valid to call this when @task is stopped for tracing on
120 * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.117 * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
121 * It's invalid to call this with @i + @n > 6; we only support system calls
122 * taking up to 6 arguments.
123 */118 */
124#define SYSCALL_MAX_ARGS 6119#define SYSCALL_MAX_ARGS 6
125void syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,120void syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
126 unsigned int i, unsigned int n, unsigned long *args)121 unsigned long *args)
127{122{
128 if (n == 0)123 args[0] = regs->orig_r0;
129 return;124 args++;
130 if (i + n > SYSCALL_MAX_ARGS) {125 memcpy(args, &regs->uregs[0] + 1, 5 * sizeof(args[0]));
131 unsigned long *args_bad = args + SYSCALL_MAX_ARGS - i;
132 unsigned int n_bad = n + i - SYSCALL_MAX_ARGS;
133 pr_warning("%s called with max args %d, handling only %d\n",
134 __func__, i + n, SYSCALL_MAX_ARGS);
135 memset(args_bad, 0, n_bad * sizeof(args[0]));
136 memset(args_bad, 0, n_bad * sizeof(args[0]));
137 }
138
139 if (i == 0) {
140 args[0] = regs->orig_r0;
141 args++;
142 i++;
143 n--;
144 }
145
146 memcpy(args, &regs->uregs[0] + i, n * sizeof(args[0]));
147}126}
148 127
149/**128/**
150 * syscall_set_arguments - change system call parameter value129 * syscall_set_arguments - change system call parameter value
151 * @task: task of interest, must be in system call entry tracing130 * @task: task of interest, must be in system call entry tracing
152 * @regs: task_pt_regs() of @task131 * @regs: task_pt_regs() of @task
153 * @i: argument index [0,5]
154 * @n: number of arguments; n+i must be [1,6].
155 * @args: array of argument values to store132 * @args: array of argument values to store
156 *133 *
157 * Changes @n arguments to the system call starting with the @i'th argument.134 * Changes 6 arguments to the system call. The first argument gets value
158 * Argument @i gets value @args[0], and so on.135 * @args[0], and so on.
159 * An arch inline version is probably optimal when @i and @n are constants.
160 *136 *
161 * It's only valid to call this when @task is stopped for tracing on137 * It's only valid to call this when @task is stopped for tracing on
162 * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.138 * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
163 * It's invalid to call this with @i + @n > 6; we only support system calls
164 * taking up to 6 arguments.
165 */139 */
166void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,140void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
167 unsigned int i, unsigned int n,
168 const unsigned long *args)141 const unsigned long *args)
169{142{
170 if (n == 0)143 regs->orig_r0 = args[0];
171 return;144 args++;
172
173 if (i + n > SYSCALL_MAX_ARGS) {
174 pr_warn("%s called with max args %d, handling only %d\n",
175 __func__, i + n, SYSCALL_MAX_ARGS);
176 n = SYSCALL_MAX_ARGS - i;
177 }
178
179 if (i == 0) {
180 regs->orig_r0 = args[0];
181 args++;
182 i++;
183 n--;
184 }
185 145
186 memcpy(&regs->uregs[0] + i, args, n * sizeof(args[0]));146 memcpy(&regs->uregs[0] + 1, args, 5 * sizeof(args[0]));
187}147}
188#endif /* _ASM_NDS32_SYSCALL_H */148#endif /* _ASM_NDS32_SYSCALL_H */
arch/nios2/include/asm/syscall.h+14−70
@@ -58,81 +58,25 @@ static inline void syscall_set_return_value(struct task_struct *task, · 57 unmodified lines
58}58}
59 59
60static inline void syscall_get_arguments(struct task_struct *task,60static inline void syscall_get_arguments(struct task_struct *task,
61 struct pt_regs *regs, unsigned int i, unsigned int n,61 struct pt_regs *regs, unsigned long *args)
62 unsigned long *args)
63{62{
64 BUG_ON(i + n > 6);63 *args++ = regs->r4;
65 64 *args++ = regs->r5;
66 switch (i) {65 *args++ = regs->r6;
67 case 0:66 *args++ = regs->r7;
68 if (!n--)67 *args++ = regs->r8;
69 break;68 *args = regs->r9;
70 *args++ = regs->r4;
71 case 1:
72 if (!n--)
73 break;
74 *args++ = regs->r5;
75 case 2:
76 if (!n--)
77 break;
78 *args++ = regs->r6;
79 case 3:
80 if (!n--)
81 break;
82 *args++ = regs->r7;
83 case 4:
84 if (!n--)
85 break;
86 *args++ = regs->r8;
87 case 5:
88 if (!n--)
89 break;
90 *args++ = regs->r9;
91 case 6:
92 if (!n--)
93 break;
94 default:
95 BUG();
96 }
97}69}
98 70
99static inline void syscall_set_arguments(struct task_struct *task,71static inline void syscall_set_arguments(struct task_struct *task,
100 struct pt_regs *regs, unsigned int i, unsigned int n,72 struct pt_regs *regs, const unsigned long *args)
101 const unsigned long *args)
102{73{
103 BUG_ON(i + n > 6);74 regs->r4 = *args++;
104 75 regs->r5 = *args++;
105 switch (i) {76 regs->r6 = *args++;
106 case 0:77 regs->r7 = *args++;
107 if (!n--)78 regs->r8 = *args++;
108 break;79 regs->r9 = *args;
109 regs->r4 = *args++;
110 case 1:
111 if (!n--)
112 break;
113 regs->r5 = *args++;
114 case 2:
115 if (!n--)
116 break;
117 regs->r6 = *args++;
118 case 3:
119 if (!n--)
120 break;
121 regs->r7 = *args++;
122 case 4:
123 if (!n--)
124 break;
125 regs->r8 = *args++;
126 case 5:
127 if (!n--)
128 break;
129 regs->r9 = *args++;
130 case 6:
131 if (!n)
132 break;
133 default:
134 BUG();
135 }
136}80}
137 81
138#endif82#endif
arch/openrisc/include/asm/syscall.h+4−8
@@ -56,20 +56,16 @@ syscall_set_return_value(struct task_struct *task, struct pt_regs *regs, · 55 unmodified lines
56 56
57static inline void57static inline void
58syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,58syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
59 unsigned int i, unsigned int n, unsigned long *args)59 unsigned long *args)
60{60{
61 BUG_ON(i + n > 6);61 memcpy(args, &regs->gpr[3], 6 * sizeof(args[0]));
62
63 memcpy(args, &regs->gpr[3 + i], n * sizeof(args[0]));
64}62}
65 63
66static inline void64static inline void
67syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,65syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
68 unsigned int i, unsigned int n, const unsigned long *args)66 const unsigned long *args)
69{67{
70 BUG_ON(i + n > 6);68 memcpy(&regs->gpr[3], args, 6 * sizeof(args[0]));
71
72 memcpy(&regs->gpr[3 + i], args, n * sizeof(args[0]));
73}69}
74 70
75static inline int syscall_get_arch(void)71static inline int syscall_get_arch(void)
arch/parisc/include/asm/ptrace.h+3−2
@@ -22,13 +22,14 @@ unsigned long profile_pc(struct pt_regs *); · 21 unmodified lines
22 22
23static inline unsigned long regs_return_value(struct pt_regs *regs)23static inline unsigned long regs_return_value(struct pt_regs *regs)
24{24{
25 return regs->gr[20];25 return regs->gr[28];
26}26}
27 27
28static inline void instruction_pointer_set(struct pt_regs *regs,28static inline void instruction_pointer_set(struct pt_regs *regs,
29 unsigned long val)29 unsigned long val)
30{30{
31 regs->iaoq[0] = val;31 regs->iaoq[0] = val;
32 regs->iaoq[1] = val + 4;
32}33}
33 34
34/* Query offset/name of register from its name/offset */35/* Query offset/name of register from its name/offset */
arch/parisc/include/asm/syscall.h+8−22
@@ -18,29 +18,15 @@ static inline long syscall_get_nr(struct task_struct *tsk, · 17 unmodified lines
18}18}
19 19
20static inline void syscall_get_arguments(struct task_struct *tsk,20static inline void syscall_get_arguments(struct task_struct *tsk,
21 struct pt_regs *regs, unsigned int i,21 struct pt_regs *regs,
22 unsigned int n, unsigned long *args)22 unsigned long *args)
23{23{
24 BUG_ON(i);24 args[5] = regs->gr[21];
25 25 args[4] = regs->gr[22];
26 switch (n) {26 args[3] = regs->gr[23];
27 case 6:27 args[2] = regs->gr[24];
28 args[5] = regs->gr[21];28 args[1] = regs->gr[25];
29 case 5:29 args[0] = regs->gr[26];
30 args[4] = regs->gr[22];
31 case 4:
32 args[3] = regs->gr[23];
33 case 3:
34 args[2] = regs->gr[24];
35 case 2:
36 args[1] = regs->gr[25];
37 case 1:
38 args[0] = regs->gr[26];
39 case 0:
40 break;
41 default:
42 BUG();
43 }
44}30}
45 31
46static inline long syscall_get_return_value(struct task_struct *task,32static inline long syscall_get_return_value(struct task_struct *task,
arch/parisc/kernel/process.c+0−6
@@ -210,12 +210,6 @@ void __cpuidle arch_cpu_idle(void) · 209 unmodified lines
210 210
211static int __init parisc_idle_init(void)211static int __init parisc_idle_init(void)
212{212{
213 const char *marker;
214
215 /* check QEMU/SeaBIOS marker in PAGE0 */
216 marker = (char *) &PAGE0->pad0;
217 running_on_qemu = (memcmp(marker, "SeaBIOS", 8) == 0);
218
219 if (!running_on_qemu)213 if (!running_on_qemu)
220 cpu_idle_poll_ctrl(1);214 cpu_idle_poll_ctrl(1);
221 215
arch/parisc/kernel/setup.c+3−0
@@ -397,6 +397,9 @@ void __init start_parisc(void) · 396 unmodified lines
397 int ret, cpunum;397 int ret, cpunum;
398 struct pdc_coproc_cfg coproc_cfg;398 struct pdc_coproc_cfg coproc_cfg;
399 399
400 /* check QEMU/SeaBIOS marker in PAGE0 */
401 running_on_qemu = (memcmp(&PAGE0->pad0, "SeaBIOS", 8) == 0);
402
400 cpunum = smp_processor_id();403 cpunum = smp_processor_id();
401 404
402 init_cpu_topology();405 init_cpu_topology();
arch/powerpc/include/asm/syscall.h+5−10
@@ -65,22 +65,20 @@ static inline void syscall_set_return_value(struct task_struct *task, · 64 unmodified lines
65 65
66static inline void syscall_get_arguments(struct task_struct *task,66static inline void syscall_get_arguments(struct task_struct *task,
67 struct pt_regs *regs,67 struct pt_regs *regs,
68 unsigned int i, unsigned int n,
69 unsigned long *args)68 unsigned long *args)
70{69{
71 unsigned long val, mask = -1UL;70 unsigned long val, mask = -1UL;
72 71 unsigned int n = 6;
73 BUG_ON(i + n > 6);
74 72
75#ifdef CONFIG_COMPAT73#ifdef CONFIG_COMPAT
76 if (test_tsk_thread_flag(task, TIF_32BIT))74 if (test_tsk_thread_flag(task, TIF_32BIT))
77 mask = 0xffffffff;75 mask = 0xffffffff;
78#endif76#endif
79 while (n--) {77 while (n--) {
80 if (n == 0 && i == 0)78 if (n == 0)
81 val = regs->orig_gpr3;79 val = regs->orig_gpr3;
82 else80 else
83 val = regs->gpr[3 + i + n];81 val = regs->gpr[3 + n];
84 82
85 args[n] = val & mask;83 args[n] = val & mask;
86 }84 }
@@ -88,15 +86,12 @@ static inline void syscall_get_arguments(struct task_struct *task, · 1 unmodified line
88 86
89static inline void syscall_set_arguments(struct task_struct *task,87static inline void syscall_set_arguments(struct task_struct *task,
90 struct pt_regs *regs,88 struct pt_regs *regs,
91 unsigned int i, unsigned int n,
92 const unsigned long *args)89 const unsigned long *args)
93{90{
94 BUG_ON(i + n > 6);91 memcpy(&regs->gpr[3], args, 6 * sizeof(args[0]));
95 memcpy(&regs->gpr[3 + i], args, n * sizeof(args[0]));
96 92
97 /* Also copy the first argument into orig_gpr3 */93 /* Also copy the first argument into orig_gpr3 */
98 if (i == 0 && n > 0)94 regs->orig_gpr3 = args[0];
99 regs->orig_gpr3 = args[0];
100}95}
101 96
102static inline int syscall_get_arch(void)97static inline int syscall_get_arch(void)
arch/powerpc/kernel/kvm.c+7−0
@@ -22,6 +22,7 @@ · 21 unmodified lines
22#include <linux/kvm_host.h>22#include <linux/kvm_host.h>
23#include <linux/init.h>23#include <linux/init.h>
24#include <linux/export.h>24#include <linux/export.h>
25#include <linux/kmemleak.h>
25#include <linux/kvm_para.h>26#include <linux/kvm_para.h>
26#include <linux/slab.h>27#include <linux/slab.h>
27#include <linux/of.h>28#include <linux/of.h>
@@ -712,6 +713,12 @@ static void kvm_use_magic_page(void) · 684 unmodified lines
712 713
713static __init void kvm_free_tmp(void)714static __init void kvm_free_tmp(void)
714{715{
716 /*
717 * Inform kmemleak about the hole in the .bss section since the
718 * corresponding pages will be unmapped with DEBUG_PAGEALLOC=y.
719 */
720 kmemleak_free_part(&kvm_tmp[kvm_tmp_index],
721 ARRAY_SIZE(kvm_tmp) - kvm_tmp_index);
715 free_reserved_area(&kvm_tmp[kvm_tmp_index],722 free_reserved_area(&kvm_tmp[kvm_tmp_index],
716 &kvm_tmp[ARRAY_SIZE(kvm_tmp)], -1, NULL);723 &kvm_tmp[ARRAY_SIZE(kvm_tmp)], -1, NULL);
717}724}
arch/riscv/include/asm/syscall.h+6−18
@@ -72,32 +72,20 @@ static inline void syscall_set_return_value(struct task_struct *task, · 71 unmodified lines
72 72
73static inline void syscall_get_arguments(struct task_struct *task,73static inline void syscall_get_arguments(struct task_struct *task,
74 struct pt_regs *regs,74 struct pt_regs *regs,
75 unsigned int i, unsigned int n,
76 unsigned long *args)75 unsigned long *args)
77{76{
78 BUG_ON(i + n > 6);77 args[0] = regs->orig_a0;
79 if (i == 0) {78 args++;
80 args[0] = regs->orig_a0;79 memcpy(args, &regs->a1, 5 * sizeof(args[0]));
81 args++;
82 i++;
83 n--;
84 }
85 memcpy(args, &regs->a1 + i * sizeof(regs->a1), n * sizeof(args[0]));
86}80}
87 81
88static inline void syscall_set_arguments(struct task_struct *task,82static inline void syscall_set_arguments(struct task_struct *task,
89 struct pt_regs *regs,83 struct pt_regs *regs,
90 unsigned int i, unsigned int n,
91 const unsigned long *args)84 const unsigned long *args)
92{85{
93 BUG_ON(i + n > 6);86 regs->orig_a0 = args[0];
94 if (i == 0) {87 args++;
95 regs->orig_a0 = args[0];88 memcpy(&regs->a1, args, 5 * sizeof(regs->a1));
96 args++;
97 i++;
98 n--;
99 }
100 memcpy(&regs->a1 + i * sizeof(regs->a1), args, n * sizeof(regs->a0));
101}89}
102 90
103static inline int syscall_get_arch(void)91static inline int syscall_get_arch(void)
arch/s390/include/asm/syscall.h+10−18
@@ -56,40 +56,32 @@ static inline void syscall_set_return_value(struct task_struct *task, · 55 unmodified lines
56 56
57static inline void syscall_get_arguments(struct task_struct *task,57static inline void syscall_get_arguments(struct task_struct *task,
58 struct pt_regs *regs,58 struct pt_regs *regs,
59 unsigned int i, unsigned int n,
60 unsigned long *args)59 unsigned long *args)
61{60{
62 unsigned long mask = -1UL;61 unsigned long mask = -1UL;
62 unsigned int n = 6;
63 63
64 /*
65 * No arguments for this syscall, there's nothing to do.
66 */
67 if (!n)
68 return;
69
70 BUG_ON(i + n > 6);
71#ifdef CONFIG_COMPAT64#ifdef CONFIG_COMPAT
72 if (test_tsk_thread_flag(task, TIF_31BIT))65 if (test_tsk_thread_flag(task, TIF_31BIT))
73 mask = 0xffffffff;66 mask = 0xffffffff;
74#endif67#endif
75 while (n-- > 0)68 while (n-- > 0)
76 if (i + n > 0)69 if (n > 0)
77 args[n] = regs->gprs[2 + i + n] & mask;70 args[n] = regs->gprs[2 + n] & mask;
78 if (i == 0)71
79 args[0] = regs->orig_gpr2 & mask;72 args[0] = regs->orig_gpr2 & mask;
80}73}
81 74
82static inline void syscall_set_arguments(struct task_struct *task,75static inline void syscall_set_arguments(struct task_struct *task,
83 struct pt_regs *regs,76 struct pt_regs *regs,
84 unsigned int i, unsigned int n,
85 const unsigned long *args)77 const unsigned long *args)
86{78{
87 BUG_ON(i + n > 6);79 unsigned int n = 6;
80
88 while (n-- > 0)81 while (n-- > 0)
89 if (i + n > 0)82 if (n > 0)
90 regs->gprs[2 + i + n] = args[n];83 regs->gprs[2 + n] = args[n];
91 if (i == 0)84 regs->orig_gpr2 = args[0];
92 regs->orig_gpr2 = args[0];
93}85}
94 86
95static inline int syscall_get_arch(void)87static inline int syscall_get_arch(void)
arch/sh/boards/of-generic.c+2−2
@@ -164,10 +164,10 @@ static struct sh_machine_vector __initmv sh_of_generic_mv = { · 163 unmodified lines
164 164
165struct sh_clk_ops;165struct sh_clk_ops;
166 166
167void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx)167void __init __weak arch_init_clk_ops(struct sh_clk_ops **ops, int idx)
168{168{
169}169}
170 170
171void __init plat_irq_setup(void)171void __init __weak plat_irq_setup(void)
172{172{
173}173}
arch/sh/include/asm/syscall_32.h+12−35
@@ -48,51 +48,28 @@ static inline void syscall_set_return_value(struct task_struct *task, · 47 unmodified lines
48 48
49static inline void syscall_get_arguments(struct task_struct *task,49static inline void syscall_get_arguments(struct task_struct *task,
50 struct pt_regs *regs,50 struct pt_regs *regs,
51 unsigned int i, unsigned int n,
52 unsigned long *args)51 unsigned long *args)
53{52{
54 /*
55 * Do this simply for now. If we need to start supporting
56 * fetching arguments from arbitrary indices, this will need some
57 * extra logic. Presently there are no in-tree users that depend
58 * on this behaviour.
59 */
60 BUG_ON(i);
61 53
62 /* Argument pattern is: R4, R5, R6, R7, R0, R1 */54 /* Argument pattern is: R4, R5, R6, R7, R0, R1 */
63 switch (n) {55 args[5] = regs->regs[1];
64 case 6: args[5] = regs->regs[1];56 args[4] = regs->regs[0];
65 case 5: args[4] = regs->regs[0];57 args[3] = regs->regs[7];
66 case 4: args[3] = regs->regs[7];58 args[2] = regs->regs[6];
67 case 3: args[2] = regs->regs[6];59 args[1] = regs->regs[5];
68 case 2: args[1] = regs->regs[5];60 args[0] = regs->regs[4];
69 case 1: args[0] = regs->regs[4];
70 case 0:
71 break;
72 default:
73 BUG();
74 }
75}61}
76 62
77static inline void syscall_set_arguments(struct task_struct *task,63static inline void syscall_set_arguments(struct task_struct *task,
78 struct pt_regs *regs,64 struct pt_regs *regs,
79 unsigned int i, unsigned int n,
80 const unsigned long *args)65 const unsigned long *args)
81{66{
82 /* Same note as above applies */67 regs->regs[1] = args[5];
83 BUG_ON(i);68 regs->regs[0] = args[4];
84 69 regs->regs[7] = args[3];
85 switch (n) {70 regs->regs[6] = args[2];
86 case 6: regs->regs[1] = args[5];71 regs->regs[5] = args[1];
87 case 5: regs->regs[0] = args[4];72 regs->regs[4] = args[0];
88 case 4: regs->regs[7] = args[3];
89 case 3: regs->regs[6] = args[2];
90 case 2: regs->regs[5] = args[1];
91 case 1: regs->regs[4] = args[0];
92 break;
93 default:
94 BUG();
95 }
96}73}
97 74
98static inline int syscall_get_arch(void)75static inline int syscall_get_arch(void)
arch/sh/include/asm/syscall_64.h+2−6
@@ -47,20 +47,16 @@ static inline void syscall_set_return_value(struct task_struct *task, · 46 unmodified lines
47 47
48static inline void syscall_get_arguments(struct task_struct *task,48static inline void syscall_get_arguments(struct task_struct *task,
49 struct pt_regs *regs,49 struct pt_regs *regs,
50 unsigned int i, unsigned int n,
51 unsigned long *args)50 unsigned long *args)
52{51{
53 BUG_ON(i + n > 6);52 memcpy(args, &regs->regs[2], 6 * sizeof(args[0]));
54 memcpy(args, &regs->regs[2 + i], n * sizeof(args[0]));
55}53}
56 54
57static inline void syscall_set_arguments(struct task_struct *task,55static inline void syscall_set_arguments(struct task_struct *task,
58 struct pt_regs *regs,56 struct pt_regs *regs,
59 unsigned int i, unsigned int n,
60 const unsigned long *args)57 const unsigned long *args)
61{58{
62 BUG_ON(i + n > 6);59 memcpy(&regs->regs[2], args, 6 * sizeof(args[0]));
63 memcpy(&regs->regs[2 + i], args, n * sizeof(args[0]));
64}60}
65 61
66static inline int syscall_get_arch(void)62static inline int syscall_get_arch(void)
arch/sparc/include/asm/syscall.h+5−6
@@ -96,11 +96,11 @@ static inline void syscall_set_return_value(struct task_struct *task, · 95 unmodified lines
96 96
97static inline void syscall_get_arguments(struct task_struct *task,97static inline void syscall_get_arguments(struct task_struct *task,
98 struct pt_regs *regs,98 struct pt_regs *regs,
99 unsigned int i, unsigned int n,
100 unsigned long *args)99 unsigned long *args)
101{100{
102 int zero_extend = 0;101 int zero_extend = 0;
103 unsigned int j;102 unsigned int j;
103 unsigned int n = 6;
104 104
105#ifdef CONFIG_SPARC64105#ifdef CONFIG_SPARC64
106 if (test_tsk_thread_flag(task, TIF_32BIT))106 if (test_tsk_thread_flag(task, TIF_32BIT))
@@ -108,7 +108,7 @@ static inline void syscall_get_arguments(struct task_struct *task, · 1 unmodified line
108#endif108#endif
109 109
110 for (j = 0; j < n; j++) {110 for (j = 0; j < n; j++) {
111 unsigned long val = regs->u_regs[UREG_I0 + i + j];111 unsigned long val = regs->u_regs[UREG_I0 + j];
112 112
113 if (zero_extend)113 if (zero_extend)
114 args[j] = (u32) val;114 args[j] = (u32) val;
@@ -119,13 +119,12 @@ static inline void syscall_get_arguments(struct task_struct *task, · 4 unmodified lines
119 119
120static inline void syscall_set_arguments(struct task_struct *task,120static inline void syscall_set_arguments(struct task_struct *task,
121 struct pt_regs *regs,121 struct pt_regs *regs,
122 unsigned int i, unsigned int n,
123 const unsigned long *args)122 const unsigned long *args)
124{123{
125 unsigned int j;124 unsigned int i;
126 125
127 for (j = 0; j < n; j++)126 for (i = 0; i < 6; i++)
128 regs->u_regs[UREG_I0 + i + j] = args[j];127 regs->u_regs[UREG_I0 + i] = args[i];
129}128}
130 129
131static inline int syscall_get_arch(void)130static inline int syscall_get_arch(void)
arch/um/include/asm/syscall-generic.h+12−66
@@ -53,84 +53,30 @@ static inline void syscall_set_return_value(struct task_struct *task, · 52 unmodified lines
53 53
54static inline void syscall_get_arguments(struct task_struct *task,54static inline void syscall_get_arguments(struct task_struct *task,
55 struct pt_regs *regs,55 struct pt_regs *regs,
56 unsigned int i, unsigned int n,
57 unsigned long *args)56 unsigned long *args)
58{57{
59 const struct uml_pt_regs *r = &regs->regs;58 const struct uml_pt_regs *r = &regs->regs;
60 59
61 switch (i) {60 *args++ = UPT_SYSCALL_ARG1(r);
62 case 0:61 *args++ = UPT_SYSCALL_ARG2(r);
63 if (!n--)62 *args++ = UPT_SYSCALL_ARG3(r);
64 break;63 *args++ = UPT_SYSCALL_ARG4(r);
65 *args++ = UPT_SYSCALL_ARG1(r);64 *args++ = UPT_SYSCALL_ARG5(r);
66 case 1:65 *args = UPT_SYSCALL_ARG6(r);
67 if (!n--)
68 break;
69 *args++ = UPT_SYSCALL_ARG2(r);
70 case 2:
71 if (!n--)
72 break;
73 *args++ = UPT_SYSCALL_ARG3(r);
74 case 3:
75 if (!n--)
76 break;
77 *args++ = UPT_SYSCALL_ARG4(r);
78 case 4:
79 if (!n--)
80 break;
81 *args++ = UPT_SYSCALL_ARG5(r);
82 case 5:
83 if (!n--)
84 break;
85 *args++ = UPT_SYSCALL_ARG6(r);
86 case 6:
87 if (!n--)
88 break;
89 default:
90 BUG();
91 break;
92 }
93}66}
94 67
95static inline void syscall_set_arguments(struct task_struct *task,68static inline void syscall_set_arguments(struct task_struct *task,
96 struct pt_regs *regs,69 struct pt_regs *regs,
97 unsigned int i, unsigned int n,
98 const unsigned long *args)70 const unsigned long *args)
99{71{
100 struct uml_pt_regs *r = &regs->regs;72 struct uml_pt_regs *r = &regs->regs;
101 73
102 switch (i) {74 UPT_SYSCALL_ARG1(r) = *args++;
103 case 0:75 UPT_SYSCALL_ARG2(r) = *args++;
104 if (!n--)76 UPT_SYSCALL_ARG3(r) = *args++;
105 break;77 UPT_SYSCALL_ARG4(r) = *args++;
106 UPT_SYSCALL_ARG1(r) = *args++;78 UPT_SYSCALL_ARG5(r) = *args++;
107 case 1:79 UPT_SYSCALL_ARG6(r) = *args;
108 if (!n--)
109 break;
110 UPT_SYSCALL_ARG2(r) = *args++;
111 case 2:
112 if (!n--)
113 break;
114 UPT_SYSCALL_ARG3(r) = *args++;
115 case 3:
116 if (!n--)
117 break;
118 UPT_SYSCALL_ARG4(r) = *args++;
119 case 4:
120 if (!n--)
121 break;
122 UPT_SYSCALL_ARG5(r) = *args++;
123 case 5:
124 if (!n--)
125 break;
126 UPT_SYSCALL_ARG6(r) = *args++;
127 case 6:
128 if (!n--)
129 break;
130 default:
131 BUG();
132 break;
133 }
134}80}
135 81
136/* See arch/x86/um/asm/syscall.h for syscall_get_arch() definition. */82/* See arch/x86/um/asm/syscall.h for syscall_get_arch() definition. */
arch/x86/include/asm/syscall.h+33−109
@@ -91,11 +91,9 @@ static inline void syscall_set_return_value(struct task_struct *task, · 90 unmodified lines
91 91
92static inline void syscall_get_arguments(struct task_struct *task,92static inline void syscall_get_arguments(struct task_struct *task,
93 struct pt_regs *regs,93 struct pt_regs *regs,
94 unsigned int i, unsigned int n,
95 unsigned long *args)94 unsigned long *args)
96{95{
97 BUG_ON(i + n > 6);96 memcpy(args, &regs->bx, 6 * sizeof(args[0]));
98 memcpy(args, &regs->bx + i, n * sizeof(args[0]));
99}97}
100 98
101static inline void syscall_set_arguments(struct task_struct *task,99static inline void syscall_set_arguments(struct task_struct *task,
@@ -116,124 +114,50 @@ static inline int syscall_get_arch(void) · 14 unmodified lines
116 114
117static inline void syscall_get_arguments(struct task_struct *task,115static inline void syscall_get_arguments(struct task_struct *task,
118 struct pt_regs *regs,116 struct pt_regs *regs,
119 unsigned int i, unsigned int n,
120 unsigned long *args)117 unsigned long *args)
121{118{
122# ifdef CONFIG_IA32_EMULATION119# ifdef CONFIG_IA32_EMULATION
123 if (task->thread_info.status & TS_COMPAT)120 if (task->thread_info.status & TS_COMPAT) {
124 switch (i) {121 *args++ = regs->bx;
125 case 0:122 *args++ = regs->cx;
126 if (!n--) break;123 *args++ = regs->dx;
127 *args++ = regs->bx;124 *args++ = regs->si;
128 case 1:125 *args++ = regs->di;
129 if (!n--) break;126 *args = regs->bp;
130 *args++ = regs->cx;127 } else
131 case 2:
132 if (!n--) break;
133 *args++ = regs->dx;
134 case 3:
135 if (!n--) break;
136 *args++ = regs->si;
137 case 4:
138 if (!n--) break;
139 *args++ = regs->di;
140 case 5:
141 if (!n--) break;
142 *args++ = regs->bp;
143 case 6:
144 if (!n--) break;
145 default:
146 BUG();
147 break;
148 }
149 else
150# endif128# endif
151 switch (i) {129 {
152 case 0:130 *args++ = regs->di;
153 if (!n--) break;131 *args++ = regs->si;
154 *args++ = regs->di;132 *args++ = regs->dx;
155 case 1:133 *args++ = regs->r10;
156 if (!n--) break;134 *args++ = regs->r8;
157 *args++ = regs->si;135 *args = regs->r9;
158 case 2:136 }
159 if (!n--) break;
160 *args++ = regs->dx;
161 case 3:
162 if (!n--) break;
163 *args++ = regs->r10;
164 case 4:
165 if (!n--) break;
166 *args++ = regs->r8;
167 case 5:
168 if (!n--) break;
169 *args++ = regs->r9;
170 case 6:
171 if (!n--) break;
172 default:
173 BUG();
174 break;
175 }
176}137}
177 138
178static inline void syscall_set_arguments(struct task_struct *task,139static inline void syscall_set_arguments(struct task_struct *task,
179 struct pt_regs *regs,140 struct pt_regs *regs,
180 unsigned int i, unsigned int n,
181 const unsigned long *args)141 const unsigned long *args)
182{142{
183# ifdef CONFIG_IA32_EMULATION143# ifdef CONFIG_IA32_EMULATION
184 if (task->thread_info.status & TS_COMPAT)144 if (task->thread_info.status & TS_COMPAT) {
185 switch (i) {145 regs->bx = *args++;
186 case 0:146 regs->cx = *args++;
187 if (!n--) break;147 regs->dx = *args++;
188 regs->bx = *args++;148 regs->si = *args++;
189 case 1:149 regs->di = *args++;
190 if (!n--) break;150 regs->bp = *args;
191 regs->cx = *args++;151 } else
192 case 2:
193 if (!n--) break;
194 regs->dx = *args++;
195 case 3:
196 if (!n--) break;
197 regs->si = *args++;
198 case 4:
199 if (!n--) break;
200 regs->di = *args++;
201 case 5:
202 if (!n--) break;
203 regs->bp = *args++;
204 case 6:
205 if (!n--) break;
206 default:
207 BUG();
208 break;
209 }
210 else
211# endif152# endif
212 switch (i) {153 {
213 case 0:154 regs->di = *args++;
214 if (!n--) break;155 regs->si = *args++;
215 regs->di = *args++;156 regs->dx = *args++;
216 case 1:157 regs->r10 = *args++;
217 if (!n--) break;158 regs->r8 = *args++;
218 regs->si = *args++;159 regs->r9 = *args;
219 case 2:160 }
220 if (!n--) break;
221 regs->dx = *args++;
222 case 3:
223 if (!n--) break;
224 regs->r10 = *args++;
225 case 4:
226 if (!n--) break;
227 regs->r8 = *args++;
228 case 5:
229 if (!n--) break;
230 regs->r9 = *args++;
231 case 6:
232 if (!n--) break;
233 default:
234 BUG();
235 break;
236 }
237}161}
238 162
239static inline int syscall_get_arch(void)163static inline int syscall_get_arch(void)
arch/x86/include/asm/xen/hypercall.h+3−0
@@ -206,6 +206,9 @@ xen_single_call(unsigned int call, · 205 unmodified lines
206 __HYPERCALL_DECLS;206 __HYPERCALL_DECLS;
207 __HYPERCALL_5ARG(a1, a2, a3, a4, a5);207 __HYPERCALL_5ARG(a1, a2, a3, a4, a5);
208 208
209 if (call >= PAGE_SIZE / sizeof(hypercall_page[0]))
210 return -EINVAL;
211
209 asm volatile(CALL_NOSPEC212 asm volatile(CALL_NOSPEC
210 : __HYPERCALL_5PARAM213 : __HYPERCALL_5PARAM
211 : [thunk_target] "a" (&hypercall_page[call])214 : [thunk_target] "a" (&hypercall_page[call])
arch/x86/kvm/svm.c+14−8
@@ -6422,11 +6422,11 @@ e_free: · 6421 unmodified lines
6422 return ret;6422 return ret;
6423}6423}
6424 6424
6425static int get_num_contig_pages(int idx, struct page **inpages,6425static unsigned long get_num_contig_pages(unsigned long idx,
6426 unsigned long npages)6426 struct page **inpages, unsigned long npages)
6427{6427{
6428 unsigned long paddr, next_paddr;6428 unsigned long paddr, next_paddr;
6429 int i = idx + 1, pages = 1;6429 unsigned long i = idx + 1, pages = 1;
6430 6430
6431 /* find the number of contiguous pages starting from idx */6431 /* find the number of contiguous pages starting from idx */
6432 paddr = __sme_page_pa(inpages[idx]);6432 paddr = __sme_page_pa(inpages[idx]);
@@ -6445,12 +6445,12 @@ static int get_num_contig_pages(int idx, struct page **inpages, · 12 unmodified lines
6445 6445
6446static int sev_launch_update_data(struct kvm *kvm, struct kvm_sev_cmd *argp)6446static int sev_launch_update_data(struct kvm *kvm, struct kvm_sev_cmd *argp)
6447{6447{
6448 unsigned long vaddr, vaddr_end, next_vaddr, npages, size;6448 unsigned long vaddr, vaddr_end, next_vaddr, npages, pages, size, i;
6449 struct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info;6449 struct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info;
6450 struct kvm_sev_launch_update_data params;6450 struct kvm_sev_launch_update_data params;
6451 struct sev_data_launch_update_data *data;6451 struct sev_data_launch_update_data *data;
6452 struct page **inpages;6452 struct page **inpages;
6453 int i, ret, pages;6453 int ret;
6454 6454
6455 if (!sev_guest(kvm))6455 if (!sev_guest(kvm))
6456 return -ENOTTY;6456 return -ENOTTY;
@@ -6799,7 +6799,8 @@ static int sev_dbg_crypt(struct kvm *kvm, struct kvm_sev_cmd *argp, bool dec) · 342 unmodified lines
6799 struct page **src_p, **dst_p;6799 struct page **src_p, **dst_p;
6800 struct kvm_sev_dbg debug;6800 struct kvm_sev_dbg debug;
6801 unsigned long n;6801 unsigned long n;
6802 int ret, size;6802 unsigned int size;
6803 int ret;
6803 6804
6804 if (!sev_guest(kvm))6805 if (!sev_guest(kvm))
6805 return -ENOTTY;6806 return -ENOTTY;
@@ -6807,6 +6808,11 @@ static int sev_dbg_crypt(struct kvm *kvm, struct kvm_sev_cmd *argp, bool dec) · 1 unmodified line
6807 if (copy_from_user(&debug, (void __user *)(uintptr_t)argp->data, sizeof(debug)))6808 if (copy_from_user(&debug, (void __user *)(uintptr_t)argp->data, sizeof(debug)))
6808 return -EFAULT;6809 return -EFAULT;
6809 6810
6811 if (!debug.len || debug.src_uaddr + debug.len < debug.src_uaddr)
6812 return -EINVAL;
6813 if (!debug.dst_uaddr)
6814 return -EINVAL;
6815
6810 vaddr = debug.src_uaddr;6816 vaddr = debug.src_uaddr;
6811 size = debug.len;6817 size = debug.len;
6812 vaddr_end = vaddr + size;6818 vaddr_end = vaddr + size;
@@ -6857,8 +6863,8 @@ static int sev_dbg_crypt(struct kvm *kvm, struct kvm_sev_cmd *argp, bool dec) · 44 unmodified lines
6857 dst_vaddr,6863 dst_vaddr,
6858 len, &argp->error);6864 len, &argp->error);
6859 6865
6860 sev_unpin_memory(kvm, src_p, 1);6866 sev_unpin_memory(kvm, src_p, n);
6861 sev_unpin_memory(kvm, dst_p, 1);6867 sev_unpin_memory(kvm, dst_p, n);
6862 6868
6863 if (ret)6869 if (ret)
6864 goto err;6870 goto err;
arch/x86/kvm/vmx/nested.c+45−29
@@ -500,6 +500,17 @@ static void nested_vmx_disable_intercept_for_msr(unsigned long *msr_bitmap_l1, · 499 unmodified lines
500 }500 }
501}501}
502 502
503static inline void enable_x2apic_msr_intercepts(unsigned long *msr_bitmap) {
504 int msr;
505
506 for (msr = 0x800; msr <= 0x8ff; msr += BITS_PER_LONG) {
507 unsigned word = msr / BITS_PER_LONG;
508
509 msr_bitmap[word] = ~0;
510 msr_bitmap[word + (0x800 / sizeof(long))] = ~0;
511 }
512}
513
503/*514/*
504 * Merge L0's and L1's MSR bitmap, return false to indicate that515 * Merge L0's and L1's MSR bitmap, return false to indicate that
505 * we do not use the hardware.516 * we do not use the hardware.
@@ -541,39 +552,44 @@ static inline bool nested_vmx_prepare_msr_bitmap(struct kvm_vcpu *vcpu, · 35 unmodified lines
541 return false;552 return false;
542 553
543 msr_bitmap_l1 = (unsigned long *)kmap(page);554 msr_bitmap_l1 = (unsigned long *)kmap(page);
544 if (nested_cpu_has_apic_reg_virt(vmcs12)) {
545 /*
546 * L0 need not intercept reads for MSRs between 0x800 and 0x8ff, it
547 * just lets the processor take the value from the virtual-APIC page;
548 * take those 256 bits directly from the L1 bitmap.
549 */
550 for (msr = 0x800; msr <= 0x8ff; msr += BITS_PER_LONG) {
551 unsigned word = msr / BITS_PER_LONG;
552 msr_bitmap_l0[word] = msr_bitmap_l1[word];
553 msr_bitmap_l0[word + (0x800 / sizeof(long))] = ~0;
554 }
555 } else {
556 for (msr = 0x800; msr <= 0x8ff; msr += BITS_PER_LONG) {
557 unsigned word = msr / BITS_PER_LONG;
558 msr_bitmap_l0[word] = ~0;
559 msr_bitmap_l0[word + (0x800 / sizeof(long))] = ~0;
560 }
561 }
562 555
563 nested_vmx_disable_intercept_for_msr(556 /*
564 msr_bitmap_l1, msr_bitmap_l0,557 * To keep the control flow simple, pay eight 8-byte writes (sixteen
565 X2APIC_MSR(APIC_TASKPRI),558 * 4-byte writes on 32-bit systems) up front to enable intercepts for
566 MSR_TYPE_W);559 * the x2APIC MSR range and selectively disable them below.
560 */
561 enable_x2apic_msr_intercepts(msr_bitmap_l0);
562
563 if (nested_cpu_has_virt_x2apic_mode(vmcs12)) {
564 if (nested_cpu_has_apic_reg_virt(vmcs12)) {
565 /*
566 * L0 need not intercept reads for MSRs between 0x800
567 * and 0x8ff, it just lets the processor take the value
568 * from the virtual-APIC page; take those 256 bits
569 * directly from the L1 bitmap.
570 */
571 for (msr = 0x800; msr <= 0x8ff; msr += BITS_PER_LONG) {
572 unsigned word = msr / BITS_PER_LONG;
573
574 msr_bitmap_l0[word] = msr_bitmap_l1[word];
575 }
576 }
567 577
568 if (nested_cpu_has_vid(vmcs12)) {
569 nested_vmx_disable_intercept_for_msr(
570 msr_bitmap_l1, msr_bitmap_l0,
571 X2APIC_MSR(APIC_EOI),
572 MSR_TYPE_W);
573 nested_vmx_disable_intercept_for_msr(578 nested_vmx_disable_intercept_for_msr(
574 msr_bitmap_l1, msr_bitmap_l0,579 msr_bitmap_l1, msr_bitmap_l0,
575 X2APIC_MSR(APIC_SELF_IPI),580 X2APIC_MSR(APIC_TASKPRI),
576 MSR_TYPE_W);581 MSR_TYPE_R | MSR_TYPE_W);
582
583 if (nested_cpu_has_vid(vmcs12)) {
584 nested_vmx_disable_intercept_for_msr(
585 msr_bitmap_l1, msr_bitmap_l0,
586 X2APIC_MSR(APIC_EOI),
587 MSR_TYPE_W);
588 nested_vmx_disable_intercept_for_msr(
589 msr_bitmap_l1, msr_bitmap_l0,
590 X2APIC_MSR(APIC_SELF_IPI),
591 MSR_TYPE_W);
592 }
577 }593 }
578 594
579 if (spec_ctrl)595 if (spec_ctrl)
arch/xtensa/include/asm/processor.h+12−9
@@ -187,15 +187,18 @@ struct thread_struct { · 186 unmodified lines
187 187
188/* Clearing a0 terminates the backtrace. */188/* Clearing a0 terminates the backtrace. */
189#define start_thread(regs, new_pc, new_sp) \189#define start_thread(regs, new_pc, new_sp) \
190 memset(regs, 0, sizeof(*regs)); \190 do { \
191 regs->pc = new_pc; \191 memset((regs), 0, sizeof(*(regs))); \
192 regs->ps = USER_PS_VALUE; \192 (regs)->pc = (new_pc); \
193 regs->areg[1] = new_sp; \193 (regs)->ps = USER_PS_VALUE; \
194 regs->areg[0] = 0; \194 (regs)->areg[1] = (new_sp); \
195 regs->wmask = 1; \195 (regs)->areg[0] = 0; \
196 regs->depc = 0; \196 (regs)->wmask = 1; \
197 regs->windowbase = 0; \197 (regs)->depc = 0; \
198 regs->windowstart = 1;198 (regs)->windowbase = 0; \
199 (regs)->windowstart = 1; \
200 (regs)->syscall = NO_SYSCALL; \
201 } while (0)
199 202
200/* Forward declaration */203/* Forward declaration */
201struct task_struct;204struct task_struct;
arch/xtensa/include/asm/syscall.h+6−27
@@ -59,45 +59,24 @@ static inline void syscall_set_return_value(struct task_struct *task, · 58 unmodified lines
59 59
60static inline void syscall_get_arguments(struct task_struct *task,60static inline void syscall_get_arguments(struct task_struct *task,
61 struct pt_regs *regs,61 struct pt_regs *regs,
62 unsigned int i, unsigned int n,
63 unsigned long *args)62 unsigned long *args)
64{63{
65 static const unsigned int reg[] = XTENSA_SYSCALL_ARGUMENT_REGS;64 static const unsigned int reg[] = XTENSA_SYSCALL_ARGUMENT_REGS;
66 unsigned int j;65 unsigned int i;
67 66
68 if (n == 0)67 for (i = 0; i < 6; ++i)
69 return;68 args[i] = regs->areg[reg[i]];
70
71 WARN_ON_ONCE(i + n > SYSCALL_MAX_ARGS);
72
73 for (j = 0; j < n; ++j) {
74 if (i + j < SYSCALL_MAX_ARGS)
75 args[j] = regs->areg[reg[i + j]];
76 else
77 args[j] = 0;
78 }
79}69}
80 70
81static inline void syscall_set_arguments(struct task_struct *task,71static inline void syscall_set_arguments(struct task_struct *task,
82 struct pt_regs *regs,72 struct pt_regs *regs,
83 unsigned int i, unsigned int n,
84 const unsigned long *args)73 const unsigned long *args)
85{74{
86 static const unsigned int reg[] = XTENSA_SYSCALL_ARGUMENT_REGS;75 static const unsigned int reg[] = XTENSA_SYSCALL_ARGUMENT_REGS;
87 unsigned int j;76 unsigned int i;
88
89 if (n == 0)
90 return;
91
92 if (WARN_ON_ONCE(i + n > SYSCALL_MAX_ARGS)) {
93 if (i < SYSCALL_MAX_ARGS)
94 n = SYSCALL_MAX_ARGS - i;
95 else
96 return;
97 }
98 77
99 for (j = 0; j < n; ++j)78 for (i = 0; i < 6; ++i)
100 regs->areg[reg[i + j]] = args[j];79 regs->areg[reg[i]] = args[i];
101}80}
102 81
103asmlinkage long xtensa_rt_sigreturn(struct pt_regs*);82asmlinkage long xtensa_rt_sigreturn(struct pt_regs*);
arch/xtensa/kernel/entry.S+6−0
@@ -1860,6 +1860,8 @@ ENTRY(system_call) · 1859 unmodified lines
1860 l32i a7, a2, PT_SYSCALL1860 l32i a7, a2, PT_SYSCALL
1861 1861
18621:18621:
1863 s32i a7, a1, 4
1864
1863 /* syscall = sys_call_table[syscall_nr] */1865 /* syscall = sys_call_table[syscall_nr] */
1864 1866
1865 movi a4, sys_call_table1867 movi a4, sys_call_table
@@ -1893,8 +1895,12 @@ ENTRY(system_call) · 27 unmodified lines
1893 retw1895 retw
1894 1896
18951:18971:
1898 l32i a4, a1, 4
1899 l32i a3, a2, PT_SYSCALL
1900 s32i a4, a2, PT_SYSCALL
1896 mov a6, a21901 mov a6, a2
1897 call4 do_syscall_trace_leave1902 call4 do_syscall_trace_leave
1903 s32i a3, a2, PT_SYSCALL
1898 retw1904 retw
1899 1905
1900ENDPROC(system_call)1906ENDPROC(system_call)
arch/xtensa/kernel/stacktrace.c+5−1
@@ -253,10 +253,14 @@ static int return_address_cb(struct stackframe *frame, void *data) · 252 unmodified lines
253 return 1;253 return 1;
254}254}
255 255
256/*
257 * level == 0 is for the return address from the caller of this function,
258 * not from this function itself.
259 */
256unsigned long return_address(unsigned level)260unsigned long return_address(unsigned level)
257{261{
258 struct return_addr_data r = {262 struct return_addr_data r = {
259 .skip = level + 1,263 .skip = level,
260 };264 };
261 walk_stackframe(stack_pointer(NULL), return_address_cb, &r);265 walk_stackframe(stack_pointer(NULL), return_address_cb, &r);
262 return r.addr;266 return r.addr;
arch/xtensa/mm/mmu.c+1−1
@@ -33,7 +33,7 @@ static void * __init init_pmd(unsigned long vaddr, unsigned long n_pages) · 32 unmodified lines
33 33
34 pte = memblock_alloc_low(n_pages * sizeof(pte_t), PAGE_SIZE);34 pte = memblock_alloc_low(n_pages * sizeof(pte_t), PAGE_SIZE);
35 if (!pte)35 if (!pte)
36 panic("%s: Failed to allocate %zu bytes align=%lx\n",36 panic("%s: Failed to allocate %lu bytes align=%lx\n",
37 __func__, n_pages * sizeof(pte_t), PAGE_SIZE);37 __func__, n_pages * sizeof(pte_t), PAGE_SIZE);
38 38
39 for (i = 0; i < n_pages; ++i)39 for (i = 0; i < n_pages; ++i)
block/bfq-iosched.c+1−1
@@ -674,7 +674,7 @@ static bool bfq_symmetric_scenario(struct bfq_data *bfqd) · 673 unmodified lines
674 * at least two nodes.674 * at least two nodes.
675 */675 */
676 return !(varied_queue_weights || multiple_classes_busy676 return !(varied_queue_weights || multiple_classes_busy
677#ifdef BFQ_GROUP_IOSCHED_ENABLED677#ifdef CONFIG_BFQ_GROUP_IOSCHED
678 || bfqd->num_groups_with_pending_reqs > 0678 || bfqd->num_groups_with_pending_reqs > 0
679#endif679#endif
680 );680 );
block/bfq-wf2q.c+1−1
@@ -1012,7 +1012,7 @@ static void __bfq_activate_entity(struct bfq_entity *entity, · 1011 unmodified lines
1012 entity->on_st = true;1012 entity->on_st = true;
1013 }1013 }
1014 1014
1015#ifdef BFQ_GROUP_IOSCHED_ENABLED1015#ifdef CONFIG_BFQ_GROUP_IOSCHED
1016 if (!bfq_entity_to_bfqq(entity)) { /* bfq_group */1016 if (!bfq_entity_to_bfqq(entity)) { /* bfq_group */
1017 struct bfq_group *bfqg =1017 struct bfq_group *bfqg =
1018 container_of(entity, struct bfq_group, entity);1018 container_of(entity, struct bfq_group, entity);
block/blk-core.c+1−3
@@ -1245,8 +1245,6 @@ static int blk_cloned_rq_check_limits(struct request_queue *q, · 1244 unmodified lines
1245 */1245 */
1246blk_status_t blk_insert_cloned_request(struct request_queue *q, struct request *rq)1246blk_status_t blk_insert_cloned_request(struct request_queue *q, struct request *rq)
1247{1247{
1248 blk_qc_t unused;
1249
1250 if (blk_cloned_rq_check_limits(q, rq))1248 if (blk_cloned_rq_check_limits(q, rq))
1251 return BLK_STS_IOERR;1249 return BLK_STS_IOERR;
1252 1250
@@ -1262,7 +1260,7 @@ blk_status_t blk_insert_cloned_request(struct request_queue *q, struct request * · 9 unmodified lines
1262 * bypass a potential scheduler on the bottom device for1260 * bypass a potential scheduler on the bottom device for
1263 * insert.1261 * insert.
1264 */1262 */
1265 return blk_mq_try_issue_directly(rq->mq_hctx, rq, &unused, true, true);1263 return blk_mq_request_issue_directly(rq, true);
1266}1264}
1267EXPORT_SYMBOL_GPL(blk_insert_cloned_request);1265EXPORT_SYMBOL_GPL(blk_insert_cloned_request);
1268 1266
block/blk-mq-sched.c+5−3
@@ -423,10 +423,12 @@ void blk_mq_sched_insert_requests(struct blk_mq_hw_ctx *hctx, · 422 unmodified lines
423 * busy in case of 'none' scheduler, and this way may save423 * busy in case of 'none' scheduler, and this way may save
424 * us one extra enqueue & dequeue to sw queue.424 * us one extra enqueue & dequeue to sw queue.
425 */425 */
426 if (!hctx->dispatch_busy && !e && !run_queue_async)426 if (!hctx->dispatch_busy && !e && !run_queue_async) {
427 blk_mq_try_issue_list_directly(hctx, list);427 blk_mq_try_issue_list_directly(hctx, list);
428 else428 if (list_empty(list))
429 blk_mq_insert_requests(hctx, ctx, list);429 return;
430 }
431 blk_mq_insert_requests(hctx, ctx, list);
430 }432 }
431 433
432 blk_mq_run_hw_queue(hctx, run_queue_async);434 blk_mq_run_hw_queue(hctx, run_queue_async);
block/blk-mq.c+68−61
@@ -1711,11 +1711,12 @@ void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule) · 1710 unmodified lines
1711 unsigned int depth;1711 unsigned int depth;
1712 1712
1713 list_splice_init(&plug->mq_list, &list);1713 list_splice_init(&plug->mq_list, &list);
1714 plug->rq_count = 0;
1715 1714
1716 if (plug->rq_count > 2 && plug->multiple_queues)1715 if (plug->rq_count > 2 && plug->multiple_queues)
1717 list_sort(NULL, &list, plug_rq_cmp);1716 list_sort(NULL, &list, plug_rq_cmp);
1718 1717
1718 plug->rq_count = 0;
1719
1719 this_q = NULL;1720 this_q = NULL;
1720 this_hctx = NULL;1721 this_hctx = NULL;
1721 this_ctx = NULL;1722 this_ctx = NULL;
@@ -1800,74 +1801,76 @@ static blk_status_t __blk_mq_issue_directly(struct blk_mq_hw_ctx *hctx, · 78 unmodified lines
1800 return ret;1801 return ret;
1801}1802}
1802 1803
1803blk_status_t blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx,1804static blk_status_t __blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx,
1804 struct request *rq,1805 struct request *rq,
1805 blk_qc_t *cookie,1806 blk_qc_t *cookie,
1806 bool bypass, bool last)1807 bool bypass_insert, bool last)
1807{1808{
1808 struct request_queue *q = rq->q;1809 struct request_queue *q = rq->q;
1809 bool run_queue = true;1810 bool run_queue = true;
1810 blk_status_t ret = BLK_STS_RESOURCE;
1811 int srcu_idx;
1812 bool force = false;
1813 1811
1814 hctx_lock(hctx, &srcu_idx);
1815 /*1812 /*
1816 * hctx_lock is needed before checking quiesced flag.1813 * RCU or SRCU read lock is needed before checking quiesced flag.
1817 *1814 *
1818 * When queue is stopped or quiesced, ignore 'bypass', insert1815 * When queue is stopped or quiesced, ignore 'bypass_insert' from
1819 * and return BLK_STS_OK to caller, and avoid driver to try to1816 * blk_mq_request_issue_directly(), and return BLK_STS_OK to caller,
1820 * dispatch again.1817 * and avoid driver to try to dispatch again.
1821 */1818 */
1822 if (unlikely(blk_mq_hctx_stopped(hctx) || blk_queue_quiesced(q))) {1819 if (blk_mq_hctx_stopped(hctx) || blk_queue_quiesced(q)) {
1823 run_queue = false;1820 run_queue = false;
1824 bypass = false;1821 bypass_insert = false;
1825 goto out_unlock;1822 goto insert;
1826 }1823 }
1827 1824
1828 if (unlikely(q->elevator && !bypass))1825 if (q->elevator && !bypass_insert)
1829 goto out_unlock;1826 goto insert;
1830 1827
1831 if (!blk_mq_get_dispatch_budget(hctx))1828 if (!blk_mq_get_dispatch_budget(hctx))
1832 goto out_unlock;1829 goto insert;
1833 1830
1834 if (!blk_mq_get_driver_tag(rq)) {1831 if (!blk_mq_get_driver_tag(rq)) {
1835 blk_mq_put_dispatch_budget(hctx);1832 blk_mq_put_dispatch_budget(hctx);
1836 goto out_unlock;1833 goto insert;
1837 }1834 }
1838 1835
1839 /*1836 return __blk_mq_issue_directly(hctx, rq, cookie, last);
1840 * Always add a request that has been through1837insert:
1841 *.queue_rq() to the hardware dispatch list.1838 if (bypass_insert)
1842 */1839 return BLK_STS_RESOURCE;
1843 force = true;1840
1844 ret = __blk_mq_issue_directly(hctx, rq, cookie, last);1841 blk_mq_request_bypass_insert(rq, run_queue);
1845out_unlock:1842 return BLK_STS_OK;
1843}
1844
1845static void blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx,
1846 struct request *rq, blk_qc_t *cookie)
1847{
1848 blk_status_t ret;
1849 int srcu_idx;
1850
1851 might_sleep_if(hctx->flags & BLK_MQ_F_BLOCKING);
1852
1853 hctx_lock(hctx, &srcu_idx);
1854
1855 ret = __blk_mq_try_issue_directly(hctx, rq, cookie, false, true);
1856 if (ret == BLK_STS_RESOURCE || ret == BLK_STS_DEV_RESOURCE)
1857 blk_mq_request_bypass_insert(rq, true);
1858 else if (ret != BLK_STS_OK)
1859 blk_mq_end_request(rq, ret);
1860
1861 hctx_unlock(hctx, srcu_idx);
1862}
1863
1864blk_status_t blk_mq_request_issue_directly(struct request *rq, bool last)
1865{
1866 blk_status_t ret;
1867 int srcu_idx;
1868 blk_qc_t unused_cookie;
1869 struct blk_mq_hw_ctx *hctx = rq->mq_hctx;
1870
1871 hctx_lock(hctx, &srcu_idx);
1872 ret = __blk_mq_try_issue_directly(hctx, rq, &unused_cookie, true, last);
1846 hctx_unlock(hctx, srcu_idx);1873 hctx_unlock(hctx, srcu_idx);
1847 switch (ret) {
1848 case BLK_STS_OK:
1849 break;
1850 case BLK_STS_DEV_RESOURCE:
1851 case BLK_STS_RESOURCE:
1852 if (force) {
1853 blk_mq_request_bypass_insert(rq, run_queue);
1854 /*
1855 * We have to return BLK_STS_OK for the DM
1856 * to avoid livelock. Otherwise, we return
1857 * the real result to indicate whether the
1858 * request is direct-issued successfully.
1859 */
1860 ret = bypass ? BLK_STS_OK : ret;
1861 } else if (!bypass) {
1862 blk_mq_sched_insert_request(rq, false,
1863 run_queue, false);
1864 }
1865 break;
1866 default:
1867 if (!bypass)
1868 blk_mq_end_request(rq, ret);
1869 break;
1870 }
1871 1874
1872 return ret;1875 return ret;
1873}1876}
@@ -1875,20 +1878,22 @@ out_unlock: · 1 unmodified line
1875void blk_mq_try_issue_list_directly(struct blk_mq_hw_ctx *hctx,1878void blk_mq_try_issue_list_directly(struct blk_mq_hw_ctx *hctx,
1876 struct list_head *list)1879 struct list_head *list)
1877{1880{
1878 blk_qc_t unused;
1879 blk_status_t ret = BLK_STS_OK;
1880
1881 while (!list_empty(list)) {1881 while (!list_empty(list)) {
1882 blk_status_t ret;
1882 struct request *rq = list_first_entry(list, struct request,1883 struct request *rq = list_first_entry(list, struct request,
1883 queuelist);1884 queuelist);
1884 1885
1885 list_del_init(&rq->queuelist);1886 list_del_init(&rq->queuelist);
1886 if (ret == BLK_STS_OK)1887 ret = blk_mq_request_issue_directly(rq, list_empty(list));
1887 ret = blk_mq_try_issue_directly(hctx, rq, &unused,1888 if (ret != BLK_STS_OK) {
1888 false,1889 if (ret == BLK_STS_RESOURCE ||
1890 ret == BLK_STS_DEV_RESOURCE) {
1891 blk_mq_request_bypass_insert(rq,
1889 list_empty(list));1892 list_empty(list));
1890 else1893 break;
1891 blk_mq_sched_insert_request(rq, false, true, false);1894 }
1895 blk_mq_end_request(rq, ret);
1896 }
1892 }1897 }
1893 1898
1894 /*1899 /*
@@ -1896,7 +1901,7 @@ void blk_mq_try_issue_list_directly(struct blk_mq_hw_ctx *hctx, · 1 unmodified line
1896 * the driver there was more coming, but that turned out to1901 * the driver there was more coming, but that turned out to
1897 * be a lie.1902 * be a lie.
1898 */1903 */
1899 if (ret != BLK_STS_OK && hctx->queue->mq_ops->commit_rqs)1904 if (!list_empty(list) && hctx->queue->mq_ops->commit_rqs)
1900 hctx->queue->mq_ops->commit_rqs(hctx);1905 hctx->queue->mq_ops->commit_rqs(hctx);
1901}1906}
1902 1907
@@ -2003,19 +2008,21 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio) · 100 unmodified lines
2003 plug->rq_count--;2008 plug->rq_count--;
2004 }2009 }
2005 blk_add_rq_to_plug(plug, rq);2010 blk_add_rq_to_plug(plug, rq);
2011 trace_block_plug(q);
2006 2012
2007 blk_mq_put_ctx(data.ctx);2013 blk_mq_put_ctx(data.ctx);
2008 2014
2009 if (same_queue_rq) {2015 if (same_queue_rq) {
2010 data.hctx = same_queue_rq->mq_hctx;2016 data.hctx = same_queue_rq->mq_hctx;
2017 trace_block_unplug(q, 1, true);
2011 blk_mq_try_issue_directly(data.hctx, same_queue_rq,2018 blk_mq_try_issue_directly(data.hctx, same_queue_rq,
2012 &cookie, false, true);2019 &cookie);
2013 }2020 }
2014 } else if ((q->nr_hw_queues > 1 && is_sync) || (!q->elevator &&2021 } else if ((q->nr_hw_queues > 1 && is_sync) || (!q->elevator &&
2015 !data.hctx->dispatch_busy)) {2022 !data.hctx->dispatch_busy)) {
2016 blk_mq_put_ctx(data.ctx);2023 blk_mq_put_ctx(data.ctx);
2017 blk_mq_bio_to_request(rq, bio);2024 blk_mq_bio_to_request(rq, bio);
2018 blk_mq_try_issue_directly(data.hctx, rq, &cookie, false, true);2025 blk_mq_try_issue_directly(data.hctx, rq, &cookie);
2019 } else {2026 } else {
2020 blk_mq_put_ctx(data.ctx);2027 blk_mq_put_ctx(data.ctx);
2021 blk_mq_bio_to_request(rq, bio);2028 blk_mq_bio_to_request(rq, bio);
@@ -2332,7 +2339,7 @@ static int blk_mq_init_hctx(struct request_queue *q, · 310 unmodified lines
2332 return 0;2339 return 0;
2333 2340
2334 free_fq:2341 free_fq:
2335 kfree(hctx->fq);2342 blk_free_flush_queue(hctx->fq);
2336 exit_hctx:2343 exit_hctx:
2337 if (set->ops->exit_hctx)2344 if (set->ops->exit_hctx)
2338 set->ops->exit_hctx(hctx, hctx_idx);2345 set->ops->exit_hctx(hctx, hctx_idx);
block/blk-mq.h+2−4
@@ -70,10 +70,8 @@ void blk_mq_request_bypass_insert(struct request *rq, bool run_queue); · 69 unmodified lines
70void blk_mq_insert_requests(struct blk_mq_hw_ctx *hctx, struct blk_mq_ctx *ctx,70void blk_mq_insert_requests(struct blk_mq_hw_ctx *hctx, struct blk_mq_ctx *ctx,
71 struct list_head *list);71 struct list_head *list);
72 72
73blk_status_t blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx,73/* Used by blk_insert_cloned_request() to issue request directly */
74 struct request *rq,74blk_status_t blk_mq_request_issue_directly(struct request *rq, bool last);
75 blk_qc_t *cookie,
76 bool bypass, bool last);
77void blk_mq_try_issue_list_directly(struct blk_mq_hw_ctx *hctx,75void blk_mq_try_issue_list_directly(struct blk_mq_hw_ctx *hctx,
78 struct list_head *list);76 struct list_head *list);
79 77
drivers/block/null_blk_main.c+5−0
@@ -1748,6 +1748,11 @@ static int __init null_init(void) · 1747 unmodified lines
1748 return -EINVAL;1748 return -EINVAL;
1749 }1749 }
1750 1750
1751 if (g_home_node != NUMA_NO_NODE && g_home_node >= nr_online_nodes) {
1752 pr_err("null_blk: invalid home_node value\n");
1753 g_home_node = NUMA_NO_NODE;
1754 }
1755
1751 if (g_queue_mode == NULL_Q_RQ) {1756 if (g_queue_mode == NULL_Q_RQ) {
1752 pr_err("null_blk: legacy IO path no longer available\n");1757 pr_err("null_blk: legacy IO path no longer available\n");
1753 return -EINVAL;1758 return -EINVAL;
drivers/block/paride/pcd.c+13−1
@@ -314,6 +314,7 @@ static void pcd_init_units(void) · 313 unmodified lines
314 disk->queue = blk_mq_init_sq_queue(&cd->tag_set, &pcd_mq_ops,314 disk->queue = blk_mq_init_sq_queue(&cd->tag_set, &pcd_mq_ops,
315 1, BLK_MQ_F_SHOULD_MERGE);315 1, BLK_MQ_F_SHOULD_MERGE);
316 if (IS_ERR(disk->queue)) {316 if (IS_ERR(disk->queue)) {
317 put_disk(disk);
317 disk->queue = NULL;318 disk->queue = NULL;
318 continue;319 continue;
319 }320 }
@@ -750,6 +751,8 @@ static int pcd_detect(void) · 430 unmodified lines
750 751
751 printk("%s: No CD-ROM drive found\n", name);752 printk("%s: No CD-ROM drive found\n", name);
752 for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) {753 for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) {
754 if (!cd->disk)
755 continue;
753 blk_cleanup_queue(cd->disk->queue);756 blk_cleanup_queue(cd->disk->queue);
754 cd->disk->queue = NULL;757 cd->disk->queue = NULL;
755 blk_mq_free_tag_set(&cd->tag_set);758 blk_mq_free_tag_set(&cd->tag_set);
@@ -1010,8 +1013,14 @@ static int __init pcd_init(void) · 254 unmodified lines
1010 pcd_probe_capabilities();1013 pcd_probe_capabilities();
1011 1014
1012 if (register_blkdev(major, name)) {1015 if (register_blkdev(major, name)) {
1013 for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++)1016 for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) {
1017 if (!cd->disk)
1018 continue;
1019
1020 blk_cleanup_queue(cd->disk->queue);
1021 blk_mq_free_tag_set(&cd->tag_set);
1014 put_disk(cd->disk);1022 put_disk(cd->disk);
1023 }
1015 return -EBUSY;1024 return -EBUSY;
1016 }1025 }
1017 1026
@@ -1032,6 +1041,9 @@ static void __exit pcd_exit(void) · 14 unmodified lines
1032 int unit;1041 int unit;
1033 1042
1034 for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) {1043 for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) {
1044 if (!cd->disk)
1045 continue;
1046
1035 if (cd->present) {1047 if (cd->present) {
1036 del_gendisk(cd->disk);1048 del_gendisk(cd->disk);
1037 pi_release(cd->pi);1049 pi_release(cd->pi);
drivers/block/paride/pf.c+11−1
@@ -762,6 +762,8 @@ static int pf_detect(void) · 761 unmodified lines
762 762
763 printk("%s: No ATAPI disk detected\n", name);763 printk("%s: No ATAPI disk detected\n", name);
764 for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++) {764 for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++) {
765 if (!pf->disk)
766 continue;
765 blk_cleanup_queue(pf->disk->queue);767 blk_cleanup_queue(pf->disk->queue);
766 pf->disk->queue = NULL;768 pf->disk->queue = NULL;
767 blk_mq_free_tag_set(&pf->tag_set);769 blk_mq_free_tag_set(&pf->tag_set);
@@ -1029,8 +1031,13 @@ static int __init pf_init(void) · 261 unmodified lines
1029 pf_busy = 0;1031 pf_busy = 0;
1030 1032
1031 if (register_blkdev(major, name)) {1033 if (register_blkdev(major, name)) {
1032 for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++)1034 for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++) {
1035 if (!pf->disk)
1036 continue;
1037 blk_cleanup_queue(pf->disk->queue);
1038 blk_mq_free_tag_set(&pf->tag_set);
1033 put_disk(pf->disk);1039 put_disk(pf->disk);
1040 }
1034 return -EBUSY;1041 return -EBUSY;
1035 }1042 }
1036 1043
@@ -1051,6 +1058,9 @@ static void __exit pf_exit(void) · 14 unmodified lines
1051 int unit;1058 int unit;
1052 unregister_blkdev(major, name);1059 unregister_blkdev(major, name);
1053 for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++) {1060 for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++) {
1061 if (!pf->disk)
1062 continue;
1063
1054 if (pf->present)1064 if (pf->present)
1055 del_gendisk(pf->disk);1065 del_gendisk(pf->disk);
1056 1066
drivers/block/xsysace.c+2−0
@@ -1090,6 +1090,8 @@ static int ace_setup(struct ace_device *ace) · 1089 unmodified lines
1090 return 0;1090 return 0;
1091 1091
1092err_read:1092err_read:
1093 /* prevent double queue cleanup */
1094 ace->gd->queue = NULL;
1093 put_disk(ace->gd);1095 put_disk(ace->gd);
1094err_alloc_disk:1096err_alloc_disk:
1095 blk_cleanup_queue(ace->queue);1097 blk_cleanup_queue(ace->queue);
drivers/char/tpm/eventlog/tpm2.c+2−2
@@ -37,8 +37,8 @@ · 36 unmodified lines
37 *37 *
38 * Returns size of the event. If it is an invalid event, returns 0.38 * Returns size of the event. If it is an invalid event, returns 0.
39 */39 */
40static int calc_tpm2_event_size(struct tcg_pcr_event2_head *event,40static size_t calc_tpm2_event_size(struct tcg_pcr_event2_head *event,
41 struct tcg_pcr_event *event_header)41 struct tcg_pcr_event *event_header)
42{42{
43 struct tcg_efi_specid_event_head *efispecid;43 struct tcg_efi_specid_event_head *efispecid;
44 struct tcg_event_field *event_field;44 struct tcg_event_field *event_field;
drivers/char/tpm/tpm-dev-common.c+8−1
@@ -233,12 +233,19 @@ __poll_t tpm_common_poll(struct file *file, poll_table *wait) · 232 unmodified lines
233 __poll_t mask = 0;233 __poll_t mask = 0;
234 234
235 poll_wait(file, &priv->async_wait, wait);235 poll_wait(file, &priv->async_wait, wait);
236 mutex_lock(&priv->buffer_mutex);
236 237
237 if (!priv->response_read || priv->response_length)238 /*
239 * The response_length indicates if there is still response
240 * (or part of it) to be consumed. Partial reads decrease it
241 * by the number of bytes read, and write resets it the zero.
242 */
243 if (priv->response_length)
238 mask = EPOLLIN | EPOLLRDNORM;244 mask = EPOLLIN | EPOLLRDNORM;
239 else245 else
240 mask = EPOLLOUT | EPOLLWRNORM;246 mask = EPOLLOUT | EPOLLWRNORM;
241 247
248 mutex_unlock(&priv->buffer_mutex);
242 return mask;249 return mask;
243}250}
244 251
drivers/char/tpm/tpm-interface.c+6−8
@@ -402,15 +402,13 @@ int tpm_pm_suspend(struct device *dev) · 401 unmodified lines
402 if (chip->flags & TPM_CHIP_FLAG_ALWAYS_POWERED)402 if (chip->flags & TPM_CHIP_FLAG_ALWAYS_POWERED)
403 return 0;403 return 0;
404 404
405 if (chip->flags & TPM_CHIP_FLAG_TPM2) {405 if (!tpm_chip_start(chip)) {
406 mutex_lock(&chip->tpm_mutex);406 if (chip->flags & TPM_CHIP_FLAG_TPM2)
407 if (!tpm_chip_start(chip)) {
408 tpm2_shutdown(chip, TPM2_SU_STATE);407 tpm2_shutdown(chip, TPM2_SU_STATE);
409 tpm_chip_stop(chip);408 else
410 }409 rc = tpm1_pm_suspend(chip, tpm_suspend_pcr);
411 mutex_unlock(&chip->tpm_mutex);410
412 } else {411 tpm_chip_stop(chip);
413 rc = tpm1_pm_suspend(chip, tpm_suspend_pcr);
414 }412 }
415 413
416 return rc;414 return rc;
drivers/crypto/caam/caamhash.c+6−7
@@ -865,19 +865,18 @@ static int ahash_update_ctx(struct ahash_request *req) · 864 unmodified lines
865 if (ret)865 if (ret)
866 goto unmap_ctx;866 goto unmap_ctx;
867 867
868 if (mapped_nents) {868 if (mapped_nents)
869 sg_to_sec4_sg_last(req->src, mapped_nents,869 sg_to_sec4_sg_last(req->src, mapped_nents,
870 edesc->sec4_sg + sec4_sg_src_index,870 edesc->sec4_sg + sec4_sg_src_index,
871 0);871 0);
872 if (*next_buflen)872 else
873 scatterwalk_map_and_copy(next_buf, req->src,
874 to_hash - *buflen,
875 *next_buflen, 0);
876 } else {
877 sg_to_sec4_set_last(edesc->sec4_sg + sec4_sg_src_index -873 sg_to_sec4_set_last(edesc->sec4_sg + sec4_sg_src_index -
878 1);874 1);
879 }
880 875
876 if (*next_buflen)
877 scatterwalk_map_and_copy(next_buf, req->src,
878 to_hash - *buflen,
879 *next_buflen, 0);
881 desc = edesc->hw_desc;880 desc = edesc->hw_desc;
882 881
883 edesc->sec4_sg_dma = dma_map_single(jrdev, edesc->sec4_sg,882 edesc->sec4_sg_dma = dma_map_single(jrdev, edesc->sec4_sg,
drivers/i2c/busses/i2c-imx.c+3−1
@@ -1169,11 +1169,13 @@ static int i2c_imx_probe(struct platform_device *pdev) · 1168 unmodified lines
1169 /* Init DMA config if supported */1169 /* Init DMA config if supported */
1170 ret = i2c_imx_dma_request(i2c_imx, phy_addr);1170 ret = i2c_imx_dma_request(i2c_imx, phy_addr);
1171 if (ret < 0)1171 if (ret < 0)
1172 goto clk_notifier_unregister;1172 goto del_adapter;
1173 1173
1174 dev_info(&i2c_imx->adapter.dev, "IMX I2C adapter registered\n");1174 dev_info(&i2c_imx->adapter.dev, "IMX I2C adapter registered\n");
1175 return 0; /* Return OK */1175 return 0; /* Return OK */
1176 1176
1177del_adapter:
1178 i2c_del_adapter(&i2c_imx->adapter);
1177clk_notifier_unregister:1179clk_notifier_unregister:
1178 clk_notifier_unregister(i2c_imx->clk, &i2c_imx->clk_change_nb);1180 clk_notifier_unregister(i2c_imx->clk, &i2c_imx->clk_change_nb);
1179rpm_disable:1181rpm_disable:
drivers/md/dm-core.h+1−0
@@ -115,6 +115,7 @@ struct mapped_device { · 114 unmodified lines
115 struct srcu_struct io_barrier;115 struct srcu_struct io_barrier;
116};116};
117 117
118void disable_discard(struct mapped_device *md);
118void disable_write_same(struct mapped_device *md);119void disable_write_same(struct mapped_device *md);
119void disable_write_zeroes(struct mapped_device *md);120void disable_write_zeroes(struct mapped_device *md);
120 121
drivers/md/dm-init.c+1−1
@@ -36,7 +36,7 @@ struct dm_device { · 35 unmodified lines
36 struct list_head list;36 struct list_head list;
37};37};
38 38
39const char *dm_allowed_targets[] __initconst = {39const char * const dm_allowed_targets[] __initconst = {
40 "crypt",40 "crypt",
41 "delay",41 "delay",
42 "linear",42 "linear",
drivers/md/dm-integrity.c+7−9
@@ -913,7 +913,7 @@ static void copy_from_journal(struct dm_integrity_c *ic, unsigned section, unsig · 912 unmodified lines
913static bool ranges_overlap(struct dm_integrity_range *range1, struct dm_integrity_range *range2)913static bool ranges_overlap(struct dm_integrity_range *range1, struct dm_integrity_range *range2)
914{914{
915 return range1->logical_sector < range2->logical_sector + range2->n_sectors &&915 return range1->logical_sector < range2->logical_sector + range2->n_sectors &&
916 range2->logical_sector + range2->n_sectors > range2->logical_sector;916 range1->logical_sector + range1->n_sectors > range2->logical_sector;
917}917}
918 918
919static bool add_new_range(struct dm_integrity_c *ic, struct dm_integrity_range *new_range, bool check_waiting)919static bool add_new_range(struct dm_integrity_c *ic, struct dm_integrity_range *new_range, bool check_waiting)
@@ -959,8 +959,6 @@ static void remove_range_unlocked(struct dm_integrity_c *ic, struct dm_integrity · 39 unmodified lines
959 struct dm_integrity_range *last_range =959 struct dm_integrity_range *last_range =
960 list_first_entry(&ic->wait_list, struct dm_integrity_range, wait_entry);960 list_first_entry(&ic->wait_list, struct dm_integrity_range, wait_entry);
961 struct task_struct *last_range_task;961 struct task_struct *last_range_task;
962 if (!ranges_overlap(range, last_range))
963 break;
964 last_range_task = last_range->task;962 last_range_task = last_range->task;
965 list_del(&last_range->wait_entry);963 list_del(&last_range->wait_entry);
966 if (!add_new_range(ic, last_range, false)) {964 if (!add_new_range(ic, last_range, false)) {
@@ -3185,7 +3183,7 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv) · 2218 unmodified lines
3185 journal_watermark = val;3183 journal_watermark = val;
3186 else if (sscanf(opt_string, "commit_time:%u%c", &val, &dummy) == 1)3184 else if (sscanf(opt_string, "commit_time:%u%c", &val, &dummy) == 1)
3187 sync_msec = val;3185 sync_msec = val;
3188 else if (!memcmp(opt_string, "meta_device:", strlen("meta_device:"))) {3186 else if (!strncmp(opt_string, "meta_device:", strlen("meta_device:"))) {
3189 if (ic->meta_dev) {3187 if (ic->meta_dev) {
3190 dm_put_device(ti, ic->meta_dev);3188 dm_put_device(ti, ic->meta_dev);
3191 ic->meta_dev = NULL;3189 ic->meta_dev = NULL;
@@ -3204,17 +3202,17 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv) · 12 unmodified lines
3204 goto bad;3202 goto bad;
3205 }3203 }
3206 ic->sectors_per_block = val >> SECTOR_SHIFT;3204 ic->sectors_per_block = val >> SECTOR_SHIFT;
3207 } else if (!memcmp(opt_string, "internal_hash:", strlen("internal_hash:"))) {3205 } else if (!strncmp(opt_string, "internal_hash:", strlen("internal_hash:"))) {
3208 r = get_alg_and_key(opt_string, &ic->internal_hash_alg, &ti->error,3206 r = get_alg_and_key(opt_string, &ic->internal_hash_alg, &ti->error,
3209 "Invalid internal_hash argument");3207 "Invalid internal_hash argument");
3210 if (r)3208 if (r)
3211 goto bad;3209 goto bad;
3212 } else if (!memcmp(opt_string, "journal_crypt:", strlen("journal_crypt:"))) {3210 } else if (!strncmp(opt_string, "journal_crypt:", strlen("journal_crypt:"))) {
3213 r = get_alg_and_key(opt_string, &ic->journal_crypt_alg, &ti->error,3211 r = get_alg_and_key(opt_string, &ic->journal_crypt_alg, &ti->error,
3214 "Invalid journal_crypt argument");3212 "Invalid journal_crypt argument");
3215 if (r)3213 if (r)
3216 goto bad;3214 goto bad;
3217 } else if (!memcmp(opt_string, "journal_mac:", strlen("journal_mac:"))) {3215 } else if (!strncmp(opt_string, "journal_mac:", strlen("journal_mac:"))) {
3218 r = get_alg_and_key(opt_string, &ic->journal_mac_alg, &ti->error,3216 r = get_alg_and_key(opt_string, &ic->journal_mac_alg, &ti->error,
3219 "Invalid journal_mac argument");3217 "Invalid journal_mac argument");
3220 if (r)3218 if (r)
@@ -3616,7 +3614,7 @@ static struct target_type integrity_target = { · 395 unmodified lines
3616 .io_hints = dm_integrity_io_hints,3614 .io_hints = dm_integrity_io_hints,
3617};3615};
3618 3616
3619int __init dm_integrity_init(void)3617static int __init dm_integrity_init(void)
3620{3618{
3621 int r;3619 int r;
3622 3620
@@ -3635,7 +3633,7 @@ int __init dm_integrity_init(void) · 12 unmodified lines
3635 return r;3633 return r;
3636}3634}
3637 3635
3638void dm_integrity_exit(void)3636static void __exit dm_integrity_exit(void)
3639{3637{
3640 dm_unregister_target(&integrity_target);3638 dm_unregister_target(&integrity_target);
3641 kmem_cache_destroy(journal_io_cache);3639 kmem_cache_destroy(journal_io_cache);
drivers/md/dm-rq.c+7−4
@@ -222,11 +222,14 @@ static void dm_done(struct request *clone, blk_status_t error, bool mapped) · 221 unmodified lines
222 }222 }
223 223
224 if (unlikely(error == BLK_STS_TARGET)) {224 if (unlikely(error == BLK_STS_TARGET)) {
225 if (req_op(clone) == REQ_OP_WRITE_SAME &&225 if (req_op(clone) == REQ_OP_DISCARD &&
226 !clone->q->limits.max_write_same_sectors)226 !clone->q->limits.max_discard_sectors)
227 disable_discard(tio->md);
228 else if (req_op(clone) == REQ_OP_WRITE_SAME &&
229 !clone->q->limits.max_write_same_sectors)
227 disable_write_same(tio->md);230 disable_write_same(tio->md);
228 if (req_op(clone) == REQ_OP_WRITE_ZEROES &&231 else if (req_op(clone) == REQ_OP_WRITE_ZEROES &&
229 !clone->q->limits.max_write_zeroes_sectors)232 !clone->q->limits.max_write_zeroes_sectors)
230 disable_write_zeroes(tio->md);233 disable_write_zeroes(tio->md);
231 }234 }
232 235
drivers/md/dm-table.c+39−0
@@ -1844,6 +1844,36 @@ static bool dm_table_supports_secure_erase(struct dm_table *t) · 1843 unmodified lines
1844 return true;1844 return true;
1845}1845}
1846 1846
1847static int device_requires_stable_pages(struct dm_target *ti,
1848 struct dm_dev *dev, sector_t start,
1849 sector_t len, void *data)
1850{
1851 struct request_queue *q = bdev_get_queue(dev->bdev);
1852
1853 return q && bdi_cap_stable_pages_required(q->backing_dev_info);
1854}
1855
1856/*
1857 * If any underlying device requires stable pages, a table must require
1858 * them as well. Only targets that support iterate_devices are considered:
1859 * don't want error, zero, etc to require stable pages.
1860 */
1861static bool dm_table_requires_stable_pages(struct dm_table *t)
1862{
1863 struct dm_target *ti;
1864 unsigned i;
1865
1866 for (i = 0; i < dm_table_get_num_targets(t); i++) {
1867 ti = dm_table_get_target(t, i);
1868
1869 if (ti->type->iterate_devices &&
1870 ti->type->iterate_devices(ti, device_requires_stable_pages, NULL))
1871 return true;
1872 }
1873
1874 return false;
1875}
1876
1847void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,1877void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
1848 struct queue_limits *limits)1878 struct queue_limits *limits)
1849{1879{
@@ -1896,6 +1926,15 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, · 46 unmodified lines
1896 1926
1897 dm_table_verify_integrity(t);1927 dm_table_verify_integrity(t);
1898 1928
1929 /*
1930 * Some devices don't use blk_integrity but still want stable pages
1931 * because they do their own checksumming.
1932 */
1933 if (dm_table_requires_stable_pages(t))
1934 q->backing_dev_info->capabilities |= BDI_CAP_STABLE_WRITES;
1935 else
1936 q->backing_dev_info->capabilities &= ~BDI_CAP_STABLE_WRITES;
1937
1899 /*1938 /*
1900 * Determine whether or not this queue's I/O timings contribute1939 * Determine whether or not this queue's I/O timings contribute
1901 * to the entropy pool, Only request-based targets use this.1940 * to the entropy pool, Only request-based targets use this.
drivers/md/dm.c+17−13
@@ -945,6 +945,15 @@ static void dec_pending(struct dm_io *io, blk_status_t error) · 944 unmodified lines
945 }945 }
946}946}
947 947
948void disable_discard(struct mapped_device *md)
949{
950 struct queue_limits *limits = dm_get_queue_limits(md);
951
952 /* device doesn't really support DISCARD, disable it */
953 limits->max_discard_sectors = 0;
954 blk_queue_flag_clear(QUEUE_FLAG_DISCARD, md->queue);
955}
956
948void disable_write_same(struct mapped_device *md)957void disable_write_same(struct mapped_device *md)
949{958{
950 struct queue_limits *limits = dm_get_queue_limits(md);959 struct queue_limits *limits = dm_get_queue_limits(md);
@@ -970,11 +979,14 @@ static void clone_endio(struct bio *bio) · 19 unmodified lines
970 dm_endio_fn endio = tio->ti->type->end_io;979 dm_endio_fn endio = tio->ti->type->end_io;
971 980
972 if (unlikely(error == BLK_STS_TARGET) && md->type != DM_TYPE_NVME_BIO_BASED) {981 if (unlikely(error == BLK_STS_TARGET) && md->type != DM_TYPE_NVME_BIO_BASED) {
973 if (bio_op(bio) == REQ_OP_WRITE_SAME &&982 if (bio_op(bio) == REQ_OP_DISCARD &&
974 !bio->bi_disk->queue->limits.max_write_same_sectors)983 !bio->bi_disk->queue->limits.max_discard_sectors)
984 disable_discard(md);
985 else if (bio_op(bio) == REQ_OP_WRITE_SAME &&
986 !bio->bi_disk->queue->limits.max_write_same_sectors)
975 disable_write_same(md);987 disable_write_same(md);
976 if (bio_op(bio) == REQ_OP_WRITE_ZEROES &&988 else if (bio_op(bio) == REQ_OP_WRITE_ZEROES &&
977 !bio->bi_disk->queue->limits.max_write_zeroes_sectors)989 !bio->bi_disk->queue->limits.max_write_zeroes_sectors)
978 disable_write_zeroes(md);990 disable_write_zeroes(md);
979 }991 }
980 992
@@ -1042,15 +1054,7 @@ int dm_set_target_max_io_len(struct dm_target *ti, sector_t len) · 61 unmodified lines
1042 return -EINVAL;1054 return -EINVAL;
1043 }1055 }
1044 1056
1045 /*1057 ti->max_io_len = (uint32_t) len;
1046 * BIO based queue uses its own splitting. When multipage bvecs
1047 * is switched on, size of the incoming bio may be too big to
1048 * be handled in some targets, such as crypt.
1049 *
1050 * When these targets are ready for the big bio, we can remove
1051 * the limit.
1052 */
1053 ti->max_io_len = min_t(uint32_t, len, BIO_MAX_PAGES * PAGE_SIZE);
1054 1058
1055 return 0;1059 return 0;
1056}1060}
drivers/mtd/chips/cfi_cmdset_0002.c+5−1
@@ -1876,7 +1876,11 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, · 1875 unmodified lines
1876 continue;1876 continue;
1877 }1877 }
1878 1878
1879 if (time_after(jiffies, timeo) && !chip_ready(map, adr))1879 /*
1880 * We check "time_after" and "!chip_good" before checking "chip_good" to avoid
1881 * the failure due to scheduling.
1882 */
1883 if (time_after(jiffies, timeo) && !chip_good(map, adr, datum))
1880 break;1884 break;
1881 1885
1882 if (chip_good(map, adr, datum)) {1886 if (chip_good(map, adr, datum)) {
drivers/net/ethernet/broadcom/bnxt/bnxt.c+13−3
@@ -1133,6 +1133,8 @@ static void bnxt_tpa_start(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, · 1132 unmodified lines
1133 tpa_info = &rxr->rx_tpa[agg_id];1133 tpa_info = &rxr->rx_tpa[agg_id];
1134 1134
1135 if (unlikely(cons != rxr->rx_next_cons)) {1135 if (unlikely(cons != rxr->rx_next_cons)) {
1136 netdev_warn(bp->dev, "TPA cons %x != expected cons %x\n",
1137 cons, rxr->rx_next_cons);
1136 bnxt_sched_reset(bp, rxr);1138 bnxt_sched_reset(bp, rxr);
1137 return;1139 return;
1138 }1140 }
@@ -1585,15 +1587,17 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, · 446 unmodified lines
1585 }1587 }
1586 1588
1587 cons = rxcmp->rx_cmp_opaque;1589 cons = rxcmp->rx_cmp_opaque;
1588 rx_buf = &rxr->rx_buf_ring[cons];
1589 data = rx_buf->data;
1590 data_ptr = rx_buf->data_ptr;
1591 if (unlikely(cons != rxr->rx_next_cons)) {1590 if (unlikely(cons != rxr->rx_next_cons)) {
1592 int rc1 = bnxt_discard_rx(bp, cpr, raw_cons, rxcmp);1591 int rc1 = bnxt_discard_rx(bp, cpr, raw_cons, rxcmp);
1593 1592
1593 netdev_warn(bp->dev, "RX cons %x != expected cons %x\n",
1594 cons, rxr->rx_next_cons);
1594 bnxt_sched_reset(bp, rxr);1595 bnxt_sched_reset(bp, rxr);
1595 return rc1;1596 return rc1;
1596 }1597 }
1598 rx_buf = &rxr->rx_buf_ring[cons];
1599 data = rx_buf->data;
1600 data_ptr = rx_buf->data_ptr;
1597 prefetch(data_ptr);1601 prefetch(data_ptr);
1598 1602
1599 misc = le32_to_cpu(rxcmp->rx_cmp_misc_v1);1603 misc = le32_to_cpu(rxcmp->rx_cmp_misc_v1);
@@ -1610,11 +1614,17 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, · 10 unmodified lines
1610 1614
1611 rx_buf->data = NULL;1615 rx_buf->data = NULL;
1612 if (rxcmp1->rx_cmp_cfa_code_errors_v2 & RX_CMP_L2_ERRORS) {1616 if (rxcmp1->rx_cmp_cfa_code_errors_v2 & RX_CMP_L2_ERRORS) {
1617 u32 rx_err = le32_to_cpu(rxcmp1->rx_cmp_cfa_code_errors_v2);
1618
1613 bnxt_reuse_rx_data(rxr, cons, data);1619 bnxt_reuse_rx_data(rxr, cons, data);
1614 if (agg_bufs)1620 if (agg_bufs)
1615 bnxt_reuse_rx_agg_bufs(cpr, cp_cons, agg_bufs);1621 bnxt_reuse_rx_agg_bufs(cpr, cp_cons, agg_bufs);
1616 1622
1617 rc = -EIO;1623 rc = -EIO;
1624 if (rx_err & RX_CMPL_ERRORS_BUFFER_ERROR_MASK) {
1625 netdev_warn(bp->dev, "RX buffer error %x\n", rx_err);
1626 bnxt_sched_reset(bp, rxr);
1627 }
1618 goto next_rx;1628 goto next_rx;
1619 }1629 }
1620 1630
drivers/net/ethernet/broadcom/tg3.c+4−4
@@ -4283,7 +4283,7 @@ static void tg3_power_down(struct tg3 *tp) · 4282 unmodified lines
4283 pci_set_power_state(tp->pdev, PCI_D3hot);4283 pci_set_power_state(tp->pdev, PCI_D3hot);
4284}4284}
4285 4285
4286static void tg3_aux_stat_to_speed_duplex(struct tg3 *tp, u32 val, u16 *speed, u8 *duplex)4286static void tg3_aux_stat_to_speed_duplex(struct tg3 *tp, u32 val, u32 *speed, u8 *duplex)
4287{4287{
4288 switch (val & MII_TG3_AUX_STAT_SPDMASK) {4288 switch (val & MII_TG3_AUX_STAT_SPDMASK) {
4289 case MII_TG3_AUX_STAT_10HALF:4289 case MII_TG3_AUX_STAT_10HALF:
@@ -4787,7 +4787,7 @@ static int tg3_setup_copper_phy(struct tg3 *tp, bool force_reset) · 497 unmodified lines
4787 bool current_link_up;4787 bool current_link_up;
4788 u32 bmsr, val;4788 u32 bmsr, val;
4789 u32 lcl_adv, rmt_adv;4789 u32 lcl_adv, rmt_adv;
4790 u16 current_speed;4790 u32 current_speed;
4791 u8 current_duplex;4791 u8 current_duplex;
4792 int i, err;4792 int i, err;
4793 4793
@@ -5719,7 +5719,7 @@ out: · 925 unmodified lines
5719static int tg3_setup_fiber_phy(struct tg3 *tp, bool force_reset)5719static int tg3_setup_fiber_phy(struct tg3 *tp, bool force_reset)
5720{5720{
5721 u32 orig_pause_cfg;5721 u32 orig_pause_cfg;
5722 u16 orig_active_speed;5722 u32 orig_active_speed;
5723 u8 orig_active_duplex;5723 u8 orig_active_duplex;
5724 u32 mac_status;5724 u32 mac_status;
5725 bool current_link_up;5725 bool current_link_up;
@@ -5823,7 +5823,7 @@ static int tg3_setup_fiber_mii_phy(struct tg3 *tp, bool force_reset) · 97 unmodified lines
5823{5823{
5824 int err = 0;5824 int err = 0;
5825 u32 bmsr, bmcr;5825 u32 bmsr, bmcr;
5826 u16 current_speed = SPEED_UNKNOWN;5826 u32 current_speed = SPEED_UNKNOWN;
5827 u8 current_duplex = DUPLEX_UNKNOWN;5827 u8 current_duplex = DUPLEX_UNKNOWN;
5828 bool current_link_up = false;5828 bool current_link_up = false;
5829 u32 local_adv, remote_adv, sgsr;5829 u32 local_adv, remote_adv, sgsr;
drivers/net/ethernet/broadcom/tg3.h+2−2
@@ -2873,7 +2873,7 @@ struct tg3_tx_ring_info { · 2872 unmodified lines
2873struct tg3_link_config {2873struct tg3_link_config {
2874 /* Describes what we're trying to get. */2874 /* Describes what we're trying to get. */
2875 u32 advertising;2875 u32 advertising;
2876 u16 speed;2876 u32 speed;
2877 u8 duplex;2877 u8 duplex;
2878 u8 autoneg;2878 u8 autoneg;
2879 u8 flowctrl;2879 u8 flowctrl;
@@ -2882,7 +2882,7 @@ struct tg3_link_config { · 2 unmodified lines
2882 u8 active_flowctrl;2882 u8 active_flowctrl;
2883 2883
2884 u8 active_duplex;2884 u8 active_duplex;
2885 u16 active_speed;2885 u32 active_speed;
2886 u32 rmt_adv;2886 u32 rmt_adv;
2887};2887};
2888 2888
drivers/net/ethernet/cadence/macb_main.c+3−1
@@ -898,7 +898,9 @@ static void macb_tx_interrupt(struct macb_queue *queue) · 897 unmodified lines
898 898
899 /* First, update TX stats if needed */899 /* First, update TX stats if needed */
900 if (skb) {900 if (skb) {
901 if (gem_ptp_do_txstamp(queue, skb, desc) == 0) {901 if (unlikely(skb_shinfo(skb)->tx_flags &
902 SKBTX_HW_TSTAMP) &&
903 gem_ptp_do_txstamp(queue, skb, desc) == 0) {
902 /* skb now belongs to timestamp buffer904 /* skb now belongs to timestamp buffer
903 * and will be removed later905 * and will be removed later
904 */906 */
drivers/net/ethernet/qlogic/qlcnic/qlcnic.h+1−1
@@ -497,7 +497,7 @@ struct qlcnic_hardware_context { · 496 unmodified lines
497 u16 board_type;497 u16 board_type;
498 u16 supported_type;498 u16 supported_type;
499 499
500 u16 link_speed;500 u32 link_speed;
501 u16 link_duplex;501 u16 link_duplex;
502 u16 link_autoneg;502 u16 link_autoneg;
503 u16 module_type;503 u16 module_type;
drivers/net/ethernet/realtek/r8169.c+6−0
@@ -28,6 +28,7 @@ · 27 unmodified lines
28#include <linux/pm_runtime.h>28#include <linux/pm_runtime.h>
29#include <linux/firmware.h>29#include <linux/firmware.h>
30#include <linux/prefetch.h>30#include <linux/prefetch.h>
31#include <linux/pci-aspm.h>
31#include <linux/ipv6.h>32#include <linux/ipv6.h>
32#include <net/ip6_checksum.h>33#include <net/ip6_checksum.h>
33 34
@@ -7336,6 +7337,11 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 7302 unmodified lines
7336 if (rc)7337 if (rc)
7337 return rc;7338 return rc;
7338 7339
7340 /* Disable ASPM completely as that cause random device stop working
7341 * problems as well as full system hangs for some PCIe devices users.
7342 */
7343 pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1);
7344
7339 /* enable device (incl. PCI PM wakeup and hotplug setup) */7345 /* enable device (incl. PCI PM wakeup and hotplug setup) */
7340 rc = pcim_enable_device(pdev);7346 rc = pcim_enable_device(pdev);
7341 if (rc < 0) {7347 if (rc < 0) {
drivers/net/vrf.c+6−2
@@ -1273,8 +1273,12 @@ static void vrf_setup(struct net_device *dev) · 1272 unmodified lines
1273 dev->priv_flags |= IFF_NO_QUEUE;1273 dev->priv_flags |= IFF_NO_QUEUE;
1274 dev->priv_flags |= IFF_NO_RX_HANDLER;1274 dev->priv_flags |= IFF_NO_RX_HANDLER;
1275 1275
1276 dev->min_mtu = 0;1276 /* VRF devices do not care about MTU, but if the MTU is set
1277 dev->max_mtu = 0;1277 * too low then the ipv4 and ipv6 protocols are disabled
1278 * which breaks networking.
1279 */
1280 dev->min_mtu = IPV6_MIN_MTU;
1281 dev->max_mtu = ETH_MAX_MTU;
1278}1282}
1279 1283
1280static int vrf_validate(struct nlattr *tb[], struct nlattr *data[],1284static int vrf_validate(struct nlattr *tb[], struct nlattr *data[],
drivers/parisc/iosapic.c+5−1
@@ -157,8 +157,12 @@ · 156 unmodified lines
157#define DBG_IRT(x...)157#define DBG_IRT(x...)
158#endif158#endif
159 159
160#ifdef CONFIG_64BIT
161#define COMPARE_IRTE_ADDR(irte, hpa) ((irte)->dest_iosapic_addr == (hpa))
162#else
160#define COMPARE_IRTE_ADDR(irte, hpa) \163#define COMPARE_IRTE_ADDR(irte, hpa) \
161 ((irte)->dest_iosapic_addr == F_EXTEND(hpa))164 ((irte)->dest_iosapic_addr == ((hpa) | 0xffffffff00000000ULL))
165#endif
162 166
163#define IOSAPIC_REG_SELECT 0x00167#define IOSAPIC_REG_SELECT 0x00
164#define IOSAPIC_REG_WINDOW 0x10168#define IOSAPIC_REG_WINDOW 0x10
drivers/reset/reset-meson-audio-arb.c+1−0
@@ -130,6 +130,7 @@ static int meson_audio_arb_probe(struct platform_device *pdev) · 129 unmodified lines
130 arb->rstc.nr_resets = ARRAY_SIZE(axg_audio_arb_reset_bits);130 arb->rstc.nr_resets = ARRAY_SIZE(axg_audio_arb_reset_bits);
131 arb->rstc.ops = &meson_audio_arb_rstc_ops;131 arb->rstc.ops = &meson_audio_arb_rstc_ops;
132 arb->rstc.of_node = dev->of_node;132 arb->rstc.of_node = dev->of_node;
133 arb->rstc.owner = THIS_MODULE;
133 134
134 /*135 /*
135 * Enable general :136 * Enable general :
drivers/rtc/Kconfig+2−2
@@ -667,9 +667,9 @@ config RTC_DRV_S5M · 666 unmodified lines
667 will be called rtc-s5m.667 will be called rtc-s5m.
668 668
669config RTC_DRV_SD3078669config RTC_DRV_SD3078
670 tristate "ZXW Crystal SD3078"670 tristate "ZXW Shenzhen whwave SD3078"
671 help671 help
672 If you say yes here you get support for the ZXW Crystal672 If you say yes here you get support for the ZXW Shenzhen whwave
673 SD3078 RTC chips.673 SD3078 RTC chips.
674 674
675 This driver can also be built as a module. If so, the module675 This driver can also be built as a module. If so, the module
drivers/rtc/rtc-cros-ec.c+2−2
@@ -298,7 +298,7 @@ static int cros_ec_rtc_suspend(struct device *dev) · 297 unmodified lines
298 struct cros_ec_rtc *cros_ec_rtc = dev_get_drvdata(&pdev->dev);298 struct cros_ec_rtc *cros_ec_rtc = dev_get_drvdata(&pdev->dev);
299 299
300 if (device_may_wakeup(dev))300 if (device_may_wakeup(dev))
301 enable_irq_wake(cros_ec_rtc->cros_ec->irq);301 return enable_irq_wake(cros_ec_rtc->cros_ec->irq);
302 302
303 return 0;303 return 0;
304}304}
@@ -309,7 +309,7 @@ static int cros_ec_rtc_resume(struct device *dev) · 4 unmodified lines
309 struct cros_ec_rtc *cros_ec_rtc = dev_get_drvdata(&pdev->dev);309 struct cros_ec_rtc *cros_ec_rtc = dev_get_drvdata(&pdev->dev);
310 310
311 if (device_may_wakeup(dev))311 if (device_may_wakeup(dev))
312 disable_irq_wake(cros_ec_rtc->cros_ec->irq);312 return disable_irq_wake(cros_ec_rtc->cros_ec->irq);
313 313
314 return 0;314 return 0;
315}315}
drivers/rtc/rtc-da9063.c+7−0
@@ -480,6 +480,13 @@ static int da9063_rtc_probe(struct platform_device *pdev) · 479 unmodified lines
480 da9063_data_to_tm(data, &rtc->alarm_time, rtc);480 da9063_data_to_tm(data, &rtc->alarm_time, rtc);
481 rtc->rtc_sync = false;481 rtc->rtc_sync = false;
482 482
483 /*
484 * TODO: some models have alarms on a minute boundary but still support
485 * real hardware interrupts. Add this once the core supports it.
486 */
487 if (config->rtc_data_start != RTC_SEC)
488 rtc->rtc_dev->uie_unsupported = 1;
489
483 irq_alarm = platform_get_irq_byname(pdev, "ALARM");490 irq_alarm = platform_get_irq_byname(pdev, "ALARM");
484 ret = devm_request_threaded_irq(&pdev->dev, irq_alarm, NULL,491 ret = devm_request_threaded_irq(&pdev->dev, irq_alarm, NULL,
485 da9063_alarm_event,492 da9063_alarm_event,
drivers/rtc/rtc-sh.c+1−1
@@ -374,7 +374,7 @@ static int sh_rtc_set_time(struct device *dev, struct rtc_time *tm) · 373 unmodified lines
374static inline int sh_rtc_read_alarm_value(struct sh_rtc *rtc, int reg_off)374static inline int sh_rtc_read_alarm_value(struct sh_rtc *rtc, int reg_off)
375{375{
376 unsigned int byte;376 unsigned int byte;
377 int value = 0xff; /* return 0xff for ignored values */377 int value = -1; /* return -1 for ignored values */
378 378
379 byte = readb(rtc->regbase + reg_off);379 byte = readb(rtc->regbase + reg_off);
380 if (byte & AR_ENB) {380 if (byte & AR_ENB) {
drivers/scsi/lpfc/lpfc_scsi.c+3−4
@@ -3878,10 +3878,9 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, · 3877 unmodified lines
3878 * wake up the thread.3878 * wake up the thread.
3879 */3879 */
3880 spin_lock(&lpfc_cmd->buf_lock);3880 spin_lock(&lpfc_cmd->buf_lock);
3881 if (unlikely(lpfc_cmd->cur_iocbq.iocb_flag & LPFC_DRIVER_ABORTED)) {3881 lpfc_cmd->cur_iocbq.iocb_flag &= ~LPFC_DRIVER_ABORTED;
3882 lpfc_cmd->cur_iocbq.iocb_flag &= ~LPFC_DRIVER_ABORTED;3882 if (lpfc_cmd->waitq) {
3883 if (lpfc_cmd->waitq)3883 wake_up(lpfc_cmd->waitq);
3884 wake_up(lpfc_cmd->waitq);
3885 lpfc_cmd->waitq = NULL;3884 lpfc_cmd->waitq = NULL;
3886 }3885 }
3887 spin_unlock(&lpfc_cmd->buf_lock);3886 spin_unlock(&lpfc_cmd->buf_lock);
drivers/scsi/qedi/qedi_main.c+2−5
@@ -1392,10 +1392,8 @@ static void qedi_free_nvm_iscsi_cfg(struct qedi_ctx *qedi) · 1391 unmodified lines
1392 1392
1393static int qedi_alloc_nvm_iscsi_cfg(struct qedi_ctx *qedi)1393static int qedi_alloc_nvm_iscsi_cfg(struct qedi_ctx *qedi)
1394{1394{
1395 struct qedi_nvm_iscsi_image nvm_image;
1396
1397 qedi->iscsi_image = dma_alloc_coherent(&qedi->pdev->dev,1395 qedi->iscsi_image = dma_alloc_coherent(&qedi->pdev->dev,
1398 sizeof(nvm_image),1396 sizeof(struct qedi_nvm_iscsi_image),
1399 &qedi->nvm_buf_dma, GFP_KERNEL);1397 &qedi->nvm_buf_dma, GFP_KERNEL);
1400 if (!qedi->iscsi_image) {1398 if (!qedi->iscsi_image) {
1401 QEDI_ERR(&qedi->dbg_ctx, "Could not allocate NVM BUF.\n");1399 QEDI_ERR(&qedi->dbg_ctx, "Could not allocate NVM BUF.\n");
@@ -2236,14 +2234,13 @@ static void qedi_boot_release(void *data) · 834 unmodified lines
2236static int qedi_get_boot_info(struct qedi_ctx *qedi)2234static int qedi_get_boot_info(struct qedi_ctx *qedi)
2237{2235{
2238 int ret = 1;2236 int ret = 1;
2239 struct qedi_nvm_iscsi_image nvm_image;
2240 2237
2241 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,2238 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
2242 "Get NVM iSCSI CFG image\n");2239 "Get NVM iSCSI CFG image\n");
2243 ret = qedi_ops->common->nvm_get_image(qedi->cdev,2240 ret = qedi_ops->common->nvm_get_image(qedi->cdev,
2244 QED_NVM_IMAGE_ISCSI_CFG,2241 QED_NVM_IMAGE_ISCSI_CFG,
2245 (char *)qedi->iscsi_image,2242 (char *)qedi->iscsi_image,
2246 sizeof(nvm_image));2243 sizeof(struct qedi_nvm_iscsi_image));
2247 if (ret)2244 if (ret)
2248 QEDI_ERR(&qedi->dbg_ctx,2245 QEDI_ERR(&qedi->dbg_ctx,
2249 "Could not get NVM image. ret = %d\n", ret);2246 "Could not get NVM image. ret = %d\n", ret);
drivers/scsi/scsi_devinfo.c+1−0
@@ -238,6 +238,7 @@ static struct { · 237 unmodified lines
238 {"NETAPP", "Universal Xport", "*", BLIST_NO_ULD_ATTACH},238 {"NETAPP", "Universal Xport", "*", BLIST_NO_ULD_ATTACH},
239 {"LSI", "Universal Xport", "*", BLIST_NO_ULD_ATTACH},239 {"LSI", "Universal Xport", "*", BLIST_NO_ULD_ATTACH},
240 {"ENGENIO", "Universal Xport", "*", BLIST_NO_ULD_ATTACH},240 {"ENGENIO", "Universal Xport", "*", BLIST_NO_ULD_ATTACH},
241 {"LENOVO", "Universal Xport", "*", BLIST_NO_ULD_ATTACH},
241 {"SMSC", "USB 2 HS-CF", NULL, BLIST_SPARSELUN | BLIST_INQUIRY_36},242 {"SMSC", "USB 2 HS-CF", NULL, BLIST_SPARSELUN | BLIST_INQUIRY_36},
242 {"SONY", "CD-ROM CDU-8001", NULL, BLIST_BORKEN},243 {"SONY", "CD-ROM CDU-8001", NULL, BLIST_BORKEN},
243 {"SONY", "TSL", NULL, BLIST_FORCELUN}, /* DDS3 & DDS4 autoloaders */244 {"SONY", "TSL", NULL, BLIST_FORCELUN}, /* DDS3 & DDS4 autoloaders */
drivers/scsi/scsi_dh.c+1−0
@@ -75,6 +75,7 @@ static const struct scsi_dh_blist scsi_dh_blist[] = { · 74 unmodified lines
75 {"NETAPP", "INF-01-00", "rdac", },75 {"NETAPP", "INF-01-00", "rdac", },
76 {"LSI", "INF-01-00", "rdac", },76 {"LSI", "INF-01-00", "rdac", },
77 {"ENGENIO", "INF-01-00", "rdac", },77 {"ENGENIO", "INF-01-00", "rdac", },
78 {"LENOVO", "DE_Series", "rdac", },
78 {NULL, NULL, NULL },79 {NULL, NULL, NULL },
79};80};
80 81
drivers/scsi/storvsc_drv.c+12−3
@@ -385,7 +385,7 @@ enum storvsc_request_type { · 384 unmodified lines
385 * This is the end of Protocol specific defines.385 * This is the end of Protocol specific defines.
386 */386 */
387 387
388static int storvsc_ringbuffer_size = (256 * PAGE_SIZE);388static int storvsc_ringbuffer_size = (128 * 1024);
389static u32 max_outstanding_req_per_channel;389static u32 max_outstanding_req_per_channel;
390 390
391static int storvsc_vcpus_per_sub_channel = 4;391static int storvsc_vcpus_per_sub_channel = 4;
@@ -668,13 +668,22 @@ static void handle_multichannel_storage(struct hv_device *device, int max_chns) · 276 unmodified lines
668{668{
669 struct device *dev = &device->device;669 struct device *dev = &device->device;
670 struct storvsc_device *stor_device;670 struct storvsc_device *stor_device;
671 int num_cpus = num_online_cpus();
672 int num_sc;671 int num_sc;
673 struct storvsc_cmd_request *request;672 struct storvsc_cmd_request *request;
674 struct vstor_packet *vstor_packet;673 struct vstor_packet *vstor_packet;
675 int ret, t;674 int ret, t;
676 675
677 num_sc = ((max_chns > num_cpus) ? num_cpus : max_chns);676 /*
677 * If the number of CPUs is artificially restricted, such as
678 * with maxcpus=1 on the kernel boot line, Hyper-V could offer
679 * sub-channels >= the number of CPUs. These sub-channels
680 * should not be created. The primary channel is already created
681 * and assigned to one CPU, so check against # CPUs - 1.
682 */
683 num_sc = min((int)(num_online_cpus() - 1), max_chns);
684 if (!num_sc)
685 return;
686
678 stor_device = get_out_stor_device(device);687 stor_device = get_out_stor_device(device);
679 if (!stor_device)688 if (!stor_device)
680 return;689 return;
drivers/vfio/pci/vfio_pci.c+2−2
@@ -1661,11 +1661,11 @@ static void __init vfio_pci_fill_ids(void) · 1660 unmodified lines
1661 rc = pci_add_dynid(&vfio_pci_driver, vendor, device,1661 rc = pci_add_dynid(&vfio_pci_driver, vendor, device,
1662 subvendor, subdevice, class, class_mask, 0);1662 subvendor, subdevice, class, class_mask, 0);
1663 if (rc)1663 if (rc)
1664 pr_warn("failed to add dynamic id [%04hx:%04hx[%04hx:%04hx]] class %#08x/%08x (%d)\n",1664 pr_warn("failed to add dynamic id [%04x:%04x[%04x:%04x]] class %#08x/%08x (%d)\n",
1665 vendor, device, subvendor, subdevice,1665 vendor, device, subvendor, subdevice,
1666 class, class_mask, rc);1666 class, class_mask, rc);
1667 else1667 else
1668 pr_info("add [%04hx:%04hx[%04hx:%04hx]] class %#08x/%08x\n",1668 pr_info("add [%04x:%04x[%04x:%04x]] class %#08x/%08x\n",
1669 vendor, device, subvendor, subdevice,1669 vendor, device, subvendor, subdevice,
1670 class, class_mask);1670 class, class_mask);
1671 }1671 }
drivers/vfio/vfio_iommu_spapr_tce.c+1−1
@@ -1398,7 +1398,7 @@ unlock_exit: · 1397 unmodified lines
1398 mutex_unlock(&container->lock);1398 mutex_unlock(&container->lock);
1399}1399}
1400 1400
1401const struct vfio_iommu_driver_ops tce_iommu_driver_ops = {1401static const struct vfio_iommu_driver_ops tce_iommu_driver_ops = {
1402 .name = "iommu-vfio-powerpc",1402 .name = "iommu-vfio-powerpc",
1403 .owner = THIS_MODULE,1403 .owner = THIS_MODULE,
1404 .open = tce_iommu_open,1404 .open = tce_iommu_open,
drivers/vfio/vfio_iommu_type1.c+14−0
@@ -58,12 +58,18 @@ module_param_named(disable_hugepages, · 57 unmodified lines
58MODULE_PARM_DESC(disable_hugepages,58MODULE_PARM_DESC(disable_hugepages,
59 "Disable VFIO IOMMU support for IOMMU hugepages.");59 "Disable VFIO IOMMU support for IOMMU hugepages.");
60 60
61static unsigned int dma_entry_limit __read_mostly = U16_MAX;
62module_param_named(dma_entry_limit, dma_entry_limit, uint, 0644);
63MODULE_PARM_DESC(dma_entry_limit,
64 "Maximum number of user DMA mappings per container (65535).");
65
61struct vfio_iommu {66struct vfio_iommu {
62 struct list_head domain_list;67 struct list_head domain_list;
63 struct vfio_domain *external_domain; /* domain for external user */68 struct vfio_domain *external_domain; /* domain for external user */
64 struct mutex lock;69 struct mutex lock;
65 struct rb_root dma_list;70 struct rb_root dma_list;
66 struct blocking_notifier_head notifier;71 struct blocking_notifier_head notifier;
72 unsigned int dma_avail;
67 bool v2;73 bool v2;
68 bool nesting;74 bool nesting;
69};75};
@@ -836,6 +842,7 @@ static void vfio_remove_dma(struct vfio_iommu *iommu, struct vfio_dma *dma) · 766 unmodified lines
836 vfio_unlink_dma(iommu, dma);842 vfio_unlink_dma(iommu, dma);
837 put_task_struct(dma->task);843 put_task_struct(dma->task);
838 kfree(dma);844 kfree(dma);
845 iommu->dma_avail++;
839}846}
840 847
841static unsigned long vfio_pgsize_bitmap(struct vfio_iommu *iommu)848static unsigned long vfio_pgsize_bitmap(struct vfio_iommu *iommu)
@@ -1081,12 +1088,18 @@ static int vfio_dma_do_map(struct vfio_iommu *iommu, · 239 unmodified lines
1081 goto out_unlock;1088 goto out_unlock;
1082 }1089 }
1083 1090
1091 if (!iommu->dma_avail) {
1092 ret = -ENOSPC;
1093 goto out_unlock;
1094 }
1095
1084 dma = kzalloc(sizeof(*dma), GFP_KERNEL);1096 dma = kzalloc(sizeof(*dma), GFP_KERNEL);
1085 if (!dma) {1097 if (!dma) {
1086 ret = -ENOMEM;1098 ret = -ENOMEM;
1087 goto out_unlock;1099 goto out_unlock;
1088 }1100 }
1089 1101
1102 iommu->dma_avail--;
1090 dma->iova = iova;1103 dma->iova = iova;
1091 dma->vaddr = vaddr;1104 dma->vaddr = vaddr;
1092 dma->prot = prot;1105 dma->prot = prot;
@@ -1583,6 +1596,7 @@ static void *vfio_iommu_type1_open(unsigned long arg) · 490 unmodified lines
1583 1596
1584 INIT_LIST_HEAD(&iommu->domain_list);1597 INIT_LIST_HEAD(&iommu->domain_list);
1585 iommu->dma_list = RB_ROOT;1598 iommu->dma_list = RB_ROOT;
1599 iommu->dma_avail = dma_entry_limit;
1586 mutex_init(&iommu->lock);1600 mutex_init(&iommu->lock);
1587 BLOCKING_INIT_NOTIFIER_HEAD(&iommu->notifier);1601 BLOCKING_INIT_NOTIFIER_HEAD(&iommu->notifier);
1588 1602
drivers/xen/privcmd-buf.c+1−2
@@ -140,8 +140,7 @@ static int privcmd_buf_mmap(struct file *file, struct vm_area_struct *vma) · 139 unmodified lines
140 if (!(vma->vm_flags & VM_SHARED))140 if (!(vma->vm_flags & VM_SHARED))
141 return -EINVAL;141 return -EINVAL;
142 142
143 vma_priv = kzalloc(sizeof(*vma_priv) + count * sizeof(void *),143 vma_priv = kzalloc(struct_size(vma_priv, pages, count), GFP_KERNEL);
144 GFP_KERNEL);
145 if (!vma_priv)144 if (!vma_priv)
146 return -ENOMEM;145 return -ENOMEM;
147 146
drivers/xen/xenbus/xenbus_dev_frontend.c+1−3
@@ -622,9 +622,7 @@ static int xenbus_file_open(struct inode *inode, struct file *filp) · 621 unmodified lines
622 if (xen_store_evtchn == 0)622 if (xen_store_evtchn == 0)
623 return -ENOENT;623 return -ENOENT;
624 624
625 nonseekable_open(inode, filp);625 stream_open(inode, filp);
626
627 filp->f_mode &= ~FMODE_ATOMIC_POS; /* cdev-style semantics */
628 626
629 u = kzalloc(sizeof(*u), GFP_KERNEL);627 u = kzalloc(sizeof(*u), GFP_KERNEL);
630 if (u == NULL)628 if (u == NULL)
fs/hugetlbfs/inode.c+14−6
@@ -755,11 +755,17 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, · 754 unmodified lines
755 umode_t mode, dev_t dev)755 umode_t mode, dev_t dev)
756{756{
757 struct inode *inode;757 struct inode *inode;
758 struct resv_map *resv_map;758 struct resv_map *resv_map = NULL;
759 759
760 resv_map = resv_map_alloc();760 /*
761 if (!resv_map)761 * Reserve maps are only needed for inodes that can have associated
762 return NULL;762 * page allocations.
763 */
764 if (S_ISREG(mode) || S_ISLNK(mode)) {
765 resv_map = resv_map_alloc();
766 if (!resv_map)
767 return NULL;
768 }
763 769
764 inode = new_inode(sb);770 inode = new_inode(sb);
765 if (inode) {771 if (inode) {
@@ -794,8 +800,10 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, · 28 unmodified lines
794 break;800 break;
795 }801 }
796 lockdep_annotate_inode_mutex_key(inode);802 lockdep_annotate_inode_mutex_key(inode);
797 } else803 } else {
798 kref_put(&resv_map->refs, resv_map_release);804 if (resv_map)
805 kref_put(&resv_map->refs, resv_map_release);
806 }
799 807
800 return inode;808 return inode;
801}809}
fs/io_uring.c+1−0
@@ -2215,6 +2215,7 @@ static int io_sqe_files_register(struct io_ring_ctx *ctx, void __user *arg, · 2214 unmodified lines
2215 fput(ctx->user_files[i]);2215 fput(ctx->user_files[i]);
2216 2216
2217 kfree(ctx->user_files);2217 kfree(ctx->user_files);
2218 ctx->user_files = NULL;
2218 ctx->nr_user_files = 0;2219 ctx->nr_user_files = 0;
2219 return ret;2220 return ret;
2220 }2221 }
fs/open.c+18−0
@@ -1215,3 +1215,21 @@ int nonseekable_open(struct inode *inode, struct file *filp) · 1214 unmodified lines
1215}1215}
1216 1216
1217EXPORT_SYMBOL(nonseekable_open);1217EXPORT_SYMBOL(nonseekable_open);
1218
1219/*
1220 * stream_open is used by subsystems that want stream-like file descriptors.
1221 * Such file descriptors are not seekable and don't have notion of position
1222 * (file.f_pos is always 0). Contrary to file descriptors of other regular
1223 * files, .read() and .write() can run simultaneously.
1224 *
1225 * stream_open never fails and is marked to return int so that it could be
1226 * directly used as file_operations.open .
1227 */
1228int stream_open(struct inode *inode, struct file *filp)
1229{
1230 filp->f_mode &= ~(FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE | FMODE_ATOMIC_POS);
1231 filp->f_mode |= FMODE_STREAM;
1232 return 0;
1233}
1234
1235EXPORT_SYMBOL(stream_open);
fs/proc/base.c+9−8
@@ -616,24 +616,25 @@ static int proc_pid_limits(struct seq_file *m, struct pid_namespace *ns, · 615 unmodified lines
616static int proc_pid_syscall(struct seq_file *m, struct pid_namespace *ns,616static int proc_pid_syscall(struct seq_file *m, struct pid_namespace *ns,
617 struct pid *pid, struct task_struct *task)617 struct pid *pid, struct task_struct *task)
618{618{
619 long nr;619 struct syscall_info info;
620 unsigned long args[6], sp, pc;620 u64 *args = &info.data.args[0];
621 int res;621 int res;
622 622
623 res = lock_trace(task);623 res = lock_trace(task);
624 if (res)624 if (res)
625 return res;625 return res;
626 626
627 if (task_current_syscall(task, &nr, args, 6, &sp, &pc))627 if (task_current_syscall(task, &info))
628 seq_puts(m, "running\n");628 seq_puts(m, "running\n");
629 else if (nr < 0)629 else if (info.data.nr < 0)
630 seq_printf(m, "%ld 0x%lx 0x%lx\n", nr, sp, pc);630 seq_printf(m, "%d 0x%llx 0x%llx\n",
631 info.data.nr, info.sp, info.data.instruction_pointer);
631 else632 else
632 seq_printf(m,633 seq_printf(m,
633 "%ld 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n",634 "%d 0x%llx 0x%llx 0x%llx 0x%llx 0x%llx 0x%llx 0x%llx 0x%llx\n",
634 nr,635 info.data.nr,
635 args[0], args[1], args[2], args[3], args[4], args[5],636 args[0], args[1], args[2], args[3], args[4], args[5],
636 sp, pc);637 info.sp, info.data.instruction_pointer);
637 unlock_trace(task);638 unlock_trace(task);
638 639
639 return 0;640 return 0;
fs/read_write.c+3−2
@@ -560,12 +560,13 @@ ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_ · 559 unmodified lines
560 560
561static inline loff_t file_pos_read(struct file *file)561static inline loff_t file_pos_read(struct file *file)
562{562{
563 return file->f_pos;563 return file->f_mode & FMODE_STREAM ? 0 : file->f_pos;
564}564}
565 565
566static inline void file_pos_write(struct file *file, loff_t pos)566static inline void file_pos_write(struct file *file, loff_t pos)
567{567{
568 file->f_pos = pos;568 if ((file->f_mode & FMODE_STREAM) == 0)
569 file->f_pos = pos;
569}570}
570 571
571ssize_t ksys_read(unsigned int fd, char __user *buf, size_t count)572ssize_t ksys_read(unsigned int fd, char __user *buf, size_t count)
include/asm-generic/syscall.h+5−16
@@ -105,41 +105,30 @@ void syscall_set_return_value(struct task_struct *task, struct pt_regs *regs, · 104 unmodified lines
105 * syscall_get_arguments - extract system call parameter values105 * syscall_get_arguments - extract system call parameter values
106 * @task: task of interest, must be blocked106 * @task: task of interest, must be blocked
107 * @regs: task_pt_regs() of @task107 * @regs: task_pt_regs() of @task
108 * @i: argument index [0,5]
109 * @n: number of arguments; n+i must be [1,6].
110 * @args: array filled with argument values108 * @args: array filled with argument values
111 *109 *
112 * Fetches @n arguments to the system call starting with the @i'th argument110 * Fetches 6 arguments to the system call. First argument is stored in
113 * (from 0 through 5). Argument @i is stored in @args[0], and so on.111* @args[0], and so on.
114 * An arch inline version is probably optimal when @i and @n are constants.
115 *112 *
116 * It's only valid to call this when @task is stopped for tracing on113 * It's only valid to call this when @task is stopped for tracing on
117 * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.114 * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
118 * It's invalid to call this with @i + @n > 6; we only support system calls
119 * taking up to 6 arguments.
120 */115 */
121void syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,116void syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
122 unsigned int i, unsigned int n, unsigned long *args);117 unsigned long *args);
123 118
124/**119/**
125 * syscall_set_arguments - change system call parameter value120 * syscall_set_arguments - change system call parameter value
126 * @task: task of interest, must be in system call entry tracing121 * @task: task of interest, must be in system call entry tracing
127 * @regs: task_pt_regs() of @task122 * @regs: task_pt_regs() of @task
128 * @i: argument index [0,5]
129 * @n: number of arguments; n+i must be [1,6].
130 * @args: array of argument values to store123 * @args: array of argument values to store
131 *124 *
132 * Changes @n arguments to the system call starting with the @i'th argument.125 * Changes 6 arguments to the system call.
133 * Argument @i gets value @args[0], and so on.126 * The first argument gets value @args[0], and so on.
134 * An arch inline version is probably optimal when @i and @n are constants.
135 *127 *
136 * It's only valid to call this when @task is stopped for tracing on128 * It's only valid to call this when @task is stopped for tracing on
137 * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.129 * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
138 * It's invalid to call this with @i + @n > 6; we only support system calls
139 * taking up to 6 arguments.
140 */130 */
141void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,131void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
142 unsigned int i, unsigned int n,
143 const unsigned long *args);132 const unsigned long *args);
144 133
145/**134/**
include/dt-bindings/reset/amlogic,meson-g12a-reset.h+4−1
@@ -51,7 +51,10 @@ · 50 unmodified lines
51#define RESET_SD_EMMC_A 4451#define RESET_SD_EMMC_A 44
52#define RESET_SD_EMMC_B 4552#define RESET_SD_EMMC_B 45
53#define RESET_SD_EMMC_C 4653#define RESET_SD_EMMC_C 46
54/* 47-60 */54/* 47 */
55#define RESET_USB_PHY20 48
56#define RESET_USB_PHY21 49
57/* 50-60 */
55#define RESET_AUDIO_CODEC 6158#define RESET_AUDIO_CODEC 61
56/* 62-63 */59/* 62-63 */
57/* RESET2 */60/* RESET2 */
include/keys/trusted.h+1−1
@@ -38,7 +38,7 @@ enum { · 37 unmodified lines
38 38
39int TSS_authhmac(unsigned char *digest, const unsigned char *key,39int TSS_authhmac(unsigned char *digest, const unsigned char *key,
40 unsigned int keylen, unsigned char *h1,40 unsigned int keylen, unsigned char *h1,
41 unsigned char *h2, unsigned char h3, ...);41 unsigned char *h2, unsigned int h3, ...);
42int TSS_checkhmac1(unsigned char *buffer,42int TSS_checkhmac1(unsigned char *buffer,
43 const uint32_t command,43 const uint32_t command,
44 const unsigned char *ononce,44 const unsigned char *ononce,
include/linux/bitrev.h+23−23
@@ -34,41 +34,41 @@ static inline u32 __bitrev32(u32 x) · 33 unmodified lines
34 34
35#define __constant_bitrev32(x) \35#define __constant_bitrev32(x) \
36({ \36({ \
37 u32 __x = x; \37 u32 ___x = x; \
38 __x = (__x >> 16) | (__x << 16); \38 ___x = (___x >> 16) | (___x << 16); \
39 __x = ((__x & (u32)0xFF00FF00UL) >> 8) | ((__x & (u32)0x00FF00FFUL) << 8); \39 ___x = ((___x & (u32)0xFF00FF00UL) >> 8) | ((___x & (u32)0x00FF00FFUL) << 8); \
40 __x = ((__x & (u32)0xF0F0F0F0UL) >> 4) | ((__x & (u32)0x0F0F0F0FUL) << 4); \40 ___x = ((___x & (u32)0xF0F0F0F0UL) >> 4) | ((___x & (u32)0x0F0F0F0FUL) << 4); \
41 __x = ((__x & (u32)0xCCCCCCCCUL) >> 2) | ((__x & (u32)0x33333333UL) << 2); \41 ___x = ((___x & (u32)0xCCCCCCCCUL) >> 2) | ((___x & (u32)0x33333333UL) << 2); \
42 __x = ((__x & (u32)0xAAAAAAAAUL) >> 1) | ((__x & (u32)0x55555555UL) << 1); \42 ___x = ((___x & (u32)0xAAAAAAAAUL) >> 1) | ((___x & (u32)0x55555555UL) << 1); \
43 __x; \43 ___x; \
44})44})
45 45
46#define __constant_bitrev16(x) \46#define __constant_bitrev16(x) \
47({ \47({ \
48 u16 __x = x; \48 u16 ___x = x; \
49 __x = (__x >> 8) | (__x << 8); \49 ___x = (___x >> 8) | (___x << 8); \
50 __x = ((__x & (u16)0xF0F0U) >> 4) | ((__x & (u16)0x0F0FU) << 4); \50 ___x = ((___x & (u16)0xF0F0U) >> 4) | ((___x & (u16)0x0F0FU) << 4); \
51 __x = ((__x & (u16)0xCCCCU) >> 2) | ((__x & (u16)0x3333U) << 2); \51 ___x = ((___x & (u16)0xCCCCU) >> 2) | ((___x & (u16)0x3333U) << 2); \
52 __x = ((__x & (u16)0xAAAAU) >> 1) | ((__x & (u16)0x5555U) << 1); \52 ___x = ((___x & (u16)0xAAAAU) >> 1) | ((___x & (u16)0x5555U) << 1); \
53 __x; \53 ___x; \
54})54})
55 55
56#define __constant_bitrev8x4(x) \56#define __constant_bitrev8x4(x) \
57({ \57({ \
58 u32 __x = x; \58 u32 ___x = x; \
59 __x = ((__x & (u32)0xF0F0F0F0UL) >> 4) | ((__x & (u32)0x0F0F0F0FUL) << 4); \59 ___x = ((___x & (u32)0xF0F0F0F0UL) >> 4) | ((___x & (u32)0x0F0F0F0FUL) << 4); \
60 __x = ((__x & (u32)0xCCCCCCCCUL) >> 2) | ((__x & (u32)0x33333333UL) << 2); \60 ___x = ((___x & (u32)0xCCCCCCCCUL) >> 2) | ((___x & (u32)0x33333333UL) << 2); \
61 __x = ((__x & (u32)0xAAAAAAAAUL) >> 1) | ((__x & (u32)0x55555555UL) << 1); \61 ___x = ((___x & (u32)0xAAAAAAAAUL) >> 1) | ((___x & (u32)0x55555555UL) << 1); \
62 __x; \62 ___x; \
63})63})
64 64
65#define __constant_bitrev8(x) \65#define __constant_bitrev8(x) \
66({ \66({ \
67 u8 __x = x; \67 u8 ___x = x; \
68 __x = (__x >> 4) | (__x << 4); \68 ___x = (___x >> 4) | (___x << 4); \
69 __x = ((__x & (u8)0xCCU) >> 2) | ((__x & (u8)0x33U) << 2); \69 ___x = ((___x & (u8)0xCCU) >> 2) | ((___x & (u8)0x33U) << 2); \
70 __x = ((__x & (u8)0xAAU) >> 1) | ((__x & (u8)0x55U) << 1); \70 ___x = ((___x & (u8)0xAAU) >> 1) | ((___x & (u8)0x55U) << 1); \
71 __x; \71 ___x; \
72})72})
73 73
74#define bitrev32(x) \74#define bitrev32(x) \
include/linux/fs.h+4−0
@@ -158,6 +158,9 @@ typedef int (dio_iodone_t)(struct kiocb *iocb, loff_t offset, · 157 unmodified lines
158#define FMODE_OPENED ((__force fmode_t)0x80000)158#define FMODE_OPENED ((__force fmode_t)0x80000)
159#define FMODE_CREATED ((__force fmode_t)0x100000)159#define FMODE_CREATED ((__force fmode_t)0x100000)
160 160
161/* File is stream-like */
162#define FMODE_STREAM ((__force fmode_t)0x200000)
163
161/* File was opened by fanotify and shouldn't generate fanotify events */164/* File was opened by fanotify and shouldn't generate fanotify events */
162#define FMODE_NONOTIFY ((__force fmode_t)0x4000000)165#define FMODE_NONOTIFY ((__force fmode_t)0x4000000)
163 166
@@ -3074,6 +3077,7 @@ extern loff_t no_seek_end_llseek_size(struct file *, loff_t, int, loff_t); · 2910 unmodified lines
3074extern loff_t no_seek_end_llseek(struct file *, loff_t, int);3077extern loff_t no_seek_end_llseek(struct file *, loff_t, int);
3075extern int generic_file_open(struct inode * inode, struct file * filp);3078extern int generic_file_open(struct inode * inode, struct file * filp);
3076extern int nonseekable_open(struct inode * inode, struct file * filp);3079extern int nonseekable_open(struct inode * inode, struct file * filp);
3080extern int stream_open(struct inode * inode, struct file * filp);
3077 3081
3078#ifdef CONFIG_BLOCK3082#ifdef CONFIG_BLOCK
3079typedef void (dio_submit_t)(struct bio *bio, struct inode *inode,3083typedef void (dio_submit_t)(struct bio *bio, struct inode *inode,
include/linux/memcontrol.h+4−1
@@ -566,7 +566,10 @@ struct mem_cgroup *lock_page_memcg(struct page *page); · 565 unmodified lines
566void __unlock_page_memcg(struct mem_cgroup *memcg);566void __unlock_page_memcg(struct mem_cgroup *memcg);
567void unlock_page_memcg(struct page *page);567void unlock_page_memcg(struct page *page);
568 568
569/* idx can be of type enum memcg_stat_item or node_stat_item */569/*
570 * idx can be of type enum memcg_stat_item or node_stat_item.
571 * Keep in sync with memcg_exact_page_state().
572 */
570static inline unsigned long memcg_page_state(struct mem_cgroup *memcg,573static inline unsigned long memcg_page_state(struct mem_cgroup *memcg,
571 int idx)574 int idx)
572{575{
include/linux/mm_types.h+1−1
@@ -671,7 +671,7 @@ enum vm_fault_reason { · 670 unmodified lines
671 671
672/* Encode hstate index for a hwpoisoned large page */672/* Encode hstate index for a hwpoisoned large page */
673#define VM_FAULT_SET_HINDEX(x) ((__force vm_fault_t)((x) << 16))673#define VM_FAULT_SET_HINDEX(x) ((__force vm_fault_t)((x) << 16))
674#define VM_FAULT_GET_HINDEX(x) (((x) >> 16) & 0xf)674#define VM_FAULT_GET_HINDEX(x) (((__force unsigned int)(x) >> 16) & 0xf)
675 675
676#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS | \676#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS | \
677 VM_FAULT_SIGSEGV | VM_FAULT_HWPOISON | \677 VM_FAULT_SIGSEGV | VM_FAULT_HWPOISON | \
include/linux/ptrace.h+8−3
@@ -9,6 +9,13 @@ · 8 unmodified lines
9#include <linux/bug.h> /* For BUG_ON. */9#include <linux/bug.h> /* For BUG_ON. */
10#include <linux/pid_namespace.h> /* For task_active_pid_ns. */10#include <linux/pid_namespace.h> /* For task_active_pid_ns. */
11#include <uapi/linux/ptrace.h>11#include <uapi/linux/ptrace.h>
12#include <linux/seccomp.h>
13
14/* Add sp to seccomp_data, as seccomp is user API, we don't want to modify it */
15struct syscall_info {
16 __u64 sp;
17 struct seccomp_data data;
18};
12 19
13extern int ptrace_access_vm(struct task_struct *tsk, unsigned long addr,20extern int ptrace_access_vm(struct task_struct *tsk, unsigned long addr,
14 void *buf, int len, unsigned int gup_flags);21 void *buf, int len, unsigned int gup_flags);
@@ -407,9 +414,7 @@ static inline void user_single_step_report(struct pt_regs *regs) · 392 unmodified lines
407#define current_user_stack_pointer() user_stack_pointer(current_pt_regs())414#define current_user_stack_pointer() user_stack_pointer(current_pt_regs())
408#endif415#endif
409 416
410extern int task_current_syscall(struct task_struct *target, long *callno,417extern int task_current_syscall(struct task_struct *target, struct syscall_info *info);
411 unsigned long args[6], unsigned int maxargs,
412 unsigned long *sp, unsigned long *pc);
413 418
414extern void sigaction_compat_abi(struct k_sigaction *act, struct k_sigaction *oact);419extern void sigaction_compat_abi(struct k_sigaction *act, struct k_sigaction *oact);
415#endif420#endif
include/linux/string.h+3−0
@@ -150,6 +150,9 @@ extern void * memscan(void *,int,__kernel_size_t); · 149 unmodified lines
150#ifndef __HAVE_ARCH_MEMCMP150#ifndef __HAVE_ARCH_MEMCMP
151extern int memcmp(const void *,const void *,__kernel_size_t);151extern int memcmp(const void *,const void *,__kernel_size_t);
152#endif152#endif
153#ifndef __HAVE_ARCH_BCMP
154extern int bcmp(const void *,const void *,__kernel_size_t);
155#endif
153#ifndef __HAVE_ARCH_MEMCHR156#ifndef __HAVE_ARCH_MEMCHR
154extern void * memchr(const void *,int,__kernel_size_t);157extern void * memchr(const void *,int,__kernel_size_t);
155#endif158#endif
include/net/nfc/nci_core.h+1−1
@@ -166,7 +166,7 @@ struct nci_conn_info { · 165 unmodified lines
166 * According to specification 102 622 chapter 4.4 Pipes,166 * According to specification 102 622 chapter 4.4 Pipes,
167 * the pipe identifier is 7 bits long.167 * the pipe identifier is 7 bits long.
168 */168 */
169#define NCI_HCI_MAX_PIPES 127169#define NCI_HCI_MAX_PIPES 128
170 170
171struct nci_hci_gate {171struct nci_hci_gate {
172 u8 gate;172 u8 gate;
include/trace/events/syscalls.h+1−1
@@ -28,7 +28,7 @@ TRACE_EVENT_FN(sys_enter, · 27 unmodified lines
28 28
29 TP_fast_assign(29 TP_fast_assign(
30 __entry->id = id;30 __entry->id = id;
31 syscall_get_arguments(current, regs, 0, 6, __entry->args);31 syscall_get_arguments(current, regs, __entry->args);
32 ),32 ),
33 33
34 TP_printk("NR %ld (%lx, %lx, %lx, %lx, %lx, %lx)",34 TP_printk("NR %ld (%lx, %lx, %lx, %lx, %lx, %lx)",
include/uapi/linux/ethtool.h+1−1
@@ -1599,7 +1599,7 @@ enum ethtool_link_mode_bit_indices { · 1598 unmodified lines
1599 1599
1600static inline int ethtool_validate_speed(__u32 speed)1600static inline int ethtool_validate_speed(__u32 speed)
1601{1601{
1602 return speed <= INT_MAX || speed == SPEED_UNKNOWN;1602 return speed <= INT_MAX || speed == (__u32)SPEED_UNKNOWN;
1603}1603}
1604 1604
1605/* Duplex, half or full. */1605/* Duplex, half or full. */
kernel/seccomp.c+1−1
@@ -149,7 +149,7 @@ static void populate_seccomp_data(struct seccomp_data *sd) · 148 unmodified lines
149 149
150 sd->nr = syscall_get_nr(task, regs);150 sd->nr = syscall_get_nr(task, regs);
151 sd->arch = syscall_get_arch();151 sd->arch = syscall_get_arch();
152 syscall_get_arguments(task, regs, 0, 6, args);152 syscall_get_arguments(task, regs, args);
153 sd->args[0] = args[0];153 sd->args[0] = args[0];
154 sd->args[1] = args[1];154 sd->args[1] = args[1];
155 sd->args[2] = args[2];155 sd->args[2] = args[2];
kernel/sysctl.c+2−1
@@ -128,6 +128,7 @@ static int zero; · 127 unmodified lines
128static int __maybe_unused one = 1;128static int __maybe_unused one = 1;
129static int __maybe_unused two = 2;129static int __maybe_unused two = 2;
130static int __maybe_unused four = 4;130static int __maybe_unused four = 4;
131static unsigned long zero_ul;
131static unsigned long one_ul = 1;132static unsigned long one_ul = 1;
132static unsigned long long_max = LONG_MAX;133static unsigned long long_max = LONG_MAX;
133static int one_hundred = 100;134static int one_hundred = 100;
@@ -1750,7 +1751,7 @@ static struct ctl_table fs_table[] = { · 1616 unmodified lines
1750 .maxlen = sizeof(files_stat.max_files),1751 .maxlen = sizeof(files_stat.max_files),
1751 .mode = 0644,1752 .mode = 0644,
1752 .proc_handler = proc_doulongvec_minmax,1753 .proc_handler = proc_doulongvec_minmax,
1753 .extra1 = &zero,1754 .extra1 = &zero_ul,
1754 .extra2 = &long_max,1755 .extra2 = &long_max,
1755 },1756 },
1756 {1757 {
kernel/trace/trace_syscalls.c+6−3
@@ -314,6 +314,7 @@ static void ftrace_syscall_enter(void *data, struct pt_regs *regs, long id) · 313 unmodified lines
314 struct ring_buffer_event *event;314 struct ring_buffer_event *event;
315 struct ring_buffer *buffer;315 struct ring_buffer *buffer;
316 unsigned long irq_flags;316 unsigned long irq_flags;
317 unsigned long args[6];
317 int pc;318 int pc;
318 int syscall_nr;319 int syscall_nr;
319 int size;320 int size;
@@ -347,7 +348,8 @@ static void ftrace_syscall_enter(void *data, struct pt_regs *regs, long id) · 27 unmodified lines
347 348
348 entry = ring_buffer_event_data(event);349 entry = ring_buffer_event_data(event);
349 entry->nr = syscall_nr;350 entry->nr = syscall_nr;
350 syscall_get_arguments(current, regs, 0, sys_data->nb_args, entry->args);351 syscall_get_arguments(current, regs, args);
352 memcpy(entry->args, args, sizeof(unsigned long) * sys_data->nb_args);
351 353
352 event_trigger_unlock_commit(trace_file, buffer, event, entry,354 event_trigger_unlock_commit(trace_file, buffer, event, entry,
353 irq_flags, pc);355 irq_flags, pc);
@@ -583,6 +585,7 @@ static void perf_syscall_enter(void *ignore, struct pt_regs *regs, long id) · 229 unmodified lines
583 struct syscall_metadata *sys_data;585 struct syscall_metadata *sys_data;
584 struct syscall_trace_enter *rec;586 struct syscall_trace_enter *rec;
585 struct hlist_head *head;587 struct hlist_head *head;
588 unsigned long args[6];
586 bool valid_prog_array;589 bool valid_prog_array;
587 int syscall_nr;590 int syscall_nr;
588 int rctx;591 int rctx;
@@ -613,8 +616,8 @@ static void perf_syscall_enter(void *ignore, struct pt_regs *regs, long id) · 24 unmodified lines
613 return;616 return;
614 617
615 rec->nr = syscall_nr;618 rec->nr = syscall_nr;
616 syscall_get_arguments(current, regs, 0, sys_data->nb_args,619 syscall_get_arguments(current, regs, args);
617 (unsigned long *)&rec->args);620 memcpy(&rec->args, args, sizeof(unsigned long) * sys_data->nb_args);
618 621
619 if ((valid_prog_array &&622 if ((valid_prog_array &&
620 !perf_call_bpf_enter(sys_data->enter_event, regs, sys_data, rec)) ||623 !perf_call_bpf_enter(sys_data->enter_event, regs, sys_data, rec)) ||
lib/lzo/lzo1x_compress.c+6−3
@@ -291,13 +291,14 @@ int lzogeneric1x_1_compress(const unsigned char *in, size_t in_len, · 290 unmodified lines
291{291{
292 const unsigned char *ip = in;292 const unsigned char *ip = in;
293 unsigned char *op = out;293 unsigned char *op = out;
294 unsigned char *data_start;
294 size_t l = in_len;295 size_t l = in_len;
295 size_t t = 0;296 size_t t = 0;
296 signed char state_offset = -2;297 signed char state_offset = -2;
297 unsigned int m4_max_offset;298 unsigned int m4_max_offset;
298 299
299 // LZO v0 will never write 17 as first byte,300 // LZO v0 will never write 17 as first byte (except for zero-length
300 // so this is used to version the bitstream301 // input), so this is used to version the bitstream
301 if (bitstream_version > 0) {302 if (bitstream_version > 0) {
302 *op++ = 17;303 *op++ = 17;
303 *op++ = bitstream_version;304 *op++ = bitstream_version;
@@ -306,6 +307,8 @@ int lzogeneric1x_1_compress(const unsigned char *in, size_t in_len, · 2 unmodified lines
306 m4_max_offset = M4_MAX_OFFSET_V0;307 m4_max_offset = M4_MAX_OFFSET_V0;
307 }308 }
308 309
310 data_start = op;
311
309 while (l > 20) {312 while (l > 20) {
310 size_t ll = l <= (m4_max_offset + 1) ? l : (m4_max_offset + 1);313 size_t ll = l <= (m4_max_offset + 1) ? l : (m4_max_offset + 1);
311 uintptr_t ll_end = (uintptr_t) ip + ll;314 uintptr_t ll_end = (uintptr_t) ip + ll;
@@ -324,7 +327,7 @@ int lzogeneric1x_1_compress(const unsigned char *in, size_t in_len, · 12 unmodified lines
324 if (t > 0) {327 if (t > 0) {
325 const unsigned char *ii = in + in_len - t;328 const unsigned char *ii = in + in_len - t;
326 329
327 if (op == out && t <= 238) {330 if (op == data_start && t <= 238) {
328 *op++ = (17 + t);331 *op++ = (17 + t);
329 } else if (t <= 3) {332 } else if (t <= 3) {
330 op[state_offset] |= t;333 op[state_offset] |= t;
lib/lzo/lzo1x_decompress_safe.c+1−3
@@ -54,11 +54,9 @@ int lzo1x_decompress_safe(const unsigned char *in, size_t in_len, · 53 unmodified lines
54 if (unlikely(in_len < 3))54 if (unlikely(in_len < 3))
55 goto input_overrun;55 goto input_overrun;
56 56
57 if (likely(*ip == 17)) {57 if (likely(in_len >= 5) && likely(*ip == 17)) {
58 bitstream_version = ip[1];58 bitstream_version = ip[1];
59 ip += 2;59 ip += 2;
60 if (unlikely(in_len < 5))
61 goto input_overrun;
62 } else {60 } else {
63 bitstream_version = 0;61 bitstream_version = 0;
64 }62 }
lib/string.c+20−0
@@ -866,6 +866,26 @@ __visible int memcmp(const void *cs, const void *ct, size_t count) · 865 unmodified lines
866EXPORT_SYMBOL(memcmp);866EXPORT_SYMBOL(memcmp);
867#endif867#endif
868 868
869#ifndef __HAVE_ARCH_BCMP
870/**
871 * bcmp - returns 0 if and only if the buffers have identical contents.
872 * @a: pointer to first buffer.
873 * @b: pointer to second buffer.
874 * @len: size of buffers.
875 *
876 * The sign or magnitude of a non-zero return value has no particular
877 * meaning, and architectures may implement their own more efficient bcmp(). So
878 * while this particular implementation is a simple (tail) call to memcmp, do
879 * not rely on anything but whether the return value is zero or non-zero.
880 */
881#undef bcmp
882int bcmp(const void *a, const void *b, size_t len)
883{
884 return memcmp(a, b, len);
885}
886EXPORT_SYMBOL(bcmp);
887#endif
888
869#ifndef __HAVE_ARCH_MEMSCAN889#ifndef __HAVE_ARCH_MEMSCAN
870/**890/**
871 * memscan - Find a character in an area of memory.891 * memscan - Find a character in an area of memory.
lib/syscall.c+25−32
@@ -5,16 +5,14 @@ · 4 unmodified lines
5#include <linux/export.h>5#include <linux/export.h>
6#include <asm/syscall.h>6#include <asm/syscall.h>
7 7
8static int collect_syscall(struct task_struct *target, long *callno,8static int collect_syscall(struct task_struct *target, struct syscall_info *info)
9 unsigned long args[6], unsigned int maxargs,
10 unsigned long *sp, unsigned long *pc)
11{9{
12 struct pt_regs *regs;10 struct pt_regs *regs;
13 11
14 if (!try_get_task_stack(target)) {12 if (!try_get_task_stack(target)) {
15 /* Task has no stack, so the task isn't in a syscall. */13 /* Task has no stack, so the task isn't in a syscall. */
16 *sp = *pc = 0;14 memset(info, 0, sizeof(*info));
17 *callno = -1;15 info->data.nr = -1;
18 return 0;16 return 0;
19 }17 }
20 18
@@ -24,12 +22,13 @@ static int collect_syscall(struct task_struct *target, long *callno, · 3 unmodified lines
24 return -EAGAIN;22 return -EAGAIN;
25 }23 }
26 24
27 *sp = user_stack_pointer(regs);25 info->sp = user_stack_pointer(regs);
28 *pc = instruction_pointer(regs);26 info->data.instruction_pointer = instruction_pointer(regs);
29 27
30 *callno = syscall_get_nr(target, regs);28 info->data.nr = syscall_get_nr(target, regs);
31 if (*callno != -1L && maxargs > 0)29 if (info->data.nr != -1L)
32 syscall_get_arguments(target, regs, 0, maxargs, args);30 syscall_get_arguments(target, regs,
31 (unsigned long *)&info->data.args[0]);
33 32
34 put_task_stack(target);33 put_task_stack(target);
35 return 0;34 return 0;
@@ -38,41 +37,35 @@ static int collect_syscall(struct task_struct *target, long *callno, · 2 unmodified lines
38/**37/**
39 * task_current_syscall - Discover what a blocked task is doing.38 * task_current_syscall - Discover what a blocked task is doing.
40 * @target: thread to examine39 * @target: thread to examine
41 * @callno: filled with system call number or -140 * @info: structure with the following fields:
42 * @args: filled with @maxargs system call arguments41 * .sp - filled with user stack pointer
43 * @maxargs: number of elements in @args to fill42 * .data.nr - filled with system call number or -1
44 * @sp: filled with user stack pointer43 * .data.args - filled with @maxargs system call arguments
45 * @pc: filled with user PC44 * .data.instruction_pointer - filled with user PC
46 *45 *
47 * If @target is blocked in a system call, returns zero with *@callno46 * If @target is blocked in a system call, returns zero with @info.data.nr
48 * set to the the call's number and @args filled in with its arguments.47 * set to the the call's number and @info.data.args filled in with its
49 * Registers not used for system call arguments may not be available and48 * arguments. Registers not used for system call arguments may not be available
50 * it is not kosher to use &struct user_regset calls while the system49 * and it is not kosher to use &struct user_regset calls while the system
51 * call is still in progress. Note we may get this result if @target50 * call is still in progress. Note we may get this result if @target
52 * has finished its system call but not yet returned to user mode, such51 * has finished its system call but not yet returned to user mode, such
53 * as when it's stopped for signal handling or syscall exit tracing.52 * as when it's stopped for signal handling or syscall exit tracing.
54 *53 *
55 * If @target is blocked in the kernel during a fault or exception,54 * If @target is blocked in the kernel during a fault or exception,
56 * returns zero with *@callno set to -1 and does not fill in @args.55 * returns zero with *@info.data.nr set to -1 and does not fill in
57 * If so, it's now safe to examine @target using &struct user_regset56 * @info.data.args. If so, it's now safe to examine @target using
58 * get() calls as long as we're sure @target won't return to user mode.57 * &struct user_regset get() calls as long as we're sure @target won't return
58 * to user mode.
59 *59 *
60 * Returns -%EAGAIN if @target does not remain blocked.60 * Returns -%EAGAIN if @target does not remain blocked.
61 *
62 * Returns -%EINVAL if @maxargs is too large (maximum is six).
63 */61 */
64int task_current_syscall(struct task_struct *target, long *callno,62int task_current_syscall(struct task_struct *target, struct syscall_info *info)
65 unsigned long args[6], unsigned int maxargs,
66 unsigned long *sp, unsigned long *pc)
67{63{
68 long state;64 long state;
69 unsigned long ncsw;65 unsigned long ncsw;
70 66
71 if (unlikely(maxargs > 6))
72 return -EINVAL;
73
74 if (target == current)67 if (target == current)
75 return collect_syscall(target, callno, args, maxargs, sp, pc);68 return collect_syscall(target, info);
76 69
77 state = target->state;70 state = target->state;
78 if (unlikely(!state))71 if (unlikely(!state))
@@ -80,7 +73,7 @@ int task_current_syscall(struct task_struct *target, long *callno, · 1 unmodified line
80 73
81 ncsw = wait_task_inactive(target, state);74 ncsw = wait_task_inactive(target, state);
82 if (unlikely(!ncsw) ||75 if (unlikely(!ncsw) ||
83 unlikely(collect_syscall(target, callno, args, maxargs, sp, pc)) ||76 unlikely(collect_syscall(target, info)) ||
84 unlikely(wait_task_inactive(target, state) != ncsw))77 unlikely(wait_task_inactive(target, state) != ncsw))
85 return -EAGAIN;78 return -EAGAIN;
86 79
mm/huge_memory.c+36−0
@@ -755,6 +755,21 @@ static void insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr, · 754 unmodified lines
755 spinlock_t *ptl;755 spinlock_t *ptl;
756 756
757 ptl = pmd_lock(mm, pmd);757 ptl = pmd_lock(mm, pmd);
758 if (!pmd_none(*pmd)) {
759 if (write) {
760 if (pmd_pfn(*pmd) != pfn_t_to_pfn(pfn)) {
761 WARN_ON_ONCE(!is_huge_zero_pmd(*pmd));
762 goto out_unlock;
763 }
764 entry = pmd_mkyoung(*pmd);
765 entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma);
766 if (pmdp_set_access_flags(vma, addr, pmd, entry, 1))
767 update_mmu_cache_pmd(vma, addr, pmd);
768 }
769
770 goto out_unlock;
771 }
772
758 entry = pmd_mkhuge(pfn_t_pmd(pfn, prot));773 entry = pmd_mkhuge(pfn_t_pmd(pfn, prot));
759 if (pfn_t_devmap(pfn))774 if (pfn_t_devmap(pfn))
760 entry = pmd_mkdevmap(entry);775 entry = pmd_mkdevmap(entry);
@@ -766,11 +781,16 @@ static void insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr, · 5 unmodified lines
766 if (pgtable) {781 if (pgtable) {
767 pgtable_trans_huge_deposit(mm, pmd, pgtable);782 pgtable_trans_huge_deposit(mm, pmd, pgtable);
768 mm_inc_nr_ptes(mm);783 mm_inc_nr_ptes(mm);
784 pgtable = NULL;
769 }785 }
770 786
771 set_pmd_at(mm, addr, pmd, entry);787 set_pmd_at(mm, addr, pmd, entry);
772 update_mmu_cache_pmd(vma, addr, pmd);788 update_mmu_cache_pmd(vma, addr, pmd);
789
790out_unlock:
773 spin_unlock(ptl);791 spin_unlock(ptl);
792 if (pgtable)
793 pte_free(mm, pgtable);
774}794}
775 795
776vm_fault_t vmf_insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr,796vm_fault_t vmf_insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr,
@@ -821,6 +841,20 @@ static void insert_pfn_pud(struct vm_area_struct *vma, unsigned long addr, · 44 unmodified lines
821 spinlock_t *ptl;841 spinlock_t *ptl;
822 842
823 ptl = pud_lock(mm, pud);843 ptl = pud_lock(mm, pud);
844 if (!pud_none(*pud)) {
845 if (write) {
846 if (pud_pfn(*pud) != pfn_t_to_pfn(pfn)) {
847 WARN_ON_ONCE(!is_huge_zero_pud(*pud));
848 goto out_unlock;
849 }
850 entry = pud_mkyoung(*pud);
851 entry = maybe_pud_mkwrite(pud_mkdirty(entry), vma);
852 if (pudp_set_access_flags(vma, addr, pud, entry, 1))
853 update_mmu_cache_pud(vma, addr, pud);
854 }
855 goto out_unlock;
856 }
857
824 entry = pud_mkhuge(pfn_t_pud(pfn, prot));858 entry = pud_mkhuge(pfn_t_pud(pfn, prot));
825 if (pfn_t_devmap(pfn))859 if (pfn_t_devmap(pfn))
826 entry = pud_mkdevmap(entry);860 entry = pud_mkdevmap(entry);
@@ -830,6 +864,8 @@ static void insert_pfn_pud(struct vm_area_struct *vma, unsigned long addr, · 3 unmodified lines
830 }864 }
831 set_pud_at(mm, addr, pud, entry);865 set_pud_at(mm, addr, pud, entry);
832 update_mmu_cache_pud(vma, addr, pud);866 update_mmu_cache_pud(vma, addr, pud);
867
868out_unlock:
833 spin_unlock(ptl);869 spin_unlock(ptl);
834}870}
835 871
mm/kmemleak.c+11−5
@@ -1529,11 +1529,6 @@ static void kmemleak_scan(void) · 1528 unmodified lines
1529 }1529 }
1530 rcu_read_unlock();1530 rcu_read_unlock();
1531 1531
1532 /* data/bss scanning */
1533 scan_large_block(_sdata, _edata);
1534 scan_large_block(__bss_start, __bss_stop);
1535 scan_large_block(__start_ro_after_init, __end_ro_after_init);
1536
1537#ifdef CONFIG_SMP1532#ifdef CONFIG_SMP
1538 /* per-cpu sections scanning */1533 /* per-cpu sections scanning */
1539 for_each_possible_cpu(i)1534 for_each_possible_cpu(i)
@@ -2071,6 +2066,17 @@ void __init kmemleak_init(void) · 531 unmodified lines
2071 }2066 }
2072 local_irq_restore(flags);2067 local_irq_restore(flags);
2073 2068
2069 /* register the data/bss sections */
2070 create_object((unsigned long)_sdata, _edata - _sdata,
2071 KMEMLEAK_GREY, GFP_ATOMIC);
2072 create_object((unsigned long)__bss_start, __bss_stop - __bss_start,
2073 KMEMLEAK_GREY, GFP_ATOMIC);
2074 /* only register .data..ro_after_init if not within .data */
2075 if (__start_ro_after_init < _sdata || __end_ro_after_init > _edata)
2076 create_object((unsigned long)__start_ro_after_init,
2077 __end_ro_after_init - __start_ro_after_init,
2078 KMEMLEAK_GREY, GFP_ATOMIC);
2079
2074 /*2080 /*
2075 * This is the point where tracking allocations is safe. Automatic2081 * This is the point where tracking allocations is safe. Automatic
2076 * scanning is started during the late initcall. Add the early logged2082 * scanning is started during the late initcall. Add the early logged
mm/memcontrol.c+18−2
@@ -3882,6 +3882,22 @@ struct wb_domain *mem_cgroup_wb_domain(struct bdi_writeback *wb) · 3881 unmodified lines
3882 return &memcg->cgwb_domain;3882 return &memcg->cgwb_domain;
3883}3883}
3884 3884
3885/*
3886 * idx can be of type enum memcg_stat_item or node_stat_item.
3887 * Keep in sync with memcg_exact_page().
3888 */
3889static unsigned long memcg_exact_page_state(struct mem_cgroup *memcg, int idx)
3890{
3891 long x = atomic_long_read(&memcg->stat[idx]);
3892 int cpu;
3893
3894 for_each_online_cpu(cpu)
3895 x += per_cpu_ptr(memcg->stat_cpu, cpu)->count[idx];
3896 if (x < 0)
3897 x = 0;
3898 return x;
3899}
3900
3885/**3901/**
3886 * mem_cgroup_wb_stats - retrieve writeback related stats from its memcg3902 * mem_cgroup_wb_stats - retrieve writeback related stats from its memcg
3887 * @wb: bdi_writeback in question3903 * @wb: bdi_writeback in question
@@ -3907,10 +3923,10 @@ void mem_cgroup_wb_stats(struct bdi_writeback *wb, unsigned long *pfilepages, · 19 unmodified lines
3907 struct mem_cgroup *memcg = mem_cgroup_from_css(wb->memcg_css);3923 struct mem_cgroup *memcg = mem_cgroup_from_css(wb->memcg_css);
3908 struct mem_cgroup *parent;3924 struct mem_cgroup *parent;
3909 3925
3910 *pdirty = memcg_page_state(memcg, NR_FILE_DIRTY);3926 *pdirty = memcg_exact_page_state(memcg, NR_FILE_DIRTY);
3911 3927
3912 /* this should eventually include NR_UNSTABLE_NFS */3928 /* this should eventually include NR_UNSTABLE_NFS */
3913 *pwriteback = memcg_page_state(memcg, NR_WRITEBACK);3929 *pwriteback = memcg_exact_page_state(memcg, NR_WRITEBACK);
3914 *pfilepages = mem_cgroup_nr_lru_pages(memcg, (1 << LRU_INACTIVE_FILE) |3930 *pfilepages = mem_cgroup_nr_lru_pages(memcg, (1 << LRU_INACTIVE_FILE) |
3915 (1 << LRU_ACTIVE_FILE));3931 (1 << LRU_ACTIVE_FILE));
3916 *pheadroom = PAGE_COUNTER_MAX;3932 *pheadroom = PAGE_COUNTER_MAX;
mm/slab.c+2−1
@@ -4308,7 +4308,8 @@ static void show_symbol(struct seq_file *m, unsigned long address) · 4307 unmodified lines
4308 4308
4309static int leaks_show(struct seq_file *m, void *p)4309static int leaks_show(struct seq_file *m, void *p)
4310{4310{
4311 struct kmem_cache *cachep = list_entry(p, struct kmem_cache, list);4311 struct kmem_cache *cachep = list_entry(p, struct kmem_cache,
4312 root_caches_node);
4312 struct page *page;4313 struct page *page;
4313 struct kmem_cache_node *n;4314 struct kmem_cache_node *n;
4314 const char *name;4315 const char *name;
mm/util.c+1−1
@@ -204,7 +204,7 @@ EXPORT_SYMBOL(vmemdup_user); · 203 unmodified lines
204 * @s: The string to duplicate204 * @s: The string to duplicate
205 * @n: Maximum number of bytes to copy, including the trailing NUL.205 * @n: Maximum number of bytes to copy, including the trailing NUL.
206 *206 *
207 * Return: newly allocated copy of @s or %NULL in case of error207 * Return: newly allocated copy of @s or an ERR_PTR() in case of error
208 */208 */
209char *strndup_user(const char __user *s, long n)209char *strndup_user(const char __user *s, long n)
210{210{
net/ipv4/ip_gre.c+10−5
@@ -259,7 +259,6 @@ static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi, · 258 unmodified lines
259 struct net *net = dev_net(skb->dev);259 struct net *net = dev_net(skb->dev);
260 struct metadata_dst *tun_dst = NULL;260 struct metadata_dst *tun_dst = NULL;
261 struct erspan_base_hdr *ershdr;261 struct erspan_base_hdr *ershdr;
262 struct erspan_metadata *pkt_md;
263 struct ip_tunnel_net *itn;262 struct ip_tunnel_net *itn;
264 struct ip_tunnel *tunnel;263 struct ip_tunnel *tunnel;
265 const struct iphdr *iph;264 const struct iphdr *iph;
@@ -282,9 +281,6 @@ static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi, · 16 unmodified lines
282 if (unlikely(!pskb_may_pull(skb, len)))281 if (unlikely(!pskb_may_pull(skb, len)))
283 return PACKET_REJECT;282 return PACKET_REJECT;
284 283
285 ershdr = (struct erspan_base_hdr *)(skb->data + gre_hdr_len);
286 pkt_md = (struct erspan_metadata *)(ershdr + 1);
287
288 if (__iptunnel_pull_header(skb,284 if (__iptunnel_pull_header(skb,
289 len,285 len,
290 htons(ETH_P_TEB),286 htons(ETH_P_TEB),
@@ -292,8 +288,9 @@ static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi, · 1 unmodified line
292 goto drop;288 goto drop;
293 289
294 if (tunnel->collect_md) {290 if (tunnel->collect_md) {
291 struct erspan_metadata *pkt_md, *md;
295 struct ip_tunnel_info *info;292 struct ip_tunnel_info *info;
296 struct erspan_metadata *md;293 unsigned char *gh;
297 __be64 tun_id;294 __be64 tun_id;
298 __be16 flags;295 __be16 flags;
299 296
@@ -306,6 +303,14 @@ static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi, · 6 unmodified lines
306 if (!tun_dst)303 if (!tun_dst)
307 return PACKET_REJECT;304 return PACKET_REJECT;
308 305
306 /* skb can be uncloned in __iptunnel_pull_header, so
307 * old pkt_md is no longer valid and we need to reset
308 * it
309 */
310 gh = skb_network_header(skb) +
311 skb_network_header_len(skb);
312 pkt_md = (struct erspan_metadata *)(gh + gre_hdr_len +
313 sizeof(*ershdr));
309 md = ip_tunnel_info_opts(&tun_dst->u.tun_info);314 md = ip_tunnel_info_opts(&tun_dst->u.tun_info);
310 md->version = ver;315 md->version = ver;
311 md2 = &md->u.md2;316 md2 = &md->u.md2;
net/ipv6/ip6_gre.c+13−7
@@ -525,10 +525,10 @@ static int ip6gre_rcv(struct sk_buff *skb, const struct tnl_ptk_info *tpi) · 524 unmodified lines
525}525}
526 526
527static int ip6erspan_rcv(struct sk_buff *skb,527static int ip6erspan_rcv(struct sk_buff *skb,
528 struct tnl_ptk_info *tpi)528 struct tnl_ptk_info *tpi,
529 int gre_hdr_len)
529{530{
530 struct erspan_base_hdr *ershdr;531 struct erspan_base_hdr *ershdr;
531 struct erspan_metadata *pkt_md;
532 const struct ipv6hdr *ipv6h;532 const struct ipv6hdr *ipv6h;
533 struct erspan_md2 *md2;533 struct erspan_md2 *md2;
534 struct ip6_tnl *tunnel;534 struct ip6_tnl *tunnel;
@@ -547,18 +547,16 @@ static int ip6erspan_rcv(struct sk_buff *skb, · 12 unmodified lines
547 if (unlikely(!pskb_may_pull(skb, len)))547 if (unlikely(!pskb_may_pull(skb, len)))
548 return PACKET_REJECT;548 return PACKET_REJECT;
549 549
550 ershdr = (struct erspan_base_hdr *)skb->data;
551 pkt_md = (struct erspan_metadata *)(ershdr + 1);
552
553 if (__iptunnel_pull_header(skb, len,550 if (__iptunnel_pull_header(skb, len,
554 htons(ETH_P_TEB),551 htons(ETH_P_TEB),
555 false, false) < 0)552 false, false) < 0)
556 return PACKET_REJECT;553 return PACKET_REJECT;
557 554
558 if (tunnel->parms.collect_md) {555 if (tunnel->parms.collect_md) {
556 struct erspan_metadata *pkt_md, *md;
559 struct metadata_dst *tun_dst;557 struct metadata_dst *tun_dst;
560 struct ip_tunnel_info *info;558 struct ip_tunnel_info *info;
561 struct erspan_metadata *md;559 unsigned char *gh;
562 __be64 tun_id;560 __be64 tun_id;
563 __be16 flags;561 __be16 flags;
564 562
@@ -571,6 +569,14 @@ static int ip6erspan_rcv(struct sk_buff *skb, · 6 unmodified lines
571 if (!tun_dst)569 if (!tun_dst)
572 return PACKET_REJECT;570 return PACKET_REJECT;
573 571
572 /* skb can be uncloned in __iptunnel_pull_header, so
573 * old pkt_md is no longer valid and we need to reset
574 * it
575 */
576 gh = skb_network_header(skb) +
577 skb_network_header_len(skb);
578 pkt_md = (struct erspan_metadata *)(gh + gre_hdr_len +
579 sizeof(*ershdr));
574 info = &tun_dst->u.tun_info;580 info = &tun_dst->u.tun_info;
575 md = ip_tunnel_info_opts(info);581 md = ip_tunnel_info_opts(info);
576 md->version = ver;582 md->version = ver;
@@ -607,7 +613,7 @@ static int gre_rcv(struct sk_buff *skb) · 30 unmodified lines
607 613
608 if (unlikely(tpi.proto == htons(ETH_P_ERSPAN) ||614 if (unlikely(tpi.proto == htons(ETH_P_ERSPAN) ||
609 tpi.proto == htons(ETH_P_ERSPAN2))) {615 tpi.proto == htons(ETH_P_ERSPAN2))) {
610 if (ip6erspan_rcv(skb, &tpi) == PACKET_RCVD)616 if (ip6erspan_rcv(skb, &tpi, hdr_len) == PACKET_RCVD)
611 return 0;617 return 0;
612 goto out;618 goto out;
613 }619 }
net/nfc/nci/hci.c+8−0
@@ -312,6 +312,10 @@ static void nci_hci_cmd_received(struct nci_dev *ndev, u8 pipe, · 311 unmodified lines
312 create_info = (struct nci_hci_create_pipe_resp *)skb->data;312 create_info = (struct nci_hci_create_pipe_resp *)skb->data;
313 dest_gate = create_info->dest_gate;313 dest_gate = create_info->dest_gate;
314 new_pipe = create_info->pipe;314 new_pipe = create_info->pipe;
315 if (new_pipe >= NCI_HCI_MAX_PIPES) {
316 status = NCI_HCI_ANY_E_NOK;
317 goto exit;
318 }
315 319
316 /* Save the new created pipe and bind with local gate,320 /* Save the new created pipe and bind with local gate,
317 * the description for skb->data[3] is destination gate id321 * the description for skb->data[3] is destination gate id
@@ -336,6 +340,10 @@ static void nci_hci_cmd_received(struct nci_dev *ndev, u8 pipe, · 18 unmodified lines
336 goto exit;340 goto exit;
337 }341 }
338 delete_info = (struct nci_hci_delete_pipe_noti *)skb->data;342 delete_info = (struct nci_hci_delete_pipe_noti *)skb->data;
343 if (delete_info->pipe >= NCI_HCI_MAX_PIPES) {
344 status = NCI_HCI_ANY_E_NOK;
345 goto exit;
346 }
339 347
340 ndev->hci_dev->pipes[delete_info->pipe].gate =348 ndev->hci_dev->pipes[delete_info->pipe].gate =
341 NCI_HCI_INVALID_GATE;349 NCI_HCI_INVALID_GATE;
scripts/coccinelle/api/stream_open.cocci+363−0
@@ -0,0 +1,363 @@
1// SPDX-License-Identifier: GPL-2.0
2// Author: Kirill Smelkov (kirr@nexedi.com)
3//
4// Search for stream-like files that are using nonseekable_open and convert
5// them to stream_open. A stream-like file is a file that does not use ppos in
6// its read and write. Rationale for the conversion is to avoid deadlock in
7// between read and write.
8
9virtual report
10virtual patch
11virtual explain // explain decisions in the patch (SPFLAGS="-D explain")
12
13// stream-like reader & writer - ones that do not depend on f_pos.
14@ stream_reader @
15identifier readstream, ppos;
16identifier f, buf, len;
17type loff_t;
18@@
19 ssize_t readstream(struct file *f, char *buf, size_t len, loff_t *ppos)
20 {
21 ... when != ppos
22 }
23
24@ stream_writer @
25identifier writestream, ppos;
26identifier f, buf, len;
27type loff_t;
28@@
29 ssize_t writestream(struct file *f, const char *buf, size_t len, loff_t *ppos)
30 {
31 ... when != ppos
32 }
33
34
35// a function that blocks
36@ blocks @
37identifier block_f;
38identifier wait_event =~ "^wait_event_.*";
39@@
40 block_f(...) {
41 ... when exists
42 wait_event(...)
43 ... when exists
44 }
45
46// stream_reader that can block inside.
47//
48// XXX wait_* can be called not directly from current function (e.g. func -> f -> g -> wait())
49// XXX currently reader_blocks supports only direct and 1-level indirect cases.
50@ reader_blocks_direct @
51identifier stream_reader.readstream;
52identifier wait_event =~ "^wait_event_.*";
53@@
54 readstream(...)
55 {
56 ... when exists
57 wait_event(...)
58 ... when exists
59 }
60
61@ reader_blocks_1 @
62identifier stream_reader.readstream;
63identifier blocks.block_f;
64@@
65 readstream(...)
66 {
67 ... when exists
68 block_f(...)
69 ... when exists
70 }
71
72@ reader_blocks depends on reader_blocks_direct || reader_blocks_1 @
73identifier stream_reader.readstream;
74@@
75 readstream(...) {
76 ...
77 }
78
79
80// file_operations + whether they have _any_ .read, .write, .llseek ... at all.
81//
82// XXX add support for file_operations xxx[N] = ... (sound/core/pcm_native.c)
83@ fops0 @
84identifier fops;
85@@
86 struct file_operations fops = {
87 ...
88 };
89
90@ has_read @
91identifier fops0.fops;
92identifier read_f;
93@@
94 struct file_operations fops = {
95 .read = read_f,
96 };
97
98@ has_read_iter @
99identifier fops0.fops;
100identifier read_iter_f;
101@@
102 struct file_operations fops = {
103 .read_iter = read_iter_f,
104 };
105
106@ has_write @
107identifier fops0.fops;
108identifier write_f;
109@@
110 struct file_operations fops = {
111 .write = write_f,
112 };
113
114@ has_write_iter @
115identifier fops0.fops;
116identifier write_iter_f;
117@@
118 struct file_operations fops = {
119 .write_iter = write_iter_f,
120 };
121
122@ has_llseek @
123identifier fops0.fops;
124identifier llseek_f;
125@@
126 struct file_operations fops = {
127 .llseek = llseek_f,
128 };
129
130@ has_no_llseek @
131identifier fops0.fops;
132@@
133 struct file_operations fops = {
134 .llseek = no_llseek,
135 };
136
137@ has_mmap @
138identifier fops0.fops;
139identifier mmap_f;
140@@
141 struct file_operations fops = {
142 .mmap = mmap_f,
143 };
144
145@ has_copy_file_range @
146identifier fops0.fops;
147identifier copy_file_range_f;
148@@
149 struct file_operations fops = {
150 .copy_file_range = copy_file_range_f,
151 };
152
153@ has_remap_file_range @
154identifier fops0.fops;
155identifier remap_file_range_f;
156@@
157 struct file_operations fops = {
158 .remap_file_range = remap_file_range_f,
159 };
160
161@ has_splice_read @
162identifier fops0.fops;
163identifier splice_read_f;
164@@
165 struct file_operations fops = {
166 .splice_read = splice_read_f,
167 };
168
169@ has_splice_write @
170identifier fops0.fops;
171identifier splice_write_f;
172@@
173 struct file_operations fops = {
174 .splice_write = splice_write_f,
175 };
176
177
178// file_operations that is candidate for stream_open conversion - it does not
179// use mmap and other methods that assume @offset access to file.
180//
181// XXX for simplicity require no .{read/write}_iter and no .splice_{read/write} for now.
182// XXX maybe_steam.fops cannot be used in other rules - it gives "bad rule maybe_stream or bad variable fops".
183@ maybe_stream depends on (!has_llseek || has_no_llseek) && !has_mmap && !has_copy_file_range && !has_remap_file_range && !has_read_iter && !has_write_iter && !has_splice_read && !has_splice_write @
184identifier fops0.fops;
185@@
186 struct file_operations fops = {
187 };
188
189
190// ---- conversions ----
191
192// XXX .open = nonseekable_open -> .open = stream_open
193// XXX .open = func -> openfunc -> nonseekable_open
194
195// read & write
196//
197// if both are used in the same file_operations together with an opener -
198// under that conditions we can use stream_open instead of nonseekable_open.
199@ fops_rw depends on maybe_stream @
200identifier fops0.fops, openfunc;
201identifier stream_reader.readstream;
202identifier stream_writer.writestream;
203@@
204 struct file_operations fops = {
205 .open = openfunc,
206 .read = readstream,
207 .write = writestream,
208 };
209
210@ report_rw depends on report @
211identifier fops_rw.openfunc;
212position p1;
213@@
214 openfunc(...) {
215 <...
216 nonseekable_open@p1
217 ...>
218 }
219
220@ script:python depends on report && reader_blocks @
221fops << fops0.fops;
222p << report_rw.p1;
223@@
224coccilib.report.print_report(p[0],
225 "ERROR: %s: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix." % (fops,))
226
227@ script:python depends on report && !reader_blocks @
228fops << fops0.fops;
229p << report_rw.p1;
230@@
231coccilib.report.print_report(p[0],
232 "WARNING: %s: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open." % (fops,))
233
234
235@ explain_rw_deadlocked depends on explain && reader_blocks @
236identifier fops_rw.openfunc;
237@@
238 openfunc(...) {
239 <...
240- nonseekable_open
241+ nonseekable_open /* read & write (was deadlock) */
242 ...>
243 }
244
245
246@ explain_rw_nodeadlock depends on explain && !reader_blocks @
247identifier fops_rw.openfunc;
248@@
249 openfunc(...) {
250 <...
251- nonseekable_open
252+ nonseekable_open /* read & write (no direct deadlock) */
253 ...>
254 }
255
256@ patch_rw depends on patch @
257identifier fops_rw.openfunc;
258@@
259 openfunc(...) {
260 <...
261- nonseekable_open
262+ stream_open
263 ...>
264 }
265
266
267// read, but not write
268@ fops_r depends on maybe_stream && !has_write @
269identifier fops0.fops, openfunc;
270identifier stream_reader.readstream;
271@@
272 struct file_operations fops = {
273 .open = openfunc,
274 .read = readstream,
275 };
276
277@ report_r depends on report @
278identifier fops_r.openfunc;
279position p1;
280@@
281 openfunc(...) {
282 <...
283 nonseekable_open@p1
284 ...>
285 }
286
287@ script:python depends on report @
288fops << fops0.fops;
289p << report_r.p1;
290@@
291coccilib.report.print_report(p[0],
292 "WARNING: %s: .read() has stream semantic; safe to change nonseekable_open -> stream_open." % (fops,))
293
294@ explain_r depends on explain @
295identifier fops_r.openfunc;
296@@
297 openfunc(...) {
298 <...
299- nonseekable_open
300+ nonseekable_open /* read only */
301 ...>
302 }
303
304@ patch_r depends on patch @
305identifier fops_r.openfunc;
306@@
307 openfunc(...) {
308 <...
309- nonseekable_open
310+ stream_open
311 ...>
312 }
313
314
315// write, but not read
316@ fops_w depends on maybe_stream && !has_read @
317identifier fops0.fops, openfunc;
318identifier stream_writer.writestream;
319@@
320 struct file_operations fops = {
321 .open = openfunc,
322 .write = writestream,
323 };
324
325@ report_w depends on report @
326identifier fops_w.openfunc;
327position p1;
328@@
329 openfunc(...) {
330 <...
331 nonseekable_open@p1
332 ...>
333 }
334
335@ script:python depends on report @
336fops << fops0.fops;
337p << report_w.p1;
338@@
339coccilib.report.print_report(p[0],
340 "WARNING: %s: .write() has stream semantic; safe to change nonseekable_open -> stream_open." % (fops,))
341
342@ explain_w depends on explain @
343identifier fops_w.openfunc;
344@@
345 openfunc(...) {
346 <...
347- nonseekable_open
348+ nonseekable_open /* write only */
349 ...>
350 }
351
352@ patch_w depends on patch @
353identifier fops_w.openfunc;
354@@
355 openfunc(...) {
356 <...
357- nonseekable_open
358+ stream_open
359 ...>
360 }
361
362
363// no read, no write - don't change anything
security/keys/trusted.c+25−7
@@ -125,7 +125,7 @@ out: · 124 unmodified lines
125 */125 */
126int TSS_authhmac(unsigned char *digest, const unsigned char *key,126int TSS_authhmac(unsigned char *digest, const unsigned char *key,
127 unsigned int keylen, unsigned char *h1,127 unsigned int keylen, unsigned char *h1,
128 unsigned char *h2, unsigned char h3, ...)128 unsigned char *h2, unsigned int h3, ...)
129{129{
130 unsigned char paramdigest[SHA1_DIGEST_SIZE];130 unsigned char paramdigest[SHA1_DIGEST_SIZE];
131 struct sdesc *sdesc;131 struct sdesc *sdesc;
@@ -135,13 +135,16 @@ int TSS_authhmac(unsigned char *digest, const unsigned char *key, · 3 unmodified lines
135 int ret;135 int ret;
136 va_list argp;136 va_list argp;
137 137
138 if (!chip)
139 return -ENODEV;
140
138 sdesc = init_sdesc(hashalg);141 sdesc = init_sdesc(hashalg);
139 if (IS_ERR(sdesc)) {142 if (IS_ERR(sdesc)) {
140 pr_info("trusted_key: can't alloc %s\n", hash_alg);143 pr_info("trusted_key: can't alloc %s\n", hash_alg);
141 return PTR_ERR(sdesc);144 return PTR_ERR(sdesc);
142 }145 }
143 146
144 c = h3;147 c = !!h3;
145 ret = crypto_shash_init(&sdesc->shash);148 ret = crypto_shash_init(&sdesc->shash);
146 if (ret < 0)149 if (ret < 0)
147 goto out;150 goto out;
@@ -196,6 +199,9 @@ int TSS_checkhmac1(unsigned char *buffer, · 48 unmodified lines
196 va_list argp;199 va_list argp;
197 int ret;200 int ret;
198 201
202 if (!chip)
203 return -ENODEV;
204
199 bufsize = LOAD32(buffer, TPM_SIZE_OFFSET);205 bufsize = LOAD32(buffer, TPM_SIZE_OFFSET);
200 tag = LOAD16(buffer, 0);206 tag = LOAD16(buffer, 0);
201 ordinal = command;207 ordinal = command;
@@ -363,6 +369,9 @@ int trusted_tpm_send(unsigned char *cmd, size_t buflen) · 161 unmodified lines
363{369{
364 int rc;370 int rc;
365 371
372 if (!chip)
373 return -ENODEV;
374
366 dump_tpm_buf(cmd);375 dump_tpm_buf(cmd);
367 rc = tpm_send(chip, cmd, buflen);376 rc = tpm_send(chip, cmd, buflen);
368 dump_tpm_buf(cmd);377 dump_tpm_buf(cmd);
@@ -429,6 +438,9 @@ int oiap(struct tpm_buf *tb, uint32_t *handle, unsigned char *nonce) · 60 unmodified lines
429{438{
430 int ret;439 int ret;
431 440
441 if (!chip)
442 return -ENODEV;
443
432 INIT_BUF(tb);444 INIT_BUF(tb);
433 store16(tb, TPM_TAG_RQU_COMMAND);445 store16(tb, TPM_TAG_RQU_COMMAND);
434 store32(tb, TPM_OIAP_SIZE);446 store32(tb, TPM_OIAP_SIZE);
@@ -1245,9 +1257,13 @@ static int __init init_trusted(void) · 810 unmodified lines
1245{1257{
1246 int ret;1258 int ret;
1247 1259
1260 /* encrypted_keys.ko depends on successful load of this module even if
1261 * TPM is not used.
1262 */
1248 chip = tpm_default_chip();1263 chip = tpm_default_chip();
1249 if (!chip)1264 if (!chip)
1250 return -ENOENT;1265 return 0;
1266
1251 ret = init_digests();1267 ret = init_digests();
1252 if (ret < 0)1268 if (ret < 0)
1253 goto err_put;1269 goto err_put;
@@ -1269,10 +1285,12 @@ err_put: · 15 unmodified lines
1269 1285
1270static void __exit cleanup_trusted(void)1286static void __exit cleanup_trusted(void)
1271{1287{
1272 put_device(&chip->dev);1288 if (chip) {
1273 kfree(digests);1289 put_device(&chip->dev);
1274 trusted_shash_release();1290 kfree(digests);
1275 unregister_key_type(&key_type_trusted);1291 trusted_shash_release();
1292 unregister_key_type(&key_type_trusted);
1293 }
1276}1294}
1277 1295
1278late_initcall(init_trusted);1296late_initcall(init_trusted);
tools/testing/selftests/tc-testing/tc-tests/filters/tests.json+20−0
@@ -18,6 +18,26 @@ · 17 unmodified lines
18 "$TC qdisc del dev $DEV1 ingress"18 "$TC qdisc del dev $DEV1 ingress"
19 ]19 ]
20 },20 },
21 {
22 "id": "2638",
23 "name": "Add matchall and try to get it",
24 "category": [
25 "filter",
26 "matchall"
27 ],
28 "setup": [
29 "$TC qdisc add dev $DEV1 clsact",
30 "$TC filter add dev $DEV1 protocol all pref 1 ingress handle 0x1234 matchall action ok"
31 ],
32 "cmdUnderTest": "$TC filter get dev $DEV1 protocol all pref 1 ingress handle 0x1234 matchall",
33 "expExitCode": "0",
34 "verifyCmd": "$TC filter show dev $DEV1 ingress",
35 "matchPattern": "filter protocol all pref 1 matchall chain 0 handle 0x1234",
36 "matchCount": "1",
37 "teardown": [
38 "$TC qdisc del dev $DEV1 clsact"
39 ]
40 },
21 {41 {
22 "id": "d052",42 "id": "d052",
23 "name": "Add 1M filters with the same action",43 "name": "Add 1M filters with the same action",
tools/testing/selftests/tpm2/tpm2.py+3−2
@@ -22,6 +22,7 @@ TPM2_CC_UNSEAL = 0x015E · 21 unmodified lines
22TPM2_CC_FLUSH_CONTEXT = 0x016522TPM2_CC_FLUSH_CONTEXT = 0x0165
23TPM2_CC_START_AUTH_SESSION = 0x017623TPM2_CC_START_AUTH_SESSION = 0x0176
24TPM2_CC_GET_CAPABILITY = 0x017A24TPM2_CC_GET_CAPABILITY = 0x017A
25TPM2_CC_GET_RANDOM = 0x017B
25TPM2_CC_PCR_READ = 0x017E26TPM2_CC_PCR_READ = 0x017E
26TPM2_CC_POLICY_PCR = 0x017F27TPM2_CC_POLICY_PCR = 0x017F
27TPM2_CC_PCR_EXTEND = 0x018228TPM2_CC_PCR_EXTEND = 0x0182
@@ -357,9 +358,9 @@ class Client: · 329 unmodified lines
357 self.flags = flags358 self.flags = flags
358 359
359 if (self.flags & Client.FLAG_SPACE) == 0:360 if (self.flags & Client.FLAG_SPACE) == 0:
360 self.tpm = open('/dev/tpm0', 'r+b')361 self.tpm = open('/dev/tpm0', 'r+b', buffering=0)
361 else:362 else:
362 self.tpm = open('/dev/tpmrm0', 'r+b')363 self.tpm = open('/dev/tpmrm0', 'r+b', buffering=0)
363 364
364 def close(self):365 def close(self):
365 self.tpm.close()366 self.tpm.close()
tools/testing/selftests/tpm2/tpm2_tests.py+63−0
@@ -158,6 +158,69 @@ class SmokeTest(unittest.TestCase): · 157 unmodified lines
158 pass158 pass
159 self.assertEqual(rejected, True)159 self.assertEqual(rejected, True)
160 160
161 def test_read_partial_resp(self):
162 try:
163 fmt = '>HIIH'
164 cmd = struct.pack(fmt,
165 tpm2.TPM2_ST_NO_SESSIONS,
166 struct.calcsize(fmt),
167 tpm2.TPM2_CC_GET_RANDOM,
168 0x20)
169 self.client.tpm.write(cmd)
170 hdr = self.client.tpm.read(10)
171 sz = struct.unpack('>I', hdr[2:6])[0]
172 rsp = self.client.tpm.read()
173 except:
174 pass
175 self.assertEqual(sz, 10 + 2 + 32)
176 self.assertEqual(len(rsp), 2 + 32)
177
178 def test_read_partial_overwrite(self):
179 try:
180 fmt = '>HIIH'
181 cmd = struct.pack(fmt,
182 tpm2.TPM2_ST_NO_SESSIONS,
183 struct.calcsize(fmt),
184 tpm2.TPM2_CC_GET_RANDOM,
185 0x20)
186 self.client.tpm.write(cmd)
187 # Read part of the respone
188 rsp1 = self.client.tpm.read(15)
189
190 # Send a new cmd
191 self.client.tpm.write(cmd)
192
193 # Read the whole respone
194 rsp2 = self.client.tpm.read()
195 except:
196 pass
197 self.assertEqual(len(rsp1), 15)
198 self.assertEqual(len(rsp2), 10 + 2 + 32)
199
200 def test_send_two_cmds(self):
201 rejected = False
202 try:
203 fmt = '>HIIH'
204 cmd = struct.pack(fmt,
205 tpm2.TPM2_ST_NO_SESSIONS,
206 struct.calcsize(fmt),
207 tpm2.TPM2_CC_GET_RANDOM,
208 0x20)
209 self.client.tpm.write(cmd)
210
211 # expect the second one to raise -EBUSY error
212 self.client.tpm.write(cmd)
213 rsp = self.client.tpm.read()
214
215 except IOError, e:
216 # read the response
217 rsp = self.client.tpm.read()
218 rejected = True
219 pass
220 except:
221 pass
222 self.assertEqual(rejected, True)
223
161class SpaceTest(unittest.TestCase):224class SpaceTest(unittest.TestCase):
162 def setUp(self):225 def setUp(self):
163 logging.basicConfig(filename='SpaceTest.log', level=logging.DEBUG)226 logging.basicConfig(filename='SpaceTest.log', level=logging.DEBUG)