Bug 530066 - get_partstats() returns NULL and causes panic in delete_partition()
Summary: get_partstats() returns NULL and causes panic in delete_partition()
Keywords:
Status: CLOSED DUPLICATE of bug 493517
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kernel
Version: 5.3
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: 5.5
Assignee: Jerome Marchand
QA Contact: Red Hat Kernel QE team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-10-21 12:48 UTC by Jan Tluka
Modified: 2009-11-16 09:43 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-11-16 09:43:06 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Jan Tluka 2009-10-21 12:48:40 UTC
Moved delete_partition() panic reported by customer in bug #493517 to this one as every bug must target only one issue. part_round_stats() panic will be fixed in bug #493517. Further investigation should be done for delete_partition() panic in this bugzilla.


Description of problem:

Unable to handle kernel NULL pointer dereference at 0000000000000040 RIP:
[<ffffffff801161d4>] delete_partition+0x8f/0x114

void delete_partition(struct gendisk *disk, int part)
{      
       struct hd_struct *p = disk->part[part-1];
…
       p->sectors[0] = p->sectors[1] = 0;
       part_stat_reset(p);                                 <<<<< This is something added in 2.6.18-123.
       sysfs_remove_link(&p->kobj, "subsystem");
}   

static inline void part_stat_reset(struct hd_struct *part)
{      
       struct partstats *ps;
       int i;  
       rcu_read_lock();
       ps = get_partstats(part);   <<<<< get_partstats returned NULL
       for_each_possible_cpu(i)
               memset(per_cpu_ptr(ps->dkstats, i), 0,   <<<<< ps is NULL, panic here.
                      sizeof(struct disk_stats));              
       rcu_read_unlock();
}

How reproducible:
Not sure how to reproduce it.  From the code, it should check the return value of get_partstats() before dereferencing it.

Steps to Reproduce:
Reproducer from customer available in https://bugzilla.redhat.com/show_bug.cgi?id=493517#c8. However this reproducer never triggered delete_partition() panic.

Actual results:
Panic.

Expected results:
No panic.

Additional info:
See bug #493517.

Comment 1 Jerome Marchand 2009-11-16 09:43:06 UTC

*** This bug has been marked as a duplicate of bug 493517 ***


Note You need to log in before you can comment on or make changes to this bug.