This patch fixes a problem in an error path when looking
up dinodes. There are two sister-functions, gfs2_inode_lookup
and gfs2_process_unlinked_inode. Both functions acquire and
hold the i_iopen glock for the dinode being looked up. The last
thing they try to do is hold the i_gl glock for the dinode.
If that glock fails for some reason, the error path was
incorrectly calling gfs2_glock_put for the i_iopen glock twice.
This resulted in the glock being prematurely freed. The
"minimum hold time" usually kept the glock in memory, but the
lock interface to dlm (aka lock_dlm) freed its memory for the
glock. In some circumstances, it would cause dlm's dlm_astd daemon
to try to call the bast function for the freed lock_dlm memory,
which resulted in a NULL pointer dereference.
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
{
struct inode *inode;
struct gfs2_inode *ip;
{
struct inode *inode;
struct gfs2_inode *ip;
- struct gfs2_glock *io_gl;
+ struct gfs2_glock *io_gl = NULL;
int error;
inode = gfs2_iget(sb, no_addr);
int error;
inode = gfs2_iget(sb, no_addr);
ip->i_iopen_gh.gh_gl->gl_object = ip;
gfs2_glock_put(io_gl);
ip->i_iopen_gh.gh_gl->gl_object = ip;
gfs2_glock_put(io_gl);
if ((type == DT_UNKNOWN) && (no_formal_ino == 0))
goto gfs2_nfsbypass;
if ((type == DT_UNKNOWN) && (no_formal_ino == 0))
goto gfs2_nfsbypass;
fail_glock:
gfs2_glock_dq(&ip->i_iopen_gh);
fail_iopen:
fail_glock:
gfs2_glock_dq(&ip->i_iopen_gh);
fail_iopen:
+ if (io_gl)
+ gfs2_glock_put(io_gl);
fail_put:
if (inode->i_state & I_NEW)
ip->i_gl->gl_object = NULL;
fail_put:
if (inode->i_state & I_NEW)
ip->i_gl->gl_object = NULL;
{
struct gfs2_sbd *sdp;
struct gfs2_inode *ip;
{
struct gfs2_sbd *sdp;
struct gfs2_inode *ip;
- struct gfs2_glock *io_gl;
+ struct gfs2_glock *io_gl = NULL;
int error;
struct gfs2_holder gh;
struct inode *inode;
int error;
struct gfs2_holder gh;
struct inode *inode;
ip->i_iopen_gh.gh_gl->gl_object = ip;
gfs2_glock_put(io_gl);
ip->i_iopen_gh.gh_gl->gl_object = ip;
gfs2_glock_put(io_gl);
inode->i_mode = DT2IF(DT_UNKNOWN);
inode->i_mode = DT2IF(DT_UNKNOWN);
fail_glock:
gfs2_glock_dq(&ip->i_iopen_gh);
fail_iopen:
fail_glock:
gfs2_glock_dq(&ip->i_iopen_gh);
fail_iopen:
+ if (io_gl)
+ gfs2_glock_put(io_gl);
fail_put:
ip->i_gl->gl_object = NULL;
gfs2_glock_put(ip->i_gl);
fail_put:
ip->i_gl->gl_object = NULL;
gfs2_glock_put(ip->i_gl);