From nobody Mon Jun 29 16:47:11 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 165C6C433FE for ; Mon, 7 Feb 2022 10:59:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350042AbiBGK4L (ORCPT ); Mon, 7 Feb 2022 05:56:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352176AbiBGKuq (ORCPT ); Mon, 7 Feb 2022 05:50:46 -0500 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DD94C043181 for ; Mon, 7 Feb 2022 02:50:45 -0800 (PST) Received: by mail-wr1-x42c.google.com with SMTP id m14so23891146wrg.12 for ; Mon, 07 Feb 2022 02:50:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=EZDSS2MYdieKNY+ptNKFPV1o4mbS/p6IjuUtTxEmOkI=; b=duNxmxAdk7clYt7ndWPXMcPdSolXHBq4k1vpVSHdqeR3Y4OWFGyd1weIqSmOvwZb6S Spl+lEN4s/4eqR+CV2VBUi31PwqNpLhu1spSm9qyFUZFnw96KF9rCAhnyUvDBEIf11z1 PSnr7JICxX6dz2N2SJiFNsqmL9hadf/eri3EZFXn1w2FkBwZdwQP/eyRjWS5wMaFGvdn ZF0lDFr030L6E1u3lhpYKRKDd4tReFjacJB9q+g0p4uS1S2/apocHH72RqIDegc24uK8 2jrlj+s/8rx96MGL4wDFQmWS8/lusi4cE2hPx9vSkIyDaelQhP2a0llYAaxuDq8JyPit J5CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=EZDSS2MYdieKNY+ptNKFPV1o4mbS/p6IjuUtTxEmOkI=; b=m0BHmCjtOm06RqsPr4H5MAMMo0udjYLBS9vSePYsPvD8LnF/EgK07C4+qyGbru0OSb u0namIiMUlwCCu8fl5Pi0imLBjGfG4ZUyo4Zjo6+pRFYR3Cdj8WXY2oF02rDwosIaGaX S2wgzx/7AWalPY9tpCVl/ls4LrBXAExojFr6zoeBwzitqywiUGuPrGJqaXuQTHQ/N6yV oH+BwiZwKZ075PsW9GPOc+/zG6Y+EqyLXhZxs39zZtz7C9Am2kMXVwrPWTp8d96CJrWT E0DnmD53oydnH7thnORslbRy0Fwf/pF6zKEToMJLIdLA8jHmnxKW1epsrJ+ycNlyhoiy f/Cw== X-Gm-Message-State: AOAM530NQtB05/35uE76M7WSsnfKzn4V6stL5U1KitXStwVsUodJsNst jPGvwCAuSwzYmZHVEkRB2MZuzg== X-Google-Smtp-Source: ABdhPJxLDom1n0BQAQA7DNHaMf3QjJwyZDXY+ENwGqJe57G5ZW9q1SeMh9v9S8yRdiIbSkPeP/Mi6A== X-Received: by 2002:a5d:6486:: with SMTP id o6mr8980127wri.454.1644231043764; Mon, 07 Feb 2022 02:50:43 -0800 (PST) Received: from usaari01.cust.communityfibre.co.uk ([2a02:6b6d:f804:0:9277:27e1:ecf9:6ab6]) by smtp.gmail.com with ESMTPSA id a22sm112080wmq.45.2022.02.07.02.50.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Feb 2022 02:50:43 -0800 (PST) From: Usama Arif To: io-uring@vger.kernel.org, axboe@kernel.dk, asml.silence@gmail.com, linux-kernel@vger.kernel.org Cc: fam.zheng@bytedance.com, lkp@lists.01.org, lkp@intel.com, Usama Arif , kernel test robot Subject: [PATCH] io_uring: unregister eventfd while holding lock when freeing ring ctx Date: Mon, 7 Feb 2022 10:50:40 +0000 Message-Id: <20220207105040.2662467-1-usama.arif@bytedance.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This is because ctx->io_ev_fd is rcu_dereference_protected using ctx->uring_lock in io_eventfd_unregister. Not locking the function resulted in suspicious RCU usage reported by kernel test robot. Reported-by: kernel test robot Signed-off-by: Usama Arif --- fs/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index ad8f84376955..dbc9d3f3f6c5 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -9471,8 +9471,8 @@ static __cold void io_ring_ctx_free(struct io_ring_ct= x *ctx) __io_sqe_files_unregister(ctx); if (ctx->rings) __io_cqring_overflow_flush(ctx, true); - mutex_unlock(&ctx->uring_lock); io_eventfd_unregister(ctx); + mutex_unlock(&ctx->uring_lock); io_destroy_buffers(ctx); if (ctx->sq_creds) put_cred(ctx->sq_creds); --=20 2.25.1