Commit 512b9a4
committed
pkg/sentry: add cleanup to avoid refcount leak
Currently, on certain error paths during task creation (e.g., when
"runsc exec" fails), we do not properly handle the refcount of the
mntns/FSContext, leading to a refcount leak. This patch adds cleanup
that would be released before the reference ownership is transferred
to callee, ensuring that the refcount is correctly decremented.
Fixes #12054
Signed-off-by: Tianyu Zhou <albert.zty@antgroup.com>1 parent fc2f4df commit 512b9a4
3 files changed
+23
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
288 | 289 | | |
289 | 290 | | |
290 | 291 | | |
| 292 | + | |
| 293 | + | |
291 | 294 | | |
292 | 295 | | |
293 | 296 | | |
| |||
327 | 330 | | |
328 | 331 | | |
329 | 332 | | |
| 333 | + | |
330 | 334 | | |
331 | 335 | | |
332 | 336 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
217 | 218 | | |
218 | 219 | | |
219 | 220 | | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | 221 | | |
226 | 222 | | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
227 | 233 | | |
228 | 234 | | |
229 | 235 | | |
| |||
235 | 241 | | |
236 | 242 | | |
237 | 243 | | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | 244 | | |
248 | 245 | | |
249 | 246 | | |
| |||
311 | 308 | | |
312 | 309 | | |
313 | 310 | | |
| 311 | + | |
314 | 312 | | |
315 | 313 | | |
316 | 314 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1038 | 1038 | | |
1039 | 1039 | | |
1040 | 1040 | | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
1041 | 1044 | | |
1042 | 1045 | | |
1043 | 1046 | | |
| |||
1056 | 1059 | | |
1057 | 1060 | | |
1058 | 1061 | | |
| 1062 | + | |
| 1063 | + | |
1059 | 1064 | | |
1060 | 1065 | | |
1061 | 1066 | | |
| |||
1081 | 1086 | | |
1082 | 1087 | | |
1083 | 1088 | | |
| 1089 | + | |
1084 | 1090 | | |
1085 | 1091 | | |
1086 | 1092 | | |
| |||
1156 | 1162 | | |
1157 | 1163 | | |
1158 | 1164 | | |
| 1165 | + | |
1159 | 1166 | | |
1160 | 1167 | | |
1161 | 1168 | | |
| |||
0 commit comments