Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9449864pxu; Mon, 28 Dec 2020 17:00:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJzKyKHakS+rBhklN+ieiUNMtrUBJD9Xp82My74emQnMMLmxBNL/+5urZ16AEUnQiOucMTnw X-Received: by 2002:aa7:d6d8:: with SMTP id x24mr45123679edr.105.1609203639771; Mon, 28 Dec 2020 17:00:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609203639; cv=none; d=google.com; s=arc-20160816; b=fnBLs6IrOfObXFtYNkPbSATVJGzferGDe9KrDd5bEEbx5HhWzrZ5Zxoqff0kYa3fi9 9KHd2lWMiPSOwSSRUkDW3CgN4phfTEq0JbKW12EYhgNevecbcipsswak4mf2DWCiCOao M29gASqMKlYw+LsygyNWu/h4iSkzUOcncF9Y833HK7A2lBo7LJdBN8py/F6dw2/F7sY2 woUTYz9k4mzL0jXK7jG8uFIUcnt+2oMT5QZksEdykYyOXTo7C27abeQV//ofxmggzNgd fka2tb/YW3wzkAi2Zc6VKxB3lDpBEjUxtZuyrIN3lU8NetKCh/qJ4oRqr4E3xI/7fSRg WYQA== 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=G7lNYBWpmSz0D9rfL9cADhMqTxoGdANWoJNZxCbWFVk=; b=N8mHAPe6ecLGdbxTMmUmp1S3NVZZBTsqtpjMW/3BuE7tOcvCR3chor4wuuRFGQHJdb 5fZ2PcjxCZy0ro0iV1a+rMAC6QC4LSCuxjhOl44mV5xLCh2QuiPun1fcZVN6q6t3faVd K94RPxSfN/Jtav1SVQ1m8S2Xt3HJaHaYcLDi9bFb3fLEqeOMF7sJgZbdlx6SobFahZ1u GpTj/PIbApKduR7wviOld6nxyGz3KknKh9NAKOHPaSO2jpouDP+N6tm/+QSkXUfQtFxn eNPiQcTMO4rL/tvqaWqcZwqkZl+i8RPR32422vXG5ov0ETBzogLDVYByfBA9o1ZcQL0G qNIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mqMms2Is; 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 j23si18955181eje.690.2020.12.28.17.00.17; Mon, 28 Dec 2020 17:00:39 -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=mqMms2Is; 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 S2393623AbgL1QU2 (ORCPT + 99 others); Mon, 28 Dec 2020 11:20:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:42132 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732350AbgL1NN6 (ORCPT ); Mon, 28 Dec 2020 08:13:58 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1310822AAA; Mon, 28 Dec 2020 13:13:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609161197; bh=Lwv8CmGye8bYWj3ELKJ9mQRHMfNUnWuYrQQaayD9kGw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mqMms2IsaANzOo2iQdQx43MqcooaAAZZG4J3YshtpSueaiiu28jFSPAn44IxMZ49Y ddW9Uvs2qQJVcKpXsyT6+/9A9CdBBfNtASi5M+iRPPDw1+fuROBIM1BcS016fqTYz1 eKcr0g5pRoKnwcT7jKKQsANPh0nlyNxmHZuLDeuk= 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.14 107/242] memstick: fix a double-free bug in memstick_check Date: Mon, 28 Dec 2020 13:48:32 +0100 Message-Id: <20201228124909.959344678@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124904.654293249@linuxfoundation.org> References: <20201228124904.654293249@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 b1564cacd19e1..20ae8652adf44 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