mirror of https://github.com/citusdata/citus.git
background task execution: fixed dereference of NULL (#7694)
In the function TaskConcurrentCancelCheck() the pointer "task" was utilized after checking against NULL, which can lead to dereference of the null pointer. To avoid the problem, added a separate handling of the case when the pointer is null with an interruption of execution. Fixes: #7693. Fixes: 1f8675da4382f6e("nonblocking concurrent task execution via background workers") Signed-off-by: Maksim Korotkov <m.korotkov@postgrespro.ru>pull/7810/merge
parent
26ad52713c
commit
d885e1a016
|
@ -706,8 +706,12 @@ TaskConcurrentCancelCheck(TaskExecutionContext *taskExecutionContext)
|
||||||
BackgroundExecutorHashEntry *handleEntry = taskExecutionContext->handleEntry;
|
BackgroundExecutorHashEntry *handleEntry = taskExecutionContext->handleEntry;
|
||||||
BackgroundTask *task = GetBackgroundTaskByTaskId(handleEntry->taskid);
|
BackgroundTask *task = GetBackgroundTaskByTaskId(handleEntry->taskid);
|
||||||
taskExecutionContext->task = task;
|
taskExecutionContext->task = task;
|
||||||
|
if (!task)
|
||||||
|
{
|
||||||
|
ereport(ERROR, (errmsg("unexpected missing task id: %ld", handleEntry->taskid)));
|
||||||
|
}
|
||||||
|
|
||||||
if (!task || task->status == BACKGROUND_TASK_STATUS_CANCELLING)
|
if (task->status == BACKGROUND_TASK_STATUS_CANCELLING)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* being in that step means that a concurrent cancel or removal happened. we should
|
* being in that step means that a concurrent cancel or removal happened. we should
|
||||||
|
|
Loading…
Reference in New Issue