Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15-SP2
qemu.18973
0167-scsi-fix-scsi_convert_sense-crash-w.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0167-scsi-fix-scsi_convert_sense-crash-w.patch of Package qemu.18973
From: Paolo Bonzini <pbonzini@redhat.com> Date: Fri, 22 Dec 2017 16:30:34 +0100 Subject: scsi: fix scsi_convert_sense crash when in_buf == NULL && in_len == 0 scsi_disk_emulate_command passes in_buf == NULL when sent a REQUEST SENSE command. Check for in_len == 0 before dereferencing in_buf. Fixes: f68d98b21fa74155dc7c1fd212474379ac3c7531 Reported-by: Roman Kagan <rkagan@virtuozzo.com> Tested-by: Roman Kagan <rkagan@virtuozzo.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> (cherry picked from commit 2770c90d432b571cab718e28f838097f0b2201ec) [LM: BSC#1154790] Signed-off-by: Lin Ma <lma@suse.com> --- scsi/utils.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scsi/utils.c b/scsi/utils.c index ddae650a999e3bfc73a8fcc12bda..87385229554b175e6bbc4994f8b9 100644 --- a/scsi/utils.c +++ b/scsi/utils.c @@ -322,18 +322,18 @@ int scsi_convert_sense(uint8_t *in_buf, int in_len, SCSISense sense; bool fixed_in; + if (in_len == 0) { + return scsi_build_sense_buf(buf, len, SENSE_CODE(NO_SENSE), fixed); + } + fixed_in = (in_buf[0] & 2) == 0; - if (in_len && fixed == fixed_in) { + if (fixed == fixed_in) { memcpy(buf, in_buf, MIN(len, in_len)); return MIN(len, in_len); - } - - if (in_len == 0) { - sense = SENSE_CODE(NO_SENSE); } else { sense = scsi_parse_sense_buf(in_buf, in_len); + return scsi_build_sense_buf(buf, len, sense, fixed); } - return scsi_build_sense_buf(buf, len, sense, fixed); } int scsi_sense_to_errno(int key, int asc, int ascq)
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor