Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp760091pxb; Tue, 5 Apr 2022 22:07:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypcqF44DX91VQLHKgeX5LIF6Vw7cjBhZbXfZ4cCiG2fyVdHcjbtfcp7o5e6qlrNU/gbdbC X-Received: by 2002:a05:6a00:a15:b0:4fb:4112:870e with SMTP id p21-20020a056a000a1500b004fb4112870emr7000297pfh.11.1649221649895; Tue, 05 Apr 2022 22:07:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649221649; cv=none; d=google.com; s=arc-20160816; b=Q8W8DZDo3FXGsUP2/DeGlCR4F5Q5o0B+wfCGnJcLfOtoQQOr2ysFMB9mYAY5UhHdeX lIDoCZ6mlBINsqnSy4uhXhh9Vg4i7okiT4dRs6rlZR+tgfSeHa5/r4J8KaNRwq4Egjyd pr6sT8jkP+wTGTEowEltZhxMzCiMo1rGXJWiQaShSfgqTTWY3XQAg7ykVZ4hahS/LFUT MpV6VZEsOCCcNVVRlrBVdZW0LNTg6vV8qgjJKT9Lu7MyNEbi87xwayS2zxeB7FGTfb3m gZziT0A/x4ZZOFvm2h8GO7n0ZwZ02kSi0610g/dc0K80m1SIqUVEFY0DsqtEYcs9Etm7 ZhEg== 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=VhT/oeNmQ/UljszaXI1ewnDxpGZUJzTIAvKXsZHtY0o=; b=RdSG/jv9Ex/kSq4P1YOBQ2WtULmThKa7F/Qg7Bre09t+6/jlMHbiUd7qgayKMUarw0 IrviawrKolvgzwOV+JHZyGgypy++0fAQRWq/OyT7PTixFAFN/M7wy2c2zOkgds/466SX y3VCATh9HD2HBRCUS+AA/obItLwOOlA9zIaw10cwwu9f/XFCPHAvhDtpLNrXP3TjI428 ukUQNtOxL5K3+N1j0GEJecysYrmS8V6SXMQaDl5O410F9xF14tpXx8qDkhJ6H0YuJeVJ KB17XzFWFwCg2SqhXqtCpiQyNn9UVH289N3YYJuWE9rCFEnz/072IOmCedityNRci83n pnDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=awDd7S8Y; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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. [23.128.96.19]) by mx.google.com with ESMTPS id a19-20020a63d213000000b003816043f155si14311540pgg.842.2022.04.05.22.07.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 22:07:29 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=awDd7S8Y; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 DFD072545A3; Tue, 5 Apr 2022 20:31:08 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346726AbiDEKns (ORCPT + 99 others); Tue, 5 Apr 2022 06:43:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241100AbiDEIct (ORCPT ); Tue, 5 Apr 2022 04:32:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01BECBC22; Tue, 5 Apr 2022 01:27:29 -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 92E88609D0; Tue, 5 Apr 2022 08:27:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F50FC385A5; Tue, 5 Apr 2022 08:27:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649147248; bh=ym600pmHaeIJVHs5K2CS3Oyi4YbAwbgjm7IvJY8E5Uo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=awDd7S8YY/j5TmJvfJtSPlPqfakjVse2PhvsznR5vuMUPHXG6mUOcCnNJ4j2q+AtO dPcm8y32VfVPpm6d1wo0GyxTlbi5X1PUGbmcoBM1o2o5gBkvLmNuShuLFWrXiFYLvU NHLfY8Mzvo662YivBjEu9p1LUXE0+ale0X+X16Xk= 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.17 1056/1126] io_uring: fix memory leak of uid in files registration Date: Tue, 5 Apr 2022 09:30:03 +0200 Message-Id: <20220405070438.461173517@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070407.513532867@linuxfoundation.org> References: <20220405070407.513532867@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 @@ -8241,6 +8241,7 @@ static int __io_sqe_files_scm(struct io_ fput(fpl->fp[i]); } else { kfree_skb(skb); + free_uid(fpl->user); kfree(fpl); }