Browse Source

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.

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Chen Gang S 10 years ago
parent
commit
dec0473dc6
1 changed files with 2 additions and 0 deletions
  1. 2 0
      linux-user/syscall.c

+ 2 - 0
linux-user/syscall.c

@@ -3576,6 +3576,7 @@ static abi_long do_ioctl_dm(const IOCTLEntry *ie, uint8_t *buf_temp, int fd,
     }
     }
     default:
     default:
         ret = -TARGET_EINVAL;
         ret = -TARGET_EINVAL;
+        unlock_user(argptr, guest_data, 0);
         goto out;
         goto out;
     }
     }
     unlock_user(argptr, guest_data, 0);
     unlock_user(argptr, guest_data, 0);
@@ -3695,6 +3696,7 @@ static abi_long do_ioctl_dm(const IOCTLEntry *ie, uint8_t *buf_temp, int fd,
             break;
             break;
         }
         }
         default:
         default:
+            unlock_user(argptr, guest_data, 0);
             ret = -TARGET_EINVAL;
             ret = -TARGET_EINVAL;
             goto out;
             goto out;
         }
         }