Skip to content
Snippets Groups Projects
Commit 0f6bb83c authored by Herbert Xu's avatar Herbert Xu
Browse files

crypto: algif_skcipher - Fixed overflow when sndbuf is page aligned


When sk_sndbuf is not a multiple of PAGE_SIZE, the limit tests
in sendmsg fail as the limit variable becomes negative and we're
using an unsigned comparison.

The same thing can happen if sk_sndbuf is lowered after a sendmsg
call.

This patch fixes this by always taking the signed maximum of limit
and 0 before we perform the comparison.

It also rounds the value of sk_sndbuf down to a multiple of PAGE_SIZE
so that we don't end up allocating a page only to use a small number
of bytes in it because we're bound by sk_sndbuf.

Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 7451708f
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment