[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <85e8114b-31a5-ccd6-f1e4-5b23a67987d6@gotplt.org>
Date: Tue, 15 Dec 2020 13:00:27 +0530
From: Siddhesh Poyarekar <siddhesh@...plt.org>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
Florian Weimer <fweimer@...hat.com>
Subject: Re: [PATCH] proc: Escape more characters in /proc/mounts output
On 12/15/20 11:40 AM, Al Viro wrote:
> On Tue, Dec 15, 2020 at 09:54:54AM +0530, Siddhesh Poyarekar wrote:
>
>> + get_user(byte, (const char __user *)data);
>> +
>> + return byte ? strndup_user(data, PATH_MAX) : NULL;
>> }
>
> No. Not to mention anything else, you
> * fetch the same data twice
> * fail to check the get_user() results
>
Ahh sorry, I could inline the strndup_user call and put an additional
check for length == 1 to return NULL. Would that be acceptable?
The other alternative would be to not touch copy_mount_string and
instead, check after fetching the string and if it is blank, free it and
set to NULL. That seems more expensive though.
Siddhesh
Powered by blists - more mailing lists