Re: [PATCH 6/9] tgt: convert ibmvstgt and libsrp to use scsi_data_buffer

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

 



On Sun, Sep 09 2007 at 16:47 +0300, FUJITA Tomonori <tomof@xxxxxxx> wrote:
> On Sun, 09 Sep 2007 13:12:03 +0300
> Boaz Harrosh <bharrosh@xxxxxxxxxxx> wrote:
> 
>> On Fri, Sep 07 2007 at 0:50 +0300, FUJITA Tomonori <tomof@xxxxxxx> wrote:
>>> Signed-off-by: FUJITA Tomonori <fujita.tomonori@xxxxxxxxxxxxx>
>>> ---
>>> ...
>>> @@ -425,8 +426,8 @@ int srp_cmd_queue(struct Scsi_Host *shost, struct srp_cmd *cmd, void *info,
>>>  
>>>  	sc->SCp.ptr = info;
>>>  	memcpy(sc->cmnd, cmd->cdb, MAX_COMMAND_SIZE);
>>> -	sc->request_bufflen = len;
>>> -	sc->request_buffer = (void *) (unsigned long) addr;
>>> +	sc->sdb.length = len;
>>> +	sc->sdb.sglist = (void *) (unsigned long) addr;
>>>  	sc->tag = tag;
>>>  	err = scsi_tgt_queue_command(sc, (struct scsi_lun *) &cmd->lun, cmd->tag);
>>>  	if (err)
>> What is done here in srp_cmd_queue() looks scary to me. even today.
>> What is that u64 addr that gets truncated to unsigned long and put
>> on sglist? What data-buffer "len" is suppose to describe? And "dir"
>> is for what data?
> 
> No trancated since it's used for an address. addr, data length, and
> data transfer direction though they are not used now.
> 
I wish you could maybe clean up the unused stuff, and/or give addr 
its proper type. If it's a pointer than make it a pointer.
Also you are implying a use_sg==0 here which is not allowed.

> 
>> It is made to look like addr is a linear pointer with a use_sg==0
>> issued command, which is no longer allowed. Only we know it is not,
>> because of the "(void *)(unsigned long) addr;" which is a bug in
>> 64-bit.
>>
>> If this is a totally private message sent threw the scsi-ml. I would
>> rather it was done with DMA_NONE,bufflen=0,sglist=NULL and put all
>> the user-info into scsi_cmnd.SCp like above "void* info".
> 
> tgt doesn't queue a command to scsi-ml. It queues it to user space.

Even though. Please don't misuse scsi_cmnd members in this way.
If you are not using any of scsi-ml functions on these commands and
they do not carry sg-lists than why use a scsi_cmnd at all? You can
just use a tgt private structure. If these commands do go through
some scsi-ml functions than banging scsi_cmnd.sdb.sglist this way
is dangerous.

Boaz

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux