public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Pavel Machek <pavel@ucw.cz>
Cc: LKML <linux-kernel@vger.kernel.org>, Andrew Morton <akpm@osdl.org>
Subject: [PATCH 2/3][Fix] swsusp: prevent possible memory leak
Date: Sun, 25 Sep 2005 20:30:04 +0200	[thread overview]
Message-ID: <200509252030.04712.rjw@sisk.pl> (raw)
In-Reply-To: <200509252018.36867.rjw@sisk.pl>

The following patch prevents swsusp from leaking some memory in case of
an error in read_pagedir().  It also prevents the BUG_ON() from triggering
if there's an error while reading swap.

Please apply,
Rafael


Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>

Index: linux-2.6.14-rc2-git3/kernel/power/swsusp.c
===================================================================
--- linux-2.6.14-rc2-git3.orig/kernel/power/swsusp.c	2005-09-25 18:49:00.000000000 +0200
+++ linux-2.6.14-rc2-git3/kernel/power/swsusp.c	2005-09-25 18:52:48.000000000 +0200
@@ -1437,9 +1437,9 @@
 	}
 
 	if (error)
-		free_page((unsigned long)pblist);
-
-	BUG_ON(i != swsusp_info.pagedir_pages);
+		free_pagedir(pblist);
+	else
+		BUG_ON(i != swsusp_info.pagedir_pages);
 
 	return error;
 }


  parent reply	other threads:[~2005-09-25 18:45 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-25 18:18 [PATCH 0/3] swsusp: fix some obscure bugs Rafael J. Wysocki
2005-09-25 18:24 ` [PATCH 1/3][Fix] swsusp: remove wrong code from data_free Rafael J. Wysocki
2005-09-25 18:30 ` Rafael J. Wysocki [this message]
2005-09-25 18:44 ` [PATCH 3/3][Fix] swsusp: prevent swsusp from failing if there's too many pagedir pages Rafael J. Wysocki
2005-09-26 10:33   ` Pavel Machek
2005-09-26 11:11     ` Rafael J. Wysocki
2005-09-26 11:20       ` Pavel Machek
2005-09-26 12:54         ` Rafael J. Wysocki
2005-09-26 14:26           ` Pavel Machek
2005-09-26 19:19             ` Rafael J. Wysocki
2005-09-26 23:22               ` Pavel Machek
2005-09-26 19:29             ` [PATCH][Fix] swsusp: avoid problems if there are too many pages to save Rafael J. Wysocki
2005-09-26 23:14               ` Pavel Machek
2005-09-25 21:47 ` [PATCH 0/3] swsusp: fix some obscure bugs Pavel Machek
2005-09-25 21:59   ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200509252030.04712.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox