diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/buffering.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/apps/buffering.c b/apps/buffering.c index 9bc5abd963..48ef1bc6c0 100644 --- a/apps/buffering.c +++ b/apps/buffering.c | |||
@@ -450,6 +450,9 @@ static bool move_handle(struct memory_handle **h, size_t *delta, | |||
450 | return false; | 450 | return false; |
451 | } | 451 | } |
452 | 452 | ||
453 | mutex_lock(&llist_mutex); | ||
454 | mutex_lock(&llist_mod_mutex); | ||
455 | |||
453 | oldpos = ringbuf_offset(src); | 456 | oldpos = ringbuf_offset(src); |
454 | newpos = ringbuf_add(oldpos, final_delta); | 457 | newpos = ringbuf_add(oldpos, final_delta); |
455 | overlap = ringbuf_add_cross(newpos, size_to_move, buffer_len); | 458 | overlap = ringbuf_add_cross(newpos, size_to_move, buffer_len); |
@@ -475,6 +478,8 @@ static bool move_handle(struct memory_handle **h, size_t *delta, | |||
475 | correction = (correction + 3) & ~3; | 478 | correction = (correction + 3) & ~3; |
476 | if (final_delta < correction + sizeof(struct memory_handle)) { | 479 | if (final_delta < correction + sizeof(struct memory_handle)) { |
477 | /* Delta cannot end up less than the size of the struct */ | 480 | /* Delta cannot end up less than the size of the struct */ |
481 | mutex_unlock(&llist_mod_mutex); | ||
482 | mutex_unlock(&llist_mutex); | ||
478 | return false; | 483 | return false; |
479 | } | 484 | } |
480 | newpos -= correction; | 485 | newpos -= correction; |
@@ -496,6 +501,8 @@ static bool move_handle(struct memory_handle **h, size_t *delta, | |||
496 | if (m && m->next == src) { | 501 | if (m && m->next == src) { |
497 | m->next = dest; | 502 | m->next = dest; |
498 | } else { | 503 | } else { |
504 | mutex_unlock(&llist_mod_mutex); | ||
505 | mutex_unlock(&llist_mutex); | ||
499 | return false; | 506 | return false; |
500 | } | 507 | } |
501 | } | 508 | } |
@@ -556,6 +563,8 @@ static bool move_handle(struct memory_handle **h, size_t *delta, | |||
556 | /* Update the caller with the new location of h and the distance moved */ | 563 | /* Update the caller with the new location of h and the distance moved */ |
557 | *h = dest; | 564 | *h = dest; |
558 | *delta = final_delta; | 565 | *delta = final_delta; |
566 | mutex_unlock(&llist_mod_mutex); | ||
567 | mutex_unlock(&llist_mutex); | ||
559 | return true; | 568 | return true; |
560 | } | 569 | } |
561 | 570 | ||