Commit 57fe246
committed
Fix reference-after-free when waiting for another xact due to constraint.
If an insertion or update had to wait for another transaction to finish,
because there was another insertion with conflicting key in progress,
we would pass a just-free'd item pointer to XactLockTableWait().
All calls to XactLockTableWait() and MultiXactIdWait() had similar issues.
Some passed a pointer to a buffer in the buffer cache, after already
releasing the lock. The call in EvalPlanQualFetch had already released the
pin too. All but the call in execUtils.c would merely lead to reporting a
bogus ctid, however (or an assertion failure, if enabled).
All the callers that passed HeapTuple->t_data->t_ctid were slightly bogus
anyway: if the tuple was updated (again) in the same transaction, its ctid
field would point to the next tuple in the chain, not the tuple itself.
Backpatch to 9.4, where the 'ctid' argument to XactLockTableWait was added
(in commit f88d4cf)1 parent 370b3a4 commit 57fe246
File tree
4 files changed
+14
-12
lines changed- src/backend
- access/heap
- catalog
- executor
4 files changed
+14
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2717 | 2717 | | |
2718 | 2718 | | |
2719 | 2719 | | |
2720 | | - | |
| 2720 | + | |
2721 | 2721 | | |
2722 | 2722 | | |
2723 | 2723 | | |
| |||
2744 | 2744 | | |
2745 | 2745 | | |
2746 | 2746 | | |
2747 | | - | |
| 2747 | + | |
2748 | 2748 | | |
2749 | 2749 | | |
2750 | 2750 | | |
| |||
3261 | 3261 | | |
3262 | 3262 | | |
3263 | 3263 | | |
3264 | | - | |
| 3264 | + | |
3265 | 3265 | | |
3266 | 3266 | | |
3267 | 3267 | | |
| |||
3341 | 3341 | | |
3342 | 3342 | | |
3343 | 3343 | | |
3344 | | - | |
| 3344 | + | |
3345 | 3345 | | |
3346 | 3346 | | |
3347 | 3347 | | |
| |||
4365 | 4365 | | |
4366 | 4366 | | |
4367 | 4367 | | |
4368 | | - | |
| 4368 | + | |
4369 | 4369 | | |
4370 | 4370 | | |
4371 | 4371 | | |
| |||
4437 | 4437 | | |
4438 | 4438 | | |
4439 | 4439 | | |
4440 | | - | |
| 4440 | + | |
4441 | 4441 | | |
4442 | 4442 | | |
4443 | 4443 | | |
| |||
5181 | 5181 | | |
5182 | 5182 | | |
5183 | 5183 | | |
5184 | | - | |
| 5184 | + | |
5185 | 5185 | | |
5186 | 5186 | | |
5187 | 5187 | | |
| |||
5242 | 5242 | | |
5243 | 5243 | | |
5244 | 5244 | | |
5245 | | - | |
| 5245 | + | |
5246 | 5246 | | |
5247 | 5247 | | |
5248 | 5248 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2328 | 2328 | | |
2329 | 2329 | | |
2330 | 2330 | | |
2331 | | - | |
| 2331 | + | |
2332 | 2332 | | |
2333 | 2333 | | |
2334 | 2334 | | |
| |||
2377 | 2377 | | |
2378 | 2378 | | |
2379 | 2379 | | |
2380 | | - | |
| 2380 | + | |
2381 | 2381 | | |
2382 | 2382 | | |
2383 | 2383 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2118 | 2118 | | |
2119 | 2119 | | |
2120 | 2120 | | |
2121 | | - | |
| 2121 | + | |
2122 | 2122 | | |
2123 | 2123 | | |
2124 | 2124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1245 | 1245 | | |
1246 | 1246 | | |
1247 | 1247 | | |
| 1248 | + | |
1248 | 1249 | | |
1249 | 1250 | | |
1250 | 1251 | | |
| |||
1306 | 1307 | | |
1307 | 1308 | | |
1308 | 1309 | | |
| 1310 | + | |
1309 | 1311 | | |
1310 | | - | |
| 1312 | + | |
1311 | 1313 | | |
1312 | 1314 | | |
1313 | 1315 | | |
| |||
0 commit comments