From: Theodore Tso <tytso@MIT.EDU>
To: NamJae Jeon <linkinjeon@gmail.com>
Cc: Theodore Tso <tytso@MIT.EDU>,
linux-kernel@vger.kernel.org, linux-ext4@vger.kernel.org
Subject: Re: [PATCH v2] ext4: fix NULL pointer dereference from orig_data in fill_super and remount.
Date: Mon, 7 Nov 2011 18:33:14 -0500 [thread overview]
Message-ID: <E08B31F5-C43D-4145-BC38-C1C967CDD18E@MIT.EDU> (raw)
In-Reply-To: <CAKYAXd_u813Q0k1iMMnfwORxXYDEBtpaKMig1FGBOKpNW3s3rg@mail.gmail.com>
On Nov 7, 2011, at 6:06 PM, NamJae Jeon wrote:
> if(data) {
> orig_data = kstrdup(data, GFP_KERNEL);
> if(!orig_data)
> return ret;
> }
As I said earlier, the use of kstrdup() in the ext4 mount code is so that we can print the mount options used in the mount request. So if the kstrdup() fails, the worst that will happen is that the printk will print the the mount had no mount options, instead of the mount options which had been passed this might be misleading, but it's not the end of the world; it's only a cosmetic issue. But if the kstrdup() failed, the other memory allocations (that in general will be for much more memory) will also fail, so the mount will return ENOMEM before ever getting to the printjk. So a pendant might make the above change, but in practice it's not really that important to do that particular checking in this case.
This is why it's important to really understand the code in question instead of just posting patches without understanding the underlying code, and understanding what might or might not go wrong both before applying the patch, and after applying the patch. And of course, testing all of the use cases is also really important.
Best regards,
-- Ted
next prev parent reply other threads:[~2011-11-07 23:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-07 14:01 Namjae Jeon
2011-11-07 15:03 ` Srivatsa S. Bhat
2011-11-07 15:19 ` Ted Ts'o
2011-11-07 23:06 ` NamJae Jeon
2011-11-07 23:33 ` Theodore Tso [this message]
2011-11-07 23:42 ` NamJae Jeon
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=E08B31F5-C43D-4145-BC38-C1C967CDD18E@MIT.EDU \
--to=tytso@mit.edu \
--cc=linkinjeon@gmail.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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®