Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1423452ybl; Mon, 2 Dec 2019 03:18:40 -0800 (PST) X-Google-Smtp-Source: APXvYqxXWMhasCDFKrREDtVexE+FSCP7QBUBlI4L0DFjLxxX0vU5X/KzHqi4NKvDlUTEsu/yedRz X-Received: by 2002:a2e:9ec4:: with SMTP id h4mr8307378ljk.77.1575285520325; Mon, 02 Dec 2019 03:18:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575285520; cv=none; d=google.com; s=arc-20160816; b=bbe+ToOP4l3r5aRbLdTav+SzX/a7h5ikjlq545ajNqeiE0DKjDAr9R7IRJwDT7KGQr I6zWHFUPZtPlw9oPT7wIPyi32CFNFVIzP+1Zmj4l5/PrpDLAlfjURjXLgbBhPNq4mh1Z e0WqkIISs5BMqKF7NZXyhT1/CPR6yl+bmwArXhxAoSrmQrIJO1nwGu52F4OmeAoZONGR v/QDj8w2V0Iy9OeGipWHWfa+Xxqb9V4ktqR0khbmkc6RyiZT8KPThUcAX9rqTqSFzRH2 qDY5lLrJF6nG5gWKyz4SN90qYG2CIa81tPqmVuZJGdkL0vtq6d/KKRn9dzqbrZ0eCTsq m22g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=Znm3U5Ob2gqDwCDYa+HtwmDHo6lTHeYnWiLoSMxkJ6w=; b=H9bXDSTYJemyvq32GBKA8ai7P2zCWrJkHoLmw8MMEU3m3vKGC0gOb+ot+IEVdexTu9 SQbMn4uIe96xFTUz6lOiCIJiDSjunYrmgm/pQnuWyWdx7h7/jgWtRcegd12Hf8+DXxjI LRMVD0TcCmufPooM+H8Vmi6dmF1mS+kpuXVPwDb0+sKC1Td5h/JmsDqrahRqdB3PGaL6 66ZFaoq4FmRMDcxo7Wmd9uYyuNy2zt0Go+xFAwJwbMfKUPVvf/LKOv1oahcPVPjDQimi JPUc8TtGQeRnHFi7b/coTo1cW+KLg4y9D0ug0eQMNQKxAOQDukNAzboMLnR4qJyANPhw Oz0A== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rp27si4353444ejb.2.2019.12.02.03.18.14; Mon, 02 Dec 2019 03:18:40 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727417AbfLBLQ0 (ORCPT + 99 others); Mon, 2 Dec 2019 06:16:26 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:60946 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726276AbfLBLQ0 (ORCPT ); Mon, 2 Dec 2019 06:16:26 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 6522E28DB10 Subject: Re: [PATCH] platform/chrome: wilco_ec: fix use after free issue To: Wen Yang , Benson Leung Cc: xlpang@linux.alibaba.com, Nick Crews , linux-kernel@vger.kernel.org References: <20191130130842.33763-1-wenyang@linux.alibaba.com> From: Enric Balletbo i Serra Message-ID: <5d19df91-ac9a-05a5-3636-c5f1594138a3@collabora.com> Date: Mon, 2 Dec 2019 12:16:21 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20191130130842.33763-1-wenyang@linux.alibaba.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Wen, On 30/11/19 14:08, Wen Yang wrote: > This is caused by dereferencing 'dev_data' after put_device() in > the telem_device_remove() function. > This patch just moves the put_device() down a bit to avoid this > issue. > > Fixes: 1210d1e6bad1 ("platform/chrome: wilco_ec: Add telemetry char device interface") > Signed-off-by: Wen Yang > Cc: Benson Leung > Cc: Enric Balletbo i Serra > Cc: Nick Crews > Cc: linux-kernel@vger.kernel.org > --- Queued for 5.5 as is a fix. Thanks. Enric > drivers/platform/chrome/wilco_ec/telemetry.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/platform/chrome/wilco_ec/telemetry.c b/drivers/platform/chrome/wilco_ec/telemetry.c > index b9d03c3..1176d54 100644 > --- a/drivers/platform/chrome/wilco_ec/telemetry.c > +++ b/drivers/platform/chrome/wilco_ec/telemetry.c > @@ -406,8 +406,8 @@ static int telem_device_remove(struct platform_device *pdev) > struct telem_device_data *dev_data = platform_get_drvdata(pdev); > > cdev_device_del(&dev_data->cdev, &dev_data->dev); > - put_device(&dev_data->dev); > ida_simple_remove(&telem_ida, MINOR(dev_data->dev.devt)); > + put_device(&dev_data->dev); > > return 0; > } >