Skip to content
Commit 0b7ec177 authored by David Howells's avatar David Howells Committed by Herbert Xu
Browse files

crypto: algif_hash - Fix race between MORE and non-MORE sends



The 'MSG_MORE' state of the previous sendmsg() is fetched without the
socket lock held, so two sendmsg calls can race.  This can be seen with a
large sendfile() as that now does a series of sendmsg() calls, and if a
write() comes in on the same socket at an inopportune time, it can flip the
state.

Fix this by moving the fetch of ctx->more inside the socket lock.

Fixes: c662b043 ("crypto: af_alg/hash: Support MSG_SPLICE_PAGES")
Reported-by: default avatar <syzbot+689ec3afb1ef07b766b2@syzkaller.appspotmail.com>
Link: https://lore.kernel.org/r/000000000000554b8205ffdea64e@google.com/


Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Tested-by: default avatar <syzbot+689ec3afb1ef07b766b2@syzkaller.appspotmail.com>
cc: Herbert Xu <herbert@gondor.apana.org.au>
cc: Paolo Abeni <pabeni@redhat.com>
cc: "David S. Miller" <davem@davemloft.net>
cc: Eric Dumazet <edumazet@google.com>
cc: Jakub Kicinski <kuba@kernel.org>
cc: linux-crypto@vger.kernel.org
cc: netdev@vger.kernel.org
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 9e9311e0
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment