Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1984231ybg; Fri, 5 Jun 2020 02:34:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIpwOwLrFHM/MnPk6kulYUA5H5RpZFGLo8LrrtYOPzOLATJLbVCVYvfAGhMfZSL/mnbSV2 X-Received: by 2002:a17:906:4b18:: with SMTP id y24mr7822369eju.366.1591349663479; Fri, 05 Jun 2020 02:34:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591349663; cv=none; d=google.com; s=arc-20160816; b=F5pvBQgNVo+CAmu9Kn+1UimPHiQHZi+aUunyNvsF2fp9Ym3xXYND790ePOe6dIBvvB NKgw7wbm8ZWu3sPwLGzhFQTl30GwSFSiBguqbxUFVdIDKxyEoeDx1xpl3DH1/wuaoEjF 8qKD13NhvPKsKMY/qcXyZq0ryxzccw8K4IwjLCMMp7BP4IOZp3r84Z9G2rPKyON5+C1z zGx2rKZIpV8xLRm+isS3eeH8ljJOyyoifc7OJfpoFKV2XifChonDt2tSu3dSlDa8IRQ0 WeeUgbvVzC/ouDeQUo9kEdCGrzfdMxAZjqDyw+Kn57Myli66ZXImTnNCXswoHiY78df+ o7IQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=g5N2NMGInA2QV9WtqBQogGP0D/D9maNsaZ4YU4uZz48=; b=VzcsKrh1PFSad4iZCh2oxYZzbUkL4NK+6wQl2IyBZCB4voerHG6XPnB0sRnI0yN/SU lcmagYrlWBF5GDK7k8Tu3XRqZEi+EjSYBE0CgcKxIoeiP8xLUuWyJenv+4NpuKfP+Bf5 CHXO7Uz2gHg3KGhvwhGfxW6TncN5qqFcvkKD5jZK9H83+6SoOkv3sNupZZBNvRaffh39 HMYojB7jqC4ofF8zuaZ/Ri7Ys4QFWy3K1tTOUvYkqu6komE6tnBX/pOdtojxBMbAWXXY BcFckW5VO9TKZuCbZvjArliTiKoazOukE0Qn/bbUFX/y0xPNP4U3dTjEV7muuoucfszN rhDQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y21si3289693edt.501.2020.06.05.02.34.00; Fri, 05 Jun 2020 02:34:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726300AbgFEJcN (ORCPT + 99 others); Fri, 5 Jun 2020 05:32:13 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:46001 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726227AbgFEJcN (ORCPT ); Fri, 5 Jun 2020 05:32:13 -0400 Received: by mail-lf1-f65.google.com with SMTP id d7so5376520lfi.12; Fri, 05 Jun 2020 02:32:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=g5N2NMGInA2QV9WtqBQogGP0D/D9maNsaZ4YU4uZz48=; b=NzLa5+wkKlANdW5ackkkf3XLPi2hdBUjA8rrj1vbPEkotEE8H89CtnyowIqTe7/do1 y4aOWk50rPTj3ypnyBYqfb5DDcn04ZUq6RKZyevWbGpTZ8/Y2Cu3Zij8Bcpg4YiHNEHB 0dulLs1pRpoJ1s8fSNzfdgcPFa82fGdfGW+x9cj5cH8jOcU9SFIV22POmKXjGhbQneqJ knO89G4eJ3/b3mT46BJKxkhLdkxjoVPwfv9eT9L9fEA+jSac2pLMvKlN6ZqCcAw2LBIF lCOC787szFCK6DrbR98FkeJA+nrnNHzk4ppWU5/AacY3RaeP4s0sM3cBu6gmZ4OfTQa7 8K4w== X-Gm-Message-State: AOAM530t/30ftGpy1Yk2dZkDVM4AW0s8BX4IywEUr618zjxUUJY1uTOf PEOVVVhOYmS55ow4N3nJdvGHQ2yV X-Received: by 2002:a19:70d:: with SMTP id 13mr4950336lfh.60.1591349530462; Fri, 05 Jun 2020 02:32:10 -0700 (PDT) Received: from localhost.localdomain (broadband-37-110-38-130.ip.moscow.rt.ru. [37.110.38.130]) by smtp.googlemail.com with ESMTPSA id j26sm646272lfp.87.2020.06.05.02.32.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 02:32:09 -0700 (PDT) From: Denis Efremov To: Jens Axboe Cc: Denis Efremov , Mark Rutland , io-uring@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH] io_uring: use kvfree() in io_sqe_buffer_register() Date: Fri, 5 Jun 2020 12:32:03 +0300 Message-Id: <20200605093203.40087-1-efremov@linux.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use kvfree() to free the pages and vmas, since they are allocated by kvmalloc_array() in a loop. Fixes: d4ef647510b1 ("io_uring: avoid page allocation warnings") Cc: stable@vger.kernel.org Signed-off-by: Denis Efremov --- I checked the v1 d4ef647510b1 discussion and these lines are using kvfree() https://lkml.org/lkml/2019/5/1/254. This was somehow missed in v2. fs/io_uring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 9d4bd0d3a080..defb8a3538fc 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -7160,8 +7160,8 @@ static int io_sqe_buffer_register(struct io_ring_ctx *ctx, void __user *arg, ret = 0; if (!pages || nr_pages > got_pages) { - kfree(vmas); - kfree(pages); + kvfree(vmas); + kvfree(pages); pages = kvmalloc_array(nr_pages, sizeof(struct page *), GFP_KERNEL); vmas = kvmalloc_array(nr_pages, -- 2.26.2