mirror of
https://github.com/dynup/kpatch
synced 2025-03-30 23:26:23 +00:00
Merge pull request #188 from spartacus06/fix-list-corruption
fix list corruption in special section handlers
This commit is contained in:
commit
59e9011a30
@ -1017,7 +1017,7 @@ void kpatch_regenerate_bug_table_rela_section(struct kpatch_elf *kelf)
|
||||
}
|
||||
|
||||
/* overwrite with new relas list */
|
||||
sec->relas = newrelas;
|
||||
list_replace(&newrelas, &sec->relas);
|
||||
|
||||
/* include both rela and text sections */
|
||||
sec->include = 1;
|
||||
@ -1064,7 +1064,7 @@ void kpatch_regenerate_smp_locks_sections(struct kpatch_elf *kelf)
|
||||
}
|
||||
|
||||
/* overwrite with new relas list */
|
||||
sec->relas = newrelas;
|
||||
list_replace(&newrelas, &sec->relas);
|
||||
|
||||
/* include both rela and text sections */
|
||||
sec->include = 1;
|
||||
@ -1129,7 +1129,7 @@ void kpatch_regenerate_parainstructions_sections(struct kpatch_elf *kelf)
|
||||
}
|
||||
|
||||
/* overwrite with new relas table */
|
||||
sec->relas = newrelas;
|
||||
list_replace(&newrelas, &sec->relas);
|
||||
|
||||
/* mark sections for inclusion */
|
||||
sec->include = 1;
|
||||
|
@ -142,6 +142,22 @@ static inline void list_del(struct list_head *entry)
|
||||
entry->prev = LIST_POISON2;
|
||||
}
|
||||
|
||||
/**
|
||||
* list_replace - replace old entry by new one
|
||||
* @old : the element to be replaced
|
||||
* @new : the new element to insert
|
||||
*
|
||||
* If @old was empty, it will be overwritten.
|
||||
*/
|
||||
static inline void list_replace(struct list_head *old,
|
||||
struct list_head *new)
|
||||
{
|
||||
new->next = old->next;
|
||||
new->next->prev = new;
|
||||
new->prev = old->prev;
|
||||
new->prev->next = new;
|
||||
}
|
||||
|
||||
#define list_entry(ptr, type, member) \
|
||||
container_of(ptr, type, member)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user