[Samba] ctdb error after upgrade to 4.12.10

Jeremy Allison jra at samba.org
Tue Nov 10 18:03:19 UTC 2020


On Tue, Nov 10, 2020 at 09:58:36AM -0800, Jeremy Allison via samba wrote:
> On Tue, Nov 10, 2020 at 06:20:45PM +0100, Günther Deschner wrote:
> > Hi Jeremy,
> > 
> > I'm afraid this is indeed caused by the talloc tidyup as one can perfectly
> > reproduce it wih the following patch for smbtorture (call bin/smbtorture
> > ncacn_np:lo local.file.file_lines_parse). I guess we need to set up some
> > warning signs around file_lines_parse() expressing that it takes talloced
> > content and that one should not free the separated lines array separately.
> 
> Dammit, I'm *so sorry* for that mistake. I looked quickly
> at file_lines_parse() and saw it do the:
> 
> ret = talloc_zero_array(mem_ctx, char *, i+2);
> 
> but then missed the:
> 
> talloc_steal(ret, p);
> 
> below. That's a *horrible* internal API to
> expose to callers.

Yes, this:

"'p' will be freed on error, and otherwise will be made a child of the returned array"

char **file_lines_parse(char *p, size_t size, int *numlines, TALLOC_CTX *mem_ctx)

is what I missed :-(. God, that's a *horrible* API
side-effect and completely unintuitive :-(.

Thanks *SO* much for adding a test for that.

Do you want to propose an MR with this test
and the additional fix for vfs_glusterfs
and I'll RB+ and push.

Sorry once again.



More information about the samba mailing list