mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 19/90] blk-core: Fix memory corruption if blkcg_init_queue fails
Date: Thu,  5 Dec 2013 17:35:01 +0000	[thread overview]
Message-ID: <1386264972-5399-20-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 fff4996b7db7955414ac74386efa5e07fd766b50 upstream.

If blkcg_init_queue fails, blk_alloc_queue_node doesn't call bdi_destroy
to clean up structures allocated by the backing dev.

------------[ cut here ]------------
WARNING: at lib/debugobjects.c:260 debug_print_object+0x85/0xa0()
ODEBUG: free active (active state 0) object type: percpu_counter hint:           (null)
Modules linked in: dm_loop dm_mod ip6table_filter ip6_tables uvesafb cfbcopyarea cfbimgblt cfbfillrect fbcon font bitblit fbcon_rotate fbcon_cw fbcon_ud fbcon_ccw softcursor fb fbdev ipt_MASQUERADE iptable_nat nf_nat_ipv4 msr nf_conntrack_ipv4 nf_defrag_ipv4 xt_state ipt_REJECT xt_tcpudp iptable_filter ip_tables x_tables bridge stp llc tun ipv6 cpufreq_userspace cpufreq_stats cpufreq_powersave cpufreq_ondemand cpufreq_conservative spadfs fuse hid_generic usbhid hid raid0 md_mod dmi_sysfs nf_nat_ftp nf_nat nf_conntrack_ftp nf_conntrack lm85 hwmon_vid snd_usb_audio snd_pcm_oss snd_mixer_oss snd_pcm snd_timer snd_page_alloc snd_hwdep snd_usbmidi_lib snd_rawmidi snd soundcore acpi_cpufreq freq_table mperf sata_svw serverworks kvm_amd ide_core ehci_pci ohci_hcd libata ehci_hcd kvm usbcore tg3 usb_common libphy k10temp pcspkr ptp i2c_piix4 i2c_core evdev microcode hwmon rtc_cmos pps_core e100 skge floppy mii processor button unix
CPU: 0 PID: 2739 Comm: lvchange Tainted: G        W
3.10.15-devel #14
Hardware name: empty empty/S3992-E, BIOS 'V1.06   ' 06/09/2009
 0000000000000009 ffff88023c3c1ae8 ffffffff813c8fd4 ffff88023c3c1b20
 ffffffff810399eb ffff88043d35cd58 ffffffff81651940 ffff88023c3c1bf8
 ffffffff82479d90 0000000000000005 ffff88023c3c1b80 ffffffff81039a67
Call Trace:
 [<ffffffff813c8fd4>] dump_stack+0x19/0x1b
 [<ffffffff810399eb>] warn_slowpath_common+0x6b/0xa0
 [<ffffffff81039a67>] warn_slowpath_fmt+0x47/0x50
 [<ffffffff8122aaaf>] ? debug_check_no_obj_freed+0xcf/0x250
 [<ffffffff81229a15>] debug_print_object+0x85/0xa0
 [<ffffffff8122abe3>] debug_check_no_obj_freed+0x203/0x250
 [<ffffffff8113c4ac>] kmem_cache_free+0x20c/0x3a0
 [<ffffffff811f6709>] blk_alloc_queue_node+0x2a9/0x2c0
 [<ffffffff811f672e>] blk_alloc_queue+0xe/0x10
 [<ffffffffa04c0093>] dm_create+0x1a3/0x530 [dm_mod]
 [<ffffffffa04c6bb0>] ? list_version_get_info+0xe0/0xe0 [dm_mod]
 [<ffffffffa04c6c07>] dev_create+0x57/0x2b0 [dm_mod]
 [<ffffffffa04c6bb0>] ? list_version_get_info+0xe0/0xe0 [dm_mod]
 [<ffffffffa04c6bb0>] ? list_version_get_info+0xe0/0xe0 [dm_mod]
 [<ffffffffa04c6528>] ctl_ioctl+0x268/0x500 [dm_mod]
 [<ffffffff81097662>] ? get_lock_stats+0x22/0x70
 [<ffffffffa04c67ce>] dm_ctl_ioctl+0xe/0x20 [dm_mod]
 [<ffffffff81161aad>] do_vfs_ioctl+0x2ed/0x520
 [<ffffffff8116cfc7>] ? fget_light+0x377/0x4e0
 [<ffffffff81161d2b>] SyS_ioctl+0x4b/0x90
 [<ffffffff813cff16>] system_call_fastpath+0x1a/0x1f
---[ end trace 4b5ff0d55673d986 ]---
------------[ cut here ]------------

This fix should be backported to stable kernels starting with 2.6.37. Note
that in the kernels prior to 3.5 the affected code is different, but the
bug is still there - bdi_init is called and bdi_destroy isn't.

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>
---
 block/blk-core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index cb3b3a7..ac4e3ea 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -605,10 +605,12 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
 	__set_bit(QUEUE_FLAG_BYPASS, &q->queue_flags);
 
 	if (blkcg_init_queue(q))
-		goto fail_id;
+		goto fail_bdi;
 
 	return q;
 
+fail_bdi:
+	bdi_destroy(&q->backing_dev_info);
 fail_id:
 	ida_simple_remove(&blk_queue_ida, q->id);
 fail_q:
-- 
1.8.3.2


  parent reply	other threads:[~2013-12-05 17:59 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 ` Luis Henriques [this message]
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 ` [PATCH 3.5 21/90] block: fix a probe argument to blk_register_region Luis Henriques
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-20-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®