Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: fix nil pointer dereference in crdb_internal.transaction_contention_events #106185

Merged

Conversation

zachlite
Copy link
Contributor

@zachlite zachlite commented Jul 5, 2023

schemaDesc was not checked for a nil pointer before dereferencing it. schemaDesc can be nil under the following conditions:

  1. A schema descriptor can be deleted, in which case all of its tables would be deleted too.

  2. The transaction used to retrieve the descriptor fails.

Given the structure of getContentionEventInfo, this nil pointer dereference is only possible under scenario 2: If a schema and its tables are deleted, a nil table descriptor would force an early return, and this code path would not execute.

Fixes: #104406
Epic: none
Release note: None

…ion_events

schemaDesc was not checked for a nil pointer before dereferencing it.

schemaDesc can be nil under the following conditions:
1. A schema descriptor can be deleted, in which case all of its
tables would be deleted too.

2. The transaction used to retrieve the descriptor fails.

Given the structure of `getContentionEventInfo`, this nil pointer
dereference is only possible under scenario 2.

If a schema and its tables are deleted, a nil table descriptor
would force an early return, and this code path would not execute.

Fixes: cockroachdb#104406
Epic: none
Release note: None
@zachlite zachlite requested a review from a team July 5, 2023 16:31
@zachlite zachlite requested a review from a team as a code owner July 5, 2023 16:31
@blathers-crl
Copy link

blathers-crl bot commented Jul 5, 2023

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@maryliag maryliag requested a review from yuzefovich July 5, 2023 17:31
Copy link
Contributor

@maryliag maryliag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @yuzefovich)

Copy link
Member

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: :shipit: complete! 2 of 0 LGTMs obtained (waiting on @zachlite)

@zachlite zachlite added the backport-23.1.x Flags PRs that need to be backported to 23.1 label Jul 5, 2023
@zachlite
Copy link
Contributor Author

zachlite commented Jul 5, 2023

bors r+

@zachlite
Copy link
Contributor Author

zachlite commented Jul 5, 2023

TFTRs!

@craig
Copy link
Contributor

craig bot commented Jul 5, 2023

Build succeeded:

@blathers-crl
Copy link

blathers-crl bot commented Jul 5, 2023

Encountered an error creating backports. Some common things that can go wrong:

  1. The backport branch might have already existed.
  2. There was a merge conflict.
  3. The backport branch contained merge commits.

You might need to create your backport manually using the backport tool.


error setting reviewers, but backport branch blathers/backport-release-23.1-106185 is ready: POST https://api.github.com/repos/cockroachdb/cockroach/pulls/106210/requested_reviewers: 422 Reviews may only be requested from collaborators. One or more of the teams you specified is not a collaborator of the cockroachdb/cockroach repository. []

Backport to branch 23.1.x failed. See errors above.


🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-23.1.x Flags PRs that need to be backported to 23.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sql: v23.1.1: nil pointer in getContentionEventInfo
4 participants