Patch "bpf: Change inode_storage's lookup_elem return value from NULL to -EBADF" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    bpf: Change inode_storage's lookup_elem return value from NULL to -EBADF

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     bpf-change-inode_storage-s-lookup_elem-return-value-.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 25d97a19a20f01cfe2cadf0ca2fe35c562c1f4a6
Author: Tal Lossos <tallossos@xxxxxxxxx>
Date:   Sun Mar 7 14:09:48 2021 +0200

    bpf: Change inode_storage's lookup_elem return value from NULL to -EBADF
    
    [ Upstream commit 769c18b254ca191b45047e1fcb3b2ce56fada0b6 ]
    
    bpf_fd_inode_storage_lookup_elem() returned NULL when getting a bad FD,
    which caused -ENOENT in bpf_map_copy_value. -EBADF error is better than
    -ENOENT for a bad FD behaviour.
    
    The patch was partially contributed by CyberArk Software, Inc.
    
    Fixes: 8ea636848aca ("bpf: Implement bpf_local_storage for inodes")
    Signed-off-by: Tal Lossos <tallossos@xxxxxxxxx>
    Signed-off-by: Daniel Borkmann <daniel@xxxxxxxxxxxxx>
    Acked-by: Yonghong Song <yhs@xxxxxx>
    Acked-by: KP Singh <kpsingh@xxxxxxxxxx>
    Link: https://lore.kernel.org/bpf/20210307120948.61414-1-tallossos@xxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/kernel/bpf/bpf_inode_storage.c b/kernel/bpf/bpf_inode_storage.c
index c2a501cd90eb..a4ac48c7dada 100644
--- a/kernel/bpf/bpf_inode_storage.c
+++ b/kernel/bpf/bpf_inode_storage.c
@@ -109,7 +109,7 @@ static void *bpf_fd_inode_storage_lookup_elem(struct bpf_map *map, void *key)
 	fd = *(int *)key;
 	f = fget_raw(fd);
 	if (!f)
-		return NULL;
+		return ERR_PTR(-EBADF);
 
 	sdata = inode_storage_lookup(f->f_inode, map, true);
 	fput(f);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux