On Thu, Dec 29, 2016 at 10:43:51AM -0500, Dave Jones wrote:
> On Wed, Dec 28, 2016 at 11:56:42PM -0800, Christoph Hellwig wrote:
>  > On Wed, Dec 28, 2016 at 04:40:16PM -0500, Dave Jones wrote:
>  > >  sg_io+0x113/0x470
>  > 
>  > Can you resolve that to a source line using a gdb?
> 
> It's the copy_from_user in an inlined copy of blk_fill_sghdr_rq.

That must be this line right at the beginning of blk_fill_sghdr_rq

        if (copy_from_user(rq->cmd, hdr->cmdp, hdr->cmd_len))
                return -EFAULT;

We're copying the SCSI CDB from the userspace pointer inside the hdr
we copied earlier into the request.

req->cmd is set to req->__cmd which is a u8 array with 16 members in
struct request by default, but if hdr->cmd_len is bigger than BLK_MAX_CDB
(16) we do a separate allocation for it in the caller:

        if (hdr->cmd_len > BLK_MAX_CDB) {
                rq->cmd = kzalloc(hdr->cmd_len, GFP_KERNEL);
                if (!rq->cmd)
                        goto out_put_request;
        }

so I'm not really sure what the problem here could be.

Reply via email to