blob: 1fc26ed88357012c1e4afbca9ec146c9ada3101d [file] [log] [blame]
From b1afdc76c80513fb7a67494b03ee1f510c552bd5 Mon Sep 17 00:00:00 2001
From: John Fastabend <john.fastabend@gmail.com>
Date: Sat, 11 Jan 2020 06:12:03 +0000
Subject: [PATCH] bpf: Sockmap/tls, msg_push_data may leave end mark in place
commit cf21e9ba1eb86c9333ca5b05b2f1cc94021bcaef upstream.
Leaving an incorrect end mark in place when passing to crypto
layer will cause crypto layer to stop processing data before
all data is encrypted. To fix clear the end mark on push
data instead of expecting users of the helper to clear the
mark value after the fact.
This happens when we push data into the middle of a skmsg and
have room for it so we don't do a set of copies that already
clear the end flag.
Fixes: 6fff607e2f14b ("bpf: sk_msg program helper bpf_msg_push_data")
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Song Liu <songliubraving@fb.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/bpf/20200111061206.8028-6-john.fastabend@gmail.com
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
diff --git a/net/core/filter.c b/net/core/filter.c
index 1b78e0646279..03236f795725 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -2414,6 +2414,7 @@ BPF_CALL_4(bpf_msg_push_data, struct sk_msg *, msg, u32, start,
sk_msg_iter_var_next(i);
sg_unmark_end(psge);
+ sg_unmark_end(&rsge);
sk_msg_iter_next(msg, end);
}
--
2.7.4