From patchwork Tue Jan 26 11:17:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Begunkov X-Patchwork-Id: 372439 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F770C433E9 for ; Tue, 26 Jan 2021 12:07:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DA9B72311F for ; Tue, 26 Jan 2021 12:07:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392343AbhAZMHU (ORCPT ); Tue, 26 Jan 2021 07:07:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392337AbhAZLW4 (ORCPT ); Tue, 26 Jan 2021 06:22:56 -0500 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C842C061788 for ; Tue, 26 Jan 2021 03:21:05 -0800 (PST) Received: by mail-ej1-x62b.google.com with SMTP id w1so22361302ejf.11 for ; Tue, 26 Jan 2021 03:21:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zY7eyzui5lrsV2Pla8jrRefVhNic/1zSoUc/C9YVCgo=; b=H0ynR2cTeva2XzhMbn0gwM2WFfwJKAoWgrfEWVdjSBRNZqWtqgx8C0iVi0a4U1eC3t FAoTK/UJbWtzPEGofVExhqAFzB28vjg3vriGoWyf2bqe38b3EEKwnkW7nFZpiJbOsoxj /HwcxaXcG1IxqSZkkL4VPs5eLhd1Cp0Wv4CAE40z/p1iUxZ2O4L9lZyGs7+t5RB/RcYA aTeMLU/S0xG0a7OV5OuNIfjTIvMJz2hU6ht93HB01yWvzRkW7IAFQ2kDAT0wgW2d6ZeX 9i2I6IWynR5evunlMfCoKAC7xmUFPKuwAZv4D5Y/fPuveVcAqf+EoCOStALHfKEE3teN jqMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zY7eyzui5lrsV2Pla8jrRefVhNic/1zSoUc/C9YVCgo=; b=DMuPGDi9sWmgepcu+cly8jYmEMerIbABy9wUdk9wNqkuS6QoOxAPMpaeQtC+Wum+bc 7p6LNdypr+KsN+GyrwPLC5BlyDROH6226D+VPcFCqXixu2SAWqK6bftMYmQrPRDucAtV Rs31/1fNuTAEUIrcsk8KcC/JVkL97wZAKqVBhEE792PiTsQQt/3RcdfEPZQtUhnPe3Rf dgPDpti+vcu79WEhpC9muhEriPnJDJ54nXypapwuiNJBUCS/pjlz/771cB+1JSqsL7iU RjswVqcEcrGKvN1fAbNNRmigCE3Kkr/vUzFzsbtUvLbHvt/1ROQrNoS74xoDeRf6AU5y OW2Q== X-Gm-Message-State: AOAM530cH+x4jyktMfzAgXYbpQudZM4PpihsAb1GA9aT+gjT3dy8KtAW PwuHE/rc5/TQwiaO8nEvmVF1h6QWnBH0XQ== X-Google-Smtp-Source: ABdhPJymDFUozw5ybFdh9uTrQRXEHZKRzbxc9RhmlAKCDBt4A2x3uyT/gwIp1iIkMq77Um3LiclkxA== X-Received: by 2002:a17:906:1a0c:: with SMTP id i12mr3262512ejf.325.1611660064020; Tue, 26 Jan 2021 03:21:04 -0800 (PST) Received: from localhost.localdomain ([148.252.129.161]) by smtp.gmail.com with ESMTPSA id o17sm12167128edr.17.2021.01.26.03.21.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jan 2021 03:21:03 -0800 (PST) From: Pavel Begunkov To: stable@vger.kernel.org Cc: Jens Axboe , syzbot+9c9c35374c0ecac06516@syzkaller.appspotmail.com Subject: [PATCH stable 06/11] io_uring: do sqo disable on install_fd error Date: Tue, 26 Jan 2021 11:17:05 +0000 Message-Id: X-Mailer: git-send-email 2.24.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org [ Upstream commit 06585c497b55045ec21aa8128e340f6a6587351c ] WARNING: CPU: 0 PID: 8494 at fs/io_uring.c:8717 io_ring_ctx_wait_and_kill+0x4f2/0x600 fs/io_uring.c:8717 Call Trace: io_uring_release+0x3e/0x50 fs/io_uring.c:8759 __fput+0x283/0x920 fs/file_table.c:280 task_work_run+0xdd/0x190 kernel/task_work.c:140 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop kernel/entry/common.c:174 [inline] exit_to_user_mode_prepare+0x249/0x250 kernel/entry/common.c:201 __syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline] syscall_exit_to_user_mode+0x19/0x50 kernel/entry/common.c:302 entry_SYSCALL_64_after_hwframe+0x44/0xa9 failed io_uring_install_fd() is a special case, we don't do io_ring_ctx_wait_and_kill() directly but defer it to fput, though still need to io_disable_sqo_submit() before. note: it doesn't fix any real problem, just a warning. That's because sqring won't be available to the userspace in this case and so SQPOLL won't submit anything. Cc: stable@vger.kernel.org # 5.5+ Reported-by: syzbot+9c9c35374c0ecac06516@syzkaller.appspotmail.com Fixes: d9d05217cb69 ("io_uring: stop SQPOLL submit on creator's death") Signed-off-by: Pavel Begunkov Signed-off-by: Jens Axboe --- fs/io_uring.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/io_uring.c b/fs/io_uring.c index f1f1de815755..2acea64656f3 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -9501,6 +9501,7 @@ static int io_uring_create(unsigned entries, struct io_uring_params *p, */ ret = io_uring_install_fd(ctx, file); if (ret < 0) { + io_disable_sqo_submit(ctx); /* fput will clean it up */ fput(file); return ret;