Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9244194pxu; Mon, 28 Dec 2020 10:16:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJybRoAfaxwEgy6oIllR9NX18x6go8gq/se5784Wk+JQaO86ns2nvSu0lh9s7MIOiG3ipmnz X-Received: by 2002:a50:b746:: with SMTP id g64mr43030509ede.33.1609179369218; Mon, 28 Dec 2020 10:16:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609179369; cv=none; d=google.com; s=arc-20160816; b=Mjzr1Oa50AFIe6I3exHpxBc3cDlWwj4+ktgbOgA5WuH/qnK1Zh3f0WNdUpn1Rh2qkP gl2kqasytbxQigTnCnCxW6HCBIDbqWuIUNRQo/s8aAgXqCzNiagB4bboFJ0o4yv1fzmQ plgUxCwtHsO/XCnry01mxC6w3pI3pa4OHYWGXHoz3KZwDlEo3ezqLfaVq3lqAVuZ7Ool morcQjtBQp2PeoHTG6xiI+A7qJ0MMPGOE3aYqffJZFZdVT2JIS+lzxaq0PYUk0naQ0FR mn9s9L99c7LMGBD4JoY5uFD7BGzlfBXUGaEQyAQS2im2uNO5CXwo+2z92rgTy2lce7+h QYlQ== 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=R4LUWnRt0u9UeMQ+ypeJo2FSwLAvlwlCTMolUFvqDInmv/jp6gIwxckes8L1KT5dP/ LFeu+2RYYN3yj3fC9GTuEaSyGdLKCmI2h5wbc3myMh3qCGrc4rhXFc7IchPeT616jh5b oYL7hNQTNscVBhkLPDMX6XvEQCbHzXY3enXN8vVpc+qS98aIP6M1hk1z4PgnqbCB4grd xuqfuihrrb+bDCbvL7xg/cmRJD2uU7Vj1jWqZFt3bMFuUKArkn7CMtvO8GA6sbhi9BMZ 5YByHBtAhw37WTnynffcntmMoH158KGAUjiG22YHJNWyZCuqJy3H/k5h/yWTwCNzE69h RktQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="erRW/ohT"; 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 e16si18794466ejd.747.2020.12.28.10.15.47; Mon, 28 Dec 2020 10:16:09 -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="erRW/ohT"; 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 S2389747AbgL1N1w (ORCPT + 99 others); Mon, 28 Dec 2020 08:27:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:55666 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389599AbgL1N1N (ORCPT ); Mon, 28 Dec 2020 08:27:13 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id A1CD22072C; Mon, 28 Dec 2020 13:26:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609162018; bh=Lwv8CmGye8bYWj3ELKJ9mQRHMfNUnWuYrQQaayD9kGw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=erRW/ohTbWFfU3B5XMmpY/DL6w/wEealgr4ZNqcgKVfCSHLL8nnR2u0D9ZQhefxSm Syr1ik5AkGUDw9mMADDL7wWd53SUxcMTDmxHobCkh3dwvB+tMuY1EHXNsixf/FSwxU E3LCSv3z4OYk+8Q6XMRfkjsHB7300qThWfh+FJ4Y= 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.19 161/346] memstick: fix a double-free bug in memstick_check Date: Mon, 28 Dec 2020 13:48:00 +0100 Message-Id: <20201228124927.569529213@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124919.745526410@linuxfoundation.org> References: <20201228124919.745526410@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