[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGG-pURFGv2my_u8Okv5bft1SzpyGH8ccYYonjTFuZ7D=92x1g@mail.gmail.com>
Date: Fri, 22 Nov 2013 19:50:44 -0200
From: Geyslan Gregório Bem <geyslan@...il.com>
To: phillip@...ashfs.org.uk
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: [RFC PATCH] double free in decompressor.c
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))
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}
--
Regards,
Geyslan G. Bem
hackingbits.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists