Re: crypto: skcipher - Unmap pages after an external error

2019-09-05 Thread Herbert Xu
On Thu, Sep 05, 2019 at 06:57:53PM -0700, Eric Biggers wrote: > > That's not what I'm talking about. I'm talking about flushing the page, in > scatterwalk_done(). It assumes the page that was just processed was: > > sg_page(walk->sg) + ((walk->offset - 1) >> PAGE_SHIFT) > > But if no byte

Re: crypto: skcipher - Unmap pages after an external error

2019-09-05 Thread Eric Biggers
On Thu, Sep 05, 2019 at 03:40:32PM +1000, Herbert Xu wrote: > On Wed, Sep 04, 2019 at 10:22:17PM -0700, Eric Biggers wrote: > > > > Okay, but what about external callers that pass in an error? (I mean, I > > don't > > actually see any currently, but the point of this patch is to allow it...) > >

Re: crypto: skcipher - Unmap pages after an external error

2019-09-04 Thread Herbert Xu
On Wed, Sep 04, 2019 at 10:22:17PM -0700, Eric Biggers wrote: > > Okay, but what about external callers that pass in an error? (I mean, I don't > actually see any currently, but the point of this patch is to allow it...) > What would prevent the crash in scatterwalk_done() in that case? With exte

Re: crypto: skcipher - Unmap pages after an external error

2019-09-04 Thread Eric Biggers
On Wed, Sep 04, 2019 at 08:36:41AM +1000, Herbert Xu wrote: > On Tue, Sep 03, 2019 at 08:50:20AM -0500, Eric Biggers wrote: > > > > Doesn't this re-introduce the same bug that my patch fixed -- that > > scatterwalk_done() could be called after 0 bytes processed, causing a crash > > in > > scatterw

Re: crypto: skcipher - Unmap pages after an external error

2019-09-03 Thread Herbert Xu
On Tue, Sep 03, 2019 at 08:50:20AM -0500, Eric Biggers wrote: > > Doesn't this re-introduce the same bug that my patch fixed -- that > scatterwalk_done() could be called after 0 bytes processed, causing a crash in > scatterwalk_pagedone()? No because that crash is caused by the internal calls to t

Re: crypto: skcipher - Unmap pages after an external error

2019-09-03 Thread Eric Biggers
On Tue, Sep 03, 2019 at 04:54:38PM +1000, Herbert Xu wrote: > int skcipher_walk_done(struct skcipher_walk *walk, int err) > { > - unsigned int n; /* bytes processed */ > - bool more; > - > - if (unlikely(err < 0)) > - goto finish; > + unsigned int n = walk->nbytes - er