diff options
author | Jakub Kicinski <jakub.kicinski@netronome.com> | 2019-11-27 12:16:44 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-12-04 22:31:02 +0100 |
commit | 569cac5a50002a135c9d791a3bac73e70cba0450 (patch) | |
tree | 2ca62f02486579b0c70f4288c4e2f6f2ec2b78ce /net/tls/tls_main.c | |
parent | a58365a79a2ab99bcf58ea4d3264c4029093147f (diff) | |
download | linux-stable-569cac5a50002a135c9d791a3bac73e70cba0450.tar.gz linux-stable-569cac5a50002a135c9d791a3bac73e70cba0450.tar.bz2 linux-stable-569cac5a50002a135c9d791a3bac73e70cba0450.zip |
net/tls: use sg_next() to walk sg entries
[ Upstream commit c5daa6cccdc2f94aca2c9b3fa5f94e4469997293 ]
Partially sent record cleanup path increments an SG entry
directly instead of using sg_next(). This should not be a
problem today, as encrypted messages should be always
allocated as arrays. But given this is a cleanup path it's
easy to miss was this ever to change. Use sg_next(), and
simplify the code.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/tls/tls_main.c')
-rw-r--r-- | net/tls/tls_main.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c index f874cc0da45d..eff444293594 100644 --- a/net/tls/tls_main.c +++ b/net/tls/tls_main.c @@ -209,24 +209,15 @@ int tls_push_partial_record(struct sock *sk, struct tls_context *ctx, return tls_push_sg(sk, ctx, sg, offset, flags); } -bool tls_free_partial_record(struct sock *sk, struct tls_context *ctx) +void tls_free_partial_record(struct sock *sk, struct tls_context *ctx) { struct scatterlist *sg; - sg = ctx->partially_sent_record; - if (!sg) - return false; - - while (1) { + for (sg = ctx->partially_sent_record; sg; sg = sg_next(sg)) { put_page(sg_page(sg)); sk_mem_uncharge(sk, sg->length); - - if (sg_is_last(sg)) - break; - sg++; } ctx->partially_sent_record = NULL; - return true; } static void tls_write_space(struct sock *sk) |