Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2856362ybb; Sun, 22 Mar 2020 09:18:51 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtQGh/SLjRkaCASB54ssKq05zqA9DtkwfcfrEPePpEezsdQsWXqT+y3OSgeDi0FxuePvb7B X-Received: by 2002:a05:6830:4038:: with SMTP id i24mr15467131ots.0.1584893931703; Sun, 22 Mar 2020 09:18:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584893931; cv=none; d=google.com; s=arc-20160816; b=emItoFztcXadyfIq+VDRbVB/Fnh9bVQIdZv/9FaslIHeMLKcKpdiMsY8rmvdh8/78N hwM6WdPGl84CF2hOGo3LrSssf11QY5v09R8w/Curq+zIh2iA9zegEETsf1i7pgRYwUye GSmcPUZ9YlnJyl0L9PiH8EyKgCYqY87AeYnuXmnBd1CPFNcDJyb36EJN5B4di+kw4U7u 6fLjyVniR5nom9AvksYXe/r1Mzq8JwVXe3y+J/q6XlBs6JGWTLI+hadMgqaUgjYTAm1e yR5RAM8sTRP3UNJc8xhQPtAayLwFY0Uh8VtVRqZL50xVcaODHYGiaFmttefGIpwUqHvp Te3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=A1pN12ZhMlTYliqUDeyy82Ogs8P8/Zy706Pd2ERpkUs=; b=Huf7xzexhNAg9dzoLqAYqLiOPkMR4swsPgkb1rAVjTHeqJsqpQNQ9nVtQ/te97k2H/ zXNy8UllTZUPJtRyNUeZkwK6smo7eLlPFURBG2awO6DZfwDmdq0vtt5sahgAXQoid2fg KVml5G6wJonoA3RVeJ0qYCsombUTpLcr17FDj9TJyNMMF4WFKL5EORiHZXUBIFYhwfg+ opOiz+yCaJ7D17R1K+Is4fMwO4sZIMh4OVxb32SV1UyY+C2J+XZ+4y+Bugl8kpGndLpv egO3jEvJSC555SYnPTx539+WB6C4KMdoHzOJalPh/GZtlZK6fcSGFKHg+zGnc1GxNF3N qTVA== ARC-Authentication-Results: i=1; mx.google.com; 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 l12si6491010otn.101.2020.03.22.09.18.39; Sun, 22 Mar 2020 09:18:51 -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; 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 S1726752AbgCVQSS (ORCPT + 99 others); Sun, 22 Mar 2020 12:18:18 -0400 Received: from sauhun.de ([88.99.104.3]:51386 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726502AbgCVQSS (ORCPT ); Sun, 22 Mar 2020 12:18:18 -0400 Received: from localhost (p54B33042.dip0.t-ipconnect.de [84.179.48.66]) by pokefinder.org (Postfix) with ESMTPSA id A62F12C0064; Sun, 22 Mar 2020 17:18:16 +0100 (CET) Date: Sun, 22 Mar 2020 17:18:16 +0100 From: Wolfram Sang To: Anders Roxell Cc: erico.nunes@datacom.ind.br, dan.carpenter@oracle.com, Linux Kernel Mailing List Subject: Re: BUG: KASAN: i2c dev use after free Message-ID: <20200322161816.GB6766@ninjato> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="v9Ux+11Zm5mwPlX6" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --v9Ux+11Zm5mwPlX6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline > I think patch introduced this issue d6760b14d4a1 ("i2c: dev: switch > from register_chrdev to cdev API") > and patch e6be18f6d62c ("i2c: dev: use after free in detach") tried to solve it. > However, when CONFIG_DEBUG_KOBJECT_RELEASE is enabled it delays > the ->release callback to make sure that anything that is done in release can > be done later than it happens in normal execution. > The cdev structure is supposed to be freed in the remove callback or after it, > but here it has already been freed by the put_i2c_dev(). For the record, Kevin Hao fixed it and it is now in linux-next as: 1413ef638aba ("i2c: dev: Fix the race between the release of i2c_dev and cdev") Thanks, Kevin! --v9Ux+11Zm5mwPlX6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAl53j8gACgkQFA3kzBSg KbbJ0w/+KxfnJmP8fsZdM3HROAtMRqlHltteP4XVBZDLt+jjvRD3qng93F4nPg6d JEch2PurElj6AQC5AsK2rN9flYW+Of/jFZZS4Su8/hFb5FkeH+3aSSQMK8kJnYkQ XJj6D2MEtPkTCnv5HY+lg9d25T037vZQO2gQgBm8HfciUcC3VF0iK7yxbZuqyOHF rF1JT8SbFas6motZJj4CJwinVkfVRmDnKivmMdiv/qRrjxJyrRlmbJJSQjgc0z38 Sd1kgsCgUJGtCBVINQG3HONmjkKddXjJB1kE/d5DarpDrg8ho0r1bY1tLaI0QXLw OnGPFLOTp2I0DPDWE47hSM1Gb3xn3U/KDvbw3OnmXuOWi1zIDv0sv2mPOZfpYuJT v/e2nqJknK57wG3Jr7PnwfVSl1o/JvJ82avnTm+PCRSvEDSS5ZIg6m4Veu9P8S/X qYhosU/XwVbA0Y90AoZD3BZS3MWgZap5A9Q77jndGA6vARyZPTB9RDGbcuhKCLBs Nq1EkZg91PJKjgF1ugt0WjNuS6kij8Q59cnDstteq2ll+hDhua4MstDBBqcmAqNO pkEg/qwxBbNdpqBpNrjf3HzkWWnwea6gavn2pBOGOZOlw1m65EoWv1tOzl38aqA1 pJLq/5Zu4a8z1cpavXVxAOXV22WQrjPaUcRNXedho8S+Vx9e/vE= =hqfi -----END PGP SIGNATURE----- --v9Ux+11Zm5mwPlX6--