patch for log_enqueue in multipath-tools-0.4.4-pre11
Benjamin Marzinski
maintainerIt looks to me like log_enqueue can accidentally mess up its la->tail ptr, if it runs out of space for the new message.
If the la->head is just past la->start, and la->tail is just before la->end, la->tail will get updated to be la->start, because there is no room at the end of the buffer for the message. Then when it realizes that there is no room at the start of the buffer, la->tail will be updated to la->start - fwd And the next message will be written before the buffer.
This patch fixes that.
-Ben
Ben Marzinski
[email protected]
(612) 638-0517
multipathd/log.c +1 -1
@@ -119,7 +119,7 @@logdbg (stderr,"enqueue: log area overrun, drop msg\n" );if (!la->empty) - la->tail -= fwd; + la->tail = lastmsg;return 1 ; }
christophe varoqui
AppliedMerged, thanks.
Good to see new eyeballs in there.
Have you spoted design flaws in the async logger ?
Regards,
cvaroqui
Quoted 11 lines · Benjamin Marzinski
It looks to me like
log_enqueuecan accidentally mess up itsla->tailptr, if it runs out of space for the new message.If the
la->headis just pastla->start, andla->tailis just beforela->end,la->tailwill get updated to bela->start, because there is no room at the end of the buffer for the message. Then when it realizes that there is no room at the start of the buffer,la->tailwill be updated tola->start- fwd And the next message will be written before the buffer.This patch fixes that.