Skip to content

Commit 189bc68

Browse files
Rameshwar Prasad Sahugregkh
authored andcommitted
ata: fixes kernel crash while tracing ata_eh_link_autopsy event
commit f1601113ddc0339a745e702f4fb1ca37d4875e65 upstream. 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: 255c03d ("libata: Add tracepoints") Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f1be210 commit 189bc68

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/ata/libata-eh.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2245,8 +2245,8 @@ static void ata_eh_link_autopsy(struct ata_link *link)
22452245
if (dev->flags & ATA_DFLAG_DUBIOUS_XFER)
22462246
eflags |= ATA_EFLAG_DUBIOUS_XFER;
22472247
ehc->i.action |= ata_eh_speed_down(dev, eflags, all_err_mask);
2248+
trace_ata_eh_link_autopsy(dev, ehc->i.action, all_err_mask);
22482249
}
2249-
trace_ata_eh_link_autopsy(dev, ehc->i.action, all_err_mask);
22502250
DPRINTK("EXIT\n");
22512251
}
22522252

0 commit comments

Comments
 (0)