]> git.baikalelectronics.ru Git - kernel.git/commit
tcm_fc: Fix free-after-use regression in ft_free_cmd
authorNicholas Bellinger <nab@linux-iscsi.org>
Mon, 12 May 2014 19:18:32 +0000 (12:18 -0700)
committerNicholas Bellinger <nab@linux-iscsi.org>
Fri, 16 May 2014 00:09:12 +0000 (17:09 -0700)
commit3dba579f0c0a143e0a4c642ade78c036ec3af9e6
treea04e8479aec767f070f65971b5acea425c844d77
parent9805be05a14c68df3847f5cc9b4dc7d98d30069e
tcm_fc: Fix free-after-use regression in ft_free_cmd

This patch fixes a free-after-use regression in ft_free_cmd(), where
ft_sess_put() is called with cmd->sess after percpu_ida_free() has
already released the tag.

Fix this bug by saving the ft_sess pointer ahead of percpu_ida_free(),
and pass it directly to ft_sess_put().

The regression was originally introduced in v3.13-rc1 commit:

  commit ef01f614cc68b1fbc45621660f83c5cc2ae8d2ab
  Author: Nicholas Bellinger <nab@daterainc.com>
  Date:   Mon Sep 23 12:12:42 2013 -0700

      tcm_fc: Convert to per-cpu command map pre-allocation of ft_cmd

Reported-by: Jun Wu <jwu@stormojo.com>
Cc: Mark Rustad <mark.d.rustad@intel.com>
Cc: Robert Love <robert.w.love@intel.com>
Cc: <stable@vger.kernel.org> #3.13+
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/target/tcm_fc/tfc_cmd.c