Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1490008ybt; Thu, 18 Jun 2020 09:52:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJRZ2cChbmpVDVISukYRdA9BAP6fs0HINDVqm6HlSgveA+VYA7V62KV1HwkDBLjXACYGKN X-Received: by 2002:a17:906:c058:: with SMTP id bm24mr4632321ejb.73.1592499131250; Thu, 18 Jun 2020 09:52:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592499131; cv=none; d=google.com; s=arc-20160816; b=et1RCXBcOeo7n0lzEg0r3S3MN2DZ/3dsScQLOGbZLNwJdNHMUzj/CvVCEJTe8Si3hV pG/t1OZWzlcEo51la7X+67Ny5UUDt7CyZ4BVZTmBh2RHz8ft6l1SD4PEXPQhol7HoEw0 MLnrCDSoJdv/40LwNVrgAoNOJq4DUGT95BQTmLalcEB1dfbMA4YMMJVNb8H34Y2z6+v3 185kfaRCpSeDH8HFRmzIl6kaLONP1Ls0gczBN9XWvMhFTgGja+3fJssUGZGwfwkTRa7i /w2xVmbBoqsTPlyvkmjTD1LHwgLCBTgDPyNjkBLxqYQoHl0YhIXWDA6lgUePsLJ2sGm6 8PLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:subject:references:in-reply-to :cc:to:from:date:dkim-signature; bh=9pLXbjcj+V+5gDj08izyGF1oWnyr3K5eaAedElrBCJY=; b=lpapqF4ruQydAuRyMJoalCf3+1Mpe8yFjbIjjuuBnQoGZEGKtII2D5oNNmd8P9oUkX GaTiyKNNV1i40ENoF8G4/q58xT4Fdw3DkzcvZO9Zbvis+K2oAAQTiXNOSi9TrknHwO90 nERjvC3kFuaAEIf45/GTE+FcYnV8flnMtKJyvj9WjmcGXsKJqNw4gBJPLzJ1mCpXSMNi awyVFedoDrI2wob/JLIvmXv600YyZoPvguhTMVgnGYCPT3A+bo8WD5yWKlaGs+9zva8n 5tDFc3ADHO30qOUAPSPXndJDGrSmjLHYjDunia3p0fGESQiBJwIfiZ2evGiwsBRjYsjo gjlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BN42uWWE; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k9si2154253ejp.499.2020.06.18.09.51.48; Thu, 18 Jun 2020 09:52:11 -0700 (PDT) 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=@kernel.org header.s=default header.b=BN42uWWE; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730435AbgFRQsv (ORCPT + 99 others); Thu, 18 Jun 2020 12:48:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:56970 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728523AbgFRQsu (ORCPT ); Thu, 18 Jun 2020 12:48:50 -0400 Received: from localhost (fw-tnat.cambridge.arm.com [217.140.96.140]) (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 F1B87208C7; Thu, 18 Jun 2020 16:48:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592498929; bh=pp5uB+H9KaW9/eo4GgCSoMqjhoACdduYxmXmEVk68D0=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From; b=BN42uWWE6E2J4HcVIR3nxwvyjQ/RZxwH503W/SALOBGKH+I4CGs9NJT7FiLPw57/s I6FEdhYb7n0QH0zD+PbeFj6QvGN3tyjh07AzBw6DBqG7nhdNUpqSbifyxBJgzFG3nj GW4bqtq992mOXT66pBMEUvX7ZbYX9pLFui9zp724= Date: Thu, 18 Jun 2020 17:48:47 +0100 From: Mark Brown To: linux-kernel@vger.kernel.org, Zhenzhong Duan Cc: linux-spi@vger.kernel.org In-Reply-To: <20200618032125.4650-1-zhenzhong.duan@gmail.com> References: <20200618032125.4650-1-zhenzhong.duan@gmail.com> Subject: Re: [PATCH 1/2] spi: spidev: fix a race between spidev_release and spidev_remove Message-Id: <159249892720.8894.3932380546197111188.b4-ty@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 18 Jun 2020 11:21:24 +0800, Zhenzhong Duan wrote: > Imagine below scene, spidev is referenced after it's freed. > > spidev_release() spidev_remove() > ... > spin_lock_irq(&spidev->spi_lock); > spidev->spi = NULL; > spin_unlock_irq(&spidev->spi_lock); > mutex_lock(&device_list_lock); > dofree = (spidev->spi == NULL); > if (dofree) > kfree(spidev); > mutex_unlock(&device_list_lock); > mutex_lock(&device_list_lock); > list_del(&spidev->device_entry); > device_destroy(spidev_class, spidev->devt); > clear_bit(MINOR(spidev->devt), minors); > if (spidev->users == 0) > kfree(spidev); > mutex_unlock(&device_list_lock); > > [...] Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next Thanks! [1/2] spi: spidev: fix a race between spidev_release and spidev_remove commit: abd42781c3d2155868821f1b947ae45bbc33330d [2/2] spi: spidev: fix a potential use-after-free in spidev_release() commit: 06096cc6c5a84ced929634b0d79376b94c65a4bd All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark