[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAKYAXd9qWfLntfuUnhZdEsL2u428=GZ=DDu2V9S518YjKXEFMw@mail.gmail.com>
Date: Tue, 8 Nov 2011 08:42:53 +0900
From: NamJae Jeon <linkinjeon@...il.com>
To: Theodore Tso <tytso@....edu>
Cc: linux-kernel@...r.kernel.org, linux-ext4@...r.kernel.org
Subject: Re: [PATCH v2] ext4: fix NULL pointer dereference from orig_data in
fill_super and remount.
2011/11/8 Theodore Tso <tytso@....edu>:
>
> 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.
Okay, I understand clearly.
Thanks.
>
> Best regards,
>
> -- Ted
>
>
--
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