From: Luis Henriques <luis.henriques@canonical.com>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
kernel-team@lists.ubuntu.com
Cc: Mikulas Patocka <mpatocka@redhat.com>,
Jens Axboe <axboe@kernel.dk>,
Luis Henriques <luis.henriques@canonical.com>
Subject: [PATCH 3.5 21/90] block: fix a probe argument to blk_register_region
Date: Thu, 5 Dec 2013 17:35:03 +0000 [thread overview]
Message-ID: <1386264972-5399-22-git-send-email-luis.henriques@canonical.com> (raw)
In-Reply-To: <1386264972-5399-1-git-send-email-luis.henriques@canonical.com>
3.5.7.27 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <mpatocka@redhat.com>
commit a207f5937630dd35bd2550620bef416937a1365e upstream.
The probe function is supposed to return NULL on failure (as we can see in
kobj_lookup: kobj = probe(dev, index, data); ... if (kobj) return kobj;
However, in loop and brd, it returns negative error from ERR_PTR.
This causes a crash if we simulate disk allocation failure and run
less -f /dev/loop0 because the negative number is interpreted as a pointer:
BUG: unable to handle kernel NULL pointer dereference at 00000000000002b4
IP: [<ffffffff8118b188>] __blkdev_get+0x28/0x450
PGD 23c677067 PUD 23d6d1067 PMD 0
Oops: 0000 [#1] PREEMPT SMP
Modules linked in: loop hpfs nvidia(PO) ip6table_filter ip6_tables uvesafb cfbcopyarea cfbimgblt cfbfillrect fbcon font bitblit fbcon_rotate fbcon_cw fbcon_ud fbcon_ccw softcursor fb fbdev msr ipt_MASQUERADE iptable_nat nf_nat_ipv4 nf_conntrack_ipv4 nf_defrag_ipv4 xt_state ipt_REJECT xt_tcpudp iptable_filter ip_tables x_tables bridge stp llc tun ipv6 cpufreq_stats cpufreq_ondemand cpufreq_userspace cpufreq_powersave cpufreq_conservative hid_generic spadfs usbhid hid fuse raid0 snd_usb_audio snd_pcm_oss snd_mixer_oss md_mod snd_pcm snd_timer snd_page_alloc snd_hwdep snd_usbmidi_lib dmi_sysfs snd_rawmidi nf_nat_ftp nf_nat nf_conntrack_ftp nf_conntrack snd soundcore lm85 hwmon_vid ohci_hcd ehci_pci ehci_hcd serverworks sata_svw libata acpi_cpufreq freq_table mperf ide_core usbcore kvm_amd kvm tg3 i2c_piix4 libphy microcode e100 usb_common ptp skge i2c_core pcspkr k10temp evdev floppy hwmon pps_core mii rtc_cmos button processor unix [last unloaded: nvidia]
CPU: 1 PID: 6831 Comm: less Tainted: P W O 3.10.15-devel #18
Hardware name: empty empty/S3992-E, BIOS 'V1.06 ' 06/09/2009
task: ffff880203cc6bc0 ti: ffff88023e47c000 task.ti: ffff88023e47c000
RIP: 0010:[<ffffffff8118b188>] [<ffffffff8118b188>] __blkdev_get+0x28/0x450
RSP: 0018:ffff88023e47dbd8 EFLAGS: 00010286
RAX: ffffffffffffff74 RBX: ffffffffffffff74 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000001
RBP: ffff88023e47dc18 R08: 0000000000000002 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffff88023f519658
R13: ffffffff8118c300 R14: 0000000000000000 R15: ffff88023f519640
FS: 00007f2070bf7700(0000) GS:ffff880247400000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000000002b4 CR3: 000000023da1d000 CR4: 00000000000007e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Stack:
0000000000000002 0000001d00000000 000000003e47dc50 ffff88023f519640
ffff88043d5bb668 ffffffff8118c300 ffff88023d683550 ffff88023e47de60
ffff88023e47dc98 ffffffff8118c10d 0000001d81605698 0000000000000292
Call Trace:
[<ffffffff8118c300>] ? blkdev_get_by_dev+0x60/0x60
[<ffffffff8118c10d>] blkdev_get+0x1dd/0x370
[<ffffffff8118c300>] ? blkdev_get_by_dev+0x60/0x60
[<ffffffff813cea6c>] ? _raw_spin_unlock+0x2c/0x50
[<ffffffff8118c300>] ? blkdev_get_by_dev+0x60/0x60
[<ffffffff8118c365>] blkdev_open+0x65/0x80
[<ffffffff8114d12e>] do_dentry_open.isra.18+0x23e/0x2f0
[<ffffffff8114d214>] finish_open+0x34/0x50
[<ffffffff8115e122>] do_last.isra.62+0x2d2/0xc50
[<ffffffff8115eb58>] path_openat.isra.63+0xb8/0x4d0
[<ffffffff81115a8e>] ? might_fault+0x4e/0xa0
[<ffffffff8115f4f0>] do_filp_open+0x40/0x90
[<ffffffff813cea6c>] ? _raw_spin_unlock+0x2c/0x50
[<ffffffff8116db85>] ? __alloc_fd+0xa5/0x1f0
[<ffffffff8114e45f>] do_sys_open+0xef/0x1d0
[<ffffffff8114e559>] SyS_open+0x19/0x20
[<ffffffff813cff16>] system_call_fastpath+0x1a/0x1f
Code: 44 00 00 55 48 89 e5 41 57 49 89 ff 41 56 41 89 d6 41 55 41 54 4c 8d 67 18 53 48 83 ec 18 89 75 cc e9 f2 00 00 00 0f 1f 44 00 00 <48> 8b 80 40 03 00 00 48 89 df 4c 8b 68 58 e8 d5
a4 07 00 44 89
RIP [<ffffffff8118b188>] __blkdev_get+0x28/0x450
RSP <ffff88023e47dbd8>
CR2: 00000000000002b4
---[ end trace bb7f32dbf02398dc ]---
The brd change should be backported to stable kernels starting with 2.6.25.
The loop change should be backported to stable kernels starting with 2.6.22.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
drivers/block/brd.c | 2 +-
drivers/block/loop.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index 4e8213a..a7d70e2 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -546,7 +546,7 @@ static struct kobject *brd_probe(dev_t dev, int *part, void *data)
mutex_lock(&brd_devices_mutex);
brd = brd_init_one(MINOR(dev) >> part_shift);
- kobj = brd ? get_disk(brd->brd_disk) : ERR_PTR(-ENOMEM);
+ kobj = brd ? get_disk(brd->brd_disk) : NULL;
mutex_unlock(&brd_devices_mutex);
*part = 0;
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 97febab..1e50244 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1743,7 +1743,7 @@ static struct kobject *loop_probe(dev_t dev, int *part, void *data)
if (err < 0)
err = loop_add(&lo, MINOR(dev) >> part_shift);
if (err < 0)
- kobj = ERR_PTR(err);
+ kobj = NULL;
else
kobj = get_disk(lo->lo_disk);
mutex_unlock(&loop_index_mutex);
--
1.8.3.2
next prev parent reply other threads:[~2013-12-05 17:36 UTC|newest]
Thread overview: 91+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-05 17:34 [3.5.y.z extended stable] Linux 3.5.7.27 stable review Luis Henriques
2013-12-05 17:34 ` [PATCH 3.5 01/90] ACPICA: Interpreter: Fix Store() when implicit conversion is not possible Luis Henriques
2013-12-05 17:34 ` [PATCH 3.5 02/90] ACPICA: DeRefOf operator: Update to fully resolve FieldUnit and BufferField refs Luis Henriques
2013-12-05 17:34 ` [PATCH 3.5 03/90] ACPICA: Return error if DerefOf resolves to a null package element Luis Henriques
2013-12-05 17:34 ` [PATCH 3.5 04/90] ACPICA: Fix for a Store->ArgX when ArgX contains a reference to a field Luis Henriques
2013-12-05 17:34 ` [PATCH 3.5 05/90] aacraid: prevent invalid pointer dereference Luis Henriques
2013-12-05 17:34 ` [PATCH 3.5 06/90] libertas: potential oops in debugfs Luis Henriques
2013-12-05 17:34 ` [PATCH 3.5 07/90] ARM: sa11x0/assabet: ensure CS2 is configured appropriately Luis Henriques
2013-12-05 17:34 ` [PATCH 3.5 08/90] dm: allocate buffer for messages with small number of arguments using GFP_NOIO Luis Henriques
2013-12-05 17:34 ` [PATCH 3.5 09/90] ext4: avoid bh leak in retry path of ext4_expand_extra_isize_ea() Luis Henriques
2013-12-05 17:34 ` [PATCH 3.5 10/90] drm/radeon/si: fix define for MC_SEQ_TRAIN_WAKEUP_CNTL Luis Henriques
2013-12-05 17:34 ` [PATCH 3.5 11/90] drm/ttm: Handle in-memory region copies Luis Henriques
2013-12-05 17:34 ` [PATCH 3.5 12/90] drm/ttm: Fix ttm_bo_move_memcpy Luis Henriques
2013-12-05 17:34 ` [PATCH 3.5 13/90] drm/ttm: Fix memory type compatibility check Luis Henriques
2013-12-05 17:34 ` [PATCH 3.5 14/90] PM / hibernate: Avoid overflow in hibernate_preallocate_memory() Luis Henriques
2013-12-05 17:34 ` [PATCH 3.5 15/90] mtd: nand: hack ONFI for non-power-of-2 dimensions Luis Henriques
2013-12-05 17:34 ` [PATCH 3.5 16/90] mtd: map: fixed bug in 64-bit systems Luis Henriques
2013-12-05 17:34 ` [PATCH 3.5 17/90] mtd: m25p80: fix allocation size Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 18/90] block: fix race between request completion and timeout handling Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 19/90] blk-core: Fix memory corruption if blkcg_init_queue fails Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 20/90] loop: fix crash if blk_alloc_queue fails Luis Henriques
2013-12-05 17:35 ` Luis Henriques [this message]
2013-12-05 17:35 ` [PATCH 3.5 22/90] block: properly stack underlying max_segment_size to DM device Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 23/90] xen/blkback: fix reference counting Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 24/90] loop: fix crash when using unassigned loop device Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 25/90] SUNRPC: Fix a data corruption issue when retransmitting RPC calls Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 26/90] mtd: gpmi: fix kernel BUG due to racing DMA operations Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 27/90] ALSA: msnd: Avoid duplicated driver name Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 28/90] x86/microcode/amd: Tone down printk(), don't treat a missing firmware file as an error Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 29/90] SUNRPC: Avoid deep recursion in rpc_release_client Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 30/90] ALSA: hda - Don't clear the power state at snd_hda_codec_reset() Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 31/90] ASoC: blackfin: Fix missing break Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 32/90] drm/nouveau: when bailing out of a pushbuf ioctl, do not remove previous fence Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 33/90] ASoC: fsl: imx-pcm-fiq: omit fiq counter to avoid harm in unbalanced situations Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 34/90] ALSA: pcsp: Fix the order of input device unregistration Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 35/90] ASoC: wm8962: Turn on regcache_cache_only before disabling regulator Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 36/90] ARM: integrator_cp: Set LCD{0,1} enable lines when turning on CLCD Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 37/90] hwmon: (lm90) Fix max6696 alarm handling Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 38/90] ASoC: cs42l52: Correct MIC CTL mask Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 39/90] ARM: OMAP2+: omap_device: maintain sane runtime pm status around suspend/resume Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 40/90] setfacl removes part of ACL when setting POSIX ACLs to Samba Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 41/90] IB/ipath: Convert ipath_user_sdma_pin_pages() to use get_user_pages_fast() Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 42/90] rtlwifi: rtl8192se: Fix wrong assignment Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 43/90] rtlwifi: Fix endian error in extracting packet type Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 44/90] rtlwifi: rtl8192se: Fix incorrect signal strength for unassociated AP Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 45/90] rtlwifi: rtl8192cu: " Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 46/90] rtlwifi: rtl8192de: " Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 47/90] mwifiex: correct packet length for packets from SDIO interface Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 48/90] prism54: set netdev type to "wlan" Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 49/90] selinux: correct locking in selinux_netlbl_socket_connect) Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 50/90] Revert "ima: policy for RAMFS" Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 51/90] audit: printk USER_AVC messages when audit isn't enabled Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 52/90] audit: fix info leak in AUDIT_GET requests Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 53/90] audit: use nlmsg_len() to get message payload length Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 54/90] target: Fix delayed Task Aborted Status (TAS) handling bug Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 55/90] md: fix calculation of stacking limits on level change Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 56/90] drm/i915: flush cursors harder Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 57/90] rtlwifi: rtl8192cu: Fix more pointer arithmetic errors Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 58/90] radeon: workaround pinning failure on low ram gpu Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 59/90] drm/radeon: add semaphore trace point Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 60/90] nfsd: split up nfsd_setattr Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 61/90] nfsd: make sure to balance get/put_write_access Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 62/90] nfsd4: fix xdr decoding of large non-write compounds Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 63/90] avr32: setup crt for early panic() Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 64/90] avr32: fix out-of-range jump in large kernels Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 65/90] PCI: Remove duplicate pci_disable_device() from pcie_portdrv_remove() Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 66/90] powerpc/pseries: Duplicate dtl entries sometimes sent to userspace Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 67/90] powerpc/signals: Mark VSX not saved with small contexts Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 68/90] iscsi-target: fix extract_param to handle buffer length corner case Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 69/90] iscsi-target: chap auth shouldn't match username with trailing garbage Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 70/90] configfs: fix race between dentry put and lookup Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 71/90] KVM: perform an invalid memslot step for gpa base change Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 72/90] KVM: Fix iommu map/unmap to handle memory slot moves Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 73/90] ARM: i.MX6q: fix the wrong parent of can_root clock Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 74/90] crypto: s390 - Fix aes-cbc IV corruption Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 75/90] iio:accel:kxsd9 fix missing mutex unlock Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 76/90] PCI: Define macro for Marvell vendor ID Luis Henriques
2013-12-05 17:35 ` [PATCH 3.5 77/90] ahci: add Marvell 9230 to the AHCI PCI device list Luis Henriques
2013-12-05 17:36 ` [PATCH 3.5 78/90] powerpc/signals: Improved mark VSX not saved with small contexts fix Luis Henriques
2013-12-05 17:36 ` [PATCH 3.5 79/90] staging: zsmalloc: Ensure handle is never 0 on success Luis Henriques
2013-12-05 17:36 ` [PATCH 3.5 80/90] ALSA: hda/realtek - Add support of ALC231 codec Luis Henriques
2013-12-05 17:36 ` [PATCH 3.5 81/90] ALSA: hda/realtek - Set pcbeep amp for ALC668 Luis Henriques
2013-12-05 17:36 ` [PATCH 3.5 82/90] tracing: Allow events to have NULL strings Luis Henriques
2013-12-05 17:36 ` [PATCH 3.5 83/90] Staging: tidspbridge: disable driver Luis Henriques
2013-12-05 17:36 ` [PATCH 3.5 84/90] cpuset: Fix memory allocator deadlock Luis Henriques
2013-12-05 17:36 ` [PATCH 3.5 85/90] staging: vt6656: [BUG] Fix for TX USB resets from vendors driver Luis Henriques
2013-12-05 17:36 ` [PATCH 3.5 86/90] exec/ptrace: fix get_dumpable() incorrect tests Luis Henriques
2013-12-05 17:36 ` [PATCH 3.5 87/90] SUNRPC: don't map EKEYEXPIRED to EACCES in call_refreshresult Luis Henriques
2013-12-05 17:36 ` [PATCH 3.5 88/90] ftrace: Fix function graph with loading of modules Luis Henriques
2013-12-05 17:36 ` [PATCH 3.5 89/90] Input: i8042 - add PNP modaliases Luis Henriques
2013-12-05 17:36 ` [PATCH 3.5 90/90] misc: atmel_pwm: add deferred-probing support Luis Henriques
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=1386264972-5399-22-git-send-email-luis.henriques@canonical.com \
--to=luis.henriques@canonical.com \
--cc=axboe@kernel.dk \
--cc=kernel-team@lists.ubuntu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mpatocka@redhat.com \
--cc=stable@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
all inboxes | Powered by JetHome®