Skip to contentSkip to conversation

ata: fixes kernel crash while tracing ata_eh_link_autopsy event

PATCH New Rameshwar Prasad Sahu 2 participants 2 messages Nov 2, 2017 – Nov 3, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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.

---
 drivers/ata/libata-eh.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/ata/libata-eh.c +1 -1
index e4effef..ea20e0e 100644
@@ -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");
 }
 

--
1.7.1

Applied
#1 lore raw

PATCH v2 1/1 ata: fixes kernel crash while tracing ata_eh_link_autopsy event

Quoted 10 lines · Rameshwar Prasad Sahu

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.

Applied to libata/for-4.15.

Thanks.

Signature · 1 line
tejun