Commit 288315e9 authored by George Kennedy's avatar George Kennedy Committed by Martin K. Petersen

scsi: sym53c8xx: fix NULL pointer dereference panic in sym_int_sir()

sym_int_sir() in sym_hipd.c does not check the command pointer for NULL before
using it in debug message prints.
Suggested-by: default avatarMatthew Wilcox <matthew.wilcox@oracle.com>
Signed-off-by: default avatarGeorge Kennedy <george.kennedy@oracle.com>
Reviewed-by: default avatarMark Kanda <mark.kanda@oracle.com>
Acked-by: default avatarMatthew Wilcox <matthew.wilcox@oracle.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 6318cb7f
...@@ -4370,6 +4370,13 @@ static void sym_nego_rejected(struct sym_hcb *np, struct sym_tcb *tp, struct sym ...@@ -4370,6 +4370,13 @@ static void sym_nego_rejected(struct sym_hcb *np, struct sym_tcb *tp, struct sym
OUTB(np, HS_PRT, HS_BUSY); OUTB(np, HS_PRT, HS_BUSY);
} }
#define sym_printk(lvl, tp, cp, fmt, v...) do { \
if (cp) \
scmd_printk(lvl, cp->cmd, fmt, ##v); \
else \
starget_printk(lvl, tp->starget, fmt, ##v); \
} while (0)
/* /*
* chip exception handler for programmed interrupts. * chip exception handler for programmed interrupts.
*/ */
...@@ -4415,7 +4422,7 @@ static void sym_int_sir(struct sym_hcb *np) ...@@ -4415,7 +4422,7 @@ static void sym_int_sir(struct sym_hcb *np)
* been selected with ATN. We do not want to handle that. * been selected with ATN. We do not want to handle that.
*/ */
case SIR_SEL_ATN_NO_MSG_OUT: case SIR_SEL_ATN_NO_MSG_OUT:
scmd_printk(KERN_WARNING, cp->cmd, sym_printk(KERN_WARNING, tp, cp,
"No MSG OUT phase after selection with ATN\n"); "No MSG OUT phase after selection with ATN\n");
goto out_stuck; goto out_stuck;
/* /*
...@@ -4423,7 +4430,7 @@ static void sym_int_sir(struct sym_hcb *np) ...@@ -4423,7 +4430,7 @@ static void sym_int_sir(struct sym_hcb *np)
* having reselected the initiator. * having reselected the initiator.
*/ */
case SIR_RESEL_NO_MSG_IN: case SIR_RESEL_NO_MSG_IN:
scmd_printk(KERN_WARNING, cp->cmd, sym_printk(KERN_WARNING, tp, cp,
"No MSG IN phase after reselection\n"); "No MSG IN phase after reselection\n");
goto out_stuck; goto out_stuck;
/* /*
...@@ -4431,7 +4438,7 @@ static void sym_int_sir(struct sym_hcb *np) ...@@ -4431,7 +4438,7 @@ static void sym_int_sir(struct sym_hcb *np)
* an IDENTIFY. * an IDENTIFY.
*/ */
case SIR_RESEL_NO_IDENTIFY: case SIR_RESEL_NO_IDENTIFY:
scmd_printk(KERN_WARNING, cp->cmd, sym_printk(KERN_WARNING, tp, cp,
"No IDENTIFY after reselection\n"); "No IDENTIFY after reselection\n");
goto out_stuck; goto out_stuck;
/* /*
...@@ -4460,7 +4467,7 @@ static void sym_int_sir(struct sym_hcb *np) ...@@ -4460,7 +4467,7 @@ static void sym_int_sir(struct sym_hcb *np)
case SIR_RESEL_ABORTED: case SIR_RESEL_ABORTED:
np->lastmsg = np->msgout[0]; np->lastmsg = np->msgout[0];
np->msgout[0] = M_NOOP; np->msgout[0] = M_NOOP;
scmd_printk(KERN_WARNING, cp->cmd, sym_printk(KERN_WARNING, tp, cp,
"message %x sent on bad reselection\n", np->lastmsg); "message %x sent on bad reselection\n", np->lastmsg);
goto out; goto out;
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment