From: Ben Hutchings <ben@decadent.org.uk>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: akpm@linux-foundation.org, "Yinghai Lu" <yinghai@kernel.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Linus Torvalds" <torvalds@linux-foundation.org>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
"Russ Anderson" <rja@sgi.com>,
"Yasuaki Ishimatsu" <isimatu.yasuaki@jp.fujitsu.com>
Subject: [106/121] drivers/base/memory.c: fix show_mem_removable() to handle missing sections
Date: Sun, 08 Sep 2013 03:52:01 +0100 [thread overview]
Message-ID: <lsq.1378608721.511138087@decadent.org.uk> (raw)
In-Reply-To: <lsq.1378608720.401499712@decadent.org.uk>
3.2.51-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Russ Anderson <rja@sgi.com>
commit 21ea9f5ace3a7317cc3ba1fbc749758021a83136 upstream.
"cat /sys/devices/system/memory/memory*/removable" crashed the system.
The problem is that show_mem_removable() is passing a
bad pfn to is_mem_section_removable(), which causes
if (!node_online(page_to_nid(page)))
to blow up. Why is it passing in a bad pfn?
The reason is that show_mem_removable() will loop sections_per_block
times. sections_per_block is 16, but mem->section_count is 8,
indicating holes in this memory block. Checking that the memory section
is present before checking to see if the memory section is removable
fixes the problem.
harp5-sys:~ # cat /sys/devices/system/memory/memory*/removable
0
1
1
1
1
1
1
1
1
1
1
1
1
1
BUG: unable to handle kernel paging request at ffffea00c3200000
IP: [<ffffffff81117ed1>] is_pageblock_removable_nolock+0x1/0x90
PGD 83ffd4067 PUD 37bdfce067 PMD 0
Oops: 0000 [#1] SMP
Modules linked in: autofs4 binfmt_misc rdma_ucm rdma_cm iw_cm ib_addr ib_srp scsi_transport_srp scsi_tgt ib_ipoib ib_cm ib_uverbs ib_umad iw_cxgb3 cxgb3 mdio mlx4_en mlx4_ib ib_sa mlx4_core ib_mthca ib_mad ib_core fuse nls_iso8859_1 nls_cp437 vfat fat joydev loop hid_generic usbhid hid hwperf(O) numatools(O) dm_mod iTCO_wdt ipv6 iTCO_vendor_support igb i2c_i801 ioatdma i2c_algo_bit ehci_pci pcspkr lpc_ich i2c_core ehci_hcd ptp sg mfd_core dca rtc_cmos pps_core mperf button xhci_hcd sd_mod crc_t10dif usbcore usb_common scsi_dh_emc scsi_dh_hp_sw scsi_dh_alua scsi_dh_rdac scsi_dh gru(O) xvma(O) xfs crc32c libcrc32c thermal sata_nv processor piix mptsas mptscsih scsi_transport_sas mptbase megaraid_sas fan thermal_sys hwmon ext3 jbd ata_piix ahci libahci libata scsi_mod
CPU: 4 PID: 5991 Comm: cat Tainted: G O 3.11.0-rc5-rja-uv+ #10
Hardware name: SGI UV2000/ROMLEY, BIOS SGI UV 2000/3000 series BIOS 01/15/2013
task: ffff88081f034580 ti: ffff880820022000 task.ti: ffff880820022000
RIP: 0010:[<ffffffff81117ed1>] [<ffffffff81117ed1>] is_pageblock_removable_nolock+0x1/0x90
RSP: 0018:ffff880820023df8 EFLAGS: 00010287
RAX: 0000000000040000 RBX: ffffea00c3200000 RCX: 0000000000000004
RDX: ffffea00c30b0000 RSI: 00000000001c0000 RDI: ffffea00c3200000
RBP: ffff880820023e38 R08: 0000000000000000 R09: 0000000000000001
R10: 0000000000000000 R11: 0000000000000001 R12: ffffea00c33c0000
R13: 0000160000000000 R14: 6db6db6db6db6db7 R15: 0000000000000001
FS: 00007ffff7fb2700(0000) GS:ffff88083fc80000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffea00c3200000 CR3: 000000081b954000 CR4: 00000000000407e0
Call Trace:
show_mem_removable+0x41/0x70
dev_attr_show+0x2a/0x60
sysfs_read_file+0xf7/0x1c0
vfs_read+0xc8/0x130
SyS_read+0x5d/0xa0
system_call_fastpath+0x16/0x1b
Signed-off-by: Russ Anderson <rja@sgi.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Reviewed-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
drivers/base/memory.c | 2 ++
1 file changed, 2 insertions(+)
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -172,6 +172,8 @@ static ssize_t show_mem_removable(struct
container_of(dev, struct memory_block, sysdev);
for (i = 0; i < sections_per_block; i++) {
+ if (!present_section_nr(mem->start_section_nr + i))
+ continue;
pfn = section_nr_to_pfn(mem->start_section_nr + i);
ret &= is_mem_section_removable(pfn, PAGES_PER_SECTION);
}
next prev parent reply other threads:[~2013-09-08 3:42 UTC|newest]
Thread overview: 134+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-08 2:52 [000/121] 3.2.51-rc1 review Ben Hutchings
2013-09-08 2:52 ` [085/121] [SCSI] zfcp: fix lock imbalance by reworking request queue locking Ben Hutchings
2013-09-08 2:52 ` [051/121] drm/radeon/atom: initialize more atom interpretor elements to 0 Ben Hutchings
2013-09-08 2:52 ` [103/121] powerpc/hvsi: Increase handshake timeout from 200ms to 400ms Ben Hutchings
2013-09-08 2:52 ` [027/121] iwlwifi: dvm: don't send BT_CONFIG on devices w/o Bluetooth Ben Hutchings
2013-09-08 2:52 ` [044/121] virtio: console: fix race in port_fops_open() and port unplug Ben Hutchings
2013-09-08 2:52 ` [004/121] sched: Fix the broken sched_rr_get_interval() Ben Hutchings
2013-09-08 2:52 ` [043/121] virtio: console: fix race with port unplug and open/close Ben Hutchings
2013-09-08 2:52 ` [095/121] alpha: makefile: don't enforce small data model for kernel builds Ben Hutchings
2013-09-08 2:52 ` [026/121] mac80211: fix duplicate retransmission detection Ben Hutchings
2013-09-08 2:52 ` [017/121] af_key: initialize satype in key_notify_policy_flush() Ben Hutchings
2013-09-08 2:52 ` [048/121] rt2x00: fix stop queue Ben Hutchings
2013-09-08 2:52 ` [078/121] drm/i915: Invalidate TLBs for the rings after a reset Ben Hutchings
2013-09-08 2:52 ` [113/121] m32r: add memcpy() for CONFIG_KERNEL_GZIP=y Ben Hutchings
2013-09-08 2:52 ` [098/121] Hexagon: misc compile warning/error cleanup due to missing headers Ben Hutchings
2013-09-08 2:52 ` [015/121] net_sched: info leak in atm_tc_dump_class() Ben Hutchings
2013-09-08 2:52 ` [057/121] tracing: Fix fields of struct trace_iterator that are zeroed by mistake Ben Hutchings
2013-09-08 2:52 ` [107/121] workqueue: cond_resched() after processing each work item Ben Hutchings
2013-09-08 2:52 ` [046/121] virtio: console: fix raising SIGIO after port unplug Ben Hutchings
2013-09-08 2:52 ` [028/121] iwlwifi: add DELL SKU for 5150 HMC Ben Hutchings
2013-09-08 2:52 ` [059/121] cifs: don't instantiate new dentries in readdir for inodes that need to be revalidated immediately Ben Hutchings
2013-09-08 2:52 ` [025/121] nl80211: fix mgmt tx status and testmode reporting for netns Ben Hutchings
2013-09-08 2:52 ` [089/121] Revert "PM / Domains: Fix handling of wakeup devices during system resume" Ben Hutchings
2013-09-08 2:52 ` [037/121] x86, fpu: correct the asm constraints for fxsave, unbreak mxcsr.daz Ben Hutchings
2013-09-08 2:52 ` [120/121] KVM: s390: move kvm_guest_enter,exit closer to sie Ben Hutchings
2013-09-08 2:52 ` [086/121] [SCSI] zfcp: fix schedule-inside-lock in scsi_device list loops Ben Hutchings
2013-09-08 2:52 ` [056/121] [SCSI] megaraid_sas: megaraid_sas driver init fails in kdump kernel Ben Hutchings
2013-09-08 2:52 ` [049/121] USB: serial: ftdi_sio: add more RT Systems ftdi devices Ben Hutchings
2013-09-08 2:52 ` [063/121] zd1201: do not use stack as URB transfer_buffer Ben Hutchings
2013-09-08 2:52 ` [081/121] xen/events: mask events when changing their VCPU binding Ben Hutchings
2013-09-08 2:52 ` [115/121] microblaze: Fix __futex_atomic_op macro register usage Ben Hutchings
2013-09-08 2:52 ` [033/121] Bluetooth: ath3k: Add support for ID 0x13d3/0x3402 Ben Hutchings
2013-09-08 2:52 ` [080/121] xen/events: initialize local per-cpu mask for all possible events Ben Hutchings
2013-09-08 2:52 ` [021/121] slab: introduce kmalloc_array() Ben Hutchings
2013-09-08 2:52 ` [038/121] mwifiex: Add missing endian conversion Ben Hutchings
2013-09-08 2:52 ` [092/121] sound: Fix make allmodconfig on MIPS Ben Hutchings
2013-09-08 2:52 ` [082/121] block: Add bio_for_each_segment_all() Ben Hutchings
2013-09-08 2:52 ` [090/121] SCSI: nsp32: use mdelay instead of large udelay constants Ben Hutchings
2013-09-08 2:52 ` [096/121] [PARISC] include <linux/prefetch.h> in drivers/parisc/iommu-helpers.h Ben Hutchings
2013-09-08 2:52 ` [041/121] serial/mxs-auart: increase time to wait for transmitter to become idle Ben Hutchings
2013-09-08 2:52 ` [110/121] x86 get_unmapped_area: Access mmap_legacy_base through mm_struct member Ben Hutchings
2013-09-08 2:52 ` [083/121] [SCSI] sg: Fix user memory corruption when SG_IO is interrupted by a signal Ben Hutchings
2013-09-08 2:52 ` [119/121] target: Fix trailing ASCII space usage in INQUIRY vendor+model Ben Hutchings
2013-09-08 2:52 ` [054/121] iwl4965: set power mode early Ben Hutchings
2013-09-08 2:52 ` [068/121] USB: adutux: fix big-endian device-type reporting Ben Hutchings
2013-09-08 2:52 ` [009/121] sysctl net: Keep tcp_syn_retries inside the boundary Ben Hutchings
2013-09-08 2:52 ` [079/121] libata: apply behavioral quirks to sil3826 PMP Ben Hutchings
2013-09-08 2:52 ` Ben Hutchings [this message]
2013-09-08 2:52 ` [013/121] net_sched: Fix stack info leak in cbq_dump_wrr() Ben Hutchings
2013-09-08 2:52 ` [077/121] USB: keyspan: fix null-deref at disconnect and release Ben Hutchings
2013-09-08 2:52 ` [050/121] ACPI / battery: Fix parsing _BIX return value Ben Hutchings
2013-09-08 2:52 ` [040/121] serial/mxs-auart: fix race condition in interrupt handler Ben Hutchings
2013-09-08 2:52 ` [109/121] drm/vmwgfx: Split GMR2_REMAP commands if they are to large Ben Hutchings
2013-09-08 2:52 ` [032/121] Bluetooth: ath3k: Add support for Fujitsu Lifebook UH5x2 [04c5:1330] Ben Hutchings
2013-09-08 2:52 ` [047/121] virtio: console: return -ENODEV on all read operations after unplug Ben Hutchings
2013-09-08 2:52 ` [099/121] iwl4965: fix rfkill set state regression Ben Hutchings
2013-09-08 2:52 ` [042/121] ixgbe: Fix Tx Hang issue with lldpad on 82598EB Ben Hutchings
2013-09-08 2:52 ` [003/121] libata: make it clear that sata_inic162x is experimental Ben Hutchings
2013-09-08 2:52 ` [008/121] arcnet: cleanup sizeof parameter Ben Hutchings
2013-09-08 2:52 ` [029/121] ath9k_htc: do some initial hardware configuration Ben Hutchings
2013-09-08 2:52 ` [064/121] Hostap: copying wrong data prism2_ioctl_giwaplist() Ben Hutchings
2013-09-08 2:52 ` [055/121] iwl4965: reset firmware after rfkill off Ben Hutchings
2013-09-08 2:52 ` [034/121] Bluetooth: Add support for Atheros [0cf3:3121] Ben Hutchings
2013-09-08 2:52 ` [117/121] sparc32: Add ucmpdi2.o to obj-y instead of lib-y Ben Hutchings
2013-09-08 2:52 ` [075/121] usb: add two quirky touchscreen Ben Hutchings
2013-09-08 2:52 ` [094/121] CRIS: Add _sdata to vmlinux.lds.S Ben Hutchings
2013-09-08 2:52 ` [001/121] ifb: Include <linux/sched.h> Ben Hutchings
2013-09-08 2:52 ` [022/121] NFSv4.1: integer overflow in decode_cb_sequence_args() Ben Hutchings
2013-09-08 2:52 ` [024/121] vm: add no-mmu vm_iomap_memory() stub Ben Hutchings
2013-09-08 2:52 ` [016/121] drm/i915/lvds: ditch ->prepare special case Ben Hutchings
2013-09-08 2:52 ` [074/121] m68k: Truncate base in do_div() Ben Hutchings
2013-09-08 2:52 ` [111/121] pci: frv architecture needs generic setup-bus infrastructure Ben Hutchings
2013-09-08 2:52 ` [069/121] USB: ti_usb_3410_5052: fix big-endian firmware handling Ben Hutchings
2013-09-08 2:52 ` [100/121] ath9k_htc: Restore skb headroom when returning skb to mac80211 Ben Hutchings
2013-09-08 2:52 ` [061/121] hwmon: (adt7470) Fix incorrect return code check Ben Hutchings
2013-09-08 2:52 ` [006/121] perf: Fix event group context move Ben Hutchings
2013-09-08 2:52 ` [045/121] virtio: console: clean up port data immediately at time of unplug Ben Hutchings
2013-09-08 2:52 ` [058/121] ALSA: 6fire: fix DMA issues with URB transfer_buffer usage Ben Hutchings
2013-09-08 2:52 ` [073/121] m68k/atari: ARAnyM - Fix NatFeat module support Ben Hutchings
2013-09-08 2:52 ` [114/121] m32r: make memset() global for CONFIG_KERNEL_BZIP2=y Ben Hutchings
2013-09-08 2:52 ` [116/121] sparc32: add ucmpdi2 Ben Hutchings
2013-09-08 2:52 ` [067/121] jbd2: Fix use after free after error in jbd2_journal_dirty_metadata() Ben Hutchings
2013-09-08 2:52 ` [091/121] microblaze: Update microblaze defconfigs Ben Hutchings
2013-09-08 2:52 ` [060/121] drm/radeon: always program the MC on startup Ben Hutchings
2013-09-08 2:52 ` [053/121] iwlwifi: dvm: fix calling ieee80211_chswitch_done() with NULL Ben Hutchings
2013-09-08 2:52 ` [014/121] af_key: more info leaks in pfkey messages Ben Hutchings
2013-09-08 2:52 ` [019/121] ALSA: usb: Parse UAC2 extension unit like for UAC1 Ben Hutchings
2013-09-08 2:52 ` [052/121] cifs: extend the buffer length enought for sprintf() using Ben Hutchings
2013-09-09 3:03 ` Scott Lovenberg
2013-09-08 2:52 ` [084/121] of: fdt: fix memory initialization for expanded DT Ben Hutchings
2013-09-08 2:52 ` [101/121] powerpc: Don't Oops when accessing /proc/powerpc/lparcfg without hypervisor Ben Hutchings
2013-09-08 2:52 ` [012/121] usbnet: do not pretend to support SG/TSO Ben Hutchings
2013-09-08 2:52 ` [093/121] sound: Fix make allmodconfig on MIPS correctly Ben Hutchings
2013-09-08 2:52 ` [023/121] jfs: fix readdir cookie incompatibility with NFSv4 Ben Hutchings
2013-09-08 2:52 ` [065/121] ALSA: 6fire: make buffers DMA-able (pcm) Ben Hutchings
2013-09-08 2:52 ` [102/121] powerpc: Work around gcc miscompilation of __pa() on 64-bit Ben Hutchings
2013-09-08 2:52 ` [066/121] ALSA: 6fire: make buffers DMA-able (midi) Ben Hutchings
2013-09-08 2:52 ` [104/121] sunrpc: remove the second argument of k[un]map_atomic() Ben Hutchings
2013-09-08 2:52 ` [031/121] Bluetooth: Add support for Mediatek Bluetooth device [0e8d:763f] Ben Hutchings
2013-09-08 2:52 ` [062/121] ext4: fix mount/remount error messages for incompatible mount options Ben Hutchings
2013-09-08 2:52 ` [112/121] m32r: consistently use "suffix-$(...)" Ben Hutchings
2013-09-10 3:59 ` Hirokazu Takata
2013-09-08 2:52 ` [108/121] drm/i915: ivb: fix edp voltage swing reg val Ben Hutchings
2013-09-08 2:52 ` [007/121] perf tools: Add anonymous huge page recognition Ben Hutchings
2013-09-08 2:52 ` [020/121] ALSA: ak4xx-adda: info leak in ak4xxx_capture_source_info() Ben Hutchings
2013-09-08 2:52 ` [118/121] ALSA: opti9xx: Fix conflicting driver object name Ben Hutchings
2013-09-08 2:52 ` [002/121] mm/memory-hotplug: fix lowmem count overflow when offline pages Ben Hutchings
2013-09-08 2:52 ` [097/121] sparc32: support atomic64_t Ben Hutchings
2013-09-08 2:52 ` [005/121] drm/i915: quirk no PCH_PWM_ENABLE for Dell XPS13 backlight Ben Hutchings
2013-09-08 2:52 ` [072/121] fs/proc/task_mmu.c: fix buffer overflow in add_page_map() Ben Hutchings
2013-09-08 2:52 ` [070/121] ARM: 7809/1: perf: fix event validation for software group leaders Ben Hutchings
2013-09-08 2:52 ` [018/121] ALSA: usb-audio: skip UAC2 EFFECT_UNIT Ben Hutchings
2013-09-08 2:52 ` [011/121] ipv6: take rtnl_lock and mark mrt6 table as freed on namespace cleanup Ben Hutchings
2013-09-08 2:52 ` [036/121] ARM: 7791/1: a.out: remove partial a.out support Ben Hutchings
2013-09-08 2:52 ` [105/121] SUNRPC: Fix memory corruption issue on 32-bit highmem systems Ben Hutchings
2013-09-08 2:52 ` [035/121] Bluetooth: Add support for Atheros [0cf3:e003] Ben Hutchings
2013-09-08 2:52 ` [039/121] USB: mos7840: fix race in register handling Ben Hutchings
2013-09-08 2:52 ` [030/121] Bluetooth: Add support for Foxconn/Hon Hai [0489:e04d] Ben Hutchings
2013-09-08 2:52 ` [010/121] sctp: fully initialize sctp_outq in sctp_outq_init Ben Hutchings
2013-09-08 2:52 ` [076/121] USB: mos7720: fix broken control requests Ben Hutchings
2013-09-08 2:52 ` [071/121] perf/arm: Fix armpmu_map_hw_event() Ben Hutchings
2013-09-08 2:52 ` [087/121] nilfs2: remove double bio_put() in nilfs_end_bio_write() for BIO_EOPNOTSUPP error Ben Hutchings
2013-09-08 2:52 ` [088/121] nilfs2: fix issue with counting number of bio requests for BIO_EOPNOTSUPP error detection Ben Hutchings
2013-09-08 2:52 ` [121/121] x86/xen: do not identity map UNUSABLE regions in the machine E820 Ben Hutchings
2013-09-08 3:53 ` [000/121] 3.2.51-rc1 review Ben Hutchings
2013-09-08 7:10 ` Guenter Roeck
2013-09-08 8:18 ` Geert Uytterhoeven
2013-09-08 16:52 ` Guenter Roeck
2013-10-20 11:56 ` Ben Hutchings
2013-10-20 16:23 ` Guenter Roeck
2013-10-20 18:05 ` Ben Hutchings
2013-10-20 19:28 ` Guenter Roeck
2013-09-09 13:16 ` Greg Ungerer
2013-09-09 13:26 ` Guenter Roeck
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=lsq.1378608721.511138087@decadent.org.uk \
--to=ben@decadent.org.uk \
--cc=akpm@linux-foundation.org \
--cc=gregkh@linuxfoundation.org \
--cc=isimatu.yasuaki@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael.j.wysocki@intel.com \
--cc=rja@sgi.com \
--cc=stable@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=yinghai@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