On Fri, Jul 07, 2023 at 10:12:38AM +0100, David Howells wrote: > 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: c662b043cdca ("crypto: af_alg/hash: Support MSG_SPLICE_PAGES") > Reported-by: syzbot+689ec3afb1ef07b766b2@xxxxxxxxxxxxxxxxxxxxxxxxx > Link: https://lore.kernel.org/r/000000000000554b8205ffdea64e@xxxxxxxxxx/ > Signed-off-by: David Howells <dhowells@xxxxxxxxxx> > Tested-by: syzbot+689ec3afb1ef07b766b2@xxxxxxxxxxxxxxxxxxxxxxxxx > cc: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> > cc: Paolo Abeni <pabeni@xxxxxxxxxx> > cc: "David S. Miller" <davem@xxxxxxxxxxxxx> > cc: Eric Dumazet <edumazet@xxxxxxxxxx> > cc: Jakub Kicinski <kuba@xxxxxxxxxx> > cc: linux-crypto@xxxxxxxxxxxxxxx > cc: netdev@xxxxxxxxxxxxxxx > --- > crypto/algif_hash.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) Patch applied. Thanks. -- Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt