On Tue, 20 Jan 2009 15:06:23 +0200 Boaz Harrosh <bharrosh@xxxxxxxxxxx> wrote: > > When submitting requests via SG_IO, which does a sync io, a > bsg_command is not allocated, so an in-Kernel sense_buffer was not > set. However when calling blk_execute_rq() with no sense buffer > one is provided from the stack. Now bsg at blk_complete_sgv4_hdr_rq() > would check if rq->sense_len and a sense was requested by sg_io_v4 > the rq->sense was copy_user() back, but by now it is already mangled > stack memory. > > I have fixed that by forcing a sense_buffer when calling bsg_map_hdr(). > The bsg_command->sense is provided in the write/read path like before, > and on-the-stack buffer is provided when doing SG_IO. > > I have also fixed a dprintk message to print rq->errors in hex because > of the scsi bit-field use of this member. For other block devices it > does not matter anyway. > > Signed-off-by: Boaz Harrosh <bharrosh@xxxxxxxxxxx> > --- > block/bsg.c | 17 ++++++++++------- > 1 files changed, 10 insertions(+), 7 deletions(-) Acked-by: FUJITA Tomonori <fujita.tomonori@xxxxxxxxxxxxx> Thanks! -- 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