Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1921181imm; Thu, 24 May 2018 02:58:57 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpzcaCU1D5w3+4IpQck75FjDHfmIyVi9hWSid91sYaH6Ju0wZ9p2GdSBBPXkbM3nqy8Kve3 X-Received: by 2002:a17:902:26a:: with SMTP id 97-v6mr6701620plc.367.1527155937858; Thu, 24 May 2018 02:58:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527155937; cv=none; d=google.com; s=arc-20160816; b=iCV8BCSCUQl5KPE3C5038s5B7qJoen83/mquxdtJhQFrZvYQD9CtbTizSccYwhyjju Wfc27LxX/QcVwhMFOAd/q3RsXllkk1Fs7RTthjqd3qpchDg+BZTLvo4Gnz71pZnEXD4q kU8AFg/6av2SD+ndmuAJ1klmLEpdh6DIxnGHoQcJmgrJxzu1IJRIyoDp67ZpkRKKyGXl m+argvraLvSm0N4s+JpEhLLRq+CIaNpeqRG6WaJXqYzqSpCR0yOSKTCSw6xh0Ypx35oM wtYtdQy1I64kTW3STMdtsr65AxLqtQMgEdXmoebYOzBNnLkRZOBg8hO8didAiUZp9B8p gNIQ== 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=2LGTe2dMrBTwSDktNbQCSwm16mmnTT+DAf4cZ29KgIo=; b=xymLBQSBL8Eyji1Nwn2Sp/woeUDquXUPm6Zwrl2fvtFrg+Rz5VpvLvyijwj6h/21Kk 5Zzg8ne4r3rNNnfnAZ8mY2hhqyZgkKXPCf9D6lLugoch3iCF0DD8lm4jgDswkeORm5FB fcEfoJWE7J7LnNBvMFaZ5T5FAv8ynMgzd0309bRiKQlbO5f5ONkXHcruluU/gNcP9bIl IGbmZJ3Z/9+S409EiEMu3qN1EqhiRM/PLgi4znQ+2XvhlCXxfA14GckdTjtpRHWFfqFR +XCCXJQLuAEXgTpFIt+ver+sxYL9NnNC+4B2r6KG2dfCD3JHUzfKdk7AvTz3C6kEsBK0 V3ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=w83xmRxk; 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 s1-v6si21745937pfb.39.2018.05.24.02.58.43; Thu, 24 May 2018 02:58:57 -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=w83xmRxk; 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 S1030548AbeEXJ6A (ORCPT + 99 others); Thu, 24 May 2018 05:58:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:37504 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030466AbeEXJ5n (ORCPT ); Thu, 24 May 2018 05:57:43 -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 7285820891; Thu, 24 May 2018 09:57:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155862; bh=Z+6fjEwOktlMRYF9GyFnyQf8yk+EfD5FugXswgr0DJw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w83xmRxkZrboGDGiEG+pxxE24OHsQDS/Rlv/c+tBpnUdJheOd9R5y3VL8vYFTCy3Z udUkBukH01xINnO9Bm1SM8uufxZujabz6LqFz/BK3+mmAQUEL9Yuw9sTo58HtBj1g7 W4bxSAwf0eYfbuU5uCZCQxzhD37P237ETipYgElc= 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.14 143/165] media: lgdt3306a: Fix a double kfree on i2c device remove Date: Thu, 24 May 2018 11:39:09 +0200 Message-Id: <20180524093627.862684082@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093621.979359379@linuxfoundation.org> References: <20180524093621.979359379@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.14-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 @@ -1767,7 +1767,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;