public inbox for linux-crypto@vger.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Pavel Skripkin <paskripkin@gmail.com>
Cc: dhowells@redhat.com, herbert@gondor.apana.org.au,
	davem@davemloft.net, pabeni@redhat.com,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	syzbot+cba21d50095623218389@syzkaller.appspotmail.com
Subject: Re: [PATCH] crypto: fix uninit-value in af_alg_free_resources
Date: Mon, 14 Aug 2023 09:26:49 +0100	[thread overview]
Message-ID: <3954480.1692001609@warthog.procyon.org.uk> (raw)
In-Reply-To: <20230813122344.14142-1-paskripkin@gmail.com>

Pavel Skripkin <paskripkin@gmail.com> wrote:

> Syzbot was able to trigger use of uninitialized memory in
> af_alg_free_resources.
> 
> Bug is caused by missing initialization of rsgl->sgl.need_unpin before
> adding to rsgl_list. Then in case of extract_iter_to_sg() failure, rsgl
> is left with uninitialized need_unpin which is read during clean up

Looks feasible :-).

> +		rsgl->sgl.need_unpin = 0;
> +

The blank line isn't really necessary and it's a bool, so can you use 'false'
rather than '0'?

Alternatively, it might be better to move:

		rsgl->sgl.need_unpin =
			iov_iter_extract_will_pin(&msg->msg_iter);

up instead.

David


  reply	other threads:[~2023-08-14  8:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-13 12:23 [PATCH] crypto: fix uninit-value in af_alg_free_resources Pavel Skripkin
2023-08-14  8:26 ` David Howells [this message]
2023-08-14 18:04   ` Pavel Skripkin
2023-08-14 18:03 ` [PATCH v2] " Pavel Skripkin
2023-08-18 10:33   ` Herbert Xu
2023-08-18 13:21   ` David Howells

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=3954480.1692001609@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=paskripkin@gmail.com \
    --cc=syzbot+cba21d50095623218389@syzkaller.appspotmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox