All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers3@gmail.com>
To: Stephan Mueller <smueller@chronox.de>
Cc: syzbot
	<bot+ff72ab869817b6ea60bc570f638ee030f4fc73e5@syzkaller.appspotmail.com>,
	davem@davemloft.net, herbert@gondor.apana.org.au,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	syzkaller-bugs@googlegroups.com
Subject: Re: general protection fault in af_alg_free_areq_sgls
Date: Tue, 28 Nov 2017 10:39:32 -0800	[thread overview]
Message-ID: <20171128183932.GA45321@gmail.com> (raw)
In-Reply-To: <2008707.GtIZiUutxC@tauon.chronox.de>

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

  reply	other threads:[~2017-11-28 18:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <001a1140f578d9710d055efb76a9@google.com>
2017-11-28  9:02 ` general protection fault in af_alg_free_areq_sgls Eric Biggers
2017-11-28  9:10   ` Stephan Mueller
2017-11-28 18:39     ` Eric Biggers [this message]
2017-11-29  5:23   ` Herbert Xu
2017-11-29 19:51     ` Eric Biggers
2017-11-30  7:16       ` Herbert Xu
2017-12-01 18:01 ` syzbot
2017-12-01 19:06   ` Eric Biggers

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=20171128183932.GA45321@gmail.com \
    --to=ebiggers3@gmail.com \
    --cc=bot+ff72ab869817b6ea60bc570f638ee030f4fc73e5@syzkaller.appspotmail.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=smueller@chronox.de \
    --cc=syzkaller-bugs@googlegroups.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.