ata: fixes kernel crash while tracing ata_eh_link_autopsy event
authorRameshwar Prasad Sahu <rsahu@apm.com>
Thu, 2 Nov 2017 11:01:07 +0000 (16:31 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Nov 2017 08:40:47 +0000 (08:40 +0000)
commit496e65f64903a3ad420a07466c5d008432136985
tree2b43abe0ba8832e0c6e95efbd41e4b8273cdf192
parent2f5be981622190fa85ba3eed31e974d73a2cae71
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: 255c03d15a29 ("libata: Add tracepoints")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/ata/libata-eh.c