[PATCH] Patch for bug 11535
Jeremy Allison
jra at samba.org
Wed Sep 30 23:46:11 UTC 2015
On Wed, Sep 30, 2015 at 04:43:56PM -0700, Ralph Böhme wrote:
> > On Wed, Sep 30, 2015 at 04:30:23PM -0700, Ralph Böhme wrote:
> > > On Wed, Sep 30, 2015 at 04:17:52PM -0700, Jeremy Allison wrote:
> > > > On Wed, Sep 30, 2015 at 04:09:00PM -0700, Ralph Böhme wrote:
> > > > > Hi,
> > > > >
> > > > > adding a NULL check seems to be the natural thing to fix a crash I hit
> > > > > when running MTM. This passes a private autobuild, so fingers crossed.
> > > >
> > > > OK, I can't see a code path that leaves dirpath == NULL
> > > > and getting to fail:
> > >
> > > line 387?
> > >
> > > As I can reproduce the issue I could check which code path actually
> > > triggers this, in case you think adding the NULL check is just paving
> > > over the problem not fixing it. :)
> >
> > Oh, now I see it. It's my fault :-).
> >
> > The fix I added to detect a 'raw' stream
> > name means we can 'goto done;' without
> > allocating dirpath.
> >
> > 374 if (smb_fname->base_name[0] == '\0') {
> > 375 /*
> > 376 * orig_name was just a stream name.
> > 377 * This is a stream on the root of
> > 378 * the share. Replace base_name with
> > 379 * a "."
> > 380 */
> > 381 smb_fname->base_name =
> > 382 talloc_strdup(smb_fname, ".");
> > 383 if (smb_fname->base_name == NULL) {
> > 384 status = NT_STATUS_NO_MEMORY;
> > 385 goto err;
> > 386 }
> > 387 if (SMB_VFS_STAT(conn, smb_fname) != 0) {
> > 388 status = map_nt_error_from_unix(errno);
> > 389 goto err;
> > 390 }
> > 391 DEBUG(5, ("conversion finished %s -> %s\n",
> > 392 orig_path,
> > 393 smb_fname->base_name));
> > 394 goto done;
> > 395 }
> >
> > calls 'goto done;' before dirpath alloc. Sorry.
>
> oh, so we have two bugs. :) Because "my" crash happens after fail
> (dereferncing dirpath which is NULL at line 1016), not done.
Oh, so it's not me :-). done: calls TALLOC_FREE(dirpath);
which is safe on NULL.
So yeah, I'd still love to see the reproducer level 10
log with added debugs :-).
More information about the samba-technical
mailing list