Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9082582pxu; Mon, 28 Dec 2020 06:13:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJw7r1KKHMIDcEDW/BvxX8pMzL5X0h2hmomVnio/MMRrphOhAIGm2JNZMPJJEXjPGc0vwWhj X-Received: by 2002:a17:906:3b8b:: with SMTP id u11mr41150969ejf.489.1609164781671; Mon, 28 Dec 2020 06:13:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609164781; cv=none; d=google.com; s=arc-20160816; b=lGtDEjWiarWULqHECISULvc3c+UHpDdG3FHjWsIOzpXeGKdcDKCjQkWrHZ8TEAOKxB U04PfKoBh67N+LTp/WwrZ+QwMBE+pHN77czUhShek/QwVwzrIIyh3d5kYu6pVDw7fx4c jc4+XZ7pRZ6lnzjRBvi/Iu8IGKpY76LGJbs0sVb6REGjrR845hE684bVEdtwkHGVFra2 QC3iGB6Yl5SBxlbwMdkmZfYx+4UUL1vjvXgg4lil/nxK/s/GYizmBIeTgyCWRdKWotLQ rcxnDUNygVHsVh/5XzFXOcWldhtMWKhkY3e1WzotMwyCDvf/JFN42veSuED7DKRYjdFa 51MQ== 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=syx52aROYh+jCgulTua1X3vs2eOJykVK0dnXIp9Stq4=; b=zcQPE+MaaVa11LqvWaZBAicY5G0ig5k8Svbspdc7FZVUO1qyOvW8mDtjTQBAVeU24P S1qZu3X7ENftBkmPrbSDS/3prLJoFBOwLxJ3Wq+tkFY1Swvdoi8vff6puHAKVSfnul+E mTe2E8DSfXLNLBL99BmG/v6hbsag+/Ig/SwbrYdzsAL7kPa6zlwWDUtKg+5MLmDW58An n/w202O+x1+zY8c8bTXhGTGU98FoNINV/MISgxtzIfhxL93PBwcc/ydNw8iI0u+PM8My CUL8njXeM9dGYPbz8bpkV1ZkwVioOLLhb4RLJ6ghcz2KrOEUZx+WgRk1B7O3/owJBwX/ LOUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pQd2IXw7; 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 i22si22041070edb.413.2020.12.28.06.12.38; Mon, 28 Dec 2020 06:13:01 -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=pQd2IXw7; 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 S2438685AbgL1OIp (ORCPT + 99 others); Mon, 28 Dec 2020 09:08:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:42958 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391714AbgL1OI1 (ORCPT ); Mon, 28 Dec 2020 09:08:27 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1134C207AB; Mon, 28 Dec 2020 14:07:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164467; bh=nxCszQ/aXyTvDe3xf/Pz//V2TQyfD+hlBVUEGLZBiwg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pQd2IXw7kCg+nPOAskh4cgnrDQrI3bfDhrOkk2O/j2r6ZS7GRNRpKmTMZ/r+ZW2D9 kWdBTgy2CT1t9bOk9SBumrBzl8NjbsijzNCSt98qjiQB9RjP/MoexQmkR2jyt4jUTN CCvF6bFrOTt27gkLNExE2LM67S+sjgB+rPTZL6Q0= 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 5.10 191/717] memstick: fix a double-free bug in memstick_check Date: Mon, 28 Dec 2020 13:43:09 +0100 Message-Id: <20201228125030.121361557@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@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 ef03d6fafc5ce..12bc3f5a6cbbd 100644 --- a/drivers/memstick/core/memstick.c +++ b/drivers/memstick/core/memstick.c @@ -468,7 +468,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