Re: [PATCH 1/8] IB/srp: Avoid that duplicate responses trigger a kernel bug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2017-02-12 at 19:05 +0200, Leon Romanovsky wrote:
> On Fri, Feb 10, 2017 at 03:56:04PM -0800, Bart Van Assche wrote:
> > diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
> > index 79bf48477ddb..4068d34f5427 100644
> > --- a/drivers/infiniband/ulp/srp/ib_srp.c
> > +++ b/drivers/infiniband/ulp/srp/ib_srp.c
> > @@ -1899,7 +1899,14 @@ static void srp_process_rsp(struct srp_rdma_ch *ch, struct srp_rsp *rsp)
> >  		scmnd = scsi_host_find_tag(target->scsi_host, rsp->tag);
> >  		if (scmnd) {
> >  			req = (void *)scmnd->host_scribble;
> > -			scmnd = srp_claim_req(ch, req, NULL, scmnd);
> > +			if (req) {
> > +				scmnd = srp_claim_req(ch, req, NULL, scmnd);
> > +			} else {
> > +				shost_printk(KERN_ERR, target->scsi_host,
> > +					     "NULL host_scribble for response with tag %#llx\n",
> > +					     rsp->tag);
> > +				scmnd = NULL;
> > +			}
> >  		}
> >  		if (!scmnd) {
> >  			shost_printk(KERN_ERR, target->scsi_host,
> 
> You have the chance to print the message below together with your new
> print, because scmd will be NULL.
> 
> What about to do the following check "if (scmd && scmd->host_scribble)"
> instead of your proposed patch?

That approach would still trigger a kernel oops if a duplicate response is
received because the second argument of srp_claim_req() must not be NULL.

Bart.��.n��������+%������w��{.n�����������ܨ}���Ơz�j:+v�����w����ޙ��&�)ߡ�a����z�ޗ���ݢj��w�f




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]