From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 558F3606A31A for ; Tue, 1 Dec 2026 17:10:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XkjwLDUQ Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C211610E2FB; Tue, 1 Dec 2026 17:10:18 +0000 (UTC) Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8365E10E2FB for ; Tue, 1 Dec 2026 17:10:12 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 4B28A43AB1; Tue, 1 Dec 2026 17:10:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B93821F00899; Tue, 1 Dec 2026 17:10:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796145011; bh=WCMZENKmB/GIRTzr1e2qbYP7UDHBaKeLv1kz7BvwjQA=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=XkjwLDUQdCqB6kuIXodPaLXAOlLxFXJJ/4nO4H1Fo131lBAhv5aYYSh0e9BTGeNCl Dhrad0q203nfH0+uVv6tYCKI6Ul4j1Z2lxrLu46rMadhB/ZMP/+2wp6c4zEfg1LWao WjBX63fG7wVCfk+943Sg+sKkdMM8ygYVTyVz4J1w55YWVU6luWUug4bM/q3zNbV0JI FDR2jeRRK1Gi1eEpH3Ny4222Fu+SiItayFOJFXGxgIlA3tM+KcRvOk0EwEG9jnkDN8 Gja18cRVLBZRlL7Jl9+MNPFpDXxSjS4+XuV+1Db4klluCRHGqR6M5jg6WhRgcyk3ac 0SPuW/twqpvzw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [RFC PATCH v3 05/13] io_uring/dma-buf: switch to tag file filtering To: "Nitesh Shetty" Cc: dri-devel@lists.freedesktop.org, nvdimm@lists.linux.dev, linux-ext4@vger.kernel.org, tytso@mit.edu, media-ci@linuxtv.org In-Reply-To: <20261201155938.3028275-6-nj.shetty@samsung.com> References: <20261201155938.3028275-1-nj.shetty@samsung.com> <20261201155938.3028275-6-nj.shetty@samsung.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 17:10:11 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "dri-devel" X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] io_uring/dma-buf: fput() in __io_register_dmabuf() unpins importer module -- commit 2e02bfbc83fd62e0046f2d9e78bfc97e418c5fff Author: Pavel Begunkov io_uring/dma-buf: switch to tag file filtering This commit replaces the exact target_file check on registered dma-bufs with tag-based file compatibility checking via dma_buf_io_file_compatible() and drops the target_file reference at the end of __io_register_dmabuf(). > diff --git a/io_uring/dma-buf.c b/io_uring/dma-buf.c > index fd9b8769818ad..fe735a8773b73 100644 > --- a/io_uring/dma-buf.c > +++ b/io_uring/dma-buf.c > @@ -4,7 +4,6 @@ static inline void io_release_dmabuf(void *priv) > { > struct io_buf_dma *bd =3D io_priv_to_dmabuf(priv); > =20 > - fput(bd->target_file); > dma_buf_io_ctx_release(bd->ctx); > kfree(bd); > } > @@ -52,13 +51,13 @@ int __io_register_dmabuf(struct io_ring_ctx *ctx, > if (ret) > goto err; > =20 > - bd->target_file =3D target_file; > imu->len =3D dmabuf->size; > imu->release =3D io_release_dmabuf; > imu->priv =3D bd; > imu->flags =3D IO_REGBUF_F_DMABUF; > imu->dir =3D IO_BUF_DEST | IO_BUF_SOURCE; > dma_buf_put(dmabuf); > + fput(target_file); > return 0; [Severity: High] Can dropping target_file in __io_register_dmabuf() allow the importer driver module to be unloaded while bd->ctx is still registered? When userspace closes target_fd and no other files remain open on the device (such as an NVMe namespace), nvme_ns_release() and bdev_release() drop the module references on nvme.ko and nvme-core.ko. Neither dma_buf_io_ctx_create() nor nvme_init_io_ctx_locked() pins the importer module; nvme_init_io_ctx_locked() only takes a kobject reference via nvme_get_ctrl(ctrl) and sets ctx->dev_ops =3D &nvme_dma_buf_io_ops. If nvme.ko is then unloaded while the buffer stays registered, nvme_remove() detaches the dma-buf and drops the driver's ctrl reference, and the later io_release_dmabuf() -> dma_buf_io_ctx_release() call invokes ctx->dev_ops->release(ctx) and ctrl->ops->free_ctrl(ctrl) in unmapped module memory. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201155938.3028= 275-1-nj.shetty@samsung.com?part=3D5