From: Bart Van Assche <bvanassche@acm.org>
To: Douglas Gilbert <dgilbert@interlog.com>, linux-kernel@vger.kernel.org
Cc: linux-block@vger.kernel.org, axboe@kernel.dk
Subject: Re: [PATCH] sgl_alloc_order: memory leak
Date: Sun, 20 Sep 2020 08:29:39 -0700 [thread overview]
Message-ID: <6376bc21-0542-bdc5-fa30-4a76ab3cbc67@acm.org> (raw)
In-Reply-To: <20200920053607.35002-1-dgilbert@interlog.com>
On 2020-09-19 22:36, Douglas Gilbert wrote:
> Noticed that when sgl_alloc_order() failed with order > 0 that
> free memory on my machine shrank. That function shouldn't call
> sgl_free() on its error path since that is only correct when
> order==0 .
>
> Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
> ---
> lib/scatterlist.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/scatterlist.c b/lib/scatterlist.c
> index 5d63a8857f36..c448642e0f78 100644
> --- a/lib/scatterlist.c
> +++ b/lib/scatterlist.c
> @@ -514,7 +514,7 @@ struct scatterlist *sgl_alloc_order(unsigned long long length,
> elem_len = min_t(u64, length, PAGE_SIZE << order);
> page = alloc_pages(gfp, order);
> if (!page) {
> - sgl_free(sgl);
> + sgl_free_order(sgl, order);
> return NULL;
> }
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
prev parent reply other threads:[~2020-09-20 15:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-20 5:36 Douglas Gilbert
2020-09-20 15:29 ` Bart Van Assche [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6376bc21-0542-bdc5-fa30-4a76ab3cbc67@acm.org \
--to=bvanassche@acm.org \
--cc=axboe@kernel.dk \
--cc=dgilbert@interlog.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®