fill_temporary_tables() does not protect thd->temporary_tables access with LOCK_temporary_tables

Bug #1223335 reported by Laurynas Biveinis
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Server moved to https://jira.percona.com/projects/PS
Invalid
Undecided
Unassigned

Bug Description

int fill_temporary_tables(THD *thd, TABLE_LIST *tables, Item *cond)
{
...
  TABLE *tmp;

  for (tmp=thd->temporary_tables; tmp; tmp=tmp->next) {
    if (store_temporary_table_record(thd, tables->table, tmp,
                                     thd->lex->select_lex.db)) {
      DBUG_RETURN(1);
    }
  }
  DBUG_RETURN(0);
}

It needs to hold thd->LOCK_temporary_tables around this loop.

tags: added: i-s-temp-tables
Revision history for this message
Alexey Kopytov (akopytov) wrote :

The whole point of introducing LOCK_temporary_tables was to protect reads in fill_global_temporary_tables() from concurrent thd->temporary_tables modifications in other threads.

Since fill_temporary_tables() is only used to read the current connection's list of temporary tables, no concurrent modifications are possible. Thus the bug is invalid.

no longer affects: percona-server/5.6
no longer affects: percona-server/5.5
no longer affects: percona-server/5.1
Changed in percona-server:
status: Fix Committed → Invalid
importance: Medium → Undecided
assignee: Laurynas Biveinis (laurynas-biveinis) → nobody
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

Indeed. I also mistakenly thought that LOCK_temporary_tables was an upstream mutex.

Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-3021

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.