Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp772748pxb; Tue, 5 Apr 2022 22:42:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxeigEeY7H5bvJF719vDI6KX/2zu+XXN7dcOAGGRtL2QCNlkMfYqNeMAPOp1QxBb46K/5yu X-Received: by 2002:a17:903:18c:b0:154:9ee:cedc with SMTP id z12-20020a170903018c00b0015409eecedcmr7115461plg.123.1649223746172; Tue, 05 Apr 2022 22:42:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649223746; cv=none; d=google.com; s=arc-20160816; b=WGHcjmZ5Ol0T4lLfEVa3yEuugDw/VrCPCkwyL4M2pa0CMWTg7Do/34XUb6JrIR7NXb +VQ/DMpmO9TU9IT7Y1yCta2tbcz9ojiiTd7DkBP6JUand/FQEXXIpDl14NVyU31fcjMf 1emgRdAkzj8URUQMIRH+UxKhM3Agwm0eIfbLVqCamylvMMYWdnFKxN92ahJ1O/wHJpp2 qiuYsHOlITQ8B3yP8ReTzg3PHKUn+nw0KtdmHksr6j1uJ58yd1wGgwaRmuWdqxl7otBj WXjcbV5PcbiduIlHrnODdTI9+Qh79JvFf8ZEqPOa91Gwhkc0jRhAQrg/wAMrnTEA/Fwx iNdg== 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=R2P1l61lFUfRF2LNVhvOIkKlhFtDiEltlpnzjFbOFB8=; b=L1uK+dFDdMLFPP32r2vlaZUWGOJMGlcrSSVL/1zaGOOrfocu9XuEqqf9BXn9612giy mxI1PLTrm2+Nq9cbhmbz8o6zdWYSdmvqafofviPVX+7wg2Cv7VfmYBZKdzqsnAVN0Dqo 4vlywkxrFjdcbXliRlJO8nc4M0izJD33eH5E0a69zXzggifVfaycq7nJscsP1nRbBtLG 5uwXHPv/akOVr1T+aUV8expwC1alH7JDfHDFtIRfHGBwq5hlfz3Q2a7BrC3s+738AL4W MNXpd0zTEdDa7GLf9eAtAbp01XsfR7fFgbbCJ33wm/xkecnAXzghFgtuVpEB1X/yzQXD zVEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vq3gI2XE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id r143-20020a632b95000000b003828506c119si13782766pgr.125.2022.04.05.22.42.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 22:42:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vq3gI2XE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E31DE43E6DC; Tue, 5 Apr 2022 21:47:40 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1588294AbiDFAPO (ORCPT + 99 others); Tue, 5 Apr 2022 20:15:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354147AbiDEKMG (ORCPT ); Tue, 5 Apr 2022 06:12:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62C48515B0; Tue, 5 Apr 2022 02:57:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F15506167E; Tue, 5 Apr 2022 09:57:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E36AC385A1; Tue, 5 Apr 2022 09:57:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649152660; bh=deA0NlTTkvXJXQU/XLDMnmMvOVgcFRhTb4ldcInvRok=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vq3gI2XEmJVjfdHJpZOBIvkmlUoAJai3YE31/igwT2bqTaW7cPCmwDu1K1RUk1Doe w+SpNOdLxAMmpaQnPZXuzs6f+lmAgQ+kD+SF7HcGclrFwNmbo2YcU0isk9tDcOBhqx hoRDiyfQQfbjBPBsOTxnqe7PnwMf4k/ckUDycfpA= 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.15 856/913] io_uring: fix memory leak of uid in files registration Date: Tue, 5 Apr 2022 09:31:58 +0200 Message-Id: <20220405070405.487304291@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pavel Begunkov commit c86d18f4aa93e0e66cda0e55827cd03eea6bc5f8 upstream. When there are no files for __io_sqe_files_scm() to process in the range, it'll free everything and return. However, it forgets to put uid. Fixes: 08a451739a9b5 ("io_uring: allow sparse fixed file sets") Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/accee442376f33ce8aaebb099d04967533efde92.1648226048.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- fs/io_uring.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -8130,6 +8130,7 @@ static int __io_sqe_files_scm(struct io_ fput(fpl->fp[i]); } else { kfree_skb(skb); + free_uid(fpl->user); kfree(fpl); }