fcntl: Fix pointer conversion in compat
The compat fcntl handler currently does not perform simple pointer conversions for all of the commands which take a user pointer as an argument.
This commit adds this new case to the switch in the handler, by converting the argument before calling do_fcntl for the relevant commands.
Signed-off-by: Luca Vizzarro Luca.Vizzarro@arm.com --- fs/fcntl.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/fs/fcntl.c b/fs/fcntl.c index 918d0136d12b..5f55eed7793b 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c @@ -654,6 +654,13 @@ static long do_compat_fcntl64(unsigned int fd, unsigned int cmd, break; err = fcntl_setlk(fd, f.file, convert_fcntl_cmd(cmd), &flock); break; + case F_GETOWN_EX: + case F_SETOWN_EX: + case F_GETOWNER_UIDS: + case F_GET_RW_HINT: + case F_SET_RW_HINT: + err = do_fcntl(fd, cmd, (user_uintptr_t)compat_ptr(arg), f.file); + break; default: err = do_fcntl(fd, cmd, arg, f.file); break;
On 15/02/2023 17:11, Luca Vizzarro wrote:
fcntl: Fix pointer conversion in compat
The compat fcntl handler currently does not perform simple pointer conversions for all of the commands which take a user pointer as an argument.
This commit adds this new case to the switch in the handler, by converting the argument before calling do_fcntl for the relevant commands.
Signed-off-by: Luca Vizzarro Luca.Vizzarro@arm.com
fs/fcntl.c | 7 +++++++ 1 file changed, 7 insertions(+)
Merged in next, thanks!
Kevin
diff --git a/fs/fcntl.c b/fs/fcntl.c index 918d0136d12b..5f55eed7793b 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c @@ -654,6 +654,13 @@ static long do_compat_fcntl64(unsigned int fd, unsigned int cmd, break; err = fcntl_setlk(fd, f.file, convert_fcntl_cmd(cmd), &flock); break;
- case F_GETOWN_EX:
- case F_SETOWN_EX:
- case F_GETOWNER_UIDS:
- case F_GET_RW_HINT:
- case F_SET_RW_HINT:
err = do_fcntl(fd, cmd, (user_uintptr_t)compat_ptr(arg), f.file);
default: err = do_fcntl(fd, cmd, arg, f.file); break;break;
linux-morello@op-lists.linaro.org