linux-stable/drivers/target/tcm_fc
Nicholas Bellinger ed8ec8f707 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 5f544cfac9
  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>
2014-05-15 17:09:12 -07:00
..
Kconfig
Makefile tcm_fc: Makefile cleanups 2011-07-22 09:37:47 +00:00
tcm_fc.h target/tcm_fc: Rename structs and list members for clarity 2014-04-11 15:30:51 -07:00
tfc_cmd.c tcm_fc: Fix free-after-use regression in ft_free_cmd 2014-05-15 17:09:12 -07:00
tfc_conf.c target/tcm_fc: Rename ft_{add,del}_lport to {add,del}_wwn 2014-04-11 15:30:51 -07:00
tfc_io.c tcm_fc: Check for aborted sequence 2013-04-25 01:05:28 -07:00
tfc_sess.c target/tcm_fc: Rename ft_tport_create to ft_tport_get 2014-04-11 15:30:52 -07:00