Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1931426imm; Thu, 24 May 2018 03:08:20 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqnVdu8TjI/MINVjh+l4HkpvhMSuAWxtBt8f80Pe0tsrHEZPscff+7HszYPX2eObl7ZHyUx X-Received: by 2002:a17:902:3c5:: with SMTP id d63-v6mr6561225pld.163.1527156500474; Thu, 24 May 2018 03:08:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527156500; cv=none; d=google.com; s=arc-20160816; b=dPEkSPnDe04MwZcx8nGb4CHsEVERT+nIwqWO8lvG1AtwOj7wVZ0IF/a2SzmdfP1AIz e6GuDvkSicjpELYqugMEnmXaRo8yI1UAZ9enPY1GFMTkQAdMAPgqxDStnnvhqhvjkPGI /sB7z5y2396uNvfm262wPYmgYkgPDVy3p/fPfkHOV0DPGtA/8CxHN0mkNu5sJekB2ET+ OO6UcYT7w35s6JzQDQ+rbKYoqO5q9/3yzuLETkt+5f3HwghYWw8ZaAyiY9t/Fngoqj4U t+n3VtGr5U+tTginHCLgRrS7oy0FP6hItR68IZH7BM6jpCaoS2PVJ34FYnynrBZWPXXW LAHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=6BgOIuarRbnVIXTI/iLfQQH8A0hZZDXdjer51ZJISbs=; b=ryNgy7sZdErlZCpq2vBQv/vdm0f2QNoise9YrxNnIGE5SdNJzFd0d7mZmc1TjH3KMW 5vK9sPQl1B9uStsJA038M/CefHXYc6Zw53f/RbdkJ5Yrz8gRw26jwAb+6+bZcYay30IA 6PMFLpjSFOwwwwdcFmYViiSPWFh9bdKRX/7dsTEQla6gNECxDVoDg5Mabm5kavwbggqa msiFgb3yuPxSLrIFWYv+14o3WyEq1pAsN4F/XioXkTVBmaoEaFaACIqMaP5EiZGtlvIv pVAGTR7pJy+lKOdMGIBmnhzA99NaQQGbg8gdRC88eQm8nZLHjxLRTc2WHd1p5XpvM39i Rt2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pWD3C1ir; 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 206-v6si20628797pfw.130.2018.05.24.03.08.06; Thu, 24 May 2018 03:08:20 -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=pWD3C1ir; 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 S1031728AbeEXKGb (ORCPT + 99 others); Thu, 24 May 2018 06:06:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:55238 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031695AbeEXKGN (ORCPT ); Thu, 24 May 2018 06:06:13 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 1B3CC20896; Thu, 24 May 2018 10:06:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527156372; bh=u81fE6hPScwdedRoXkAJweracDsHkPT7+yBEfVxZvIY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pWD3C1irTasO5dkzhm5UBH8CWlzv49q2KUrF7KYILhaa2V6QqqCvFdiGooCjr+vOK 1X51p1U5B5gwYFzW0M6c8jWybOxADRHAilZWi7soIa58oMhWH550mCWZc1g/3/a6nC iVsu3w5NwT1nc9vamJjQBgHWi5X5ITAlxNYjLIwE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brad Love , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.16 138/161] media: lgdt3306a: Fix a double kfree on i2c device remove Date: Thu, 24 May 2018 11:39:23 +0200 Message-Id: <20180524093034.906207899@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093018.331893860@linuxfoundation.org> References: <20180524093018.331893860@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Brad Love [ Upstream commit 94448e21cf08b10f7dc7acdaca387594370396b0 ] Both lgdt33606a_release and lgdt3306a_remove kfree state, but _release is called first, then _remove operates on states members before kfree'ing it. This can lead to random oops/GPF/etc on USB disconnect. Signed-off-by: Brad Love Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/media/dvb-frontends/lgdt3306a.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/drivers/media/dvb-frontends/lgdt3306a.c +++ b/drivers/media/dvb-frontends/lgdt3306a.c @@ -1768,7 +1768,13 @@ static void lgdt3306a_release(struct dvb struct lgdt3306a_state *state = fe->demodulator_priv; dbg_info("\n"); - kfree(state); + + /* + * If state->muxc is not NULL, then we are an i2c device + * and lgdt3306a_remove will clean up state + */ + if (!state->muxc) + kfree(state); } static const struct dvb_frontend_ops lgdt3306a_ops;