Skip to content

Commit 41da341

Browse files
committed
mod-tdx-guest: validate RTMR index and remove dead code
- Add bounds check (index > 3) before TDG_MR_RTMR_EXTEND TDCALL - Remove unreachable code after return in tdx_guest_init() Closes: Dstack-TEE/meta-dstack#45
1 parent c019113 commit 41da341

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

mod-tdx-guest/mod.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ static long tdx_extend_rtmr(struct tdx_extend_rtmr_req __user *req)
107107
goto out;
108108
}
109109

110+
if (index > 3) {
111+
ret = -EINVAL;
112+
goto out;
113+
}
114+
110115
{
111116
struct tdx_module_args args = {
112117
.rcx = virt_to_phys(data),
@@ -164,12 +169,7 @@ static int __init tdx_guest_init(void)
164169
if (ret)
165170
return ret;
166171

167-
168172
return 0;
169-
170-
misc_deregister(&tdx_misc_dev);
171-
172-
return ret;
173173
}
174174
module_init(tdx_guest_init);
175175

0 commit comments

Comments
 (0)