[Ocfs2-tools-devel] [PATCH] mount.ocfs2: Fix double free problems when remounting a device
Joseph Qi
jiangqi903 at gmail.com
Wed Feb 7 02:01:19 PST 2018
Please use the correct format when sending patch.
Thanks,
Joseph
On 18/2/7 17:48, Shichangkuo wrote:
> Hi, All
> When I remount a device, the issue happens:
> ~# mount -o remount,rw /vms/share
> *** Error in `/sbin/mount.ocfs2': double free or corruption (!prev): 0x0000000000b305a0 ***
> Aborted
> This patch can fix this issue.
>
> Thanks,
> Changkuo
>
> Author: shichangkuo <shi.changkuo at h3c.com>
> Date: Wed Feb 7 17:25:08 2018 +0800
>
> mount.ocfs2: Fix double free problems when remounting a device
>
> We should free the old mnt_opts, and duplicate a new one from instead->mnt_opts.
>
> Signed-off-by: shichangkuo <shi.changkuo at h3c.com>
>
> diff --git a/mount.ocfs2/fstab.c b/mount.ocfs2/fstab.c
> index d3fc617..59cd369 100644
> --- a/mount.ocfs2/fstab.c
> +++ b/mount.ocfs2/fstab.c
> @@ -612,7 +612,8 @@ update_mtab (const char *dir, struct my_mntent *instead) {
> }
> } else {
> /* A remount */
> - mc->m.mnt_opts = instead->mnt_opts;
> + my_free(mc->m.mnt_opts);
> + mc->m.mnt_opts = xstrdup(instead->mnt_opts);
> }
> } else if (instead) {
> /* not found, add a new entry */
> -------------------------------------------------------------------------------------------------------------------------------------
> 本邮件及其附件含有新华三技术有限公司的保密信息,仅限于发送给上面地址中列出
> 的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、
> 或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本
> 邮件!
> This e-mail and its attachments contain confidential information from New H3C, which is
> intended only for the person or entity whose address is listed above. Any use of the
> information contained herein in any way (including, but not limited to, total or partial
> disclosure, reproduction, or dissemination) by persons other than the intended
> recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender
> by phone or email immediately and delete it!
>
>
>
> _______________________________________________
> Ocfs2-tools-devel mailing list
> Ocfs2-tools-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/ocfs2-tools-devel
>
More information about the Ocfs2-tools-devel
mailing list