Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp581316img; Fri, 22 Mar 2019 04:29:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqwYU8OplQqBA54c+MzHwZhr0LZmkMutBkkmOyfZ4HdBqlzkISANcnnLgsAb82I5meDauLHG X-Received: by 2002:a63:7444:: with SMTP id e4mr8502561pgn.398.1553254190796; Fri, 22 Mar 2019 04:29:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553254190; cv=none; d=google.com; s=arc-20160816; b=ZlXcTmeJi3gE5AO0aw5rzIQ98c1qVHT14YeB/fHR4fJmesGmz/3OvWsyztrzwBacgh IfNqQaIhf0cjmDmLsP308uFC0nGq46QcIGAebG5F3Wi8bU7hW9P0a7/OHP+zc6EfBwnW sMpLp17dK0nlRR4OATHdhVrr0TdGAiVpIMIRkzfDr7dqHWjYb2VohcC/l79JYHHk37eP GqSBy5hefqpMDqyAkTbO0tSwNZRR8bOgY4JU5WNAF1S+NlJvZ3PQwzH/rxtNPtnWS2Ge fHKwiKlDrnYbuKVUiBtUIqBHVbX2RfRPFm/Hi6SjhJRAD+96Ys9EAzPoDv+c/Jfu2ud8 K9pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9WOFXBVFIJE+QEyAF1omnT1kVdcyeBZiqk2kaiNgI4g=; b=KAR7rJ/ET4fb1H0esrVdswWmpFxykH5j/QGTla2s7EfEDq25uE8Y+yGOowAxoUfbkn OJpr3RKHfClgEctOijbbzPgWXsl+zWEmp+3z8rSlCLqiNPL6EBA3RMPlc9sU/60age+Y KkIB/x79Wv1zquwq1RtLl9gs+k3w1wEYgMXPdIvHVLxtPFqzUxnyxMoc/AYDwXANjjq7 2W4U9ec0MnyWjDYO5FdtgO4Um5t3YAAhMMKsyRFZYPjKHU/4eAyZIy6k9j2yhI+SD6a0 5Y4ZuzfUySqRVZcYsQNPSDZ0a132SeOsMJjV1Fr/1NtSQwBv66cQjp9Q6S1FvQsC710i 9XYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XH0Dj8R+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w16si6707707pll.113.2019.03.22.04.29.35; Fri, 22 Mar 2019 04:29:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XH0Dj8R+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729478AbfCVL0x (ORCPT + 99 others); Fri, 22 Mar 2019 07:26:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:54590 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729454AbfCVL0v (ORCPT ); Fri, 22 Mar 2019 07:26:51 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4499D218A2; Fri, 22 Mar 2019 11:26:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553254010; bh=oY+/Jqh2TtnhI1Qrp3AcSjcK3lqguVR4b2hNEFjJ1JQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XH0Dj8R++h2FaPSceGGcc9gGiJWwfEeCRpbHCvASjZ+g9nfUwiMYXf2WNvit6NhLo 9GZY6vOLZ4yVC6RGPuYQdScB9uN1rBqBfNnmz9VVPEK5fn57Ulho+JJxnavTW7H+A8 WGvYrOdNgAktqCdroZsJFs8u3Y50ElSYnZavmFag= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guoqing Jiang , Aditya Pakki , Song Liu Subject: [PATCH 3.18 131/134] md: Fix failed allocation of md_register_thread Date: Fri, 22 Mar 2019 12:15:44 +0100 Message-Id: <20190322111220.030238387@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322111210.465931067@linuxfoundation.org> References: <20190322111210.465931067@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Aditya Pakki commit e406f12dde1a8375d77ea02d91f313fb1a9c6aec upstream. mddev->sync_thread can be set to NULL on kzalloc failure downstream. The patch checks for such a scenario and frees allocated resources. Committer node: Added similar fix to raid5.c, as suggested by Guoqing. Cc: stable@vger.kernel.org # v3.16+ Acked-by: Guoqing Jiang Signed-off-by: Aditya Pakki Signed-off-by: Song Liu Signed-off-by: Greg Kroah-Hartman --- drivers/md/raid10.c | 2 ++ drivers/md/raid5.c | 2 ++ 2 files changed, 4 insertions(+) --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -3836,6 +3836,8 @@ static int run(struct mddev *mddev) set_bit(MD_RECOVERY_RUNNING, &mddev->recovery); mddev->sync_thread = md_register_thread(md_do_sync, mddev, "reshape"); + if (!mddev->sync_thread) + goto out_free_conf; } return 0; --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -6171,6 +6171,8 @@ static int run(struct mddev *mddev) set_bit(MD_RECOVERY_RUNNING, &mddev->recovery); mddev->sync_thread = md_register_thread(md_do_sync, mddev, "reshape"); + if (!mddev->sync_thread) + goto abort; } /* Ok, everything is just fine now */