linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Tosatti <marcelo@conectiva.com.br>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: linux-kernel@vger.kernel.org
Subject: __get_swap_page() minor problem
Date: Thu, 4 Jan 2001 02:25:19 -0200 (BRST)	[thread overview]
Message-ID: <Pine.LNX.4.21.0101040220180.1158-100000@freak.distro.conectiva> (raw)


Hi,

If the check for "count >= SWAP_MAP_MAX" in __get_swap_page is true, we
will end up trying to unlock a not-yet-locked spinlock.

Here goes a patch to change this.

--- linux/mm/swapfile.c.orig	Thu Jan  4 04:10:08 2001
+++ linux/mm/swapfile.c	Thu Jan  4 04:10:12 2001
@@ -90,8 +90,12 @@
 	int type, wrapped = 0;
 
 	entry.val = 0;	/* Out of memory */
-	if (count >= SWAP_MAP_MAX)
-		goto bad_count;
+	if (count >= SWAP_MAP_MAX) {
+		printk(KERN_ERR "get_swap_page: bad count %hd from %p\n",
+	       		count, __builtin_return_address(0));
+		return entry;
+	}
+
 	swap_list_lock();
 	type = swap_list.next;
 	if (type < 0)
@@ -130,11 +134,6 @@
 out:
 	swap_list_unlock();
 	return entry;
-
-bad_count:
-	printk(KERN_ERR "get_swap_page: bad count %hd from %p\n",
-	       count, __builtin_return_address(0));
-	goto out;
 }
 
 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

                 reply	other threads:[~2001-01-04  6:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=Pine.LNX.4.21.0101040220180.1158-100000@freak.distro.conectiva \
    --to=marcelo@conectiva.com.br \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /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;
as well as URLs for NNTP newsgroup(s).