+ if (hdr->cmd_len < 6 || hdr->cmd_len > sizeof(req->__cmd))
+ return -EMSGSIZE;
That doesn't look right to me since sg_io() allocates req->cmd if necessary:
if (hdr->cmd_len > BLK_MAX_CDB) {
req->cmd = kzalloc(hdr->cmd_len, GFP_KERNEL);
if (!req->cmd)
goto out_put_request;
}