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...)
> > What would prevent the crash in scatterwalk_done() in that case?
> 
> With external callers the pages are always mapped and therefore
> they have to be unmapped, regardless of whether the actual crypto
> succeeded or not.
> 

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 bytes were processed, this is invalid.  Notably, if no bytes were
processed then walk->offset can be 0, causing a crash.

- Eric

Reply via email to