Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp622365pxb; Tue, 5 Apr 2022 16:16:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfzoXbuiIJL9pBpzpVuveEialphmsmrF+UYn74n5xCpu/FX0q5WXlGZ2dL8oU48xY3dx0Z X-Received: by 2002:a17:90a:db08:b0:1c9:7cf3:6363 with SMTP id g8-20020a17090adb0800b001c97cf36363mr6722628pjv.35.1649200560639; Tue, 05 Apr 2022 16:16:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649200560; cv=none; d=google.com; s=arc-20160816; b=KJai9Evayb9VYzgjdeKbSlkQjNPgBMmtL+56VW2cE2lKnHn4kW+Le8fdca1DClky9R 4EbauKbgSKcTUOmEyX9HDVuolVx96y4aMxZV9yfLbeZKkNEcV1/KtzBYSBmm1YX0urJd hmmnt5nz5EF9hFAl/jnScR/Y26IPn29U275Ws9xhNJTCwvmz04V04r1XxhhlZc+U6QiR k/23V1a3o0uHdm+uQ28F9yjzHOeKeDMx1bDuFDgRykYZqYFx3U+VfS2llVMB9lX4KHhC nSYp1RgWpI9/IrJjz3rPkZ+kKCw0eWQDYm9U6YKa/kAUm9c2k6mgnLejFlTWuneUY+ad JIDg== 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=/EA19ejqXxNotcUQfMKfwbeUI9fq+2HlMgIVZ1/2mdc=; b=sEY35ee0flU4lGzk0Pl+9ms0TVt8JUcVDTiVKPewjJ2agP8R8t5DNLpZkY81uxHNOL bt/r4aSAoNeZDvY6XD05AMZtL/IlkfZ96GwBAVfiOwfJnFYnpr4jIFcx0/6cii9/rVND 11wka0+pxAZYg2UPmTWJKaQ86G07GAmljjpKXGtA566Dw0qVEIBF6CzM2BJ1B+r2mpDY bF5InDXwpVN/VyHAj2gj+rBYP8HtI09O/u+JEYR9nYJ1CRfunW6i8cFqECLZfnyG/yaP gaRQ+L0LXtx2iewSoKsi5XtNRwUD26KvzSkFJwJ6m//BDU4LhGGMUMh4ILoJgT5IiQlP 1Yhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FQ4EUkKy; 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 e123-20020a636981000000b00382773dcd86si13761490pgc.431.2022.04.05.16.16.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 16:16:00 -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=FQ4EUkKy; 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 out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 168B8223223; Tue, 5 Apr 2022 16:00:30 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1391014AbiDENqm (ORCPT + 99 others); Tue, 5 Apr 2022 09:46:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244524AbiDEJ0B (ORCPT ); Tue, 5 Apr 2022 05:26:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF773DE924; Tue, 5 Apr 2022 02:15:20 -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 ams.source.kernel.org (Postfix) with ESMTPS id 0110AB81B14; Tue, 5 Apr 2022 09:15:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 579A3C385A0; Tue, 5 Apr 2022 09:14:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649150099; bh=th3SH/UYN00xmghGQyw0UjvdAJJPxvFTYeHfhhfy0kc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FQ4EUkKylPPxTtpWD7o5Z2q3UhgBWH8LlSgLL1wQxNBqFEcxKs1nJIhczBUBOi6ji bFFRKU699/FidbkF3DgHWbASs15q4sKgAeUzVpFt9DjzlloCqTfr3O+Qz/et3gXmkI G/IXFgrfBJWry7EhDaaKtQ0A0d/zjD/nP2CY3tbI= 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.16 0953/1017] io_uring: fix memory leak of uid in files registration Date: Tue, 5 Apr 2022 09:31:06 +0200 Message-Id: <20220405070422.499082322@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@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 @@ -8180,6 +8180,7 @@ static int __io_sqe_files_scm(struct io_ fput(fpl->fp[i]); } else { kfree_skb(skb); + free_uid(fpl->user); kfree(fpl); }