Commit e3c4269d139db7471ee560fb30948179e180b3d4

Authored by Michal Nazarewicz
Committed by Steven Whitehouse
1 parent 527d151131

GFS2: fix potential NULL pointer dereference

Commit [e66cf1610: GFS2: Use lockref for glocks] replaced call:
    atomic_read(&gi->gl->gl_ref) == 0
with:
    __lockref_is_dead(&gl->gl_lockref)
therefore changing how gl is accessed, from gi->gl to plan gl.
However, gl can be a NULL pointer, and so gi->gl needs to be
used instead (which is guaranteed not to be NULL because fo
the while loop checking that condition).

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>

Showing 1 changed file with 2 additions and 1 deletions Side-by-side Diff

... ... @@ -1899,7 +1899,8 @@
1899 1899 gi->nhash = 0;
1900 1900 }
1901 1901 /* Skip entries for other sb and dead entries */
1902   - } while (gi->sdp != gi->gl->gl_sbd || __lockref_is_dead(&gl->gl_lockref));
  1902 + } while (gi->sdp != gi->gl->gl_sbd ||
  1903 + __lockref_is_dead(&gi->gl->gl_lockref));
1903 1904  
1904 1905 return 0;
1905 1906 }