Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp408306pxk; Wed, 9 Sep 2020 08:25:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqHjYmLzy3IR4ngrNE5vxpKYFwDGqHpN+Fd1JqeBT2XTd5OuCIYJwx4W6KgEKPrhoGFCh9 X-Received: by 2002:a17:906:488d:: with SMTP id v13mr4129699ejq.524.1599665134927; Wed, 09 Sep 2020 08:25:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599665134; cv=none; d=google.com; s=arc-20160816; b=aDVQWLgFatLLiZXDKwFqrJ215At3KS4Mx5rtNfGg8heLZuf/0INSM3tq6oQzOJjxc0 b3p/unGvBIhk7qRmLX26qJNHd3ALAHXVScTq/ZDwH/hc5i4lsME960YT0F+msrptFSac U1LIUJqk6/9kZCzcYeJ+Z5t6KcHrouP3th6mjNAmPO96rI2j4BBweeD/Gg+SeeyCZ3Ty ENHVGozKtrw5vendURvzwP2SQxMKmr1efgetRPJ9MthNirlPLtdqfmzIOY6YwY/Cqj5+ FV3JSrab1GgEe/9rKBP723Fy1wcs/ZvFlD2gT6i/kuR/OrXre9OmBtQwZI+KpJ0udCvn f3ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=sbe1MYStSybtVRq6YvsVpm4HxML9pRlo3wGjsU8lVrI=; b=iiXGUKjfIgm3gN7zf18IgEH98458xgqVl7m0d6urLDa/7+dC3lVyZYy47C/almJyPq 25EeAurWQfXId79Ok+GYHcxlSJ1kCsSiVWN+YAAHqi/EC5p9Hx1pA0kpOeqZ/82zgoGl RuLIClr2xFVRoGmBMvB578yDgHvZrqlun3PagTQBOTqrTu5YlWInINMXtA+LYIM0+6ej 5I4IBq7VzCGQ1IlV2RkKAe3s46ppwE/HkQa0FCkvtfpOgW+yKkRbugWPIKKPsg4cbFP2 T0g2tWJZNQB373IiR7d3cPaooF5Qv33Gnmi79BtF/u75OUTotQIKFwuNAgWJkw120TPF J2GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SImLyaqc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h9si1772322edv.170.2020.09.09.08.25.11; Wed, 09 Sep 2020 08:25:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SImLyaqc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729990AbgIIPXY (ORCPT + 99 others); Wed, 9 Sep 2020 11:23:24 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:21222 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728611AbgIIPWJ (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 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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. -- 2.26.2