Only one VFS Module in the stack can safely use SMB_VFS_HANDLE_SET_DATA?

Richard Sharpe realrichardsharpe at
Fri Oct 7 08:28:09 MDT 2011

Hi folks,

in looking at SMB_VFS_HANDLE_SET_DATA:

#define SMB_VFS_HANDLE_SET_DATA(handle, datap, free_fn, type, ret) { \
        if (!(handle)) { \
                DEBUG(0,("%s() failed to set handle->data!\n",__FUNCTION__)); \
                ret; \
        } else { \
                if ((handle)->free_data) { \
                        (handle)->free_data(&(handle)->data); \
                } \
                (handle)->data = (void *)datap; \
                (handle)->free_data = free_fn; \
        } \

it seems that only one module is the stack can safely set data in a
stack. Others will have theirs released or silently overwritten and
you would need to examine the code in each module to figure out which
one survives.

Since we know when we start to load the modules how many modules there
are in the stack, we could talloc an array of pointers and then have
the above macro set the data pointer for the level that the function
is at ... of course some additional changes would be needed to track
which level a function is at in the stack, etc.

Of course, we could not handle cases where the admin changes the list
of modules in the vfs objects statement, but we don't support that
today (without the smbd being shut down).

Should I log a bug?

Richard Sharpe

More information about the samba-technical mailing list