diff options
author | Jeff King <peff@peff.net> | 2019-03-21 05:28:54 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-03-22 15:52:54 +0900 |
commit | d3322eb28b142a893fbc03142724bb54e95990a6 (patch) | |
tree | 7c3f275890a9fe5cb88f180131c10825c369d117 /Documentation/doc-diff | |
parent | refs/files-backend: handle packed transaction prepare failure (diff) | |
download | tgif-d3322eb28b142a893fbc03142724bb54e95990a6.tar.xz |
refs/files-backend: don't look at an aborted transaction
When deleting refs, we hold packed-refs.lock and prepare a packed
transaction to drop the refs from the packed-refs file. If it turns out
that we don't need to rewrite the packed refs (e.g., because none of the
deletions were present in the file), then we abort the transaction.
If that abort succeeds, then the transaction struct will have been
freed, and we set our local pointer to NULL so we don't look at it
again.
However, if it fails, then the struct will _still_ have been freed
(because ref_transaction_abort() always frees). But we don't clean up
the pointer, and will jump to our cleanup code, which will try to abort
it again, causing a use-after-free.
It's actually impossible for this to trigger in practice, since
packed_transaction_abort() will never return anything but success. But
let's fix it anyway, since that's more than we should assume about the
packed-refs code (after all, we are already bothering to check for an
error result which cannot be triggered).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/doc-diff')
0 files changed, 0 insertions, 0 deletions