Commit f2d2420b authored by Julia Lawall's avatar Julia Lawall Committed by Russell King
Browse files

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: (


// <smpl>
expression E,E2;

  E = E2
* E
// </smpl>
Signed-off-by: default avatarJulia Lawall <>
Signed-off-by: default avatarRussell King <>
parent 74bc8093
......@@ -1028,13 +1028,12 @@ static int sa1111_remove(struct platform_device *pdev)
struct sa1111 *sachip = platform_get_drvdata(pdev);
if (sachip) {
platform_set_drvdata(pdev, NULL);
#ifdef CONFIG_PM
sachip->saved_state = NULL;
platform_set_drvdata(pdev, NULL);
return 0;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment