On Mon, 2012-08-27 at 10:17 +0800, Benjamin Wang wrote: > Hello, > Below is the content of the patch: > From: Benjamin Wang <cpwang2009@xxxxxxxxx> > Date: Sun, 26 Aug 2012 18:04:10 +0800 > Subject: [PATCH] Modify the error handling for calling idr_get_new. > > > Signed-off-by: Benjamin Wang <cpwang2009@xxxxxxxxx> > --- > drivers/target/iscsi/iscsi_target_login.c | 11 ++++++++++- > 1 files changed, 10 insertions(+), 1 deletions(-) > > > diff --git a/drivers/target/iscsi/iscsi_target_login.c > b/drivers/target/iscsi/iscsi_target_login.c > index a3656c9..9509d88 100644 > --- a/drivers/target/iscsi/iscsi_target_login.c > +++ b/drivers/target/iscsi/iscsi_target_login.c > @@ -221,6 +221,7 @@ static int iscsi_login_zero_tsih_s1( > { > struct iscsi_session *sess = NULL; > struct iscsi_login_req *pdu = (struct iscsi_login_req *)buf; > + int ret; > > > sess = kzalloc(sizeof(struct iscsi_session), GFP_KERNEL); > if (!sess) { > @@ -257,9 +258,17 @@ static int iscsi_login_zero_tsih_s1( > return -ENOMEM; > } > spin_lock(&sess_idr_lock); > - idr_get_new(&sess_idr, NULL, &sess->session_index); > + ret = idr_get_new(&sess_idr, NULL, &sess->session_index); > spin_unlock(&sess_idr_lock); > > > + if (ret < 0) { > + pr_err("idr_get_new() for sess_idr failed\n"); > + iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, > + ISCSI_LOGIN_STATUS_NO_RESOURCES); > + kfree(sess); > + return -ENOMEM; > + } > + > > So I've added the following text to the patch description: commit 13b5533a38b1eec9d61a07711dc075f03ae47a36 Author: Benjamin Wang <cpwang2009@xxxxxxxxx> Date: Sun Aug 26 18:04:10 2012 +0800 target: Check idr_get_new return value in iscsi_login_zero_tsih_s1 This patch updates iscsi_login_zero_tsih_s1() usage for generating iscsi_session->session_index to properly check the return value from idr_get_new(), and reject the iSCSI login attempt with exception status ISCSI_LOGIN_STATUS_NO_RESOURCES in the event of a failure. Signed-off-by: Benjamin Wang <cpwang2009@xxxxxxxxx> Signed-off-by: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx> and applied to target-pending.git/master, and will be pushed along with other 3.6-rc-fixes into mainline over the next weeks. Nice work Benjamin! --nab -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html