mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-13 00:00:00 -04:00
UPSTREAM: bpf, inode_storage: Put file handler if no storage was found
[ Upstream commit b9557caaf872271671bdc1ef003d72f421eb72f6 ]
Put file f if inode_storage_ptr() returns NULL.
Fixes: 8ea636848aca ("bpf: Implement bpf_local_storage for inodes")
Change-Id: I52ca6e726a0fd83c88e8b5cb05cf9662a2e6bd41
Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: KP Singh <kpsingh@kernel.org>
Link: https://lore.kernel.org/bpf/20210121020856.25507-1-bianpan2016@163.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
52239f4e3e
commit
57343bd5dd
1 changed files with 5 additions and 1 deletions
|
|
@ -125,8 +125,12 @@ static int bpf_fd_inode_storage_update_elem(struct bpf_map *map, void *key,
|
|||
|
||||
fd = *(int *)key;
|
||||
f = fget_raw(fd);
|
||||
if (!f || !inode_storage_ptr(f->f_inode))
|
||||
if (!f)
|
||||
return -EBADF;
|
||||
if (!inode_storage_ptr(f->f_inode)) {
|
||||
fput(f);
|
||||
return -EBADF;
|
||||
}
|
||||
|
||||
sdata = bpf_local_storage_update(f->f_inode,
|
||||
(struct bpf_local_storage_map *)map,
|
||||
|
|
|
|||
Loading…
Reference in a new issue