]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.4.103/ata-fixes-kernel-crash-while-tracing-ata_eh_link_autopsy-event.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.4.103 / ata-fixes-kernel-crash-while-tracing-ata_eh_link_autopsy-event.patch
CommitLineData
d431789d
GKH
1From f1601113ddc0339a745e702f4fb1ca37d4875e65 Mon Sep 17 00:00:00 2001
2From: Rameshwar Prasad Sahu <rsahu@apm.com>
3Date: Thu, 2 Nov 2017 16:31:07 +0530
4Subject: ata: fixes kernel crash while tracing ata_eh_link_autopsy event
5
6From: Rameshwar Prasad Sahu <rsahu@apm.com>
7
8commit f1601113ddc0339a745e702f4fb1ca37d4875e65 upstream.
9
10When tracing ata link error event, the kernel crashes when the disk is
11removed due to NULL pointer access by trace_ata_eh_link_autopsy API.
12This occurs as the dev is NULL when the disk disappeared. This patch
13fixes this crash by calling trace_ata_eh_link_autopsy only if "dev"
14is not NULL.
15
16v2 changes:
17 Removed direct passing "link" pointer instead of "dev" in trace API.
18
19Signed-off-by: Rameshwar Prasad Sahu <rsahu@apm.com>
20Signed-off-by: Tejun Heo <tj@kernel.org>
21Fixes: 255c03d15a29 ("libata: Add tracepoints")
22Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
23
24---
25 drivers/ata/libata-eh.c | 2 +-
26 1 file changed, 1 insertion(+), 1 deletion(-)
27
28--- a/drivers/ata/libata-eh.c
29+++ b/drivers/ata/libata-eh.c
30@@ -2245,8 +2245,8 @@ static void ata_eh_link_autopsy(struct a
31 if (dev->flags & ATA_DFLAG_DUBIOUS_XFER)
32 eflags |= ATA_EFLAG_DUBIOUS_XFER;
33 ehc->i.action |= ata_eh_speed_down(dev, eflags, all_err_mask);
34+ trace_ata_eh_link_autopsy(dev, ehc->i.action, all_err_mask);
35 }
36- trace_ata_eh_link_autopsy(dev, ehc->i.action, all_err_mask);
37 DPRINTK("EXIT\n");
38 }
39