From: Bart Van Assche Subject: [ofa-general] Re: sg_reset can trigger a NULL pointer dereference in the SRP initiator Date: Thu, 6 Aug 2009 17:38:18 +0200 Message-ID: References: <4A7A949B.60408@panasas.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <4A7A949B.60408@panasas.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: general-bounces@lists.openfabrics.org Errors-To: general-bounces@lists.openfabrics.org To: Boaz Harrosh Cc: Vladislav Bolkhovitin , linux-scsi , Roland Dreier , James Bottomley , OpenIB List-Id: linux-scsi@vger.kernel.org On Thu, Aug 6, 2009 at 10:30 AM, Boaz Harrosh wrote: > [Just out of memory, I've not inspected the code for a long time] > > It looks like an srp_request was never allocated for the reset > command. (since it never went through .queuecommand) > > static int srp_find_req(struct srp_target_port *target, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0struct scsi_cmnd *scmnd, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0struct srp_request **req) > { > =A0 =A0 =A0 =A0if (scmnd->host_scribble =3D=3D (void *) -1L) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return -1; > > =A0 =A0 =A0 =A0*req =3D &target->req_ring[(long) scmnd->host_scribble]; > > =A0 =A0 =A0 =A0return 0; > } > > Specifically scmnd->host_scribble can just be Zero. > When queues are active that does not matter and a device is found > since the reset does not really need the scsi_cmnd. But in above > scenario the queues were never used and the array entry is empty. Hello Boaz, Thanks for the info. Do you know by heart which SCSI drivers process the SG_SCSI_RESET ioctl correctly and that could be used as an example for fixing the SRP initiator ? Bart.