Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756064Ab2JVSn5 (ORCPT ); Mon, 22 Oct 2012 14:43:57 -0400 Received: from casper.infradead.org ([85.118.1.10]:58012 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756037Ab2JVSn4 (ORCPT ); Mon, 22 Oct 2012 14:43:56 -0400 Message-ID: <508593E6.2060303@kernel.dk> Date: Mon, 22 Oct 2012 20:43:50 +0200 From: Jens Axboe MIME-Version: 1.0 To: "Jun'ichi Nomura" CC: "linux-kernel@vger.kernel.org" , Tejun Heo , Vivek Goyal Subject: Re: [PATCH] blkcg: Fix use-after-free of q->root_blkg and q->root_rl.blkg References: <50750367.2070508@ce.jp.nec.com> <20121010155929.GA18733@redhat.com> <50762182.5090806@ce.jp.nec.com> <20121016232040.GH16166@google.com> <507DF58E.8060804@ce.jp.nec.com> <507E7030.9070607@ce.jp.nec.com> In-Reply-To: <507E7030.9070607@ce.jp.nec.com> X-Enigmail-Version: 1.4.5 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2808 Lines: 62 On 2012-10-17 10:45, Jun'ichi Nomura wrote: > blk_put_rl() does not call blkg_put() for q->root_rl because we > don't take request list reference on q->root_blkg. > However, if root_blkg is once attached then detached (freed), > blk_put_rl() is confused by the bogus pointer in q->root_blkg. > > For example, with !CONFIG_BLK_DEV_THROTTLING && > CONFIG_CFQ_GROUP_IOSCHED, > switching IO scheduler from cfq to deadline will cause system stall > after the following warning with 3.6: > >> WARNING: at /work/build/linux/block/blk-cgroup.h:250 >> blk_put_rl+0x4d/0x95() >> Modules linked in: bridge stp llc sunrpc acpi_cpufreq freq_table mperf >> ipt_REJECT nf_conntrack_ipv4 nf_defrag_ipv4 >> Pid: 0, comm: swapper/0 Not tainted 3.6.0 #1 >> Call Trace: >> [] warn_slowpath_common+0x85/0x9d >> [] warn_slowpath_null+0x1a/0x1c >> [] blk_put_rl+0x4d/0x95 >> [] __blk_put_request+0xc3/0xcb >> [] blk_finish_request+0x232/0x23f >> [] ? blk_end_bidi_request+0x34/0x5d >> [] blk_end_bidi_request+0x42/0x5d >> [] blk_end_request+0x10/0x12 >> [] scsi_io_completion+0x207/0x4d5 >> [] scsi_finish_command+0xfa/0x103 >> [] scsi_softirq_done+0xff/0x108 >> [] blk_done_softirq+0x8d/0xa1 >> [] ? >> generic_smp_call_function_single_interrupt+0x9f/0xd7 >> [] __do_softirq+0x102/0x213 >> [] ? lock_release_holdtime+0xb6/0xbb >> [] ? raise_softirq_irqoff+0x9/0x3d >> [] call_softirq+0x1c/0x30 >> [] do_softirq+0x4b/0xa3 >> [] irq_exit+0x53/0xd5 >> [] smp_call_function_single_interrupt+0x34/0x36 >> [] call_function_single_interrupt+0x6f/0x80 >> [] ? mwait_idle+0x94/0xcd >> [] ? mwait_idle+0x8b/0xcd >> [] cpu_idle+0xbb/0x114 >> [] rest_init+0xc1/0xc8 >> [] ? csum_partial_copy_generic+0x16c/0x16c >> [] start_kernel+0x3d4/0x3e1 >> [] ? kernel_init+0x1f7/0x1f7 >> [] x86_64_start_reservations+0xb8/0xbd >> [] x86_64_start_kernel+0x101/0x110 > > This patch clears q->root_blkg and q->root_rl.blkg when root blkg > is destroyed. Thanks, applied to for-linus (and marked stable). -- Jens Axboe -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/