From patchwork Mon Jan 15 12:09:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tang.wenji@zte.com.cn X-Patchwork-Id: 10163633 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2D1BD602C2 for ; Mon, 15 Jan 2018 12:08:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1DBCE27F2B for ; Mon, 15 Jan 2018 12:08:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E7DB2889C; Mon, 15 Jan 2018 12:08:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 79D0327F2B for ; Mon, 15 Jan 2018 12:08:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754222AbeAOMII (ORCPT ); Mon, 15 Jan 2018 07:08:08 -0500 Received: from out1.zte.com.cn ([202.103.147.172]:51396 "EHLO mxct.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752357AbeAOMIH (ORCPT ); Mon, 15 Jan 2018 07:08:07 -0500 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id CF5534069FE6237495B0; Mon, 15 Jan 2018 20:08:00 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id w0FC7t2i025793; Mon, 15 Jan 2018 20:07:55 +0800 (GMT-8) (envelope-from tang.wenji@zte.com.cn) Received: from localhost.localdomain ([10.118.202.203]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2018011520075834-1602492 ; Mon, 15 Jan 2018 20:07:58 +0800 From: tang.wenji@zte.com.cn To: Nicholas Bellinger Cc: target-devel@vger.kernel.org, tangwenji Subject: [PATCH] target:fix destory device in target_configure_device Date: Mon, 15 Jan 2018 20:09:37 +0800 Message-Id: <1516018177-7714-1-git-send-email-tang.wenji@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2018-01-15 20:07:58, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2018-01-15 20:07:55, Serialize complete at 2018-01-15 20:07:55 X-MAIL: mse01.zte.com.cn w0FC7t2i025793 Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: tangwenji After dev->transport->configure_device succeeds,target_configure_device exits abnormally, dev_flags has not set DF_CONFIGURED yet, does not call destory_device function in free_device Signed-off-by: tangwenji Reviewed-by: Mike Christie --- drivers/target/target_core_device.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index e8dd6da..18716fa 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c @@ -997,7 +997,7 @@ int target_configure_device(struct se_device *dev) ret = core_setup_alua(dev); if (ret) - goto out_free_index; + goto out_destory_device; /* * Startup the struct se_device processing thread @@ -1041,6 +1041,8 @@ int target_configure_device(struct se_device *dev) out_free_alua: core_alua_free_lu_gp_mem(dev); +out_destory_device: + dev->transport->destroy_device(dev); out_free_index: mutex_lock(&device_mutex); idr_remove(&devices_idr, dev->dev_index);