From: Phillip Lougher <phillip@lougher.demon.co.uk>
To: "Geyslan Gregório Bem" <geyslan@gmail.com>
Cc: phillip@squashfs.org.uk, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH] double free in decompressor.c
Date: Fri, 22 Nov 2013 23:25:57 +0000 [thread overview]
Message-ID: <528FE805.1080001@lougher.demon.co.uk> (raw)
In-Reply-To: <CAGG-pURFGv2my_u8Okv5bft1SzpyGH8ccYYonjTFuZ7D=92x1g@mail.gmail.com>
On 22/11/13 21:50, Geyslan Gregório Bem wrote:
> Coverity caught double free possibility (CID 1130962).
>
> I can patch this, but I have to know if is correct to free comp_opts
> in the function squashfs_decompressor_create() or it had to be done in
> the caller. My bet is the caller.
>
>
> 128void *squashfs_decompressor_setup(struct super_block *sb, unsigned
> short flags)
> 129{
> 130 struct squashfs_sb_info *msblk = sb->s_fs_info;
> 131 void *stream, *comp_opts = get_comp_opts(sb, flags);
> 132
>
> 1. Condition "IS_ERR(comp_opts)", taking false branch
> 133 if (IS_ERR(comp_opts))
> 134 return comp_opts;
> 135
>
> 2. freed_arg: "squashfs_decompressor_create(struct squashfs_sb_info *,
> void *)" frees "comp_opts".[show details]
> 136 stream = squashfs_decompressor_create(msblk, comp_opts);
>
> 3. Condition "IS_ERR(stream)", taking true branch
> 137 if (IS_ERR(stream))
FALSE positive.
squashfs_decompressor_create() frees comp_opts only on success.
If IS_ERR(stream) is true, then comp_opts has not been freed by
squashfs_decompressor_create().
Phillip
>
> CID 1130962 (#1 of 1): Double free (USE_AFTER_FREE)4. double_free:
> Calling "kfree(void const *)" frees pointer "comp_opts" which has
> already been freed.
> 138 kfree(comp_opts);
> 139
> 140 return stream;
> 141}
>
>
next prev parent reply other threads:[~2013-11-22 23:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-22 21:50 Geyslan Gregório Bem
2013-11-22 21:59 ` Richard Weinberger
2013-11-22 22:14 ` Geyslan Gregório Bem
2013-11-22 23:25 ` Phillip Lougher [this message]
2013-11-23 1:14 ` Geyslan Gregório Bem
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=528FE805.1080001@lougher.demon.co.uk \
--to=phillip@lougher.demon.co.uk \
--cc=geyslan@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=phillip@squashfs.org.uk \
/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
all inboxes | Powered by JetHome®