cifs: verify that tcon is valid before dereference in cifs_kill_sb
On umount, cifs_sb->tlink_tree might contain entries that do not represent a valid tcon. Check the tcon for error before we dereference it. Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> Cc: stable@vger.kernel.org Reviewed-by: Shyam Prasad N <sprasad@microsoft.com> Reported-by: Xiaoli Feng <xifeng@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
parent
64c4a37ac0
commit
8b6c58458e
|
@ -266,10 +266,11 @@ static void cifs_kill_sb(struct super_block *sb)
|
||||||
* before we kill the sb.
|
* before we kill the sb.
|
||||||
*/
|
*/
|
||||||
if (cifs_sb->root) {
|
if (cifs_sb->root) {
|
||||||
node = rb_first(root);
|
for (node = rb_first(root); node; node = rb_next(node)) {
|
||||||
while (node != NULL) {
|
|
||||||
tlink = rb_entry(node, struct tcon_link, tl_rbnode);
|
tlink = rb_entry(node, struct tcon_link, tl_rbnode);
|
||||||
tcon = tlink_tcon(tlink);
|
tcon = tlink_tcon(tlink);
|
||||||
|
if (IS_ERR(tcon))
|
||||||
|
continue;
|
||||||
cfid = &tcon->crfid;
|
cfid = &tcon->crfid;
|
||||||
mutex_lock(&cfid->fid_mutex);
|
mutex_lock(&cfid->fid_mutex);
|
||||||
if (cfid->dentry) {
|
if (cfid->dentry) {
|
||||||
|
@ -277,7 +278,6 @@ static void cifs_kill_sb(struct super_block *sb)
|
||||||
cfid->dentry = NULL;
|
cfid->dentry = NULL;
|
||||||
}
|
}
|
||||||
mutex_unlock(&cfid->fid_mutex);
|
mutex_unlock(&cfid->fid_mutex);
|
||||||
node = rb_next(node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* finally release root dentry */
|
/* finally release root dentry */
|
||||||
|
|
Loading…
Reference in New Issue