]>
Commit | Line | Data |
---|---|---|
d431789d GKH |
1 | From f1601113ddc0339a745e702f4fb1ca37d4875e65 Mon Sep 17 00:00:00 2001 |
2 | From: Rameshwar Prasad Sahu <rsahu@apm.com> | |
3 | Date: Thu, 2 Nov 2017 16:31:07 +0530 | |
4 | Subject: ata: fixes kernel crash while tracing ata_eh_link_autopsy event | |
5 | ||
6 | From: Rameshwar Prasad Sahu <rsahu@apm.com> | |
7 | ||
8 | commit f1601113ddc0339a745e702f4fb1ca37d4875e65 upstream. | |
9 | ||
10 | When tracing ata link error event, the kernel crashes when the disk is | |
11 | removed due to NULL pointer access by trace_ata_eh_link_autopsy API. | |
12 | This occurs as the dev is NULL when the disk disappeared. This patch | |
13 | fixes this crash by calling trace_ata_eh_link_autopsy only if "dev" | |
14 | is not NULL. | |
15 | ||
16 | v2 changes: | |
17 | Removed direct passing "link" pointer instead of "dev" in trace API. | |
18 | ||
19 | Signed-off-by: Rameshwar Prasad Sahu <rsahu@apm.com> | |
20 | Signed-off-by: Tejun Heo <tj@kernel.org> | |
21 | Fixes: 255c03d15a29 ("libata: Add tracepoints") | |
22 | Signed-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 |