tagcache: don't allow temp commit buffer to be moved
The temporary buffer used during database commit did not have any buflib callbacks set, which allows it to be moved by buflib at any time. The code is not prepared to deal with this, so things break horribly if anything tries to allocate during the commit. The solution is to pass dummy callbacks to prevent the buffer from being moved. I expect this may create other issues since the commit uses up all available RAM, but at least things won't get silently corrupted anymore. Change-Id: I3183aaee58c94bfbaf4e24424030b8be6e341d22
This commit is contained in:
parent
525eb15864
commit
aafe2dd2d1
1 changed files with 4 additions and 1 deletions
|
@ -326,7 +326,10 @@ static void allocate_tempbuf(void)
|
|||
if (tempbuf)
|
||||
tempbuf_size = size;
|
||||
#else /* !__PCTOOL__ */
|
||||
tempbuf_handle = core_alloc_maximum("tc tempbuf", &size, NULL);
|
||||
/* Need to pass dummy ops to prevent the buffer being moved
|
||||
* out from under us, since we yield during the tagcache commit. */
|
||||
static struct buflib_callbacks dummy_ops;
|
||||
tempbuf_handle = core_alloc_maximum("tc tempbuf", &size, &dummy_ops);
|
||||
if (tempbuf_handle > 0)
|
||||
{
|
||||
tempbuf = core_get_data(tempbuf_handle);
|
||||
|
|
Loading…
Reference in a new issue