kernel: fix mount arguments checks from userland

Since NULL is not considered a user address anymore, we must check for
it first.

This fixes the "mount: Bad address" error after hrev52905.

Change-Id: If60ea58bb81b6c35c6bf27ecfa9b29bd7a25d8aa
This commit is contained in:
François Revol 2019-02-21 03:13:24 +01:00
parent fe9e1e0c4f
commit 38c4c8bfa9

View File

@ -8789,9 +8789,7 @@ _user_mount(const char* userPath, const char* userDevice,
char* args = NULL;
status_t status;
if (!IS_USER_ADDRESS(userPath)
|| !IS_USER_ADDRESS(userFileSystem)
|| !IS_USER_ADDRESS(userDevice))
if (!IS_USER_ADDRESS(userPath))
return B_BAD_ADDRESS;
if (path.InitCheck() != B_OK || device.InitCheck() != B_OK)
@ -8803,12 +8801,18 @@ _user_mount(const char* userPath, const char* userDevice,
return status;
if (userFileSystem != NULL) {
if (!IS_USER_ADDRESS(userFileSystem))
return B_BAD_ADDRESS;
status = user_copy_name(fileSystem, userFileSystem, sizeof(fileSystem));
if (status != B_OK)
return status;
}
if (userDevice != NULL) {
if (!IS_USER_ADDRESS(userDevice))
return B_BAD_ADDRESS;
status = user_copy_name(device.LockBuffer(), userDevice,
B_PATH_NAME_LENGTH);
if (status != B_OK)