From: Andy Grover Subject: [PATCH] target/tcm_fc: Fix use-after-free of ft_tpg Date: Fri, 4 Apr 2014 16:44:37 -0700 Message-ID: <1396655077-30912-1-git-send-email-agrover@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fcoe-devel-bounces-s9riP+hp16TNLxjTenLetw@public.gmane.org Sender: fcoe-devel-bounces-s9riP+hp16TNLxjTenLetw@public.gmane.org To: target-devel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Cc: fcoe-devel-s9riP+hp16TNLxjTenLetw@public.gmane.org, linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-scsi@vger.kernel.org ft_del_tpg checks tpg->tport is set before unlinking the tpg from the tport when the tpg is being removed. Set this pointer in ft_tport_create, or the unlinking won't happen in ft_del_tpg and tport->tpg will reference a deleted object. see https://bugzilla.redhat.com/show_bug.cgi?id=1071340 Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Signed-off-by: Andy Grover --- drivers/target/tcm_fc/tfc_sess.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/target/tcm_fc/tfc_sess.c b/drivers/target/tcm_fc/tfc_sess.c index 0475142..1329726 100644 --- a/drivers/target/tcm_fc/tfc_sess.c +++ b/drivers/target/tcm_fc/tfc_sess.c @@ -68,6 +68,7 @@ static struct ft_tport *ft_tport_create(struct fc_lport *lport) if (tport) { tport->tpg = tpg; + tpg->tport = tport; return tport; } -- 1.9.0