Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3044431rwb; Mon, 15 Aug 2022 16:48:12 -0700 (PDT) X-Google-Smtp-Source: AA6agR5Wx3duznxAxo4YBdT3qLw6VgWZj2rKd2/6JeDNc76OOPiAzrO8nRE06iDkttx6Xi1+g1Uz X-Received: by 2002:a17:903:188:b0:16f:102d:a62 with SMTP id z8-20020a170903018800b0016f102d0a62mr18881304plg.33.1660607292309; Mon, 15 Aug 2022 16:48:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660607292; cv=none; d=google.com; s=arc-20160816; b=JfLGnfYN+3GW7/bNSMaV/quRjtAAhvo3Rk6UKzI1um20Pr/7DBSRkBvBRYPmqiyCiN G7srC2yb+u4wiN2J3ONw9sxqosPT9k9d55O5ewhEHyxZvbSM4SDmCQ/WkTYtSVScAO4h uuz4EPTYs9KCeeemcKyLyi2zoTIKSsB+qcPJm5tiU/MmPZzX+r5Ojo//jjD1vf10tIUF l3V7lPG9UxmcvHMZm8l5pZGnlp8e53M2CJ0VexSyXQ5K1tamwrtXMHS55v73M33F9oaJ 5g2nQGYAlhZfViBtJSgWrTu2ME4m2rm3Ye5dg52euluYtv8az0c1AGl5qN6rz9lIdjMc o1nQ== 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=7rAQIeI+KZPHbcDbPENVz3QUbzjyjAgY+Z/UaElnwMQ=; b=qz06tw5ylZRRGFy60F9/7yU4dTXy5ro13L9v2majAkCt0+w7VOa8eOdp3XPMXI6/JH A1RnQzvANv9rtnOjLPodkNE2gFAMFLV1NZZtUMEeCmgDB/SAXF3DDbnseRmvo4UqWpBd gIs2I8h+2sEvNllmZeJxBjGcaB5ACWOfDMXl4sJcaMD1VSMFyawi7DETfPllL/EYWBgZ 0oVNd1PDIS9CW43oMUV8dPit4w3lO8iKCMYUObcmuqsWbt+DaBSwhpYYLILan5uDrTx8 CrkF0rgHirKPDwlxsVdmWAkvZJroN2p6L2FMRgV1lcNT2zvAihj3+8Zv72O0I3mqKoMB WHSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="x9rYiX/v"; 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 ip7-20020a17090b314700b001e887404411si19202904pjb.8.2022.08.15.16.47.59; Mon, 15 Aug 2022 16:48:12 -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="x9rYiX/v"; 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 S1354671AbiHOXqJ (ORCPT + 99 others); Mon, 15 Aug 2022 19:46:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354315AbiHOXlw (ORCPT ); Mon, 15 Aug 2022 19:41:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03BE62C64D; Mon, 15 Aug 2022 13:12:17 -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 BC76FB80EA9; Mon, 15 Aug 2022 20:12:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FC26C433D6; Mon, 15 Aug 2022 20:12:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594334; bh=WkeaMXg8g2mDWR9wbrsSqC/qSPKJQjDfLTRD4TGn7zs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x9rYiX/vwMDh9S3NQigifed4vlelYja8A/rWjOzlezFGhIA+P5XHDg234CbNJgJVJ UxYbu/W2VQF6mKjDFpEDicSTJH2gKXWtjJIq1OUznFcvSzcUKTcw8AaDrvP3LtivmT 0Ne7HDXh94BuHAzH+QSpXMh/zUdEKcyvjieZ6lmU= 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.18 1094/1095] io_uring: mem-account pbuf buckets Date: Mon, 15 Aug 2022 20:08:13 +0200 Message-Id: <20220815180514.265719320@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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 @@ -4927,7 +4927,7 @@ static int io_provide_buffers(struct io_ bl = io_buffer_get_list(ctx, p->bgid); if (unlikely(!bl)) { - bl = kmalloc(sizeof(*bl), GFP_KERNEL); + bl = kzalloc(sizeof(*bl), GFP_KERNEL_ACCOUNT); if (!bl) { ret = -ENOMEM; goto err;