From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB2BBC4360F for ; Wed, 20 Mar 2019 17:46:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 906A02184D for ; Wed, 20 Mar 2019 17:46:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553103969; bh=64HVlYvsWpzits0Zv+ARc+JrRxv1sELpiENLxlVtAQ8=; h=Subject:To:Cc:From:Date:List-ID:From; b=rvyEhVbSXWBtmnojIHm5gmgfTRStFAhWrwd9VIov12OgociO9faKODw1eirNIOMhg S4zdY8CVuWygcnSFs4iL4L7b3rFri7En56Gp0URYbRt+RPmDfLS9MCDRDHBpVB9bx1 idIfqJ5hksNoQ/Wl4+A45WYtOpWQZXvvfQ2zMnAs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727102AbfCTRqJ (ORCPT ); Wed, 20 Mar 2019 13:46:09 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:34777 "EHLO out5-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726971AbfCTRqI (ORCPT ); Wed, 20 Mar 2019 13:46:08 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id D193B23324; Wed, 20 Mar 2019 13:46:07 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 20 Mar 2019 13:46:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=bwEu/j wHeCfv0Aiyqycze8LY2oNKq0Xi41xoMD7rsb4=; b=DE0jWWMAVuAchyEuZ9Rz+1 GlzX2Uz40wHLib3fg04coefleHxATGuXStRUGV2w+a+fxjSwvtKO5+A3Cf7bVRvi cPmPBuvN1hkKrLnFgf5xNcl4tcwSAx9WMvvjjgwP1+zRZKw5GzpiJGiwHHVpgMAK DbW3nXKuuvKJhdjgosssxqvvCNBf4QBeG7zXkykPW565jLKsM37klZY/g9PstzoB 1UzBzV+p9cqfo0otXFjkUZIN8SofLp2qRPHEpR4PiDpArkHH3334fjUBvdUhzLaz ScZ6Gr+e+NTLL7ijx9CKWCq3f9M9C/yl717YUxmyRWJ5VcFJICGPkIus+PVBoO2w == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrieeigddutdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvffhfffkgggtgfesthekredttd dtlfenucfhrhhomhepoehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhr gheqnecukfhppeekfedrkeeirdekledruddtjeenucfrrghrrghmpehmrghilhhfrhhomh epghhrvghgsehkrhhorghhrdgtohhmnecuvehluhhsthgvrhfuihiivgepje X-ME-Proxy: Received: from localhost (5356596b.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) by mail.messagingengine.com (Postfix) with ESMTPA id 23480E4176; Wed, 20 Mar 2019 13:46:07 -0400 (EDT) Subject: FAILED: patch "[PATCH] btrfs: init csum_list before possible free" failed to apply to 4.4-stable tree To: dan@dlrobertson.com, dsterba@suse.com, nborisov@suse.com Cc: From: Date: Wed, 20 Mar 2019 18:45:54 +0100 Message-ID: <155310395421515@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 4.4-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From e49be14b8d80e23bb7c53d78c21717a474ade76b Mon Sep 17 00:00:00 2001 From: Dan Robertson Date: Tue, 19 Feb 2019 02:56:43 +0000 Subject: [PATCH] btrfs: init csum_list before possible free The scrub_ctx csum_list member must be initialized before scrub_free_ctx is called. If the csum_list is not initialized beforehand, the list_empty call in scrub_free_csums will result in a null deref if the allocation fails in the for loop. Fixes: a2de733c78fa ("btrfs: scrub") CC: stable@vger.kernel.org # 3.0+ Reviewed-by: Nikolay Borisov Signed-off-by: Dan Robertson Reviewed-by: David Sterba Signed-off-by: David Sterba diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 669bedfec4a9..a99588536c79 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -584,6 +584,7 @@ static noinline_for_stack struct scrub_ctx *scrub_setup_ctx( sctx->pages_per_rd_bio = SCRUB_PAGES_PER_RD_BIO; sctx->curr = -1; sctx->fs_info = fs_info; + INIT_LIST_HEAD(&sctx->csum_list); for (i = 0; i < SCRUB_BIOS_PER_SCTX; ++i) { struct scrub_bio *sbio; @@ -608,7 +609,6 @@ static noinline_for_stack struct scrub_ctx *scrub_setup_ctx( atomic_set(&sctx->workers_pending, 0); atomic_set(&sctx->cancel_req, 0); sctx->csum_size = btrfs_super_csum_size(fs_info->super_copy); - INIT_LIST_HEAD(&sctx->csum_list); spin_lock_init(&sctx->list_lock); spin_lock_init(&sctx->stat_lock);