Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4306267pxu; Tue, 1 Dec 2020 01:27:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJxZfho5c+3o7eLD1W8Quxemc/L9MG6FryVfsasHpxzNo1ssBaIXFcaDsw/taJ0grjWYuMpk X-Received: by 2002:a05:6402:1d12:: with SMTP id dg18mr2094289edb.238.1606814822310; Tue, 01 Dec 2020 01:27:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606814822; cv=none; d=google.com; s=arc-20160816; b=iK6JAldA1nNOyRyjQRDblMe0hTpXTWFiAhP4QCEp60bpnPt6Zf0IxPWf5B0qclfYWc N1KB1sz6n0+2VAKB16XFmp/4Jd1XQC8kxH3KNHPQZnhh7HemxLyGzAf5Ru6J645h/kEg F0DgAQvOCp3pDkx3bIM5eSp7mkbucB42UzGkYqh0xX2jJeo0z1p+WAqv0tm4QncJ1Fk1 ChGTsHQ90Dg9D7fEESTwkhfK8SMq5DmPqiBdJGy8knNPRvBvc55NmilF7qy9b+Y1h5j0 x7rCfHn/YM9Rd6pZlPkRFWwaEBla5WLUtj+m8zKXNo3fcdZVyoCls0n8sR+blN3teodP Xirw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZHha1LoDXBRUZL9NlvY7u2wO8+8w/Aqw3TWOHPggQn8=; b=xDkAVI+ZguVOw2oLdoEzktW/O/XUyxVcFjjK65K+W9XupcjQnuANTjM5M2oM2LNr6/ KHqOZ+X7iNfXJ+gyQq7JVFEpSyDSkx7hfmvjdHy6KjA7cbcL7JkAVmXhWK0cYR1yg056 N+ZdHeggFfnI+/oUozc/PDGcj6saQXBWZMnSXxcgF7JVh/tRswVlsmlOO4jXowQD1clC //dWy6YH65bedxGiMoo3qepXAEU4cNaUKinxTGNHzJmHco2vyRuyyZb3Y9s7FKvyYPYU Lgt+oHYuAbpKKXeZKauHsbEkhyUUKlJTE9PVy0Ww2C0HyF1kR1Y5vYnUhbF9naD57wX/ D08A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xGLXTVci; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z18si696389edi.229.2020.12.01.01.26.39; Tue, 01 Dec 2020 01:27:02 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=xGLXTVci; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390507AbgLAJWg (ORCPT + 99 others); Tue, 1 Dec 2020 04:22:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:45220 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389155AbgLAJH5 (ORCPT ); Tue, 1 Dec 2020 04:07:57 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D04732067D; Tue, 1 Dec 2020 09:07:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606813637; bh=VAJnG8/aAnLqoLfCaMnKUy66gVg40xhpH/2wKr56+vU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xGLXTVciPyo+KhqevRxp0/BRnjDM1oC6pPhdLWwFZhd9FOxC11AuxuDhH1vgcAFpt Vb87yzgXTd4LzcKpXPeykvsWtJqVBKbV8S/SiEUCsip3Bz1W4i0i7lZmpmSs46Cmps /HbVNmwI46WJxjjOTj8hctff23C4HeTj8nBz99+g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Begunkov , Jens Axboe Subject: [PATCH 5.9 001/152] io_uring: get an active ref_node from files_data Date: Tue, 1 Dec 2020 09:51:56 +0100 Message-Id: <20201201084711.858351374@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201201084711.707195422@linuxfoundation.org> References: <20201201084711.707195422@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pavel Begunkov commit 1e5d770bb8a23dd01e28e92f4fb0b1093c8bdbe6 upstream. An active ref_node always can be found in ctx->files_data, it's much safer to get it this way instead of poking into files_data->ref_list. Signed-off-by: Pavel Begunkov Cc: stable@vger.kernel.org # v5.7+ Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- fs/io_uring.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -6854,9 +6854,8 @@ static int io_sqe_files_unregister(struc return -ENXIO; spin_lock(&data->lock); - if (!list_empty(&data->ref_list)) - ref_node = list_first_entry(&data->ref_list, - struct fixed_file_ref_node, node); + ref_node = container_of(data->cur_refs, struct fixed_file_ref_node, + refs); spin_unlock(&data->lock); if (ref_node) percpu_ref_kill(&ref_node->refs);