summaryrefslogtreecommitdiff
path: root/kernel/bpf/inode.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2016-04-28 17:29:46 -0400
committerDavid S. Miller <davem@davemloft.net>2016-04-28 17:29:46 -0400
commit1dfcd832b1a9ed45edac15b31d079b805fa0ae2a (patch)
treed19ff13218ada2b400bece7a058919478afea9ce /kernel/bpf/inode.c
parentbd34cf66cc48a5fb17deb7a1494845c45d71ba8e (diff)
parent569cc39d39385a74b23145496bca2df5ac8b2fb8 (diff)
Merge branch 'bpf-fixes'
Alexei Starovoitov says: ==================== bpf: fix several bugs First two patches address bugs found by Jann Horn. Last patch is a minor samples fix spotted during the testing. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel/bpf/inode.c')
-rw-r--r--kernel/bpf/inode.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c
index f2ece3c174a5..8f94ca1860cf 100644
--- a/kernel/bpf/inode.c
+++ b/kernel/bpf/inode.c
@@ -31,10 +31,10 @@ static void *bpf_any_get(void *raw, enum bpf_type type)
{
switch (type) {
case BPF_TYPE_PROG:
- atomic_inc(&((struct bpf_prog *)raw)->aux->refcnt);
+ raw = bpf_prog_inc(raw);
break;
case BPF_TYPE_MAP:
- bpf_map_inc(raw, true);
+ raw = bpf_map_inc(raw, true);
break;
default:
WARN_ON_ONCE(1);
@@ -297,7 +297,8 @@ static void *bpf_obj_do_get(const struct filename *pathname,
goto out;
raw = bpf_any_get(inode->i_private, *type);
- touch_atime(&path);
+ if (!IS_ERR(raw))
+ touch_atime(&path);
path_put(&path);
return raw;