diff mbox

[v2] linux-user/syscall.c: Need call unlock_user() before go to failure return in default case

Message ID 54C4322A.3060704@sunrus.com.cn
State New
Headers show

Commit Message

Chen Gang Jan. 25, 2015, midnight UTC
In abi_long do_ioctl_dm(), after calls lock_user(), it does not call
unlock_user() before go to failure return in default case.

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
 linux-user/syscall.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Peter Maydell Jan. 25, 2015, 12:38 p.m. UTC | #1
On 25 January 2015 at 00:00, Chen Gang S <gang.chen@sunrus.com.cn> wrote:
> In abi_long do_ioctl_dm(), after calls lock_user(), it does not call
> unlock_user() before go to failure return in default case.
>
> Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
> ---
>  linux-user/syscall.c | 2 ++
>  1 file changed, 2 insertions(+)
Michael Tokarev Jan. 27, 2015, 5:24 p.m. UTC | #2
25.01.2015 03:00, Chen Gang S wrote:
> In abi_long do_ioctl_dm(), after calls lock_user(), it does not call
> unlock_user() before go to failure return in default case.

Applied to -trivial, with the following description (modified just slightly,
I tried to keep original wording as much as possible):

    linux-user/syscall.c: do_ioctl_dm: Need to call unlock_user() before going to failure return in default case

    In abi_long do_ioctl_dm(), after lock_user() call, the code does
    not call unlock_user() before going to failure return in default case.

Thank you!

/mjt

> Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
> ---
>  linux-user/syscall.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index a427f7a..ec9e4fc 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -3566,6 +3566,7 @@ static abi_long do_ioctl_dm(const IOCTLEntry *ie, uint8_t *buf_temp, int fd,
>      }
>      default:
>          ret = -TARGET_EINVAL;
> +        unlock_user(argptr, guest_data, 0);
>          goto out;
>      }
>      unlock_user(argptr, guest_data, 0);
> @@ -3685,6 +3686,7 @@ static abi_long do_ioctl_dm(const IOCTLEntry *ie, uint8_t *buf_temp, int fd,
>              break;
>          }
>          default:
> +            unlock_user(argptr, guest_data, 0);
>              ret = -TARGET_EINVAL;
>              goto out;
>          }
>
diff mbox

Patch

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index a427f7a..ec9e4fc 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -3566,6 +3566,7 @@  static abi_long do_ioctl_dm(const IOCTLEntry *ie, uint8_t *buf_temp, int fd,
     }
     default:
         ret = -TARGET_EINVAL;
+        unlock_user(argptr, guest_data, 0);
         goto out;
     }
     unlock_user(argptr, guest_data, 0);
@@ -3685,6 +3686,7 @@  static abi_long do_ioctl_dm(const IOCTLEntry *ie, uint8_t *buf_temp, int fd,
             break;
         }
         default:
+            unlock_user(argptr, guest_data, 0);
             ret = -TARGET_EINVAL;
             goto out;
         }