From: "Stephan Müller" <smueller@chronox.de>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: linux-crypto@vger.kernel.org
Subject: Re: [PATCH] crypto: AF_ALG - fix memory management of aio with multiple iocbs
Date: Fri, 16 Dec 2016 13:27:50 +0100 [thread overview]
Message-ID: <2916745.RxhEJByb92@tauon.atsec.com> (raw)
In-Reply-To: <20161216115436.GA19917@gondor.apana.org.au>
Am Freitag, 16. Dezember 2016, 19:54:36 CET schrieb Herbert Xu:
Hi Herbert,
> On Tue, Dec 13, 2016 at 09:42:45PM +0100, Stephan Müller wrote:
> > + /*
> > + * The async operation may have processed only a subset of
> > + * the data that was initially received from the caller.
> > + * Thus, we only can release the data that a cipher operation
> > + * processed.
> > + */
> > + if (len < sg->length) {
> > + /* ensure that empty SGLs are not referenced any more */
> > + sreq->tsg = sg;
>
> Hmm if you change sreq->tsg how is the original tsg ever going to
> get freed?
You are right, this will introduce a memleak. But with the immediate freeing
of sreq->tsg in the current code, the AIO interface cannot support multiple
IOCBs.
Thus, the entire memory handling in the AIO case seems broken.
>
> > +
> > + /* advance the buffers to the unprocessed data */
> > + sg->length -= len;
> > + sg->offset += len;
> > + return;
> > + }
> > +
> > + len -= sg->length;
> > + put_page(page);
> > + }
> >
> > kfree(sreq->tsg);
>
> Thanks,
Ciao
Stephan
next prev parent reply other threads:[~2016-12-16 12:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-13 20:42 [PATCH] crypto: AF_ALG - fix memory management of aio with multiple iocbs Stephan Müller
2016-12-16 11:54 ` Herbert Xu
2016-12-16 12:27 ` Stephan Müller [this message]
2016-12-16 12:31 ` Herbert Xu
2016-12-16 13:58 ` Stephan Müller
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=2916745.RxhEJByb92@tauon.atsec.com \
--to=smueller@chronox.de \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@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;
as well as URLs for NNTP newsgroup(s).