[SCSI] 3w-9xxx fix bug in sgl loading
This small patch fixes a bug in the 3w-9xxx driver where it would load an invalid sgl address in the ioctl path even if request length was zero. Signed-off-by: Adam Radford <aradford@gmail.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
This commit is contained in:
parent
55a66d3c1e
commit
53ca353594
1 changed files with 7 additions and 4 deletions
|
@ -76,6 +76,7 @@
|
|||
Fix bug in twa_get_param() on 4GB+.
|
||||
Use pci_resource_len() for ioremap().
|
||||
2.26.02.012 - Add power management support.
|
||||
2.26.02.013 - Fix bug in twa_load_sgl().
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
|
@ -100,7 +101,7 @@
|
|||
#include "3w-9xxx.h"
|
||||
|
||||
/* Globals */
|
||||
#define TW_DRIVER_VERSION "2.26.02.012"
|
||||
#define TW_DRIVER_VERSION "2.26.02.013"
|
||||
static TW_Device_Extension *twa_device_extension_list[TW_MAX_SLOT];
|
||||
static unsigned int twa_device_extension_count;
|
||||
static int twa_major = -1;
|
||||
|
@ -1382,10 +1383,12 @@ static void twa_load_sgl(TW_Device_Extension *tw_dev, TW_Command_Full *full_comm
|
|||
newcommand = &full_command_packet->command.newcommand;
|
||||
newcommand->request_id__lunl =
|
||||
cpu_to_le16(TW_REQ_LUN_IN(TW_LUN_OUT(newcommand->request_id__lunl), request_id));
|
||||
newcommand->sg_list[0].address = TW_CPU_TO_SGL(dma_handle + sizeof(TW_Ioctl_Buf_Apache) - 1);
|
||||
newcommand->sg_list[0].length = cpu_to_le32(length);
|
||||
if (length) {
|
||||
newcommand->sg_list[0].address = TW_CPU_TO_SGL(dma_handle + sizeof(TW_Ioctl_Buf_Apache) - 1);
|
||||
newcommand->sg_list[0].length = cpu_to_le32(length);
|
||||
}
|
||||
newcommand->sgl_entries__lunh =
|
||||
cpu_to_le16(TW_REQ_LUN_IN(TW_LUN_OUT(newcommand->sgl_entries__lunh), 1));
|
||||
cpu_to_le16(TW_REQ_LUN_IN(TW_LUN_OUT(newcommand->sgl_entries__lunh), length ? 1 : 0));
|
||||
} else {
|
||||
oldcommand = &full_command_packet->command.oldcommand;
|
||||
oldcommand->request_id = request_id;
|
||||
|
|
Loading…
Reference in a new issue