* [PATCH 09/11] target/iscsi: Fix a race condition in iscsit_add_reject_from_cmd()
@ 2017-10-31 18:03 Bart Van Assche
0 siblings, 0 replies; 2+ messages in thread
From: Bart Van Assche @ 2017-10-31 18:03 UTC (permalink / raw)
To: target-devel
Avoid that cmd->se_cmd.se_tfo is read after a command has already been
freed.
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Mike Christie <mchristi@redhat.com>
---
drivers/target/iscsi/iscsi_target.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index 91fbada7cdc2..541f66a875fc 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -833,6 +833,7 @@ static int iscsit_add_reject_from_cmd(
unsigned char *buf)
{
struct iscsi_conn *conn;
+ const bool do_put = cmd->se_cmd.se_tfo != NULL;
if (!cmd->conn) {
pr_err("cmd->conn is NULL for ITT: 0x%08x\n",
@@ -863,7 +864,7 @@ static int iscsit_add_reject_from_cmd(
* Perform the kref_put now if se_cmd has already been setup by
* scsit_setup_scsi_cmd()
*/
- if (cmd->se_cmd.se_tfo != NULL) {
+ if (do_put) {
pr_debug("iscsi reject: calling target_put_sess_cmd >>>>>>\n");
target_put_sess_cmd(&cmd->se_cmd);
}
--
2.14.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 09/11] target/iscsi: Fix a race condition in iscsit_add_reject_from_cmd()
@ 2017-11-02 14:28 Hannes Reinecke
0 siblings, 0 replies; 2+ messages in thread
From: Hannes Reinecke @ 2017-11-02 14:28 UTC (permalink / raw)
To: target-devel
On 10/31/2017 07:03 PM, Bart Van Assche wrote:
> Avoid that cmd->se_cmd.se_tfo is read after a command has already been
> freed.
>
> Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
> Cc: Nicholas Bellinger <nab@linux-iscsi.org>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Hannes Reinecke <hare@suse.com>
> Cc: Mike Christie <mchristi@redhat.com>
> ---
> drivers/target/iscsi/iscsi_target.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
> index 91fbada7cdc2..541f66a875fc 100644
> --- a/drivers/target/iscsi/iscsi_target.c
> +++ b/drivers/target/iscsi/iscsi_target.c
> @@ -833,6 +833,7 @@ static int iscsit_add_reject_from_cmd(
> unsigned char *buf)
> {
> struct iscsi_conn *conn;
> + const bool do_put = cmd->se_cmd.se_tfo != NULL;
>
> if (!cmd->conn) {
> pr_err("cmd->conn is NULL for ITT: 0x%08x\n",
> @@ -863,7 +864,7 @@ static int iscsit_add_reject_from_cmd(
> * Perform the kref_put now if se_cmd has already been setup by
> * scsit_setup_scsi_cmd()
> */
> - if (cmd->se_cmd.se_tfo != NULL) {
> + if (do_put) {
> pr_debug("iscsi reject: calling target_put_sess_cmd >>>>>>\n");
> target_put_sess_cmd(&cmd->se_cmd);
> }
>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare@suse.com +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-11-02 14:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-31 18:03 [PATCH 09/11] target/iscsi: Fix a race condition in iscsit_add_reject_from_cmd() Bart Van Assche
2017-11-02 14:28 Hannes Reinecke
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.