Skip to content

Commit a15ccef

Browse files
ritbudhirajaSteve French
authored andcommitted
cifs: fix use after free for iface while disabling secondary channels
We were deferencing iface after it has been released. Fix is to release after all dereference instances have been encountered. Signed-off-by: Ritvik Budhiraja <rbudhiraja@microsoft.com> Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <error27@gmail.com> Closes: https://lore.kernel.org/r/202311110815.UJaeU3Tt-lkp@intel.com/ Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 98b1cc8 commit a15ccef

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/smb/client/sess.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,10 +332,10 @@ cifs_disable_secondary_channels(struct cifs_ses *ses)
332332

333333
if (iface) {
334334
spin_lock(&ses->iface_lock);
335-
kref_put(&iface->refcount, release_iface);
336335
iface->num_channels--;
337336
if (iface->weight_fulfilled)
338337
iface->weight_fulfilled--;
338+
kref_put(&iface->refcount, release_iface);
339339
spin_unlock(&ses->iface_lock);
340340
}
341341

0 commit comments

Comments
 (0)