Skip to contentSkip to conversation

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

PATCH Superseded Chen Gang S 2 participants 3 messages Jan 23, 2015

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 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 | 1 +
 1 file changed, 1 insertion(+)
linux-user/syscall.c +1 -0
index aaac6a2..290fdea 100644
@@ -3681,6 +3681,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, guest_data_size);
Signature · 1 line
1.9.3 (Apple Git-50)
#1 lore raw
Quoted 21 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 | 1 +
 1 file changed, 1 insertion(+)
linux-user/syscall.c +1 -1
index aaac6a2..290fdea 100644
@@ -3681,6 +3681,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, guest_data_size);
--
Quoted 1 line

1.9.3 (Apple Git-50)

Correct as far as it goes, but notice that we have the identical bug in the other switch (ie->host_cmd) as well...

thanks
-- PMM

#2 lore raw
Quoted 18 lines · Peter Maydell
Quoted 17 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 | 1 +
 1 file changed, 1 insertion(+)
linux-user/syscall.c +1 -0
index aaac6a2..290fdea 100644
@@ -3681,6 +3681,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);
Quoted 9 lines
Quoted 5 lines
linux-user/syscall.c +0 -1
             goto out;
         }
         unlock_user(argptr, guest_data, guest_data_size);
--

1.9.3 (Apple Git-50)

Correct as far as it goes, but notice that we have the identical bug in the other switch (ie->host_cmd) as well...

Oh, really, thanks. I shall send patch v2 for it, if no additional reply within 2 days.

Thanks.

Signature · 3 lines
Chen Gang

Open, share, and attitude like air, water, and life which God blessed