diff mbox

libiscsi: Remove iscsi_destroy_session

Message ID 20170712233812.49572-1-khazhy@google.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Khazhy Kumykov July 12, 2017, 11:38 p.m. UTC
iscsi_session_teardown was the only user of this function. Function
currently is just short for iscsi_remove_session + iscsi_free_session.

Signed-off-by: Khazhismel Kumykov <khazhy@google.com>
---
 with "libiscsi: Fix use after free race during iscsi_session_teardown" removing the
 last user.

 drivers/scsi/scsi_transport_iscsi.c | 16 ----------------
 include/scsi/scsi_transport_iscsi.h |  1 -
 2 files changed, 17 deletions(-)

Comments

kernel test robot July 13, 2017, 12:13 p.m. UTC | #1
Hi Khazhismel,

[auto build test ERROR on mkp-scsi/for-next]
[also build test ERROR on v4.12 next-20170713]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Khazhismel-Kumykov/libiscsi-Remove-iscsi_destroy_session/20170713-185526
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: blackfin-allyesconfig (attached as .config)
compiler: bfin-uclinux-gcc (GCC) 6.2.0
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=blackfin 

All errors (new ones prefixed by >>):

   drivers/scsi/libiscsi.c: In function 'iscsi_session_teardown':
>> drivers/scsi/libiscsi.c:2880:2: error: implicit declaration of function 'iscsi_destroy_session' [-Werror=implicit-function-declaration]
     iscsi_destroy_session(cls_session);
     ^~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +/iscsi_destroy_session +2880 drivers/scsi/libiscsi.c

7996a778 Mike Christie        2006-04-06  2850  
7996a778 Mike Christie        2006-04-06  2851  /**
7996a778 Mike Christie        2006-04-06  2852   * iscsi_session_teardown - destroy session, host, and cls_session
75613521 Mike Christie        2008-05-21  2853   * @cls_session: iscsi session
7996a778 Mike Christie        2006-04-06  2854   *
75613521 Mike Christie        2008-05-21  2855   * The driver must have called iscsi_remove_session before
75613521 Mike Christie        2008-05-21  2856   * calling this.
75613521 Mike Christie        2008-05-21  2857   */
7996a778 Mike Christie        2006-04-06  2858  void iscsi_session_teardown(struct iscsi_cls_session *cls_session)
7996a778 Mike Christie        2006-04-06  2859  {
75613521 Mike Christie        2008-05-21  2860  	struct iscsi_session *session = cls_session->dd_data;
63f75cc8 Mike Christie        2006-07-24  2861  	struct module *owner = cls_session->transport->owner;
e5bd7b54 Mike Christie        2008-09-24  2862  	struct Scsi_Host *shost = session->host;
7996a778 Mike Christie        2006-04-06  2863  
6320377f Olaf Kirch           2007-12-13  2864  	iscsi_pool_free(&session->cmdpool);
7996a778 Mike Christie        2006-04-06  2865  
b2c64167 Mike Christie        2007-05-30  2866  	kfree(session->password);
b2c64167 Mike Christie        2007-05-30  2867  	kfree(session->password_in);
b2c64167 Mike Christie        2007-05-30  2868  	kfree(session->username);
b2c64167 Mike Christie        2007-05-30  2869  	kfree(session->username_in);
f3ff0c36 Mike Christie        2006-07-24  2870  	kfree(session->targetname);
3c5c4801 Vikas Chaudhary      2012-01-19  2871  	kfree(session->targetalias);
88dfd340 Mike Christie        2008-05-21  2872  	kfree(session->initiatorname);
3b9373e9 Eddie Wai            2013-06-20  2873  	kfree(session->boot_root);
3b9373e9 Eddie Wai            2013-06-20  2874  	kfree(session->boot_nic);
3b9373e9 Eddie Wai            2013-06-20  2875  	kfree(session->boot_target);
88dfd340 Mike Christie        2008-05-21  2876  	kfree(session->ifacename);
f8525eb4 Adheer Chandravanshi 2013-07-01  2877  	kfree(session->portal_type);
f8525eb4 Adheer Chandravanshi 2013-07-01  2878  	kfree(session->discovery_parent_type);
f3ff0c36 Mike Christie        2006-07-24  2879  
75613521 Mike Christie        2008-05-21 @2880  	iscsi_destroy_session(cls_session);
e5bd7b54 Mike Christie        2008-09-24  2881  	iscsi_host_dec_session_cnt(shost);
63f75cc8 Mike Christie        2006-07-24  2882  	module_put(owner);
7996a778 Mike Christie        2006-04-06  2883  }
7996a778 Mike Christie        2006-04-06  2884  EXPORT_SYMBOL_GPL(iscsi_session_teardown);
7996a778 Mike Christie        2006-04-06  2885  

:::::: The code at line 2880 was first introduced by commit
:::::: 756135215ec743be6fdce2bdebe8cdb9f8a231f6 [SCSI] iscsi: remove session and host binding in libiscsi

:::::: TO: Mike Christie <michaelc@cs.wisc.edu>
:::::: CC: James Bottomley <James.Bottomley@HansenPartnership.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index a424eaeafeb0..924ac408d8a9 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -2210,22 +2210,6 @@  void iscsi_free_session(struct iscsi_cls_session *session)
 }
 EXPORT_SYMBOL_GPL(iscsi_free_session);
 
-/**
- * iscsi_destroy_session - destroy iscsi session
- * @session: iscsi_session
- *
- * Can be called by a LLD or iscsi_transport. There must not be
- * any running connections.
- */
-int iscsi_destroy_session(struct iscsi_cls_session *session)
-{
-	iscsi_remove_session(session);
-	ISCSI_DBG_TRANS_SESSION(session, "Completing session destruction\n");
-	iscsi_free_session(session);
-	return 0;
-}
-EXPORT_SYMBOL_GPL(iscsi_destroy_session);
-
 /**
  * iscsi_create_conn - create iscsi class connection
  * @session: iscsi cls session
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index 6183d20a01fb..b266d2a3bcb1 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -434,7 +434,6 @@  extern struct iscsi_cls_session *iscsi_create_session(struct Scsi_Host *shost,
 						unsigned int target_id);
 extern void iscsi_remove_session(struct iscsi_cls_session *session);
 extern void iscsi_free_session(struct iscsi_cls_session *session);
-extern int iscsi_destroy_session(struct iscsi_cls_session *session);
 extern struct iscsi_cls_conn *iscsi_create_conn(struct iscsi_cls_session *sess,
 						int dd_size, uint32_t cid);
 extern int iscsi_destroy_conn(struct iscsi_cls_conn *conn);