summaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-eh.c
diff options
context:
space:
mode:
authorRameshwar Prasad Sahu2017-11-02 12:01:07 +0100
committerTejun Heo2017-11-03 14:23:06 +0100
commitf1601113ddc0339a745e702f4fb1ca37d4875e65 (patch)
treeeb175e33705391c9203cf1b060441ae3531ee3b2 /drivers/ata/libata-eh.c
parentata: pata_pdc2027x: Fix space before '[' error. (diff)
downloadkernel-qcow2-linux-f1601113ddc0339a745e702f4fb1ca37d4875e65.tar.gz
kernel-qcow2-linux-f1601113ddc0339a745e702f4fb1ca37d4875e65.tar.xz
kernel-qcow2-linux-f1601113ddc0339a745e702f4fb1ca37d4875e65.zip
ata: fixes kernel crash while tracing ata_eh_link_autopsy event
When tracing ata link error event, the kernel crashes when the disk is removed due to NULL pointer access by trace_ata_eh_link_autopsy API. This occurs as the dev is NULL when the disk disappeared. This patch fixes this crash by calling trace_ata_eh_link_autopsy only if "dev" is not NULL. v2 changes: Removed direct passing "link" pointer instead of "dev" in trace API. Signed-off-by: Rameshwar Prasad Sahu <rsahu@apm.com> Signed-off-by: Tejun Heo <tj@kernel.org> Fixes: 255c03d15a29 ("libata: Add tracepoints") Cc: stable@vger.kernel.org # v4.1+
Diffstat (limited to 'drivers/ata/libata-eh.c')
-rw-r--r--drivers/ata/libata-eh.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index e070fe8267ff..6d45bfa6d611 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -2264,8 +2264,8 @@ static void ata_eh_link_autopsy(struct ata_link *link)
if (dev->flags & ATA_DFLAG_DUBIOUS_XFER)
eflags |= ATA_EFLAG_DUBIOUS_XFER;
ehc->i.action |= ata_eh_speed_down(dev, eflags, all_err_mask);
+ trace_ata_eh_link_autopsy(dev, ehc->i.action, all_err_mask);
}
- trace_ata_eh_link_autopsy(dev, ehc->i.action, all_err_mask);
DPRINTK("EXIT\n");
}