Merge tag 'x86_urgent_for_v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / kernel / bpf / bpf_inode_storage.c
index 2f05973..6639640 100644 (file)
@@ -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,