Linux 4.9.138
Greg KH
maintainerI'm announcing the release of the 4.9.138 kernel.
All users of the 4.9 kernel series must upgrade.
The updated 4.9.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-4.9.y
and can be browsed at the normal kernel.org git web browser:
http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary
thanks,
greg k-h
------------
Makefile | 2 arch/alpha/include/asm/termios.h | 8 ++- arch/alpha/include/uapi/asm/ioctls.h | 5 + arch/alpha/include/uapi/asm/termbits.h | 17 ++++++ arch/arm/configs/imx_v6_v7_defconfig | 1 arch/arm/kvm/arm.c | 4 - arch/mips/include/asm/mach-loongson64/irq.h | 2 arch/mips/kernel/crash.c | 3 + arch/mips/kernel/machine_kexec.c | 3 + arch/mips/loongson64/loongson-3/irq.c | 56 ++------------------- arch/mips/pci/pci-legacy.c | 4 + arch/parisc/kernel/hpmc.S | 10 ++- arch/powerpc/boot/crt0.S | 4 + arch/powerpc/kernel/eeh.c | 5 + arch/powerpc/mm/tlb_nohash.c | 3 + arch/xtensa/boot/Makefile | 2 arch/xtensa/include/asm/processor.h | 6 +- arch/xtensa/kernel/head.S | 7 +- arch/xtensa/kernel/vmlinux.lds.S | 1 drivers/cdrom/cdrom.c | 2 drivers/clk/at91/clk-pll.c | 3 + drivers/clk/clk-s2mps11.c | 30 +++++++++++ drivers/clk/hisilicon/reset.c | 5 - drivers/clk/rockchip/clk-ddr.c | 4 - drivers/clocksource/i8253.c | 14 ++++- drivers/gpu/drm/drm_dp_mst_topology.c | 3 + drivers/gpu/drm/i915/intel_audio.c | 17 ++++++ drivers/gpu/drm/i915/intel_lrc.c | 14 ++++- drivers/gpu/drm/omapdrm/omap_dmm_tiler.c | 11 ++++ drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 6 ++ drivers/media/i2c/tvp5150.c | 14 +++-- drivers/media/pci/cx23885/altera-ci.c | 10 +++ drivers/mtd/devices/Kconfig | 2 drivers/net/ethernet/brocade/bna/bnad_ethtool.c | 4 - drivers/net/ethernet/intel/e1000/e1000_ethtool.c | 9 +-- drivers/net/ethernet/intel/e1000/e1000_main.c | 11 +++- drivers/of/of_numa.c | 9 ++- drivers/rtc/hctosys.c | 4 + drivers/scsi/qla2xxx/qla_init.c | 2 drivers/scsi/qla2xxx/qla_mbx.c | 5 - drivers/tty/serial/sc16is7xx.c | 19 ++++--- drivers/tty/tty_io.c | 2 drivers/tty/tty_ioctl.c | 4 - drivers/vhost/scsi.c | 4 + drivers/video/fbdev/aty/mach64_accel.c | 28 ++++------ fs/9p/vfs_file.c | 16 +++++- fs/btrfs/inode.c | 5 - fs/btrfs/ioctl.c | 12 +++- fs/ceph/inode.c | 8 ++- fs/configfs/symlink.c | 2 fs/ext4/namei.c | 5 + fs/ext4/resize.c | 28 ++++++---- fs/ext4/super.c | 17 +++--- fs/ext4/xattr.c | 4 + fs/fuse/dev.c | 29 ++++++++--- fs/fuse/file.c | 4 + fs/namespace.c | 22 ++++++-- fs/nfsd/nfs4proc.c | 3 + fs/ocfs2/dir.c | 3 - include/linux/ceph/libceph.h | 8 ++- include/linux/hugetlb.h | 14 +++++ include/linux/i8253.h | 1 include/linux/mm.h | 6 ++ lib/ubsan.c | 3 - mm/gup.c | 2 mm/hugetlb.c | 60 ++++++++++++++++++++--- mm/mempolicy.c | 32 +++++++++++- mm/mmap.c | 19 +++---- mm/rmap.c | 56 +++++++++++++++++++++ net/9p/protocol.c | 5 + net/netfilter/nf_conntrack_core.c | 13 +++- net/sunrpc/xdr.c | 5 - tools/testing/selftests/powerpc/tm/tm-tmspr.c | 27 ++++++---- 73 files changed, 579 insertions(+), 209 deletions(-)
Andrea Arcangeli (1):
mm: thp: relax __GFP_THISNODE for MADV_HUGEPAGE mappings
Arnd Bergmann (2):
mtd: docg3: don't set conflicting BCH_CONST_PARAMS option lib/ubsan.c: don't mark __ubsan_handle_builtin_unreachable as noreturn
Breno Leitao (1):
powerpc/selftests: Wait all threads to join
Changwei Ge (1):
ocfs2: fix a misuse a of brelse after failing ocfs2_check_dir_entry
Chris Wilson (1):
drm/i915/execlists: Force write serialisation into context image vs execution
Clint Taylor (1):
drm/i915/hdmi: Add HDMI 2.0 audio clock recovery N values
Colin Ian King (1):
e1000: avoid null pointer dereference on invalid stat type
Daniel Axtens (1):
powerpc/nohash: fix undefined behaviour when testing page size support
Dengcheng Zhu (1):
MIPS: kexec: Mark CPU offline before disabling local IRQ
Dominique Martinet (2):
9p locks: fix glock.client_id leak in do_lock 9p: clear dangling pointers in p9stat_free
Enric Balletbo i Serra (1):
clk: rockchip: Fix static checker warning in rockchip_ddrclk_get_parent call
Eric W. Biederman (3):
mount: Retest MNT_LOCKED in do_umount
mount: Don't allow copying MNT_UNBINDABLE|MNT_LOCKED mounts
mount: Prevent MNT_DETACH from disconnecting locked mounts
Fabio Estevam (1):
ARM: imx_v6_v7_defconfig: Select CONFIG_TMPFS_POSIX_ACL
Filipe Manana (1):
Btrfs: fix data corruption due to cloning of eof block
Frank Sorenson (1):
sunrpc: correct the computation for page_ptr when truncating
Greg Edwards (1):
vhost/scsi: truncate T10 PI iov_iter to prot_bytes
Greg Kroah-Hartman (1):
Linux 4.9.138
Guenter Roeck (1):
configfs: replace strncpy with memcpy
Gustavo A. R. Silva (1):
reset: hisilicon: fix potential NULL pointer dereference
H. Peter Anvin (1):
termios, tty/tty_baudrate.c: fix buffer overrun
H. Peter Anvin (Intel) (1):
arch/alpha, termios: implement BOTHER, IBSHIFT and termios2
Helge Deller (3):
parisc: Align os_hpmc_size on word boundary
parisc: Fix HPMC handler by increasing size to multiple of 16 bytes
parisc: Fix exported address of os_hpmc handler
Himanshu Madhani (1):
scsi: qla2xxx: Fix incorrect port speed being set for FC adapters
Huacai Chen (3):
MIPS/PCI: Call pcie_bus_configure_settings() to set MPS/MRRS
MIPS: Loongson-3: Fix CPU UART irq delivery problem
MIPS: Loongson-3: Fix BRIDGE irq delivery problem
Ilya Dryomov (1):
libceph: bump CEPH_MSG_MAX_DATA_LEN
Joel Stanley (1):
powerpc/boot: Ensure _zimage_start is a weak symbol
John Garry (1):
of, numa: Validate some distance map rules
Kees Cook (1):
bna: ethtool: Avoid reading past end of buffer
Kirill Tkhai (2):
fuse: Fix use-after-free in fuse_dev_do_read()
fuse: Fix use-after-free in fuse_dev_do_write()
Krzysztof Kozlowski (1):
clk: s2mps11: Fix matching when built as module and DT node contains compatible
Lukas Czerner (1):
fuse: fix use-after-free in fuse_direct_IO()
Maciej W. Rozycki (1):
rtc: hctosys: Add missing range error reporting
Marc Zyngier (1):
drm/rockchip: Allow driver to be shutdown on reboot/kexec
Marco Felsch (1):
media: tvp5150: fix width alignment during set_selection()
Mark Rutland (1):
KVM: arm64: Fix caching of host MDCR_EL2 value
Max Filippov (3):
xtensa: add NOTES section to the linker script
xtensa: make sure bFLT stack is 16 byte aligned
xtensa: fix boot parameters address translation
Michael Kelley (1):
clockevents/drivers/i8253: Add support for PIT shutdown quirk
Michal Hocko (1):
mm: do not bug_on on incorrect length in __mm_populate()
Mike Kravetz (2):
hugetlbfs: fix kernel BUG at fs/hugetlbfs/inode.c:444!
mm: migration: fix migration of huge PMD shared pages
Miklos Szeredi (3):
fuse: fix blocked_waitq wakeup
fuse: set FR_SENT while locked
fuse: fix leaked notify reply
Mikulas Patocka (2):
mach64: fix display corruption on big endian machines
mach64: fix image corruption due to reading accelerator registers
Miles Chen (1):
tty: check name length in tty_find_polling_driver()
Nicholas Mc Guire (1):
media: pci: cx23885: handle adding to list failure
Phil Elwell (1):
sc16is7xx: Fix for multi-channel stall
Quinn Tran (1):
scsi: qla2xxx: shutdown chip if reset fail
Robbie Ko (1):
Btrfs: fix cur_offset in the error case for nocow
Ronald Wahl (1):
clk: at91: Fix division by zero in PLL recalc_rate()
Sam Bobroff (1):
powerpc/eeh: Fix possible null deref in eeh_dump_dev_log()
Scott Mayhew (1):
nfsd: COPY and CLONE operations require the saved filehandle to be set
Stanislav Lisovskiy (1):
drm/dp_mst: Check if primary mstb is null
Theodore Ts'o (2):
ext4: avoid possible double brelse() in add_new_gdb() on error path
ext4: fix possible leak of sbi->s_group_desc_leak in error path
Tomi Valkeinen (1):
drm/omap: fix memory barrier bug in DMM driver
Vasily Averin (11):
ext4: add missing brelse() update_backups()'s error path
ext4: add missing brelse() in set_flexbg_block_bitmap()'s error path
ext4: add missing brelse() add_new_gdb_meta_bg()'s error path
ext4: avoid potential extra brelse in setup_new_flex_group_blocks()
ext4: fix possible inode leak in the retry loop of ext4_resize_fs()
ext4: avoid buffer leak in ext4_orphan_add() after prior errors
ext4: fix missing cleanup if ext4_alloc_flex_bg_array() fails while resizing
ext4: fix possible leak of s_journal_flag_rwsem in error path
ext4: release bs.bh before re-using in ext4_xattr_block_find()
ext4: fix buffer leak in ext4_xattr_move_to_block() on error path
ext4: fix buffer leak in __ext4_read_dirblock() on error path
Vasily Khoruzhick (1):
netfilter: conntrack: fix calculation of next bucket number in early_drop
Vincenzo Maffione (1):
e1000: fix race condition between e1000_down() and e1000_watchdog
Yan, Zheng (1):
Revert "ceph: fix dentry leak in splice_dentry()"
Young_X (1):
cdrom: fix improper type cast, which can leat to information leak.
Greg KH
maintainerMakefile +1 -1
@@ -1,6 +1,6 @@ VERSION = 4 PATCHLEVEL = 9 -SUBLEVEL = 137 +SUBLEVEL = 138 EXTRAVERSION = NAME = Roaring Lionus
arch/alpha/include/asm/termios.h +7 -1
@@ -72,9 +72,15 @@ })#define user_termios_to_kernel_termios (k, u) \ - copy_from_user(k, u, sizeof(struct termios)) + copy_from_user(k, u, sizeof(struct termios2))#define kernel_termios_to_user_termios (u, k) \ + copy_to_user(u, k, sizeof(struct termios2)) + +#define user_termios_to_kernel_termios_1 (k, u) \ + copy_from_user(k, u, sizeof(struct termios)) + +#define kernel_termios_to_user_termios_1 (u, k) \ copy_to_user(u, k, sizeof(struct termios))#endif /* _ALPHA_TERMIOS_H */
arch/alpha/include/uapi/asm/ioctls.h +5 -0
@@ -31,6 +31,11 @@#define TCXONC _IO('t', 30)#define TCFLSH _IO('t', 31) +#define TCGETS2 _IOR('T', 42, struct termios2) +#define TCSETS2 _IOW('T', 43, struct termios2) +#define TCSETSW2 _IOW('T', 44, struct termios2) +#define TCSETSF2 _IOW('T', 45, struct termios2) +#define TIOCSWINSZ _IOW('t', 103, struct winsize)#define TIOCGWINSZ _IOR('t', 104, struct winsize)#define TIOCSTART _IO('t', 110)/* start output, like ^Q */
arch/alpha/include/uapi/asm/termbits.h +17 -0
@@ -25,6 +25,19 @@ struct termios {speed_t c_ospeed;/* output speed */ }; +/* Alpha has identical termios and termios2 */ + +struct termios2 { +tcflag_t c_iflag;/* input mode flags */ +tcflag_t c_oflag;/* output mode flags */ +tcflag_t c_cflag;/* control mode flags */ +tcflag_t c_lflag;/* local mode flags */ +cc_t c_cc[NCCS ];/* control characters */ +cc_t c_line;/* line discipline (== c_cc[19]) */ +speed_t c_ispeed;/* input speed */ +speed_t c_ospeed;/* output speed */ +}; +/* Alpha has matching termios and ktermios */ struct ktermios {
@@ -147,6 +160,7 @@ struct ktermios {#define B3000000 00034#define B3500000 00035#define B4000000 00036 +#define BOTHER 00037#define CSIZE 00001400#define CS5 00000000
@@ -164,6 +178,9 @@ struct ktermios {#define CMSPAR 010000000000/* mark or space (stick) parity */ #define CRTSCTS 020000000000/* flow control */ +#define CIBAUD 07600000 +#define IBSHIFT 16 +/* c_lflag bits */ #define ISIG 0x00000080#define ICANON 0x00000100
arch/arm/configs/imx_v6_v7_defconfig +1 -0
@@ -361,6 +361,7 @@ CONFIG_ZISOFS=y CONFIG_UDF_FS=m CONFIG_MSDOS_FS=m CONFIG_VFAT_FS=y +CONFIG_TMPFS_POSIX_ACL=y CONFIG_JFFS2_FS=y CONFIG_UBIFS_FS=y CONFIG_NFS_FS=y
arch/arm/kvm/arm.c +2 -2
@@ -1092,8 +1092,6 @@ static void cpu_init_hyp_mode(void *dummy)__cpu_init_hyp_mode (pgd_ptr, hyp_stack_ptr, vector_ptr);__cpu_init_stage2 (); - -kvm_arm_init_debug (); }static void cpu_hyp_reinit (void )
@@ -1108,6 +1106,8 @@ static void cpu_hyp_reinit(void)if (__hyp_get_vectors () == hyp_default_vectors)cpu_init_hyp_mode (NULL ); } + +kvm_arm_init_debug (); }static void cpu_hyp_reset (void )
arch/mips/include/asm/mach-loongson64/irq.h +1 -1
@@ -9,7 +9,7 @@#define MIPS_CPU_IRQ_BASE 56#define LOONGSON_UART_IRQ (MIPS_CPU_IRQ_BASE + 2)/* UART */ -#define LOONGSON_HT1_IRQ (MIPS_CPU_IRQ_BASE + 3)/* HT1 */ +#define LOONGSON_BRIDGE_IRQ (MIPS_CPU_IRQ_BASE + 3)/* CASCADE */ #define LOONGSON_TIMER_IRQ (MIPS_CPU_IRQ_BASE + 7)/* CPU Timer */ #define LOONGSON_HT1_CFG_BASE loongson_sysconf.ht_control_base
arch/mips/kernel/crash.c +3 -0
@@ -34,6 +34,9 @@ static void crash_shutdown_secondary(void *passed_regs)if (!cpu_online (cpu))return ; +/* We won't be sent IPIs any more. */ +set_cpu_online (cpu, false); +local_irq_disable ();if (!cpumask_test_cpu (cpu, &cpus_in_crash))crash_save_cpu (regs, cpu);
arch/mips/kernel/machine_kexec.c +3 -0
@@ -96,6 +96,9 @@ machine_kexec(struct kimage *image) *ptr = (unsigned long )phys_to_virt (*ptr); } +/* Mark offline BEFORE disabling local irq. */ +set_cpu_online (smp_processor_id (), false); +/* * we do not want to be bothered. */
arch/mips/loongson64/loongson-3/irq.c +6 -50
69 lines not on this page · raw message
arch/mips/pci/pci-legacy.c +4 -0
@@ -116,8 +116,12 @@ static void pcibios_scanbus(struct pci_controller *hose)if (pci_has_flag (PCI_PROBE_ONLY )) {pci_bus_claim_resources (bus); }else { +struct pci_bus *child; +pci_bus_size_bridges (bus);pci_bus_assign_resources (bus); +list_for_each_entry (child, &bus->children, node) +pcie_bus_configure_settings (child); }pci_bus_add_devices (bus); }
arch/parisc/kernel/hpmc.S +7 -3
@@ -83,7 +83,8 @@ END(hpmc_pim_data) .text .import intr_save, code -ENTRY_CFI(os_hpmc) + .align 16 +ENTRY(os_hpmc) .os_hpmc: /*
@@ -299,11 +300,14 @@ os_hpmc_6: b . nop -ENDPROC_CFI(os_hpmc) + .align 16 /* make function length multiple of 16 bytes */ .os_hpmc_end: __INITRODATA - .export os_hpmc_size +.globl os_hpmc_size + .align 4 + .type os_hpmc_size, @object + .size os_hpmc_size, 4 os_hpmc_size: .word .os_hpmc_end-.os_hpmc
arch/powerpc/boot/crt0.S +3 -1
@@ -47,8 +47,10 @@ p_end: .long _end p_pstack: .long _platform_stack_top #endif - .weak _zimage_start .globl _zimage_start + /* Clang appears to require the .weak directive to be after the symbol + * is defined. See https://bugs.llvm.org/show_bug.cgi?id=38921 */ + .weak _zimage_start _zimage_start: .globl _zimage_start_lib _zimage_start_lib:
arch/powerpc/kernel/eeh.c +5 -0
@@ -169,6 +169,11 @@ static size_t eeh_dump_dev_log(struct eeh_dev *edev, char *buf, size_t len)int n =0 , l =0 ;char buffer[128 ]; +if (!pdn) { +pr_warn ("EEH: Note: No error log for absent device.\n" ); +return 0 ; + } + n +=scnprintf (buf+n, len-n,"%04x:%02x:%02x.%01x\n" , edev->phb->global_number, pdn->busno,PCI_SLOT (pdn->devfn),PCI_FUNC (pdn->devfn));
arch/powerpc/mm/tlb_nohash.c +3 -0
@@ -481,6 +481,9 @@ static void setup_page_sizes(void)for (psize =0 ; psize <MMU_PAGE_COUNT ; ++psize) {struct mmu_psize_def *def = &mmu_psize_defs[psize]; +if (!def->shift) +continue ; +if (tlb1ps & (1U << (def->shift -10 ))) { def->flags |=MMU_PAGE_SIZE_DIRECT ;
arch/xtensa/boot/Makefile +1 -1
@@ -31,7 +31,7 @@ $(bootdir-y): $(addprefix $(obj)/,$(subdir-y)) \ $(addprefix $(obj)/,$(host-progs)) $(Q)$(MAKE) $(build)=$(obj)/$@ $(MAKECMDGOALS) -OBJCOPYFLAGS = --strip-all -R .comment -R .note.gnu.build-id -O binary +OBJCOPYFLAGS = --strip-all -R .comment -R .notes -O binary vmlinux.bin: vmlinux FORCE $(call if_changed,objcopy)
arch/xtensa/include/asm/processor.h +5 -1
@@ -24,7 +24,11 @@# error Linux requires the Xtensa Windowed Registers Option.#endif -#define ARCH_SLAB_MINALIGN XCHAL_DATA_WIDTH +/* Xtensa ABI requires stack alignment to be at least 16 */ + +#define STACK_ALIGN (XCHAL_DATA_WIDTH > 16 ? XCHAL_DATA_WIDTH : 16) + +#define ARCH_SLAB_MINALIGN STACK_ALIGN/* * User space process size: 1 GB.
arch/xtensa/kernel/head.S +5 -2
@@ -88,9 +88,12 @@ _SetupMMU: initialize_mmu #if defined(CONFIG_MMU) && XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY rsr a2, excsave1 - movi a3, 0x08000000 + movi a3, XCHAL_KSEG_PADDR + bltu a2, a3, 1f + sub a2, a2, a3 + movi a3, XCHAL_KSEG_SIZE bgeu a2, a3, 1f - movi a3, 0xd0000000 + movi a3, XCHAL_KSEG_CACHED_VADDR add a2, a2, a3 wsr a2, excsave1 1:
arch/xtensa/kernel/vmlinux.lds.S +1 -0
@@ -109,6 +109,7 @@ SECTIONS .fixup : { *(.fixup) } EXCEPTION_TABLE(16) + NOTES /* Data section */ _sdata = .;
drivers/cdrom/cdrom.c +1 -1
@@ -2435,7 +2435,7 @@ static int cdrom_ioctl_select_disc(struct cdrom_device_info *cdi,return -ENOSYS ;if (arg !=CDSL_CURRENT && arg !=CDSL_NONE ) { -if ((int )arg >= cdi->capacity) +if (arg >= cdi->capacity)return -EINVAL ; }
drivers/clk/at91/clk-pll.c +3 -0
@@ -133,6 +133,9 @@ static unsigned long clk_pll_recalc_rate(struct clk_hw *hw, {struct clk_pll *pll =to_clk_pll (hw); +if (!pll->div || !pll->mul) +return 0 ; +return (parent_rate / pll->div) * (pll->mul +1 ); }
drivers/clk/clk-s2mps11.c +30 -0
@@ -245,6 +245,36 @@ static const struct platform_device_id s2mps11_clk_id[] = { };MODULE_DEVICE_TABLE (platform, s2mps11_clk_id); +#ifdef CONFIG_OF +/* +* Device is instantiated through parent MFD device and device matching is done +* through platform_device_id. +* +* However if device's DT node contains proper clock compatible and driver is +* built as a module, then the *module* matching will be done trough DT aliases. +* This requires of_device_id table. In the same time this will not change the +* actual *device* matching so do not add .of_match_table. +*/ +static const struct of_device_id s2mps11_dt_match[] = { + { + .compatible ="samsung,s2mps11-clk" , + .data = (void *)S2MPS11X , + }, { + .compatible ="samsung,s2mps13-clk" , + .data = (void *)S2MPS13X , + }, { + .compatible ="samsung,s2mps14-clk" , + .data = (void *)S2MPS14X , + }, { + .compatible ="samsung,s5m8767-clk" , + .data = (void *)S5M8767X , + }, { +/* Sentinel */ + }, +}; +MODULE_DEVICE_TABLE (of, s2mps11_dt_match); +#endif +static struct platform_driver s2mps11_clk_driver = { .driver = { .name ="s2mps11-clk" ,
drivers/clk/hisilicon/reset.c +2 -3
@@ -109,9 +109,8 @@ struct hisi_reset_controller *hisi_reset_init(struct platform_device *pdev)return NULL ; res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); - rstc->membase =devm_ioremap (&pdev->dev, - res->start,resource_size (res)); -if (!rstc->membase) + rstc->membase =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (rstc->membase))return NULL ;spin_lock_init (&rstc->lock);
drivers/clk/rockchip/clk-ddr.c +0 -4
@@ -80,16 +80,12 @@ static long rockchip_ddrclk_sip_round_rate(struct clk_hw *hw,static u8 rockchip_ddrclk_get_parent (struct clk_hw *hw) {struct rockchip_ddrclk *ddrclk =to_rockchip_ddrclk_hw (hw); -int num_parents =clk_hw_get_num_parents (hw);u32 val; val =clk_readl (ddrclk->reg_base + ddrclk->mux_offset) >> ddrclk->mux_shift; val &=GENMASK (ddrclk->mux_width -1 ,0 ); -if (val >= num_parents) -return -EINVAL ; -return val; }
drivers/clocksource/i8253.c +12 -2
@@ -19,6 +19,13 @@DEFINE_RAW_SPINLOCK (i8253_lock);EXPORT_SYMBOL (i8253_lock); +/* +* Handle PIT quirk in pit_shutdown() where zeroing the counter register +* restarts the PIT, negating the shutdown. On platforms with the quirk, +* platform specific code can set this to false. +*/ +bool i8253_clear_counter_on_shutdown__ro_after_init = true; +#ifdef CONFIG_CLKSRC_I8253 /* * Since the PIT overflows every tick, its not very useful
@@ -108,8 +115,11 @@ static int pit_shutdown(struct clock_event_device *evt)raw_spin_lock (&i8253_lock);outb_p (0x30 ,PIT_MODE ); -outb_p (0 ,PIT_CH0 ); -outb_p (0 ,PIT_CH0 ); + +if (i8253_clear_counter_on_shutdown) { +outb_p (0 ,PIT_CH0 ); +outb_p (0 ,PIT_CH0 ); + }raw_spin_unlock (&i8253_lock);return 0 ;
drivers/gpu/drm/drm_dp_mst_topology.c +3 -0
@@ -1230,6 +1230,9 @@ static struct drm_dp_mst_branch *drm_dp_get_mst_branch_device(struct drm_dp_mst_mutex_lock (&mgr->lock); mstb = mgr->mst_primary; +if (!mstb) + goto out; +for (i =0 ; i < lct -1 ; i++) {int shift = (i %2 ) ?0 :4 ;int port_num = (rad[i /2 ] >> shift) &0xf ;
drivers/gpu/drm/i915/intel_audio.c +17 -0
@@ -76,6 +76,9 @@ static const struct {/* HDMI N/CTS table */ #define TMDS_297M 297000#define TMDS_296M 296703 +#define TMDS_594M 594000 +#define TMDS_593M 593407 + static const struct { int sample_rate; int clock;
@@ -96,6 +99,20 @@ static const struct { { 176400, TMDS_297M, 18816, 247500 }, { 192000, TMDS_296M, 23296, 281250 }, { 192000, TMDS_297M, 20480, 247500 }, + { 44100, TMDS_593M, 8918, 937500 }, + { 44100, TMDS_594M, 9408, 990000 }, + { 48000, TMDS_593M, 5824, 562500 }, + { 48000, TMDS_594M, 6144, 594000 }, + { 32000, TMDS_593M, 5824, 843750 }, + { 32000, TMDS_594M, 3072, 445500 }, + { 88200, TMDS_593M, 17836, 937500 }, + { 88200, TMDS_594M, 18816, 990000 }, + { 96000, TMDS_593M, 11648, 562500 }, + { 96000, TMDS_594M, 12288, 594000 }, + { 176400, TMDS_593M, 35672, 937500 }, + { 176400, TMDS_594M, 37632, 990000 }, + { 192000, TMDS_593M, 23296, 562500 }, + { 192000, TMDS_594M, 24576, 594000 }, };/* get AUD_CONFIG_PIXEL_CLOCK_HDMI_* value for mode */
drivers/gpu/drm/i915/intel_lrc.c +13 -1
@@ -368,7 +368,8 @@ static u64 execlists_update_context(struct drm_i915_gem_request *rq) reg_state[CTX_RING_TAIL +1 ] =intel_ring_offset (rq->ring, rq->tail); -/* True 32b PPGTT with dynamic page allocation: update PDP +/* +* True 32b PPGTT with dynamic page allocation: update PDP * registers and point the unallocated PDPs to scratch page. * PML4 is allocated during ppgtt init, so this is not needed * in 48-bit mode.
@@ -376,6 +377,17 @@ static u64 execlists_update_context(struct drm_i915_gem_request *rq)if (ppgtt && !USES_FULL_48BIT_PPGTT (ppgtt->base.dev))execlists_update_context_pdps (ppgtt, reg_state); +/* +* Make sure the context image is complete before we submit it to HW. +* +* Ostensibly, writes (including the WCB) should be flushed prior to +* an uncached write such as our mmio register access, the empirical +* evidence (esp. on Braswell) suggests that the WC write into memory +* may not be visible to the HW prior to the completion of the UC +* register write and that we may begin execution from the context +* before its image is complete leading to invalid PD chasing. +*/ +wmb ();return ce->lrc_desc; }
drivers/gpu/drm/omapdrm/omap_dmm_tiler.c +11 -0
@@ -273,6 +273,17 @@ static int dmm_txn_commit(struct dmm_txn *txn, bool wait) } txn->last_pat->next_pa =0 ; +/* ensure that the written descriptors are visible to DMM */ +wmb (); + +/* +* NOTE: the wmb() above should be enough, but there seems to be a bug +* in OMAP's memory barrier implementation, which in some rare cases may +* cause the writes not to be observable after wmb(). +*/ + +/* read back to ensure the data is in RAM */ +readl (&txn->last_pat->next_pa);/* write to PAT_DESCR to clear out any pending transaction */ dmm_write (dmm,0x0 , reg[PAT_DESCR ][engine->id]);
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +6 -0
@@ -478,6 +478,11 @@ static int rockchip_drm_platform_remove(struct platform_device *pdev)return 0 ; } +static void rockchip_drm_platform_shutdown (struct platform_device *pdev) +{ +rockchip_drm_platform_remove (pdev); +} +static const struct of_device_id rockchip_drm_dt_ids[] = { { .compatible ="rockchip,display-subsystem" , }, {/* sentinel */ },
@@ -487,6 +492,7 @@ MODULE_DEVICE_TABLE(of, rockchip_drm_dt_ids);static struct platform_driver rockchip_drm_platform_driver = { .probe = rockchip_drm_platform_probe, .remove = rockchip_drm_platform_remove, + .shutdown = rockchip_drm_platform_shutdown, .driver = { .name ="rockchip-drm" , .of_match_table = rockchip_drm_dt_ids,
drivers/media/i2c/tvp5150.c +9 -5
@@ -897,9 +897,6 @@ static int tvp5150_set_selection(struct v4l2_subdev *sd,/* tvp5150 has some special limits */ rect.left =clamp (rect.left,0 ,TVP5150_MAX_CROP_LEFT ); - rect.width = clamp_t(unsigned int, rect.width, -TVP5150_H_MAX -TVP5150_MAX_CROP_LEFT - rect.left, -TVP5150_H_MAX - rect.left); rect.top =clamp (rect.top,0 ,TVP5150_MAX_CROP_TOP );/* Calculate height based on current standard */
@@ -913,9 +910,16 @@ static int tvp5150_set_selection(struct v4l2_subdev *sd,else hmax =TVP5150_V_MAX_OTHERS ; - rect.height = clamp_t(unsigned int, rect.height, +/* +* alignments: +* - width = 2 due to UYVY colorspace +* - height, image = no special alignment +*/ +v4l_bound_align_image (&rect.width, +TVP5150_H_MAX -TVP5150_MAX_CROP_LEFT - rect.left, +TVP5150_H_MAX - rect.left,1 , &rect.height, hmax -TVP5150_MAX_CROP_TOP - rect.top, - hmax - rect.top); + hmax - rect.top,0 ,0 );tvp5150_write (sd,TVP5150_VERT_BLANKING_START , rect.top); tvp5150_write(sd, TVP5150_VERT_BLANKING_STOP,
drivers/media/pci/cx23885/altera-ci.c +10 -0
@@ -660,6 +660,10 @@ static int altera_hw_filt_init(struct altera_ci_config *config, int hw_filt_nr) } temp_int =append_internal (inter); +if (!temp_int) { + ret = -ENOMEM ; + goto err; + } inter->filts_used =1 ; inter->dev = config->dev; inter->fpga_rw = config->fpga_rw;
@@ -694,6 +698,7 @@ static int altera_hw_filt_init(struct altera_ci_config *config, int hw_filt_nr) __func__, ret);kfree (pid_filt); +kfree (inter);return ret; }
@@ -728,6 +733,10 @@ int altera_ci_init(struct altera_ci_config *config, int ci_nr) } temp_int =append_internal (inter); +if (!temp_int) { + ret = -ENOMEM ; + goto err; + } inter->cis_used =1 ; inter->dev = config->dev; inter->fpga_rw = config->fpga_rw;
@@ -796,6 +805,7 @@ int altera_ci_init(struct altera_ci_config *config, int ci_nr)ci_dbg_print ("%s: Cannot initialize CI: Error %d.\n" , __func__, ret);kfree (state); +kfree (inter);return ret; }
drivers/mtd/devices/Kconfig +1 -1
@@ -196,7 +196,7 @@ comment "Disk-On-Chip Device Drivers" config MTD_DOCG3 tristate "M-Systems Disk-On-Chip G3" select BCH - select BCH_CONST_PARAMS + select BCH_CONST_PARAMS if !MTD_NAND_BCH select BITREVERSE ---help--- This provides an MTD device driver for the M-Systems DiskOnChip
drivers/net/ethernet/brocade/bna/bnad_ethtool.c +2 -2
@@ -541,8 +541,8 @@ bnad_get_strings(struct net_device *netdev, u32 stringset, u8 *string)for (i =0 ; i <BNAD_ETHTOOL_STATS_NUM ; i++) {BUG_ON (!(strlen (bnad_net_stats_strings[i]) <ETH_GSTRING_LEN )); -memcpy (string, bnad_net_stats_strings[i], -ETH_GSTRING_LEN ); +strncpy (string, bnad_net_stats_strings[i], +ETH_GSTRING_LEN ); string +=ETH_GSTRING_LEN ; } bmap =bna_tx_rid_mask (&bnad->bna);
drivers/net/ethernet/intel/e1000/e1000_ethtool.c +4 -5
@@ -1826,11 +1826,12 @@ static void e1000_get_ethtool_stats(struct net_device *netdev, {struct e1000_adapter *adapter =netdev_priv (netdev);int i; -char *p =NULL ;const struct e1000_stats *stat = e1000_gstrings_stats;e1000_update_stats (adapter); -for (i =0 ; i <E1000_GLOBAL_STATS_LEN ; i++) { +for (i =0 ; i <E1000_GLOBAL_STATS_LEN ; i++, stat++) { +char *p; +switch (stat->type) {case NETDEV_STATS : p = (char *)netdev + stat->stat_offset;
@@ -1841,15 +1842,13 @@ static void e1000_get_ethtool_stats(struct net_device *netdev,default :WARN_ONCE (1 ,"Invalid E1000 stat type: %u index %d\n" , stat->type, i); -break ; +continue ; }if (stat->sizeof_stat ==sizeof (u64)) data[i] = *(u64 *)p;else data[i] = *(u32 *)p; - - stat++; }/* BUG_ON(i != E1000_STATS_LEN); */ }
drivers/net/ethernet/intel/e1000/e1000_main.c +9 -2
@@ -521,8 +521,6 @@ void e1000_down(struct e1000_adapter *adapter)struct net_device *netdev = adapter->netdev;u32 rctl, tctl; -netif_carrier_off (netdev); -/* disable receives in the hardware */ rctl =er32 (RCTL );ew32 (RCTL , rctl & ~E1000_RCTL_EN );
@@ -538,6 +536,15 @@ void e1000_down(struct e1000_adapter *adapter)E1000_WRITE_FLUSH ();msleep (10 ); +/* Set the carrier off after transmits have been disabled in the +* hardware, to avoid race conditions with e1000_watchdog() (which +* may be running concurrently to us, checking for the carrier +* bit to decide whether it should enable transmits again). Such +* a race condition would result into transmission being disabled +* in the hardware until the next IFF_DOWN+IFF_UP cycle. +*/ +netif_carrier_off (netdev); +napi_disable (&adapter->napi);e1000_irq_disable (adapter);
drivers/of/of_numa.c +7 -2
@@ -126,9 +126,14 @@ static int __init of_numa_parse_distance_map_v1(struct device_node *map) distance =of_read_number (matrix,1 ); matrix++; +if ((nodea == nodeb && distance !=LOCAL_DISTANCE ) || + (nodea != nodeb && distance <=LOCAL_DISTANCE )) { +pr_err ("Invalid distance[node%d -> node%d] = %d\n" , + nodea, nodeb, distance); +return -EINVAL ; + } +numa_set_distance (nodea, nodeb, distance); -pr_debug ("distance[node%d -> node%d] = %d\n" , - nodea, nodeb, distance);/* Set default distance of node B->A same as A->B */ if (nodeb > nodea)
drivers/rtc/hctosys.c +3 -1
@@ -50,8 +50,10 @@ static int __init rtc_hctosys(void) tv64.tv_sec =rtc_tm_to_time64 (&tm);#if BITS_PER_LONG ==32 -if (tv64.tv_sec >INT_MAX ) +if (tv64.tv_sec >INT_MAX ) { + err = -ERANGE ; goto err_read; + }#endif err =do_settimeofday64 (&tv64);
drivers/scsi/qla2xxx/qla_init.c +1 -1
@@ -4894,7 +4894,7 @@ qla2x00_abort_isp(scsi_qla_host_t *vha)* The next call disables the board * completely. */ - ha->isp_ops->reset_adapter (vha); +qla2x00_abort_isp_cleanup (vha); vha->flags.online =0 ;clear_bit (ISP_ABORT_RETRY , &vha->dpc_flags);
drivers/scsi/qla2xxx/qla_mbx.c +1 -4
@@ -3580,10 +3580,7 @@ qla2x00_set_idma_speed(scsi_qla_host_t *vha, uint16_t loop_id, mcp->mb[0 ] =MBC_PORT_PARAMS ; mcp->mb[1 ] = loop_id; mcp->mb[2 ] =BIT_0 ; -if (IS_CNA_CAPABLE (vha->hw)) - mcp->mb[3 ] = port_speed & (BIT_5 |BIT_4 |BIT_3 |BIT_2 |BIT_1 |BIT_0 ); -else - mcp->mb[3 ] = port_speed & (BIT_2 |BIT_1 |BIT_0 ); + mcp->mb[3 ] = port_speed & (BIT_5 |BIT_4 |BIT_3 |BIT_2 |BIT_1 |BIT_0 ); mcp->mb[9 ] = vha->vp_idx; mcp->out_mb =MBX_9 |MBX_3 |MBX_2 |MBX_1 |MBX_0 ; mcp->in_mb =MBX_3 |MBX_1 |MBX_0 ;
drivers/tty/serial/sc16is7xx.c +13 -6
@@ -661,7 +661,7 @@ static void sc16is7xx_handle_tx(struct uart_port *port)uart_write_wakeup (port); } -static void sc16is7xx_port_irq (struct sc16is7xx_port *s,int portno) +static bool sc16is7xx_port_irq (struct sc16is7xx_port *s,int portno) {struct uart_port *port = &s->p[portno].port;
@@ -670,7 +670,7 @@ static void sc16is7xx_port_irq(struct sc16is7xx_port *s, int portno) iir =sc16is7xx_port_read (port,SC16IS7XX_IIR_REG );if (iir &SC16IS7XX_IIR_NO_INT_BIT ) -break ; +return false; iir &=SC16IS7XX_IIR_ID_MASK ;
@@ -692,16 +692,23 @@ static void sc16is7xx_port_irq(struct sc16is7xx_port *s, int portno) port->line, iir);break ; } - }while (1 ); + }while (0 ); +return true; }static void sc16is7xx_ist (struct kthread_work *ws) {struct sc16is7xx_port *s =to_sc16is7xx_port (ws, irq_work); -int i; -for (i =0 ; i < s->devtype->nr_uart; ++i) -sc16is7xx_port_irq (s, i); +while (1 ) { +bool keep_polling = false; +int i; + +for (i =0 ; i < s->devtype->nr_uart; ++i) + keep_polling |=sc16is7xx_port_irq (s, i); +if (!keep_polling) +break ; + } }static irqreturn_t sc16is7xx_irq (int irq,void *dev_id)
drivers/tty/tty_io.c +1 -1
@@ -354,7 +354,7 @@ struct tty_driver *tty_find_polling_driver(char *name, int *line)mutex_lock (&tty_mutex);/* Search through the tty devices to look for a match */ list_for_each_entry (p, &tty_drivers, tty_drivers) { -if (strncmp (name, p->name, len) !=0 ) +if (!len ||strncmp (name, p->name, len) !=0 )continue ; stp = str;if (*stp ==',' )
drivers/tty/tty_ioctl.c +2 -2
@@ -325,7 +325,7 @@ speed_t tty_termios_baud_rate(struct ktermios *termios)else cbaud +=15 ; } -return baud_table[cbaud]; +return cbaud >= n_baud_table ?0 : baud_table[cbaud]; }EXPORT_SYMBOL (tty_termios_baud_rate);
@@ -361,7 +361,7 @@ speed_t tty_termios_input_baud_rate(struct ktermios *termios) else cbaud += 15; } -return baud_table[cbaud]; +return cbaud >= n_baud_table ?0 : baud_table[cbaud];#else return tty_termios_baud_rate (termios);#endif
drivers/vhost/scsi.c +3 -1
@@ -999,7 +999,8 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq) prot_bytes =vhost32_to_cpu (vq, v_req_pi.pi_bytesin); }/* -* Set prot_iter to data_iter, and advance past any +* Set prot_iter to data_iter and truncate it to +* prot_bytes, and advance data_iter past any * preceeding prot_bytes that may be present. * * Also fix up the exp_data_len to reflect only the
@@ -1008,6 +1009,7 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq)if (prot_bytes) { exp_data_len -= prot_bytes; prot_iter = data_iter; +iov_iter_truncate (&prot_iter, prot_bytes);iov_iter_advance (&data_iter, prot_bytes); } tag =vhost64_to_cpu (vq, v_req_pi.tag);
drivers/video/fbdev/aty/mach64_accel.c +12 -16
@@ -126,7 +126,7 @@ void aty_init_engine(struct atyfb_par *par, struct fb_info *info)/* set host attributes */ wait_for_fifo (13 , par); -aty_st_le32 (HOST_CNTL ,0 , par); +aty_st_le32 (HOST_CNTL ,HOST_BYTE_ALIGN , par);/* set pattern attributes */ aty_st_le32 (PAT_REG0 ,0 , par);
@@ -232,7 +232,8 @@ void atyfb_copyarea(struct fb_info *info, const struct fb_copyarea *area) rotation =rotation24bpp (dx, direction); } -wait_for_fifo (4 , par); +wait_for_fifo (5 , par); +aty_st_le32 (DP_PIX_WIDTH , par->crtc.dp_pix_width, par);aty_st_le32 (DP_SRC ,FRGD_SRC_BLIT , par);aty_st_le32 (SRC_Y_X , (sx <<16 ) | sy, par);aty_st_le32 (SRC_HEIGHT1_WIDTH1 , (width <<16 ) | area->height, par);
@@ -268,7 +269,8 @@ void atyfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) rotation =rotation24bpp (dx,DST_X_LEFT_TO_RIGHT ); } -wait_for_fifo (3 , par); +wait_for_fifo (4 , par); +aty_st_le32 (DP_PIX_WIDTH , par->crtc.dp_pix_width, par);aty_st_le32 (DP_FRGD_CLR , color, par); aty_st_le32(DP_SRC, BKGD_SRC_BKGD_CLR | FRGD_SRC_FRGD_CLR | MONO_SRC_ONE,
@@ -283,7 +285,7 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image) {struct atyfb_par *par = (struct atyfb_par *) info->par;u32 src_bytes, dx = image->dx, dy = image->dy, width = image->width; -u32 pix_width_save, pix_width, host_cntl, rotation =0 , src, mix; +u32 pix_width, rotation =0 , src, mix;if (par->asleep)return ;
@@ -295,8 +297,7 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image)return ; } - pix_width = pix_width_save =aty_ld_le32 (DP_PIX_WIDTH , par); - host_cntl =aty_ld_le32 (HOST_CNTL , par) |HOST_BYTE_ALIGN ; + pix_width = par->crtc.dp_pix_width;switch (image->depth) {case 1 :
@@ -344,7 +345,7 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image)* since Rage 3D IIc we have DP_HOST_TRIPLE_EN bit * this hwaccelerated triple has an issue with not aligned data */ -if (M64_HAS (HW_TRIPLE ) && image->width %8 ==0 ) +if (image->depth ==1 &&M64_HAS (HW_TRIPLE ) && image->width %8 ==0 ) pix_width |=DP_HOST_TRIPLE_EN ; }
@@ -369,19 +370,18 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image) mix =FRGD_MIX_D_XOR_S |BKGD_MIX_D ; } -wait_for_fifo (6 , par); -aty_st_le32 (DP_WRITE_MASK ,0xFFFFFFFF , par); +wait_for_fifo (5 , par);aty_st_le32 (DP_PIX_WIDTH , pix_width, par);aty_st_le32 (DP_MIX , mix, par);aty_st_le32 (DP_SRC , src, par); -aty_st_le32 (HOST_CNTL , host_cntl, par); +aty_st_le32 (HOST_CNTL ,HOST_BYTE_ALIGN , par);aty_st_le32 (DST_CNTL ,DST_Y_TOP_TO_BOTTOM |DST_X_LEFT_TO_RIGHT | rotation, par);draw_rect (dx, dy, width, image->height, par); src_bytes = (((image->width * image->depth) +7 ) /8 ) * image->height;/* manual triple each pixel */ -if (info->var.bits_per_pixel ==24 && !(pix_width &DP_HOST_TRIPLE_EN )) { +if (image->depth ==1 && info->var.bits_per_pixel ==24 && !(pix_width &DP_HOST_TRIPLE_EN )) {int inbit, outbit, mult24, byte_id_in_dword, width;u8 *pbitmapin = (u8 *)image->data, *pbitmapout;u32 hostdword;
@@ -414,7 +414,7 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image) } }wait_for_fifo (1 , par); -aty_st_le32 (HOST_DATA0 , hostdword, par); +aty_st_le32 (HOST_DATA0 ,le32_to_cpu (hostdword), par); } }else {u32 *pbitmap, dwords = (src_bytes +3 ) /4 ;
@@ -423,8 +423,4 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image)aty_st_le32 (HOST_DATA0 ,get_unaligned_le32 (pbitmap), par); } } - -/* restore pix_width */ -wait_for_fifo (1 , par); -aty_st_le32 (DP_PIX_WIDTH , pix_width_save, par); }
fs/9p/vfs_file.c +14 -2
@@ -204,6 +204,14 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl)break ;if (schedule_timeout_interruptible (P9_LOCK_TIMEOUT ) !=0 )break ; +/* +* p9_client_lock_dotl overwrites flock.client_id with the +* server message, free and reuse the client name +*/ +if (flock.client_id != fid->clnt->name) { +kfree (flock.client_id); + flock.client_id = fid->clnt->name; + } }/* map 9p status to VFS status */
@@ -235,6 +243,8 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl)locks_lock_file_wait (filp, fl); fl->fl_type = fl_type; } +if (flock.client_id != fid->clnt->name) +kfree (flock.client_id); out:return res; }
@@ -269,7 +279,7 @@ static int v9fs_file_getlock(struct file *filp, struct file_lock *fl) res =p9_client_getlock_dotl (fid, &glock);if (res <0 ) -return res; + goto out;/* map 9p lock type to os lock type */ switch (glock.type) {case P9_LOCK_TYPE_RDLCK :
@@ -290,7 +300,9 @@ static int v9fs_file_getlock(struct file *filp, struct file_lock *fl) fl->fl_end = glock.start + glock.length -1 ; fl->fl_pid = glock.proc_id; } -kfree (glock.client_id); +out: +if (glock.client_id != fid->clnt->name) +kfree (glock.client_id);return res; }
fs/btrfs/inode.c +2 -3
@@ -1548,12 +1548,11 @@ static noinline int run_delalloc_nocow(struct inode *inode, }btrfs_release_path (path); -if (cur_offset <= end && cow_start == (u64)-1 ) { +if (cur_offset <= end && cow_start == (u64)-1 ) cow_start = cur_offset; - cur_offset = end; - }if (cow_start != (u64)-1 ) { + cur_offset = end; ret =cow_file_range (inode, locked_page, cow_start, end, end, page_started, nr_written,1 ,NULL );if (ret)
fs/btrfs/ioctl.c +10 -2
@@ -3911,9 +3911,17 @@ static noinline int btrfs_clone_files(struct file *file, struct file *file_src, goto out_unlock;if (len ==0 ) olen = len = src->i_size - off; -/* if we extend to eof, continue to block boundary */ -if (off + len == src->i_size) +/* +* If we extend to eof, continue to block boundary if and only if the +* destination end offset matches the destination file's size, otherwise +* we would be corrupting data by placing the eof block into the middle +* of a file. +*/ +if (off + len == src->i_size) { +if (!IS_ALIGNED (len, bs) && destoff + len < inode->i_size) + goto out_unlock; len =ALIGN (src->i_size, bs) - off; + }if (len ==0 ) { ret =0 ;
fs/ceph/inode.c +6 -2
@@ -1077,8 +1077,12 @@ static struct dentry *splice_dentry(struct dentry *dn, struct inode *in)if (IS_ERR (realdn)) {pr_err ("splice_dentry error %ld %p inode %p ino %llx.%llx\n" ,PTR_ERR (realdn), dn, in,ceph_vinop (in)); -dput (dn); - dn = realdn;/* note realdn contains the error */ + dn = realdn; +/* +* Caller should release 'dn' in the case of error. +* If 'req->r_dentry' is passed to this function, +* caller should leave 'req->r_dentry' untouched. +*/ goto out; }else if (realdn) { dout("dn %p (%d) spliced with %p (%d) "
fs/configfs/symlink.c +1 -1
@@ -64,7 +64,7 @@ static void fill_item_path(struct config_item * item, char * buffer, int length)/* back up enough to print this bus id with '/' */ length -= cur; -strncpy (buffer + length,config_item_name (p),cur); +memcpy (buffer + length,config_item_name (p), cur); *(buffer + --length) ='/' ; } }
fs/ext4/namei.c +4 -1
@@ -124,6 +124,7 @@ static struct buffer_head *__ext4_read_dirblock(struct inode *inode,if (!is_dx_block && type ==INDEX ) {ext4_error_inode (inode, func, line, block,"directory leaf block found instead of index block" ); +brelse (bh);return ERR_PTR (-EFSCORRUPTED ); } if (!ext4_has_metadata_csum(inode->i_sb) ||
@@ -2842,7 +2843,9 @@ int ext4_orphan_add(handle_t *handle, struct inode *inode)list_del_init (&EXT4_I (inode)->i_orphan);mutex_unlock (&sbi->s_orphan_lock); } - } + }else +brelse (iloc.bh); +jbd_debug (4 ,"superblock will point to %lu\n" , inode->i_ino);jbd_debug (4 ,"orphan inode %lu will point to %d\n" , inode->i_ino,NEXT_ORPHAN (inode));
fs/ext4/resize.c +16 -12
@@ -442,16 +442,18 @@ static int set_flexbg_block_bitmap(struct super_block *sb, handle_t *handle,BUFFER_TRACE (bh,"get_write_access" ); err =ext4_journal_get_write_access (handle, bh); -if (err) +if (err) { +brelse (bh);return err; + }ext4_debug ("mark block bitmap %#04llx (+%llu/%u)\n" , block, block - start, count2);ext4_set_bits (bh->b_data, block - start, count2); err =ext4_handle_dirty_metadata (handle,NULL , bh); +brelse (bh);if (unlikely (err))return err; -brelse (bh); }return 0 ;
@@ -588,7 +590,6 @@ static int setup_new_flex_group_blocks(struct super_block *sb, bh =bclean (handle, sb, block);if (IS_ERR (bh)) { err =PTR_ERR (bh); - bh =NULL ; goto out; } overhead =ext4_group_overhead_blocks (sb, group);
@@ -600,9 +601,9 @@ static int setup_new_flex_group_blocks(struct super_block *sb,ext4_mark_bitmap_end (group_data[i].blocks_count, sb->s_blocksize *8 , bh->b_data); err =ext4_handle_dirty_metadata (handle,NULL , bh); +brelse (bh);if (err) goto out; -brelse (bh); handle_ib:if (bg_flags[i] &EXT4_BG_INODE_UNINIT )
@@ -617,18 +618,16 @@ static int setup_new_flex_group_blocks(struct super_block *sb, bh =bclean (handle, sb, block);if (IS_ERR (bh)) { err =PTR_ERR (bh); - bh =NULL ; goto out; }ext4_mark_bitmap_end (EXT4_INODES_PER_GROUP (sb), sb->s_blocksize *8 , bh->b_data); err =ext4_handle_dirty_metadata (handle,NULL , bh); +brelse (bh);if (err) goto out; -brelse (bh); } - bh =NULL ;/* Mark group tables in block bitmap */ for (j =0 ; j <GROUP_TABLE_COUNT ; j++) {
@@ -659,7 +658,6 @@ static int setup_new_flex_group_blocks(struct super_block *sb, } out: -brelse (bh); err2 =ext4_journal_stop (handle);if (err2 && !err) err = err2;
@@ -846,6 +844,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode, err =ext4_handle_dirty_metadata (handle,NULL , gdb_bh);if (unlikely (err)) {ext4_std_error (sb, err); + iloc.bh =NULL ; goto exit_inode; }brelse (dind);
@@ -897,6 +896,7 @@ static int add_new_gdb_meta_bg(struct super_block *sb,sizeof (struct buffer_head *), GFP_NOFS);if (!n_group_desc) { +brelse (gdb_bh); err = -ENOMEM ;ext4_warning (sb,"not enough memory for %lu groups" , gdb_num +1 );
@@ -912,8 +912,6 @@ static int add_new_gdb_meta_bg(struct super_block *sb,kvfree (o_group_desc);BUFFER_TRACE (gdb_bh,"get_write_access" ); err =ext4_journal_get_write_access (handle, gdb_bh); -if (unlikely (err)) -brelse (gdb_bh);return err; }
@@ -1095,8 +1093,10 @@ static void update_backups(struct super_block *sb, sector_t blk_off, char *data, backup_block, backup_block - ext4_group_first_block_no(sb, group));BUFFER_TRACE (bh,"get_write_access" ); -if ((err =ext4_journal_get_write_access (handle, bh))) +if ((err =ext4_journal_get_write_access (handle, bh))) { +brelse (bh);break ; + }lock_buffer (bh);memcpy (bh->b_data, data, size);if (rest)
@@ -1991,7 +1991,7 @@ int ext4_resize_fs(struct super_block *sb, ext4_fsblk_t n_blocks_count) err =ext4_alloc_flex_bg_array (sb, n_group +1 );if (err) -return err; + goto out; err =ext4_mb_alloc_groupinfo (sb, n_group +1 );if (err)
@@ -2027,6 +2027,10 @@ int ext4_resize_fs(struct super_block *sb, ext4_fsblk_t n_blocks_count) n_blocks_count_retry =0 ;free_flex_gd (flex_gd); flex_gd =NULL ; +if (resize_inode) { +iput (resize_inode); + resize_inode =NULL ; + } goto retry; }
fs/ext4/super.c +9 -8
@@ -3897,6 +3897,14 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) sbi->s_groups_count = blocks_count; sbi->s_blockfile_groups =min_t (ext4_group_t, sbi->s_groups_count, (EXT4_MAX_BLOCK_FILE_PHYS /EXT4_BLOCKS_PER_GROUP (sb))); +if (((u64 )sbi->s_groups_count * sbi->s_inodes_per_group) != +le32_to_cpu (es->s_inodes_count)) { +ext4_msg (sb,KERN_ERR ,"inodes count not valid: %u vs %llu" , +le32_to_cpu (es->s_inodes_count), + ((u64 )sbi->s_groups_count * sbi->s_inodes_per_group)); + ret = -EINVAL ; + goto failed_mount; + } db_count = (sbi->s_groups_count +EXT4_DESC_PER_BLOCK (sb) -1 ) /EXT4_DESC_PER_BLOCK (sb);if (ext4_has_feature_meta_bg (sb)) {
@@ -3916,14 +3924,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) ret = -ENOMEM ; goto failed_mount; } -if (((u64 )sbi->s_groups_count * sbi->s_inodes_per_group) != -le32_to_cpu (es->s_inodes_count)) { -ext4_msg (sb,KERN_ERR ,"inodes count not valid: %u vs %llu" , -le32_to_cpu (es->s_inodes_count), - ((u64 )sbi->s_groups_count * sbi->s_inodes_per_group)); - ret = -EINVAL ; - goto failed_mount; - }bgl_lock_init (sbi->s_blockgroup_lock);
@@ -4305,6 +4305,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)percpu_counter_destroy (&sbi->s_freeinodes_counter);percpu_counter_destroy (&sbi->s_dirs_counter);percpu_counter_destroy (&sbi->s_dirtyclusters_counter); +percpu_free_rwsem (&sbi->s_journal_flag_rwsem); failed_mount5:ext4_ext_release (sb);ext4_release_system_zone (sb);
fs/ext4/xattr.c +4 -0
@@ -1221,6 +1221,8 @@ ext4_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index, error =ext4_xattr_block_set (handle, inode, &i, &bs); }else if (error == -ENOSPC ) {if (EXT4_I (inode)->i_file_acl && !bs.s.base) { +brelse (bs.bh); + bs.bh =NULL ; error =ext4_xattr_block_find (inode, &i, &bs);if (error) goto cleanup;
@@ -1391,6 +1393,8 @@ static int ext4_xattr_move_to_block(handle_t *handle, struct inode *inode,kfree (buffer);if (is)brelse (is->iloc.bh); +if (bs) +brelse (bs->bh);kfree (is);kfree (bs);
fs/fuse/dev.c +22 -7
@@ -383,12 +383,19 @@ static void request_end(struct fuse_conn *fc, struct fuse_req *req)if (test_bit (FR_BACKGROUND , &req->flags)) {spin_lock (&fc->lock);clear_bit (FR_BACKGROUND , &req->flags); -if (fc->num_background == fc->max_background) +if (fc->num_background == fc->max_background) { fc->blocked =0 ; - -/* Wake up next waiter, if any */ -if (!fc->blocked &&waitqueue_active (&fc->blocked_waitq))wake_up (&fc->blocked_waitq); + }else if (!fc->blocked) { +/* +* Wake up next waiter, if any. It's okay to use +* waitqueue_active(), as we've already synced up +* fc->blocked with waiters with the wake_up() call +* above. +*/ +if (waitqueue_active (&fc->blocked_waitq)) +wake_up (&fc->blocked_waitq); + }if (fc->num_background == fc->congestion_threshold && fc->connected && fc->bdi_initialized) {
@@ -1303,12 +1310,14 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file, goto out_end; }list_move_tail (&req->list, &fpq->processing); -spin_unlock (&fpq->lock); +__fuse_get_request (req);set_bit (FR_SENT , &req->flags); +spin_unlock (&fpq->lock);/* matches barrier in request_wait_answer() */ smp_mb__after_atomic ();if (test_bit (FR_INTERRUPTED , &req->flags))queue_interrupt (fiq, req); +fuse_put_request (fc, req);return reqsize;
@@ -1706,8 +1715,10 @@ static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode, req->in.args[1 ].size = total_len; err =fuse_request_send_notify_reply (fc, req, outarg->notify_unique); -if (err) +if (err) {fuse_retrieve_end (fc, req); +fuse_put_request (fc, req); + }return err; }
@@ -1866,16 +1877,20 @@ static ssize_t fuse_dev_do_write(struct fuse_dev *fud,/* Is it an interrupt reply? */ if (req->intr_unique == oh.unique) { +__fuse_get_request (req);spin_unlock (&fpq->lock); err = -EINVAL ; -if (nbytes !=sizeof (struct fuse_out_header )) +if (nbytes !=sizeof (struct fuse_out_header )) { +fuse_put_request (fc, req); goto err_finish; + }if (oh.error == -ENOSYS ) fc->no_interrupt =1 ;else if (oh.error == -EAGAIN )queue_interrupt (&fc->iq, req); +fuse_put_request (fc, req);fuse_copy_finish (cs);return nbytes;
fs/fuse/file.c +3 -1
@@ -2900,10 +2900,12 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter) }if (io->async) { +bool blocking = io->blocking; +fuse_aio_complete (io, ret <0 ? ret :0 ,-1 );/* we have a non-extending, async request, so return */ -if (!io->blocking) +if (!blocking)return -EIOCBQUEUED ;wait_for_completion (&wait);
fs/namespace.c +17 -5
@@ -1599,8 +1599,13 @@ static int do_umount(struct mount *mnt, int flags)namespace_lock ();lock_mount_hash (); - event++; +/* Recheck MNT_LOCKED with the locks held */ + retval = -EINVAL ; +if (mnt->mnt.mnt_flags &MNT_LOCKED ) + goto out; + + event++;if (flags &MNT_DETACH ) {if (!list_empty (&mnt->mnt_list))umount_tree (mnt,UMOUNT_PROPAGATE );
@@ -1614,6 +1619,7 @@ static int do_umount(struct mount *mnt, int flags) retval =0 ; } } +out:unlock_mount_hash ();namespace_unlock ();return retval;
@@ -1704,7 +1710,7 @@ SYSCALL_DEFINE2(umount, char __user *, name, int, flags) goto dput_and_out;if (!check_mnt (mnt)) goto dput_and_out; -if (mnt->mnt.mnt_flags &MNT_LOCKED ) +if (mnt->mnt.mnt_flags &MNT_LOCKED )/* Check optimistically */ goto dput_and_out; retval = -EPERM ;if (flags &MNT_FORCE && !capable (CAP_SYS_ADMIN ))
@@ -1782,8 +1788,14 @@ struct mount *copy_tree(struct mount *mnt, struct dentry *dentry,for (s = r; s; s =next_mnt (s, r)) {if (!(flag &CL_COPY_UNBINDABLE ) &&IS_MNT_UNBINDABLE (s)) { - s =skip_mnt_tree (s); -continue ; +if (s->mnt.mnt_flags &MNT_LOCKED ) { +/* Both unbindable and locked. */ + q =ERR_PTR (-EPERM ); + goto out; + }else { + s =skip_mnt_tree (s); +continue ; + } }if (!(flag &CL_COPY_MNT_NS_FILE ) &&is_mnt_ns_file (s->mnt.mnt_root)) {
@@ -1836,7 +1848,7 @@ void drop_collected_mounts(struct vfsmount *mnt) {namespace_lock ();lock_mount_hash (); -umount_tree (real_mount (mnt),UMOUNT_SYNC ); +umount_tree (real_mount (mnt),0 );unlock_mount_hash ();namespace_unlock (); }
fs/nfsd/nfs4proc.c +3 -0
@@ -1016,6 +1016,9 @@ nfsd4_verify_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, {__be32 status; +if (!cstate->save_fh.fh_dentry) +return nfserr_nofilehandle; + status =nfs4_preprocess_stateid_op (rqstp, cstate, &cstate->save_fh, src_stateid,RD_STATE , src,NULL );if (status) {
fs/ocfs2/dir.c +1 -2
@@ -1896,8 +1896,7 @@ static int ocfs2_dir_foreach_blk_el(struct inode *inode,/* On error, skip the f_pos to the next block. */ ctx->pos = (ctx->pos | (sb->s_blocksize -1 )) +1 ; -brelse (bh); -continue ; +break ; }if (le64_to_cpu (de->inode)) {unsigned char d_type =DT_UNKNOWN ;
include/linux/ceph/libceph.h +7 -1
@@ -77,7 +77,13 @@ struct ceph_options {#define CEPH_MSG_MAX_FRONT_LEN (16*1024*1024)#define CEPH_MSG_MAX_MIDDLE_LEN (16*1024*1024) -#define CEPH_MSG_MAX_DATA_LEN (16*1024*1024) + +/* +* Handle the largest possible rbd object in one message. +* There is no limit on the size of cephfs objects, but it has to obey +* rsize and wsize mount options anyway. +*/ +#define CEPH_MSG_MAX_DATA_LEN (32*1024*1024)#define CEPH_AUTH_NAME_DEFAULT "guest"
include/linux/hugetlb.h +14 -0
@@ -109,6 +109,8 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr, unsigned long sz);pte_t *huge_pte_offset (struct mm_struct *mm,unsigned long addr);int huge_pmd_unshare (struct mm_struct *mm,unsigned long *addr,pte_t *ptep); +void adjust_range_if_pmd_sharing_possible (struct vm_area_struct *vma, +unsigned long *start,unsigned long *end);struct page *follow_huge_addr (struct mm_struct *mm,unsigned long address,int write); struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address,
@@ -131,6 +133,18 @@ static inline unsigned long hugetlb_total_pages(void)return 0 ; } +static inline int huge_pmd_unshare (struct mm_struct *mm,unsigned long *addr, +pte_t *ptep) +{ +return 0 ; +} + +static inline void adjust_range_if_pmd_sharing_possible ( +struct vm_area_struct *vma, +unsigned long *start,unsigned long *end) +{ +} +#define follow_hugetlb_page (m,v,p,vs,a,b,i,w) ({ BUG(); 0; })#define follow_huge_addr (mm, addr, write) ERR_PTR(-EINVAL)#define copy_hugetlb_page_range (src, dst, vma) ({ BUG(); 0; })
include/linux/i8253.h +1 -0
@@ -21,6 +21,7 @@#define PIT_LATCH ((PIT_TICK_RATE + HZ/2) / HZ)extern raw_spinlock_t i8253_lock; +extern bool i8253_clear_counter_on_shutdown;extern struct clock_event_device i8253_clockevent;extern void clockevent_i8253_init (bool oneshot);
include/linux/mm.h +6 -0
@@ -2187,6 +2187,12 @@ static inline struct vm_area_struct *find_exact_vma(struct mm_struct *mm,return vma; } +static inline bool range_in_vma (struct vm_area_struct *vma, +unsigned long start,unsigned long end) +{ +return (vma && vma->vm_start <= start && end <= vma->vm_end); +} +#ifdef CONFIG_MMU pgprot_t vm_get_page_prot (unsigned long vm_flags);void vma_set_page_prot (struct vm_area_struct *vma);
lib/ubsan.c +1 -2
@@ -451,8 +451,7 @@ void __ubsan_handle_shift_out_of_bounds(struct shift_out_of_bounds_data *data,EXPORT_SYMBOL (__ubsan_handle_shift_out_of_bounds); -void __noreturn -__ubsan_handle_builtin_unreachable (struct unreachable_data *data) +void __ubsan_handle_builtin_unreachable (struct unreachable_data *data) {unsigned long flags;
mm/gup.c +0 -2
@@ -1122,8 +1122,6 @@ int __mm_populate(unsigned long start, unsigned long len, int ignore_errors)int locked =0 ;long ret =0 ; -VM_BUG_ON (start & ~PAGE_MASK ); -VM_BUG_ON (len !=PAGE_ALIGN (len)); end = start + len;for (nstart = start; nstart < end; nstart = nend) {
mm/hugetlb.c +54 -6
94 lines not on this page · raw message
mm/mempolicy.c +30 -2
@@ -2027,8 +2027,36 @@ alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma, nmask =policy_nodemask (gfp, pol);if (!nmask ||node_isset (hpage_node, *nmask)) {mpol_cond_put (pol); - page =__alloc_pages_node (hpage_node, - gfp | __GFP_THISNODE, order); +/* +* We cannot invoke reclaim if __GFP_THISNODE +* is set. Invoking reclaim with +* __GFP_THISNODE set, would cause THP +* allocations to trigger heavy swapping +* despite there may be tons of free memory +* (including potentially plenty of THP +* already available in the buddy) on all the +* other NUMA nodes. +* +* At most we could invoke compaction when +* __GFP_THISNODE is set (but we would need to +* refrain from invoking reclaim even if +* compaction returned COMPACT_SKIPPED because +* there wasn't not enough memory to succeed +* compaction). For now just avoid +* __GFP_THISNODE instead of limiting the +* allocation path to a strict and single +* compaction invocation. +* +* Supposedly if direct reclaim was enabled by +* the caller, the app prefers THP regardless +* of the node it comes from so this would be +* more desiderable behavior than only +* providing THP originated from the local +* node in such case. +*/ +if (!(gfp & __GFP_DIRECT_RECLAIM)) + gfp |= __GFP_THISNODE; + page =__alloc_pages_node (hpage_node, gfp, order); goto out; } }
mm/mmap.c +10 -9
@@ -2876,21 +2876,15 @@ static inline void verify_mm_writelocked(struct mm_struct *mm)* anonymous maps. eventually we may be able to do some * brk-specific accounting here. */ -static int do_brk (unsigned long addr,unsigned long request) +static int do_brk (unsigned long addr,unsigned long len) {struct mm_struct *mm = current->mm;struct vm_area_struct *vma, *prev; -unsigned long flags, len; +unsigned long flags;struct rb_node **rb_link, *rb_parent;pgoff_t pgoff = addr >>PAGE_SHIFT ;int error; - len =PAGE_ALIGN (request); -if (len < request) -return -ENOMEM ; -if (!len) -return 0 ; - flags =VM_DATA_DEFAULT_FLAGS |VM_ACCOUNT | mm->def_flags; error =get_unmapped_area (NULL , addr, len,0 ,MAP_FIXED );
@@ -2959,12 +2953,19 @@ static int do_brk(unsigned long addr, unsigned long request)return 0 ; } -int vm_brk (unsigned long addr,unsigned long len) +int vm_brk (unsigned long addr,unsigned long request) {struct mm_struct *mm = current->mm; +unsigned long len;int ret;bool populate; + len =PAGE_ALIGN (request); +if (len < request) +return -ENOMEM ; +if (!len) +return 0 ; +if (down_write_killable (&mm->mmap_sem))return -EINTR ;
mm/rmap.c +56 -0
80 lines not on this page · raw message
net/9p/protocol.c +5 -0
@@ -46,10 +46,15 @@ p9pdu_writef(struct p9_fcall *pdu, int proto_version, const char *fmt, ...);void p9stat_free (struct p9_wstat *stbuf) {kfree (stbuf->name); + stbuf->name =NULL ;kfree (stbuf->uid); + stbuf->uid =NULL ;kfree (stbuf->gid); + stbuf->gid =NULL ;kfree (stbuf->muid); + stbuf->muid =NULL ;kfree (stbuf->extension); + stbuf->extension =NULL ; }EXPORT_SYMBOL (p9stat_free);
net/netfilter/nf_conntrack_core.c +8 -5
@@ -918,19 +918,22 @@ static unsigned int early_drop_list(struct net *net,return drops; } -static noinline int early_drop(struct net *net, unsigned int _hash) +static noinline int early_drop(struct net *net, unsigned int hash) { -unsigned int i; +unsigned int i, bucket;for (i =0 ; i <NF_CT_EVICTION_RANGE ; i++) {struct hlist_nulls_head *ct_hash; -unsigned int hash, hsize, drops; +unsigned int hsize, drops;rcu_read_lock ();nf_conntrack_get_ht (&ct_hash, &hsize); - hash =reciprocal_scale (_hash++, hsize); +if (!i) + bucket =reciprocal_scale (hash, hsize); +else + bucket = (bucket +1 ) % hsize; - drops =early_drop_list (net, &ct_hash[hash]); + drops =early_drop_list (net, &ct_hash[bucket]);rcu_read_unlock ();if (drops) {
net/sunrpc/xdr.c +2 -3
@@ -639,11 +639,10 @@ void xdr_truncate_encode(struct xdr_stream *xdr, size_t len)WARN_ON_ONCE (xdr->iov);return ; } -if (fraglen) { +if (fraglen) xdr->end = head->iov_base + head->iov_len; - xdr->page_ptr--; - }/* (otherwise assume xdr->end is already set) */ + xdr->page_ptr--; head->iov_len = len; buf->len = len; xdr->p = head->iov_base + head->iov_len;
tools/testing/selftests/powerpc/tm/tm-tmspr.c +17 -10
@@ -98,7 +98,7 @@ void texasr(void *in)int test_tmspr () { -pthread_t thread; +pthread_t *thread;int thread_num;unsigned long i;
@@ -107,21 +107,28 @@ int test_tmspr()/* To cause some context switching */ thread_num =10 *sysconf (_SC_NPROCESSORS_ONLN); + thread =malloc (thread_num *sizeof (pthread_t)); +if (thread ==NULL ) +return EXIT_FAILURE ; +/* Test TFIAR and TFHAR */ -for (i =0 ; i < thread_num ; i +=2 ){ -if (pthread_create (&thread,NULL , (void *)tfiar_tfhar, (void *)i)) +for (i =0 ; i < thread_num; i +=2 ) { +if (pthread_create (&thread[i],NULL , (void *)tfiar_tfhar, + (void *)i))return EXIT_FAILURE ; } -if (pthread_join (thread,NULL ) !=0 ) -return EXIT_FAILURE ; -/* Test TEXASR */ -for (i =0 ; i < thread_num ; i++){ -if (pthread_create (&thread,NULL , (void *)texasr, (void *)i)) +for (i =1 ; i < thread_num; i +=2 ) { +if (pthread_create (&thread[i],NULL , (void *)texasr, (void *)i))return EXIT_FAILURE ; } -if (pthread_join (thread,NULL ) !=0 ) -return EXIT_FAILURE ; + +for (i =0 ; i < thread_num; i++) { +if (pthread_join (thread[i],NULL ) !=0 ) +return EXIT_FAILURE ; + } + +free (thread);if (passed)return 0 ;