From: Vlastimil Babka <vbabka@suse.cz>
To: Colin King <colin.king@canonical.com>,
Seth Jennings <sjenning@redhat.com>,
Dan Streetman <ddstreet@ieee.org>,
Vitaly Wool <vitaly.wool@konsulko.com>,
Andrew Morton <akpm@linux-foundation.org>,
Tian Tao <tiantao6@hisilicon.com>,
Stephen Rothwell <sfr@canb.auug.org.au>,
linux-mm@kvack.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] mm/zswap: fix potential uninitialized pointer read on tmp
Date: Thu, 28 Jan 2021 16:18:23 +0100 [thread overview]
Message-ID: <2dee1f77-863b-e7aa-a3d2-bb4591d4f720@suse.cz> (raw)
In-Reply-To: <20210128141728.639030-1-colin.king@canonical.com>
On 1/28/21 3:17 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> In the case where zpool_can_sleep_mapped(pool) returns 0
> then tmp is not allocated and tmp is then an uninitialized
> pointer. Later if entry is null, tmp is freed, hence free'ing
> an uninitialized pointer. Fix this by ensuring tmp is initialized
> to NULL.
>
> Addresses-Coverity: ("Uninitialized pointer read")
> Fixes: 908aa806dba0 ("mm/zswap: fix potential memory leak")
That's a linux-next hash, patch is in mmotm [1] *) You know what it means...
*) actually it's not there, yet it is in -next. What's going on?
[1]
https://ozlabs.org/~akpm/mmotm/broken-out/mm-zswap-fix-potential-memory-leak.patch
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> mm/zswap.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/zswap.c b/mm/zswap.c
> index 8d1381b1178d..578d9f256920 100644
> --- a/mm/zswap.c
> +++ b/mm/zswap.c
> @@ -935,7 +935,7 @@ static int zswap_writeback_entry(struct zpool *pool, unsigned long handle)
> struct scatterlist input, output;
> struct crypto_acomp_ctx *acomp_ctx;
>
> - u8 *src, *tmp;
> + u8 *src, *tmp = NULL;
> unsigned int dlen;
> int ret;
> struct writeback_control wbc = {
>
next prev parent reply other threads:[~2021-01-28 15:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-28 14:17 [PATCH][next] mm/zswap: fix potential uninitialized pointer read on tmp Colin King
2021-01-28 15:18 ` Vlastimil Babka [this message]
2021-01-28 20:51 ` Andrew Morton
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=2dee1f77-863b-e7aa-a3d2-bb4591d4f720@suse.cz \
--to=vbabka@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=colin.king@canonical.com \
--cc=ddstreet@ieee.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=sfr@canb.auug.org.au \
--cc=sjenning@redhat.com \
--cc=tiantao6@hisilicon.com \
--cc=vitaly.wool@konsulko.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;
as well as URLs for NNTP newsgroup(s).