From: <vl...@us...> - 2008-05-12 15:58:40
|
Revision: 365 http://scst.svn.sourceforge.net/scst/?rev=365&view=rev Author: vlnb Date: 2008-05-12 08:58:34 -0700 (Mon, 12 May 2008) Log Message: ----------- - Fixed GFP_KERNEL misuse. Reported independently by mb...@ch... and Erez Zilber <er...@Vo...> - Fixed not sufficient in_irq() to determine atomic allocation context. Reported by mb...@ch... Modified Paths: -------------- trunk/scst/src/scst_lib.c trunk/scst/src/scst_priv.h trunk/scst/src/scst_targ.c Modified: trunk/scst/src/scst_lib.c =================================================================== --- trunk/scst/src/scst_lib.c 2008-05-07 18:44:15 UTC (rev 364) +++ trunk/scst/src/scst_lib.c 2008-05-12 15:58:34 UTC (rev 365) @@ -1089,7 +1089,7 @@ TRACE(TRACE_DEBUG | TRACE_SCSI, "%s", "Sending RELEASE req to " "SCSI mid-level"); rc = scsi_execute(scsi_dev, cdb, SCST_DATA_NONE, NULL, 0, - sense, SCST_DEFAULT_TIMEOUT, 0, GFP_KERNEL); + sense, SCST_DEFAULT_TIMEOUT, 0, 0); TRACE_DBG("MODE_SENSE done: %x", rc); if (scsi_status_is_good(rc)) { @@ -2336,7 +2336,7 @@ TRACE(TRACE_SCSI, "%s", "Doing internal MODE_SENSE"); res = scsi_execute(dev->scsi_dev, cmd, SCST_DATA_READ, buffer, sizeof(buffer), sense_buffer, SCST_DEFAULT_TIMEOUT, - 0, GFP_KERNEL); + 0, 0); TRACE_DBG("MODE_SENSE done: %x", res); Modified: trunk/scst/src/scst_priv.h =================================================================== --- trunk/scst/src/scst_priv.h 2008-05-07 18:44:15 UTC (rev 364) +++ trunk/scst/src/scst_priv.h 2008-05-12 15:58:34 UTC (rev 365) @@ -133,6 +133,11 @@ return SCST_CONTEXT_DIRECT; } +static inline bool scst_is_context_gfp_atomic(void) +{ + return irqs_disabled() || in_atomic() || in_interrupt(); +} + extern unsigned long scst_max_cmd_mem; extern mempool_t *scst_mgmt_mempool; Modified: trunk/scst/src/scst_targ.c =================================================================== --- trunk/scst/src/scst_targ.c 2008-05-07 18:44:15 UTC (rev 364) +++ trunk/scst/src/scst_targ.c 2008-05-12 15:58:34 UTC (rev 365) @@ -1086,7 +1086,8 @@ } if (cmd->status == SAM_STAT_CHECK_CONDITION) - scst_alloc_set_sense(cmd, in_irq(), rq_sense, rq_sense_len); + scst_alloc_set_sense(cmd, scst_is_context_gfp_atomic(), + rq_sense, rq_sense_len); TRACE(TRACE_SCSI, "result=%x, cmd->status=%x, resid=%d, " "cmd->msg_status=%x, cmd->host_status=%x, " This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |