io_uring/zctx: check chained notif contexts
Send zc only links ubuf_info for requests coming from the same context. There are some ambiguous syz reports, so let's check the assumption on notification completion. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/fd527d8638203fe0f1c5ff06ff2e1d8fd68f831b.1755179962.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>pull/1354/merge
parent
92a96b0a22
commit
ab3ea6eac5
|
|
@ -14,10 +14,15 @@ static const struct ubuf_info_ops io_ubuf_ops;
|
||||||
static void io_notif_tw_complete(struct io_kiocb *notif, io_tw_token_t tw)
|
static void io_notif_tw_complete(struct io_kiocb *notif, io_tw_token_t tw)
|
||||||
{
|
{
|
||||||
struct io_notif_data *nd = io_notif_to_data(notif);
|
struct io_notif_data *nd = io_notif_to_data(notif);
|
||||||
|
struct io_ring_ctx *ctx = notif->ctx;
|
||||||
|
|
||||||
|
lockdep_assert_held(&ctx->uring_lock);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
notif = cmd_to_io_kiocb(nd);
|
notif = cmd_to_io_kiocb(nd);
|
||||||
|
|
||||||
|
if (WARN_ON_ONCE(ctx != notif->ctx))
|
||||||
|
return;
|
||||||
lockdep_assert(refcount_read(&nd->uarg.refcnt) == 0);
|
lockdep_assert(refcount_read(&nd->uarg.refcnt) == 0);
|
||||||
|
|
||||||
if (unlikely(nd->zc_report) && (nd->zc_copied || !nd->zc_used))
|
if (unlikely(nd->zc_report) && (nd->zc_copied || !nd->zc_used))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue