From: Chen Gang <gang.chen@asianux.com>
To: Theodore Ts'o <tytso@mit.edu>
Cc: jack@suse.cz, akpm@linux-foundation.org, linux-ext4@vger.kernel.org
Subject: Re: [PATCH] fs/ext3: set pointer = NULL, after kfree it
Date: Wed, 26 Dec 2012 10:33:12 +0800 [thread overview]
Message-ID: <50DA61E8.5090009@asianux.com> (raw)
In-Reply-To: <20121225185155.GE5318@thunk.org>
于 2012年12月26日 02:51, Theodore Ts'o 写道:
> On Mon, Dec 24, 2012 at 01:58:14PM +0800, Chen Gang wrote:
>>
>> set s->base = NULL, after kfree it.
>>
>> Signed-off-by: Chen Gang <gang.chen@asianux.com>
>
> Was this to fix something flagged by some static code checker? The
> only caller of ext3_xattr_block_set() is ext3_xattr_set_handle(), and
> s->base is stored on the stack, and as soon as ext3_xattr_block_set()
> returns, the object will disappear. So it seems pretty hard to see
> how this could lead to a use-after-free bug.
>
> - Ted
>
>
this patch is not for a bug
it is only for coding habit:
it is better to set is to NULL, after kfree it.
in the future, if another functions need call ext3_xattr_block_set, too.
it will avoid another members to make mistake.
since it is not for fixing bug, it is really a minor patch.
I can understand if you do not apply it.
--
Chen Gang
Asianux Corporation
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2012-12-26 2:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-24 5:58 [PATCH] fs/ext3: set pointer = NULL, after kfree it Chen Gang
2012-12-25 18:51 ` Theodore Ts'o
2012-12-26 2:33 ` Chen Gang [this message]
2012-12-31 15:19 ` Jan Kara
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=50DA61E8.5090009@asianux.com \
--to=gang.chen@asianux.com \
--cc=akpm@linux-foundation.org \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.