Skip to content

Commit b0fc889

Browse files
Chandrujbarnes993
authored andcommitted
PCI hotplug: ibmphp: read the length of ebda and map entire ebda region
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 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> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
1 parent 6fcaf17 commit b0fc889

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

‎drivers/pci/hotplug/ibmphp_ebda.c‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ static void __init print_ebda_hpc (void)
245245

246246
int __init ibmphp_access_ebda (void)
247247
{
248-
u8 format, num_ctlrs, rio_complete, hs_complete;
248+
u8 format, num_ctlrs, rio_complete, hs_complete, ebda_sz;
249249
u16 ebda_seg, num_entries, next_offset, offset, blk_id, sub_addr, re, rc_id, re_id, base;
250250
int rc = 0;
251251

@@ -260,7 +260,14 @@ int __init ibmphp_access_ebda (void)
260260
iounmap (io_mem);
261261
debug ("returned ebda segment: %x\n", ebda_seg);
262262

263-
io_mem = ioremap(ebda_seg<<4, 1024);
263+
io_mem = ioremap(ebda_seg<<4, 1);
264+
ebda_sz = readb(io_mem);
265+
iounmap(io_mem);
266+
debug("ebda size: %d(KiB)\n", ebda_sz);
267+
if (ebda_sz == 0)
268+
return -ENOMEM;
269+
270+
io_mem = ioremap(ebda_seg<<4, (ebda_sz * 1024));
264271
if (!io_mem )
265272
return -ENOMEM;
266273
next_offset = 0x180;

0 commit comments

Comments
 (0)