Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9036452pxu; Mon, 28 Dec 2020 05:05:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJz5uOavgYhcu8tlalzlgDPJ0R9ttkEkqvvgEzK1M9KIAA7yT8dRM19lBq4TRou7MFP1bQu1 X-Received: by 2002:a05:6402:8d5:: with SMTP id d21mr32583701edz.57.1609160703757; Mon, 28 Dec 2020 05:05:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609160703; cv=none; d=google.com; s=arc-20160816; b=DwFgzAsmn3ImmVQ3LZ9z9w2ILu3LD58P6cD8t3wQmlLpIhVgWBAgjYEV9/iwyrEHht ytmteWPFyS6770e5reocw9UA0Njyj9/4iQMen7iLr9uOeJkpMO2qkpZnnQqNsUmoq9h7 /+eTlLSS9ZHc6kfCED9kExgaEiDVU2Mc0W/0zNxPUYQmgZD2Suu2ZoW3CpVm7vDR9p4I NryyV3hfJbgegKkPLnpuyqTK2R9kXK0AGVos2LlYOk2HJn+s0mm4P19Rikp2bWu9MEWl 5N9oj9UG9oyC9NebyBc+4zb1gGRxQlM/gmBwH73+L1hao4TRuseWQYFPwn+v8QwvbAwQ gbTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZIwjQ3h2FlmvB+sHt9nJqw/9lWIWuVLGaolBbjsrmeQ=; b=nV2lQT+x0wpR16NFqAQYblu0oJVj8yWvMi7skHIxqFEHC6KPctr72BxygyqS5tVLf4 ldHTQPckKvJyKhIajU3KBKRlK1KYtTDNnJae9/A8d1aqP23dTwE8YDEdkGiz7hzBjzlT gZNaaBCMKeBT0W3FuA2oFrjHFYk7FTuYHdyVjbkjEqG5xtVlUdEY4hLasOA0cAW4act1 ptnvJCoqxmF1lkODAugNLo97m/3EC/1uv3xWYcKssPuEdlxBlFk6pJBPmUSfZ5mbNW5+ CqLC3cE7YJ9quq5MDHzwDGV+RK6v/72x8c/vE8czME9JbJPXkckZDXcAXyd9Gn9TbM92 WKxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=r26h2c7t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id by16si18186142ejb.105.2020.12.28.05.04.40; Mon, 28 Dec 2020 05:05:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=r26h2c7t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730120AbgL1NCh (ORCPT + 99 others); Mon, 28 Dec 2020 08:02:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:58754 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730112AbgL1NCg (ORCPT ); Mon, 28 Dec 2020 08:02:36 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6DFE7208D5; Mon, 28 Dec 2020 13:01:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609160516; bh=nZBP5cnI8bEjDbd9B4b4iJzMT36/HOi4uySoS/y2+qA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r26h2c7tEgpyr2TajqT5BfP7EXwL2HE4xoFLGnKSd8xelxokDG0zyWczgAV3/4J5Q dE6uZPqntNqb/E0v+QKu2mpt624YpRDmyHiO8yIJS7MyXs3C7nfGJ75ZD724FMUx33 o/AL8pN3/qEToqsJdc0Cwm7wF3JgsncN3zYMcQhU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Qinglang Miao , Ulf Hansson , Sasha Levin Subject: [PATCH 4.9 077/175] memstick: fix a double-free bug in memstick_check Date: Mon, 28 Dec 2020 13:48:50 +0100 Message-Id: <20201228124856.973177909@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124853.216621466@linuxfoundation.org> References: <20201228124853.216621466@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Qinglang Miao [ Upstream commit e3e9ced5c93803d5b2ea1942c4bf0192622531d6 ] kfree(host->card) has been called in put_device so that another kfree would raise cause a double-free bug. Fixes: 0193383a5833 ("memstick: core: fix device_register() error handling") Reported-by: Hulk Robot Signed-off-by: Qinglang Miao Link: https://lore.kernel.org/r/20201120074846.31322-1-miaoqinglang@huawei.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/memstick/core/memstick.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/memstick/core/memstick.c b/drivers/memstick/core/memstick.c index 1041eb7a61672..2cae85a7ca6de 100644 --- a/drivers/memstick/core/memstick.c +++ b/drivers/memstick/core/memstick.c @@ -469,7 +469,6 @@ static void memstick_check(struct work_struct *work) host->card = card; if (device_register(&card->dev)) { put_device(&card->dev); - kfree(host->card); host->card = NULL; } } else -- 2.27.0