Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3251796rwb; Mon, 15 Aug 2022 22:20:54 -0700 (PDT) X-Google-Smtp-Source: AA6agR68PR/m1e34hC9jSefXXdtLQxG2gnds5nX778mSdF2xCIGw1DiXqBrwi+JHoWjP7ucGvkxQ X-Received: by 2002:a63:18d:0:b0:41b:20bc:3139 with SMTP id 135-20020a63018d000000b0041b20bc3139mr16260926pgb.521.1660627254661; Mon, 15 Aug 2022 22:20:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660627254; cv=none; d=google.com; s=arc-20160816; b=ZZTpweaehfothbhF0nU9kK3AaGiquDnptRP2az0Qf+NEv+s4BHnbeq1xG/AlAPY7NA pf24btSCtVQPx0BLlSCvT9SuI/PJcLah9USQcXwR1gqLnSIJmSjP9qhSKmBN0n0fZPv/ aPWqYM01TZVp/IC7TREdeMerhSOcYlZLRyFx7LwdCe6Nr6sYw95sMoOlHIGvxA2GiwS7 1NKILmmELe9vBRBU05e/CjVD7rOePgnw9jv6hDP08vg69DNqcb8dEzxiaoQxLtXbMQTK 0qMUM9MnNll3wd6Y/VCA202xtFxpoAFE4cF8+6EVLFhvKJZIAKaFrrfiEB5wuKi6qFt2 ZvVw== 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=TugCyf40LYyA8fk52ZRPud37QCsLGZIrZLBLlaNzVyc=; b=hSOVov2AuNnbxU81v5qAFuz4qdJF3jFEJqNxG8x3qSRX4uYSDUw+/VjAFxoy+kpRR2 DjhxvFe6xnW26zOJv1LPBrlp+CfsrBSRw4OjFL9tFpAWhW5pab7oDLbPTyfwQnZv2+mf DgzoWeczRy2jv2YrEITzUI5/rioK5blzv8BW7W/Kfs5k2yUWoRaYx4wm4Ooiie+9+Q+1 kkU8YEtecZP1N1c/DwBBMUROHUHAqwxCb4/M/Pc7ei/6a9/K3dZ0dSMAy4ICvcAy9+5f A+kVmmZMHMYaw/+SC7FKCe+6vIu0WF7Rx9WLNtXT7NPaORqTkb0fVBulbQGj6nOEF4sG jOPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AEmpsPwg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 66-20020a630245000000b0041bf0a54ad0si12959744pgc.729.2022.08.15.22.20.43; Mon, 15 Aug 2022 22:20:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AEmpsPwg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231961AbiHPE6c (ORCPT + 99 others); Tue, 16 Aug 2022 00:58:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234052AbiHPE5i (ORCPT ); Tue, 16 Aug 2022 00:57:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC8EFBC10E; Mon, 15 Aug 2022 13:51:42 -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 7E214B811A0; Mon, 15 Aug 2022 20:51:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AEC8CC433D6; Mon, 15 Aug 2022 20:51:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660596701; bh=SineZzm4ZFmCRlgdEIOsofFlLq4uupTwAY6ZGkRMhng=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AEmpsPwg3mIo0qcyd+itiPgeeUDbZpFhavL4BhnyQQE9U+HHmm2LsVa9cePR4STU2 gp2eNgcNQ9iqwyPi8pzrV6CgEYMByDguT4rqUzf6mi2KFRXUFDj5I8TjuSyCNE8pz7 w4nf7f7KNX4S0VPKR2rYSHo5u7+3gbJoh7l9+Po0= 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.19 1156/1157] io_uring: mem-account pbuf buckets Date: Mon, 15 Aug 2022 20:08:32 +0200 Message-Id: <20220815180526.789722614@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 cc18cc5e82033d406f54144ad6f8092206004684 upstream. Potentially, someone may create as many pbuf bucket as there are indexes in an xarray without any other restrictions bounding our memory usage, put memory needed for the buckets under memory accounting. Cc: Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/d34c452e45793e978d26e2606211ec9070d329ea.1659622312.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -5520,7 +5520,7 @@ static int io_provide_buffers(struct io_ bl = io_buffer_get_list(ctx, p->bgid); if (unlikely(!bl)) { - bl = kzalloc(sizeof(*bl), GFP_KERNEL); + bl = kzalloc(sizeof(*bl), GFP_KERNEL_ACCOUNT); if (!bl) { ret = -ENOMEM; goto err;