aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2016-08-04um: Select HAVE_DEBUG_KMEMLEAKRichard Weinberger1-0/+1
Now we have the infrastructure to support kmemleak. Enable the HAVE flag. Signed-off-by: Richard Weinberger <[email protected]>
2016-08-04um: Setup physical memory in setup_arch()Richard Weinberger1-4/+4
Currently UML sets up physical memory very early, long before setup_arch() was called by the kernel main function. This can cause problems when code paths in UML's memory setup code assume that the kernel is already running. i.e. when kmemleak is enabled it will evaluate current() in free_bootmem(). That early current() is undefined and UML explodes. Solve the problem by setting up physical memory in setup_arch(), at this stage the kernel has materialized and basic infrastructure such as current() works. Signed-off-by: Richard Weinberger <[email protected]>
2016-08-04um: Eliminate null test after alloc_bootmemAmitoj Kaur Chawla1-2/+0
alloc_bootmem function never returns NULL. Thus a NULL test after a call to this function is unnecessary. The Coccinelle semantic patch used to make this change is follows: @@ expression E; statement S; @@ E = alloc_bootmem(...) ... when != E - if (E == NULL) S Signed-off-by: Amitoj Kaur Chawla <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
2016-08-03Documenation: update cgroup's document pathseokhoon.yoon14-19/+19
cgroup's document path is changed to "cgroup-v1". update it. Signed-off-by: seokhoon.yoon <[email protected]> Signed-off-by: Jonathan Corbet <[email protected]>
2016-08-03Documentation/sphinx: do not warn about missing tools in 'make help'Jani Nikula1-2/+2
Simply move the dochelp rule outside of the HAVE_SPHINX check, overriding the .DEFAULT rule for HAVE_SPHINX=0. Cc: Jonathan Corbet <[email protected]> Cc: Christian Kujau <[email protected]> Signed-off-by: Jani Nikula <[email protected]> Signed-off-by: Jonathan Corbet <[email protected]>
2016-08-03Btrfs: fix __MAX_CSUM_ITEMSChris Mason1-2/+3
Jeff Mahoney's cleanup commit (14a1e067b4) wasn't correct for csums on machines where the pagesize >= metadata blocksize. This just reverts the relevant hunks to bring the old math back. Signed-off-by: Chris Mason <[email protected]>
2016-08-03cachefiles: Fix race between inactivating and culling a cache objectDavid Howells1-2/+3
There's a race between cachefiles_mark_object_inactive() and cachefiles_cull(): (1) cachefiles_cull() can't delete a backing file until the cache object is marked inactive, but as soon as that's the case it's fair game. (2) cachefiles_mark_object_inactive() marks the object as being inactive and *only then* reads the i_blocks on the backing inode - but cachefiles_cull() might've managed to delete it by this point. Fix this by making sure cachefiles_mark_object_inactive() gets any data it needs from the backing inode before deactivating the object. Without this, the following oops may occur: BUG: unable to handle kernel NULL pointer dereference at 0000000000000098 IP: [<ffffffffa06c5cc1>] cachefiles_mark_object_inactive+0x61/0xb0 [cachefiles] ... CPU: 11 PID: 527 Comm: kworker/u64:4 Tainted: G I ------------ 3.10.0-470.el7.x86_64 #1 Hardware name: Hewlett-Packard HP Z600 Workstation/0B54h, BIOS 786G4 v03.19 03/11/2011 Workqueue: fscache_object fscache_object_work_func [fscache] task: ffff880035edaf10 ti: ffff8800b77c0000 task.ti: ffff8800b77c0000 RIP: 0010:[<ffffffffa06c5cc1>] cachefiles_mark_object_inactive+0x61/0xb0 [cachefiles] RSP: 0018:ffff8800b77c3d70 EFLAGS: 00010246 RAX: 0000000000000000 RBX: ffff8800bf6cc400 RCX: 0000000000000034 RDX: 0000000000000000 RSI: ffff880090ffc710 RDI: ffff8800bf761ef8 RBP: ffff8800b77c3d88 R08: 2000000000000000 R09: 0090ffc710000000 R10: ff51005d2ff1c400 R11: 0000000000000000 R12: ffff880090ffc600 R13: ffff8800bf6cc520 R14: ffff8800bf6cc400 R15: ffff8800bf6cc498 FS: 0000000000000000(0000) GS:ffff8800bb8c0000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b CR2: 0000000000000098 CR3: 00000000019ba000 CR4: 00000000000007e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Stack: ffff880090ffc600 ffff8800bf6cc400 ffff8800867df140 ffff8800b77c3db0 ffffffffa06c48cb ffff880090ffc600 ffff880090ffc180 ffff880090ffc658 ffff8800b77c3df0 ffffffffa085d846 ffff8800a96b8150 ffff880090ffc600 Call Trace: [<ffffffffa06c48cb>] cachefiles_drop_object+0x6b/0xf0 [cachefiles] [<ffffffffa085d846>] fscache_drop_object+0xd6/0x1e0 [fscache] [<ffffffffa085d615>] fscache_object_work_func+0xa5/0x200 [fscache] [<ffffffff810a605b>] process_one_work+0x17b/0x470 [<ffffffff810a6e96>] worker_thread+0x126/0x410 [<ffffffff810a6d70>] ? rescuer_thread+0x460/0x460 [<ffffffff810ae64f>] kthread+0xcf/0xe0 [<ffffffff810ae580>] ? kthread_create_on_node+0x140/0x140 [<ffffffff81695418>] ret_from_fork+0x58/0x90 [<ffffffff810ae580>] ? kthread_create_on_node+0x140/0x140 The oopsing code shows: callq 0xffffffff810af6a0 <wake_up_bit> mov 0xf8(%r12),%rax mov 0x30(%rax),%rax mov 0x98(%rax),%rax <---- oops here lock add %rax,0x130(%rbx) where this is: d_backing_inode(object->dentry)->i_blocks Fixes: a5b3a80b899bda0f456f1246c4c5a1191ea01519 (CacheFiles: Provide read-and-reset release counters for cachefilesd) Reported-by: Jianhong Yin <[email protected]> Signed-off-by: David Howells <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Reviewed-by: Steve Dickson <[email protected]> cc: [email protected] Signed-off-by: Al Viro <[email protected]>
2016-08-03Merge branch 'for-viro' of ↵Al Viro3-9/+4
git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs into for-linus
2016-08-03Merge tag 'trace-v4.8-1' of ↵Linus Torvalds4-9/+19
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace Pull tracing fixes from Steven Rostedt: "A few updates and fixes: - move the suppressing of the __builtin_return_address >0 warning to the tracing directory only. - metag recordmcount fix for newer glibc's - two tracing histogram fixes that were reported by KASAN" * tag 'trace-v4.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: tracing: Fix use-after-free in hist_register_trigger() tracing: Fix use-after-free in hist_unreg_all/hist_enable_unreg_all Makefile: Mute warning for __builtin_return_address(>0) for tracing only ftrace/recordmcount: Work around for addition of metag magic but not relocations
2016-08-03fs/proc: Add compiler check for -Wno-override-init to support gcc < 4.2Geert Uytterhoeven1-1/+1
With gcc < 4.2 (e.g. 4.1.2): CC fs/proc/task_mmu.o cc1: error: unrecognized command line option "-Wno-override-init" To fix this, only enable the compiler option when it is actually supported by the compiler. Fixes: ca52953f5f24 ("fs/proc/task_mmu.c: suppress compilation warnings with W=1") Signed-off-by: Geert Uytterhoeven <[email protected]> Acked-by: Valdis Kletnieks <[email protected]> Cc: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2016-08-03dm raid: constructor fails on non-zero incompat_featuresHeinz Mauelshagen1-0/+1
When lvm2 userspace requests a RaidLV repair, it sets the rebuild constructor flag on the new replacement DataLVs but does not clear the respective MetaLVs. Hence the superblock that is loaded from such new MetaLVs may have a non-zero incompat_features member and the constructor will fail with false-positive on incompat_features. Solve by initializing the incompat_features member properly. Signed-off-by: Heinz Mauelshagen <[email protected]> Signed-off-by: Mike Snitzer <[email protected]>
2016-08-039p: use clone_fid()Al Viro5-31/+8
in a bunch of places it cleans the things up Signed-off-by: Al Viro <[email protected]>
2016-08-039p: fix braino introduced in "9p: new helper - v9fs_parent_fid()"Al Viro2-2/+6
In v9fs_vfs_rename() we need to clone the parents' fids, not just find them. Spotted-by: Johannes Berg <[email protected]> Signed-off-by: Al Viro <[email protected]>
2016-08-03dm raid: fix processing of max_recovery_rate constructor flagHeinz Mauelshagen1-1/+1
__CTR_FLAG_MIN_RECOVERY_RATE was used instead of __CTR_FLAG_MAX_RECOVERY_RATE thus causing max_recovery_rate to be rejected in case min_recovery_rate was already set. Signed-off-by: Heinz Mauelshagen <[email protected]> Signed-off-by: Mike Snitzer <[email protected]>
2016-08-03ALSA: hda: Fix krealloc() with __GFP_ZERO usageTakashi Iwai1-1/+3
krealloc() doesn't work always properly with __GFP_ZERO flag as expected. For clearing the reallocated area, we need to clear explicitly instead. Reported-by: Joe Perches <[email protected]> Cc: <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
2016-08-03vfs: make dentry_needs_remove_privs() internalMiklos Szeredi3-2/+1
Only used by the vfs. Signed-off-by: Miklos Szeredi <[email protected]>
2016-08-03vfs: remove file_needs_remove_privs()Miklos Szeredi1-4/+0
This function is now unused. Signed-off-by: Miklos Szeredi <[email protected]>
2016-08-03vfs: fix deadlock in file_remove_privs() on overlayfsMiklos Szeredi1-3/+3
file_remove_privs() is called with inode lock on file_inode(), which proceeds to calling notify_change() on file->f_path.dentry. Which triggers the WARN_ON_ONCE(!inode_is_locked(inode)) in addition to deadlocking later when ovl_setattr tries to lock the underlying inode again. Fix this mess by not mixing the layers, but doing everything on underlying dentry/inode. Signed-off-by: Miklos Szeredi <[email protected]> Fixes: 07a2daab49c5 ("ovl: Copy up underlying inode's ->i_mode to overlay inode") Cc: <[email protected]>
2016-08-03ALSA: hda: add AMD Bonaire AZ PCI ID with proper driver capsMaruthi Srinivas Bayyavarapu1-0/+2
This commit fixes garbled audio on Bonaire HDMI Signed-off-by: Maruthi Bayyavarapu <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Cc: <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
2016-08-03Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netLinus Torvalds52-95/+195
Pull networking fixes from David Miller: 1) Fix several cases of missing of_node_put() calls in various networking drivers. From Peter Chen. 2) Don't try to remove unconfigured VLANs in qed driver, from Yuval Mintz. 3) Unbalanced locking in TIPC error handling, from Wei Yongjun. 4) Fix lockups in CPDMA driver, from Grygorii Strashko. 5) More MACSEC refcount et al fixes, from Sabrina Dubroca. 6) Fix MAC address setting in r8169 during runtime suspend, from Chun-Hao Lin. 7) Various printf format specifier fixes, from Heinrich Schuchardt. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (59 commits) qed: Fail driver load in 100g MSI mode. ethernet: ti: davinci_emac: add missing of_node_put after calling of_parse_phandle ethernet: stmicro: stmmac: add missing of_node_put after calling of_parse_phandle ethernet: stmicro: stmmac: dwmac-socfpga: add missing of_node_put after calling of_parse_phandle ethernet: renesas: sh_eth: add missing of_node_put after calling of_parse_phandle ethernet: renesas: ravb_main: add missing of_node_put after calling of_parse_phandle ethernet: marvell: pxa168_eth: add missing of_node_put after calling of_parse_phandle ethernet: marvell: mvpp2: add missing of_node_put after calling of_parse_phandle ethernet: marvell: mvneta: add missing of_node_put after calling of_parse_phandle ethernet: hisilicon: hns: hns_dsaf_main: add missing of_node_put after calling of_parse_phandle ethernet: hisilicon: hns: hns_dsaf_mac: add missing of_node_put after calling of_parse_phandle ethernet: cavium: octeon: add missing of_node_put after calling of_parse_phandle ethernet: aurora: nb8800: add missing of_node_put after calling of_parse_phandle ethernet: arc: emac_main: add missing of_node_put after calling of_parse_phandle ethernet: apm: xgene: add missing of_node_put after calling of_parse_phandle ethernet: altera: add missing of_node_put 8139too: fix system hang when there is a tx timeout event. qed: Fix error return code in qed_resc_alloc() net: qlcnic: avoid superfluous assignement dsa: b53: remove redundant if ...
2016-08-03Merge branch '4.7-fixes' into mips-for-linux-nextRalf Baechle131-605/+1150
2016-08-03Input: add driver for SiS 9200 family I2C touchscreen controllersMika Penttilä5-0/+460
This is a driver for SiS 9200 family touchscreen controllers using I2C bus. Signed-off-by: Mika Penttilä <[email protected]> Acked-by: Tammy Tseng <[email protected]> Acked-by: Yuger Yu <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]>
2016-08-03MIPS: mm: Fix definition of R6 cache instructionMatt Redfearn1-1/+1
Commit a168b8f1cde6 ("MIPS: mm: Add MIPS R6 instruction encodings") added an incorrect definition of the redefined MIPSr6 cache instruction. Executing any kernel code including this instuction results in a reserved instruction exception and kernel panic. Fix the instruction definition. Fixes: a168b8f1cde6588ff7a67699fa11e01bc77a5ddd Signed-off-by: Matt Redfearn <[email protected]> Cc: <[email protected]> # 4.x- Cc: [email protected] Cc: [email protected] Patchwork: https://patchwork.linux-mips.org/patch/13663/ Signed-off-by: Ralf Baechle <[email protected]>
2016-08-03MIPS: tools: Fix relocs tool compiler warningsHarvey Hunt1-8/+11
When using clang as HOSTCC, the following warnings appear: In file included from arch/mips/boot/tools/relocs_64.c:27:0: arch/mips/boot/tools/relocs.c: In function ‘read_relocs’: arch/mips/boot/tools/relocs.c:397:4: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] ELF_R_SYM(rel->r_info) = elf32_to_cpu(ELF_R_SYM(rel->r_info)); ^~~~~~~~~ arch/mips/boot/tools/relocs.c:397:4: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] arch/mips/boot/tools/relocs.c: In function ‘walk_relocs’: arch/mips/boot/tools/relocs.c:491:4: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] Elf_Sym *sym = &sh_symtab[ELF_R_SYM(rel->r_info)]; ^~~~~~~ arch/mips/boot/tools/relocs.c: In function ‘do_reloc’: arch/mips/boot/tools/relocs.c:502:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] unsigned r_type = ELF_R_TYPE(rel->r_info); ^~~~~~~~ arch/mips/boot/tools/relocs.c: In function ‘do_reloc_info’: arch/mips/boot/tools/relocs.c:641:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] rel_type(ELF_R_TYPE(rel->r_info)), ^~~~~~~~ Fix them by making Elf64_Mips_Rela a union Signed-off-by: Harvey Hunt <[email protected]> Acked-by: Matt Redfearn <[email protected]> Cc: [email protected] Cc: [email protected] Patchwork: https://patchwork.linux-mips.org/patch/13683/ Signed-off-by: Ralf Baechle <[email protected]>
2016-08-02Input: ili210x - fix permissions on "calibrate" attributeDmitry Torokhov1-1/+1
"calibrate" attribute does not provide "show" methods and thus we should not mark it as readable. Signed-off-by: Dmitry Torokhov <[email protected]>
2016-08-02Input: elan_i2c - properly wake up touchpad on ASUS laptopsKT Liao1-16/+63
Some ASUS laptops were shipped with touchpads that require to be woken up first, before trying to switch them into absolute reporting mode, otherwise touchpad would fail to work while flooding the logs with: elan_i2c i2c-ELAN1000:00: invalid report id data (1) Among affected devices are Asus E202SA, N552VW, X456UF, UX305CA, and others. We detect such devices by checking the IC type and product ID numbers and adjusting order of operations accordingly. Signed-off-by: KT Liao <[email protected]> Reported-by: Chris Chiu <[email protected]> Reported-by: Vlad Glagolev <[email protected]> Tested-by: Vlad Glagolev <[email protected]> Cc: [email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
2016-08-02Input: add driver for Silead touchscreensRobert Dolca4-0/+617
This driver adds support for Silead touchscreens. It has been tested with GSL1680 and GSL3680 touch panels. It supports ACPI and device tree enumeration. Screen resolution, the maximum number of fingers supported and firmware name are configurable. Signed-off-by: Robert Dolca <[email protected]> Signed-off-by: Daniel Jansen <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]>
2016-08-02Input: elantech - fix debug dump of the current packetBenjamin Tissoires1-6/+2
The use of mixed psmouse_printk() and printk creates 2 lines in the log, while the use of %*ph solves everything. Signed-off-by: Benjamin Tissoires <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]>
2016-08-03MIPS: Cobalt: Fix typoAndrea Gelmini1-2/+2
Signed-off-by: Andrea Gelmini <[email protected]> Cc: [email protected] Cc: [email protected] Patchwork: https://patchwork.linux-mips.org/patch/13316/ Signed-off-by: Ralf Baechle <[email protected]>
2016-08-03MIPS: Octeon: Fix typoAndrea Gelmini1-1/+1
Signed-off-by: Andrea Gelmini <[email protected]> Cc: [email protected] Cc: [email protected] Patchwork: https://patchwork.linux-mips.org/patch/13315/ Signed-off-by: Ralf Baechle <[email protected]>
2016-08-03MIPS: Lantiq: Fix build failureSudip Mukherjee1-2/+2
Some configs of mips like xway_defconffig are failing with the error: arch/mips/lantiq/irq.c:209:2: error: initialization from incompatible pointer type [-Werror] "icu", ^ arch/mips/lantiq/irq.c:209:2: error: (near initialization for 'ltq_irq_type.parent_device') [-Werror] arch/mips/lantiq/irq.c:219:2: error: initialization from incompatible pointer type [-Werror] "eiu", ^ arch/mips/lantiq/irq.c:219:2: error: (near initialization for 'ltq_eiu_type.parent_device') [-Werror] The first member of the "struct irq" is no longer a pointer for the name. Fixes: be45beb2df69 ("genirq: Add runtime power management support for IRQ chips") Signed-off-by: Sudip Mukherjee <[email protected]> Acked-by: John Crispin <[email protected]> Cc: [email protected] Cc: [email protected] Patchwork: https://patchwork.linux-mips.org/patch/13684/ Signed-off-by: Ralf Baechle <[email protected]>
2016-08-03powerpc/32: Fix early access to cpu_spec relocationBenjamin Herrenschmidt1-1/+1
Commit 9402c6846131 ("powerpc: Factor do_feature_fixup calls") introduced a subtle bug on 32-bit. When reading the cpu spec from the global, we not only need to do a pointer relocation on the global address but also on the pointer we read from it. This fixes crashes reported on MPC5200 based machines. Fixes: 9402c6846131 ("powerpc: Factor do_feature_fixup calls") Signed-off-by: Benjamin Herrenschmidt <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
2016-08-02IB/hfi1: Add cache evict LRU listDean Luick1-10/+19
The original code used a LRU list to evict nodes which were least recently used. For correctness the evict code was moved under the handler->lock, now add back the LRU list. Reviewed-by: Ira Weiny <[email protected]> Signed-off-by: Dean Luick <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
2016-08-02IB/hfi1: Fix memory leak during unexpected shutdownIra Weiny1-13/+31
During an unexpected shutdown, references to tid_rb_node were NULL'ed out without properly being released. Fix this by calling clear_tid_node in the mmu notifier remove callback rather than after these callbacks are called. Reviewed-by: Dean Luick <[email protected]> Signed-off-by: Ira Weiny <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
2016-08-02IB/hfi1: Remove unneeded mm argument in remove functionDean Luick4-15/+10
The reworked mmu_rb interface allows the unused mm argument to be removed. Reviewed-by: Ira Weiny <[email protected]> Signed-off-by: Dean Luick <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
2016-08-02IB/hfi1: Consistently call ops->remove outside spinlockDean Luick4-23/+84
The ops->remove() callback was called by hfi1_mmu_unregister() with a NULL mm argument while holding a spinlock. In the case of sdma_rb_remove() this caused it to pass current->mm to hfi1_release_user_pages() This had 2 problems. First this would attempt to acquire the mmap_sem under a spin lock. Second the use of current->mm is not always guaranteed to be the proper mm when the fd is being closed. Rather than depend on this implicit behavior we move all calls to ops->remove outside of the spinlock. This also allows the correct mm to be used in the remove callback without fear of deadlock. Because the MMU notifier is not guaranteed to hold mm->mmap_sem, but usually does, we must delay all remove callbacks until out of the notifier, when the callbacks can take the mmap_sem if they need to. Code comments were added to clarify what the expectations are for the users of the mmu rb tree. Suggested-by: Jim Foraker <[email protected]> Reviewed-by: Ira Weiny <[email protected]> Signed-off-by: Dean Luick <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
2016-08-02IB/hfi1: Use evict mmu rb operationDean Luick2-73/+47
Use the new cache evict operation in the SDMA code. This allows the cache to properly coordinate evicts and removes, preventing any race. With this change, the separate list, lock, and race flag are not needed. Reviewed-by: Ira Weiny <[email protected]> Signed-off-by: Dean Luick <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
2016-08-02IB/hfi1: Add evict operation to the mmu rb handlerDean Luick2-0/+38
Allow users to clear nodes from the rb tree based on their evict callback. Reviewed-by: Ira Weiny <[email protected]> Signed-off-by: Dean Luick <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
2016-08-02IB/hfi1: Fix TID caching actionsDean Luick2-9/+11
Per file descriptor TID caching actions depend on a global that can change midway through the lifetime of that file descriptor. Make the use of caching consistent for the life of the file descriptor by using the presence of the cache handler to decide when to use the cache functions. Reviewed-by: Ira Weiny <[email protected]> Signed-off-by: Dean Luick <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
2016-08-02IB/hfi1: Make the cache handler own its rb tree rootDean Luick6-125/+81
The objects which use cache handling should reference their own handler object not the internal data structure it uses to track the nodes. Have the "users" of the mmu notifier code pass opaque objects which can then be properly used in the mmu callbacks depending on the owners needs. This patch has the additional benefit that operations no longer require a look up in a list to find the handlers. Reviewed-by: Ira Weiny <[email protected]> Signed-off-by: Dean Luick <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
2016-08-02IB/hfi1: Make use of mm consistentIra Weiny8-31/+50
The hfi1 driver registers a mmu_notifier callback when /dev/hfi1_* is opened, and unregisters it when the device is closed. The driver incorrectly assumes that the close will always happen from the same context as the open. In particular, closes due to SIGKILL or OOM killer activity may happen from a different context. In these cases, the wrong mm is passed to mmu_notifier_unregister(), which causes improper reference counting for the victim mm, and eventual memory corruption. Preserve the mm for all open file descriptors and use this mm rather than current->mm for memory operations for the lifetime of that fd. Note: this patch leaves 1 use of current->mm in place. This use is removed in a follow on patch because other functional changes were required prior to that use being removed. If registration fails, there is no reason to keep the handler object around. Free the handler object rather than add it to the list to prevent any mmu_notifier operations, including unregister, when registration fails. Suggested-by: Jim Foraker <[email protected]> Reviewed-by: Dean Luick <[email protected]> Signed-off-by: Ira Weiny <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
2016-08-02IB/hfi1: Fix user SDMA racy user request claimDean Luick2-13/+20
The user SDMA in-use claim bit is in the structure that gets zeroed out once the claim is made. Move the request in-use flag into its own bit array and use that for atomic claims. This cleans up the claim code and removes any race possibility. Reviewed-by: Ira Weiny <[email protected]> Signed-off-by: Dean Luick <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
2016-08-02IB/hfi1: Fix error condition that needs to clean upDean Luick1-1/+2
If input validation fails, properly free the request before returning. Reviewed-by: Ira Weiny <[email protected]> Signed-off-by: Dean Luick <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
2016-08-02IB/hfi1: Release node on insert failureDean Luick1-0/+1
If unable to insert node into the RB tree cache, node will be freed before returning from the function. Null out iovec's pointer to node so iovec does not try to free it later. Reviewed-by: Ira Weiny <[email protected]> Signed-off-by: Dean Luick <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
2016-08-02IB/hfi1: Validate SDMA user iovector countDean Luick1-2/+22
Reviewed-by: Ira Weiny <[email protected]> Signed-off-by: Dean Luick <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
2016-08-02IB/hfi1: Validate SDMA user request indexDean Luick1-0/+8
Reviewed-by: Ira Weiny <[email protected]> Signed-off-by: Dean Luick <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
2016-08-02IB/hfi1: Use the same capability state for all shared contextsDean Luick4-21/+12
Save the current capability state at user context creation time. Report this saved value for all shared contexts. Also get rid of unnecessary hfi1_get_base_kinfo function. Reviewed-by: Ira Weiny <[email protected]> Signed-off-by: Dean Luick <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
2016-08-02IB/hfi1: Prevent null pointer dereferenceIra Weiny1-1/+1
If a context has not been assigned or assignment failed, pq may be NULL. Move the unregister within the protection of the null check. Reviewed-by: Dean Luick <[email protected]> Signed-off-by: Ira Weiny <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
2016-08-02IB/hfi1: Rename TID mmu_rb_* functionsDean Luick1-12/+12
Clarify the names of the TID mmu functions. Reviewed-by: Ira Weiny <[email protected]> Signed-off-by: Dean Luick <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
2016-08-02IB/hfi1: Remove unneeded empty check in hfi1_mmu_rb_unregister()Dean Luick1-9/+6
Checking if the rb tree is empty is redundant with the while loop which is emptying the rb tree. Reviewed-by: Ira Weiny <[email protected]> Signed-off-by: Dean Luick <[email protected]> Signed-off-by: Doug Ledford <[email protected]>