mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chandru <chandru@in.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: gregkh@suse.de, Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH] ibmphp : read the length of ebda and map entire ebda region
Date: Sat, 9 Jan 2010 17:12:25 +0530	[thread overview]
Message-ID: <201001091712.25655.chandru@in.ibm.com> (raw)

ibmphp driver currently maps only 1KB of ebda memory area into kernel address 
space during driver initialization. This causes kernel oops when the driver is 
modprobe'd and it accesses memory area beyond 1KB within ebda segment. The first 
byte of ebda segment actually stores the length of the ebda region in 
Kilobytes. Hence make use of the length parameter and map the entire ebda 
region.


Signed-off-by: Chandru Siddalingappa <chandru@linux.vnet.ibm.com>
---

 drivers/pci/hotplug/ibmphp_ebda.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

--- linux-2.6.33-rc2/drivers/pci/hotplug/ibmphp_ebda.c.orig	2010-01-09 
15:23:54.000000000 +0530
+++ linux-2.6.33-rc2/drivers/pci/hotplug/ibmphp_ebda.c	2010-01-09 
17:01:06.000000000 +0530
@@ -245,7 +245,7 @@ static void __init print_ebda_hpc (void)
 
 int __init ibmphp_access_ebda (void)
 {
-	u8 format, num_ctlrs, rio_complete, hs_complete;
+	u8 format, num_ctlrs, rio_complete, hs_complete, ebda_sz;
 	u16 ebda_seg, num_entries, next_offset, offset, blk_id, sub_addr, re, rc_id, 
re_id, base;
 	int rc = 0;
 
@@ -260,7 +260,14 @@ int __init ibmphp_access_ebda (void)
 	iounmap (io_mem);
 	debug ("returned ebda segment: %x\n", ebda_seg);
 	
-	io_mem = ioremap(ebda_seg<<4, 1024);
+	io_mem = ioremap(ebda_seg<<4, 1);
+	ebda_sz = readb(io_mem);
+	iounmap(io_mem);
+	debug("ebda size: %d(KiB)\n", ebda_sz);
+	if (ebda_sz == 0)
+		return -ENOMEM;
+
+	io_mem = ioremap(ebda_seg<<4, (ebda_sz * 1024));
 	if (!io_mem )
 		return -ENOMEM;
 	next_offset = 0x180;



             reply	other threads:[~2010-01-09 11:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-09 11:42 Chandru [this message]
2010-01-09 18:23 ` Greg KH
2010-01-13 11:26   ` Chandru
2010-01-13  1:26 ` Andrew Morton
2010-01-13 10:52   ` Chandru

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=201001091712.25655.chandru@in.ibm.com \
    --to=chandru@in.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    /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

Powered by JetHome