Skip to contentSkip to conversation

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

PATCH Applied Chen Gang S 3 participants 3 messages Jan 24, 2015 – Jan 27, 2015

lore
Share & tools
lore
#0 lore raw

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

In abi_long do_ioctl_dm(), after calls lock_user(), it does not call unlock_user() before go to failure return in default case.

---
 linux-user/syscall.c | 2 ++
 1 file changed, 2 insertions(+)
linux-user/syscall.c +2 -0
index a427f7a..ec9e4fc 100644
@@ -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;
         }
Signature · 1 line
1.9.3
#1 lore raw
Quoted 7 lines · Chen Gang S

In abi_long do_ioctl_dm(), after calls lock_user(), it does not call unlock_user() before go to failure return in default case.

---
 linux-user/syscall.c | 2 ++
 1 file changed, 2 insertions(+)
Signature · 4 lines
Reviewed-by: Peter Maydell <[email protected]>

thanks
-- PMM
#2 lore raw
In reply to Chen Gang S
Quoted 2 lines · Chen Gang S

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

Quoted 26 lines
---
 linux-user/syscall.c | 2 ++
 1 file changed, 2 insertions(+)
linux-user/syscall.c +2 -0
index a427f7a..ec9e4fc 100644
@@ -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;
         }