[PATCH bpf-next v4 4/7] bpf: sockmap: accept sock_common pointer when updating

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

 



The sockmap update path already ensures that only full sockets are
inserted (see sock_map_sk_state_allowed). Allow BPF to pass pointers
to sock_common to map_update_elem(sockmap). This allows calling the
helper with struct sock pointer derived from the sockmap iterator context.

Signed-off-by: Lorenz Bauer <lmb@xxxxxxxxxxxxxx>
---
 kernel/bpf/verifier.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index f1f45ce42d60..a4c398e05673 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -3895,7 +3895,7 @@ static int resolve_map_arg_type(struct bpf_verifier_env *env,
 	case BPF_MAP_TYPE_SOCKMAP:
 	case BPF_MAP_TYPE_SOCKHASH:
 		if (*arg_type == ARG_PTR_TO_MAP_VALUE) {
-			*arg_type = ARG_PTR_TO_SOCKET;
+			*arg_type = ARG_PTR_TO_SOCK_COMMON;
 		} else {
 			verbose(env, "invalid arg_type for sockmap/sockhash\n");
 			return -EINVAL;
-- 
2.25.1




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux