cmd: scsi: Fix null pointer dereference in 'scsi reset'
authorBin Meng <bmeng.cn@gmail.com>
Sat, 17 Jun 2017 13:36:00 +0000 (06:36 -0700)
committerSimon Glass <sjg@chromium.org>
Fri, 28 Jul 2017 18:02:47 +0000 (12:02 -0600)
During 'scsi reset', scsi_bus_reset() is called with udevice pointed
to NULL, which causes exception. As a temporary fix, disable the call
for DM SCSI for now.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
cmd/scsi.c

index 570971891ec5c994908f1a235f240b8180d0d5eb..8e36de107e9a91a01376164accfdb96c4fd235a0 100644 (file)
@@ -36,7 +36,9 @@ static int do_scsi(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
        case 2:
                if (strncmp(argv[1], "res", 3) == 0) {
                        printf("\nReset SCSI\n");
+#ifndef CONFIG_DM_SCSI
                        scsi_bus_reset(NULL);
+#endif
                        ret = scsi_scan(true);
                        if (ret)
                                return CMD_RET_FAILURE;