mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Octavian Purdila <octavian.purdila@intel.com>
To: linux-kernel@vger.kernel.org
Cc: linuxram@us.ibm.com, bjorn.helgaas@hp.com,
	Octavian Purdila <octavian.purdila@intel.com>
Subject: [PATCH] resource: make sure requested range intersects root range
Date: Thu,  3 May 2012 11:40:57 +0300	[thread overview]
Message-ID: <1336034457-26708-1-git-send-email-octavian.purdila@intel.com> (raw)

When the requested and root ranges do not intersect,
__reserve_region_with_split will eventually overflow the stack.

Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
---
 kernel/resource.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/kernel/resource.c b/kernel/resource.c
index 7e8ea66..1f8d698 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -789,7 +789,11 @@ void __init reserve_region_with_split(struct resource *root,
 		const char *name)
 {
 	write_lock(&resource_lock);
-	__reserve_region_with_split(root, start, end, name);
+	if (start > root->end || end < root->start)
+		printk(KERN_ERR "Requested range (0x%llx-0x%llx) not in root range (0x%llx-0x%llx)\n",
+		       start, end, root->start, root->end);
+	else
+		__reserve_region_with_split(root, start, end, name);
 	write_unlock(&resource_lock);
 }
 
-- 
1.7.5.4


             reply	other threads:[~2012-05-03  8:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-03  8:40 Octavian Purdila [this message]
2012-06-30 12:00 Octavian Purdila
2012-07-10 21:33 ` Andrew Morton
2012-07-11  1:25   ` Joe Perches
2012-07-11  2:09   ` Ram Pai
2012-07-11 11:06     ` Purdila, Octavian
2012-07-11 14:54       ` Ram Pai
2012-07-11 15:26         ` Purdila, Octavian
2012-07-12  2:02           ` Ram Pai
2012-07-12  8:56             ` Ram Pai
     [not found]               ` <CAE1zot+iKwg5uijy7mWbxrQ3KUFYoKXuSYc0OnADmrWu7EtgLw@mail.gmail.com>
     [not found]                 ` <20120712163026.GG2430@ram-ThinkPad-T61>
2012-07-12 16:49                   ` Purdila, Octavian

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=1336034457-26708-1-git-send-email-octavian.purdila@intel.com \
    --to=octavian.purdila@intel.com \
    --cc=bjorn.helgaas@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxram@us.ibm.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

all inboxes | Powered by JetHome®