2008-07-24 10:02:33

by Pierre Ossman

[permalink] [raw]
Subject: bad dereference in sched_mc_power_savings_store()

I get the following with yesterdays kernel:

[ 62.650080] BUG: unable to handle kernel NULL pointer dereference at 00000002
[ 62.650093] IP: [<c0428736>] sched_mc_power_savings_store+0x6/0x40
[ 62.650109] *pdpt = 0000000035447001 *pde = 0000000000000000
[ 62.650119] Oops: 0000 [#2] PREEMPT SMP
[ 62.650127] Modules linked in: ipt_MASQUERADE iptable_nat nf_nat nf_conntrack_ipv4 xt_state nf_conntrack ipt_REJECT xt_tcpudp iptable_filter ip_tables x_tables bridge stp llc rfcomm l2cap fuse sunrpc ipv6 acpi_cpufreq binfmt_misc loop kvm_intel kvm sr_mod cdrom snd_hda_intel snd_seq_dummy ata_piix pcmcia snd_seq_oss ata_generic snd_seq_midi_event snd_seq arc4 ecb i2c_i801 sdhci_pci snd_seq_device yenta_socket firewire_ohci crypto_blkcipher rtc_cmos sdhci firewire_core snd_pcm_oss rsrc_nonstatic sg rtc_core thinkpad_acpi mmc_core snd_mixer_oss i2c_core pcmcia_core rtc_lib ricoh_mmc ac pcspkr pata_acpi crc_itu_t iwl4965 video snd_pcm output iwlcore battery bay rfkill snd_timer mac80211 snd wmi soundcore hci_usb e1000e button snd_page_alloc bluetooth cfg80211 ahci libata sd_mod scsi_mod ext3 jbd mbcache uhci_hcd ohci_hcd ehci_hcd [last unloaded: microcode]
[ 62.650292]
[ 62.650298] Pid: 2823, comm: sched-powersave Tainted: G D (2.6.26 #108)
[ 62.650304] EIP: 0060:[<c0428736>] EFLAGS: 00010286 CPU: 1
[ 62.650312] EIP is at sched_mc_power_savings_store+0x6/0x40
[ 62.650317] EAX: c076e700 EBX: c0428730 ECX: 00000002 EDX: ffffffea
[ 62.650323] ESI: c076e724 EDI: f5546000 EBP: f54aff3c ESP: f54aff28
[ 62.650328] DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
[ 62.650334] Process sched-powersave (pid: 2823, ti=f54af000 task=f4ffa400 task.ti=f54af000)
[ 62.650338] Stack: f54aff3c c059d930 f740c150 c076e418 f541b2c0 f54aff6c c04e7f32 00000002
[ 62.650355] 00000002 b7fb2000 f587f900 f541b2d4 c076e418 c076e724 f587f900 b7fb2000
[ 62.650370] 00000002 f54aff90 c049f81c f54aff9c 00000001 00000004 c04e7e90 f587f900
[ 62.650385] Call Trace:
[ 62.650390] [<c059d930>] ? sysdev_class_store+0x30/0x40
[ 62.650403] [<c04e7f32>] ? sysfs_write_file+0xa2/0x100
[ 62.650414] [<c049f81c>] ? vfs_write+0x9c/0x160
[ 62.650424] [<c04e7e90>] ? sysfs_write_file+0x0/0x100
[ 62.650433] [<c049f9a2>] ? sys_write+0x42/0x70
[ 62.650442] [<c0403fc6>] ? syscall_call+0x7/0xb
[ 62.650451] =======================
[ 62.650455] Code: ff 89 c3 b8 08 e9 75 c0 e8 08 5d 24 00 e8 93 4b 00 00 89 d8 5b c9 c3 8d b4 26 00 00 00 00 8d bc 27 00 00 00 00 55 ba ea ff ff ff <0f> b6 09 89 e5 8d 41 d0 3c 01 76 0e 89 d0 c9 c3 8d 76 00 8d bc
[ 62.650540] EIP: [<c0428736>] sched_mc_power_savings_store+0x6/0x40 SS:ESP 0068:f54aff28
[ 62.650560] ---[ end trace 155686795e307d74 ]---

I'm guessing it's because of commit 4a0b2b4dbe.

Rgds
--
-- Pierre Ossman

Linux kernel, MMC maintainer http://www.kernel.org
rdesktop, core developer http://www.rdesktop.org

WARNING: This correspondence is being monitored by the
Swedish government. Make sure your server uses encryption
for SMTP traffic and consider using PGP for end-to-end
encryption.


Attachments:
signature.asc (197.00 B)

2008-07-24 20:27:18

by Andi Kleen

[permalink] [raw]
Subject: Re: bad dereference in sched_mc_power_savings_store()

On Thu, Jul 24, 2008 at 12:02:17PM +0200, Pierre Ossman wrote:
> I get the following with yesterdays kernel:

This patch should fix it.

-andi


commit a2ab909933f8c8623282979dfa64f3e358bdb9fc
Author: Andi Kleen <ak@gargoyle.(none)>
Date: Thu Jul 24 21:57:40 2008 +0200

Make scheduler sysfs attributes sysdev class devices

They are really class devices, but were incorrectly declared. This leads
to crashes with the recent changes that makes non normal sysdevs
use a different prototype.

Signed-off-by: Andi Kleen <[email protected]>

diff --git a/kernel/sched.c b/kernel/sched.c
index 6acf749..24358ca 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -7641,34 +7641,34 @@ static ssize_t sched_power_savings_store(const char *buf, size_t count, int smt)
}

#ifdef CONFIG_SCHED_MC
-static ssize_t sched_mc_power_savings_show(struct sys_device *dev,
- struct sysdev_attribute *attr, char *page)
+static ssize_t sched_mc_power_savings_show(struct sysdev_class *class,
+ char *page)
{
return sprintf(page, "%u\n", sched_mc_power_savings);
}
-static ssize_t sched_mc_power_savings_store(struct sys_device *dev,
- struct sysdev_attribute *attr,
+static ssize_t sched_mc_power_savings_store(struct sysdev_class *class,
const char *buf, size_t count)
{
return sched_power_savings_store(buf, count, 0);
}
-static SYSDEV_ATTR(sched_mc_power_savings, 0644, sched_mc_power_savings_show,
- sched_mc_power_savings_store);
+static SYSDEV_CLASS_ATTR(sched_mc_power_savings, 0644,
+ sched_mc_power_savings_show,
+ sched_mc_power_savings_store);
#endif

#ifdef CONFIG_SCHED_SMT
-static ssize_t sched_smt_power_savings_show(struct sys_device *dev,
- struct sysdev_attribute *attr, char *page)
+static ssize_t sched_smt_power_savings_show(struct sysdev_class *dev,
+ char *page)
{
return sprintf(page, "%u\n", sched_smt_power_savings);
}
-static ssize_t sched_smt_power_savings_store(struct sys_device *dev,
- struct sysdev_attribute *attr,
+static ssize_t sched_smt_power_savings_store(struct sysdev_class *dev,
const char *buf, size_t count)
{
return sched_power_savings_store(buf, count, 1);
}
-static SYSDEV_ATTR(sched_smt_power_savings, 0644, sched_smt_power_savings_show,
+static SYSDEV_CLASS_ATTR(sched_smt_power_savings, 0644,
+ sched_smt_power_savings_show,
sched_smt_power_savings_store);
#endif

2008-07-24 22:21:03

by Pierre Ossman

[permalink] [raw]
Subject: Re: bad dereference in sched_mc_power_savings_store()

On Thu, 24 Jul 2008 22:26:34 +0200
Andi Kleen <[email protected]> wrote:

> On Thu, Jul 24, 2008 at 12:02:17PM +0200, Pierre Ossman wrote:
> > I get the following with yesterdays kernel:
>
> This patch should fix it.
>

Indeed it did. Thanks.

--
-- Pierre Ossman

Linux kernel, MMC maintainer http://www.kernel.org
rdesktop, core developer http://www.rdesktop.org

WARNING: This correspondence is being monitored by the
Swedish government. Make sure your server uses encryption
for SMTP traffic and consider using PGP for end-to-end
encryption.


Attachments:
signature.asc (197.00 B)

2008-07-30 04:07:34

by Andrew Morton

[permalink] [raw]
Subject: Re: bad dereference in sched_mc_power_savings_store()

On Thu, 24 Jul 2008 22:26:34 +0200 Andi Kleen <[email protected]> wrote:

> From: Andi Kleen <[email protected]>
> Author: Andi Kleen <ak@gargoyle.(none)>
> Signed-off-by: Andi Kleen <[email protected]>

Multiple personality disorder. Which is your preferred address for git
commits?

Nobody seems to have merged this patch into anything yet. I guess I
can take care of that.