From patchwork Wed Sep 9 15:19:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Garzarella X-Patchwork-Id: 11765627 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3E55C138E for ; Wed, 9 Sep 2020 15:24:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0ECD22228A for ; Wed, 9 Sep 2020 15:24:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="SImLyaqc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727870AbgIIPXN (ORCPT ); Wed, 9 Sep 2020 11:23:13 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:50222 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729521AbgIIPWJ (ORCPT ); Wed, 9 Sep 2020 11:22:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599664879; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=sbe1MYStSybtVRq6YvsVpm4HxML9pRlo3wGjsU8lVrI=; b=SImLyaqcTKsVhJh4yUSQJal9qcRZkSRHY1wmAvP+3vWY40eDLNho8bgXDSgiVbX/+zki50 gYF1lhfQpe4+m6Z3Aq4+NzfO9k6+2iGX7GwFu+M3OabDIwCpMjtCHrpNYCQlqvLnuLxrju C3TgYLh8c70XgNugRBi40456YJWq/14= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-527--z1QE4rGOeyVvlexIryBsg-1; Wed, 09 Sep 2020 11:19:05 -0400 X-MC-Unique: -z1QE4rGOeyVvlexIryBsg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BC7071019627; Wed, 9 Sep 2020 15:19:03 +0000 (UTC) Received: from steredhat.redhat.com (ovpn-113-207.ams2.redhat.com [10.36.113.207]) by smtp.corp.redhat.com (Postfix) with ESMTP id F383A7E8D3; Wed, 9 Sep 2020 15:19:01 +0000 (UTC) From: Stefano Garzarella To: Jens Axboe Cc: Alexander Viro , io-uring@vger.kernel.org, Stefano Garzarella , Kees Cook , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH for-next] io_uring: fix ctx refcounting in io_uring_enter() Date: Wed, 9 Sep 2020 17:19:00 +0200 Message-Id: <20200909151900.60321-1-sgarzare@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org If the ring is disabled we don't decrease the 'ctx' refcount since we wrongly jump to 'out_fput' label. Instead let's jump to 'out' label where we decrease the 'ctx' refcount. Fixes: 7ec3d1dd9378 ("io_uring: allow disabling rings during the creation") Signed-off-by: Stefano Garzarella --- 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 bd1ac8581d38..8fc44967fd52 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -8645,7 +8645,7 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit, ret = -EBADFD; if (ctx->flags & IORING_SETUP_R_DISABLED) - goto out_fput; + goto out; /* * For SQ polling, the thread will do all submissions and completions.