lkml.org 
[lkml]   [2017]   [Nov]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: general protection fault in af_alg_free_areq_sgls
On Tue, Nov 28, 2017 at 10:10:55AM +0100, Stephan Mueller wrote:
> > diff --git a/crypto/af_alg.c b/crypto/af_alg.c
> > index 358749c38894..415a54ced4d6 100644
> > --- a/crypto/af_alg.c
> > +++ b/crypto/af_alg.c
> > @@ -672,14 +672,15 @@ void af_alg_free_areq_sgls(struct af_alg_async_req
> > *areq) }
> >
> > tsgl = areq->tsgl;
> > - for_each_sg(tsgl, sg, areq->tsgl_entries, i) {
> > - if (!sg_page(sg))
> > - continue;
> > - put_page(sg_page(sg));
> > - }
> > + if (tsgl) {
> > + for_each_sg(tsgl, sg, areq->tsgl_entries, i) {
> > + if (!sg_page(sg))
> > + continue;
> > + put_page(sg_page(sg));
> > + }
> >
> > - if (areq->tsgl && areq->tsgl_entries)
>
> Why do you want to remove the check for areq->tsgl_entries? I know in the
> current code that cannot happen. But it should be caught in case of a
> programming error.
>
> Thus, should we add a BUG_ON(!areq->tsgl_entries)?
>

sock_kfree_s() works even if the size is 0. So there's no reason to check.

Eric

\
 
 \ /
  Last update: 2017-11-28 19:40    [W:0.133 / U:1.576 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site