History

SA1111: Eliminate use after free

__sa1111_remove always frees its argument, so the subsequent reference to sachip->saved_state represents a use after free. __sa1111_remove does not appear to use the saved_state field, so the patch simply frees it first. A simplified version of the semantic patch that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ expression E,E2; @@ __sa1111_remove(E) ... ( E = E2 | * E ) // </smpl>

Julia Lawall committed 16 years ago

Commit f2d24201 parent 74bc8091 file · +2 −3Browse files

Unified · Split

arch/arm/common/sa1111.c+2−3
@@ -1028,13 +1028,12 @@ static int sa1111_remove(struct platform_device *pdev) · 1027 unmodified lines
10281028 struct sa1111 *sachip = platform_get_drvdata(pdev);
10291029
10301030 if (sachip) {
1031− __sa1111_remove(sachip);
1032− platform_set_drvdata(pdev, NULL);
1033−
10341031 #ifdef CONFIG_PM
10351032 kfree(sachip->saved_state);
10361033 sachip->saved_state = NULL;
10371034 #endif
1035+ __sa1111_remove(sachip);
1036+ platform_set_drvdata(pdev, NULL);
10381037 }
10391038
10401039 return 0;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t