Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1510189pxb; Fri, 6 Nov 2020 11:29:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJybEAoU75j45By+Et41Mc4x9sCEV2EI1hbC3mQfn06/XTVyh9wzKcZRnl6i4TMZIZ9BEx7B X-Received: by 2002:aa7:d1c6:: with SMTP id g6mr3609046edp.130.1604690942604; Fri, 06 Nov 2020 11:29:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604690942; cv=none; d=google.com; s=arc-20160816; b=TwjkQaT6041GQscY13321CSkDn1t4X6oaPVa140eQs7kLlKz8BVXPrl9TUDUgCUX1v eiOaKNLsRhnFCnfk+TRSqoc57m8gTjabxL6m3LlUcE2BU2JtTqmz1tBLpkg9CLphnWzl gR/qxJwaMNugT8z0k+IebYdM6CTHV/Swiq32/Hf6hhmZC3iDePgrUzxjP/xgzYDG3O1L nvBExa5jkukXzAxc+JrXmsWG0o+oZIS12wNLYq4Gn+1vRDIB52z/jWMWvVVO3c+NPqvU BEHJwdbKeNzBP/pESLMNUPwStVfw1Cc5iUBG6d+lcAlaEUvpWknysCgrQ/dcDj2hspFU 8crg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=v8aUxlzhOmPPnjHBTuKWh9NcWoNY4jT3BjUF/BStqrA=; b=sTu3hcNnc+NkCPLGUXob38hn55Ae+z1OgCXfLPMTV0mjGTvyI/xEd4KUpTGRODAlZP MxHWZHuHsyKYv/wTrjNxmvR8M9DTBCC7SoGcSsTJBzXaaV4aK+knfWuqiJEpKLpjrsUL 985WkeVMiOv0Qoz4w3ydqti3ofBwG3FTkhqSzDPJjd8TE4GvtchHIOAD4eMO/vfqW5Uc Y61hruG6XI4bdTWpVd9eD1SkW3Rlws3Hmzz7UFuRJs7hocnWX+o9JR0AouIV9pU3F5cB uaEBzBZcN6LlijIc1XDvygutCHtRDDBONypFw7gxk0+2VvEgAXX2GgXvOohWS25VQAzb LDLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=Dl9SFax0; 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=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m11si1679804edl.523.2020.11.06.11.28.38; Fri, 06 Nov 2020 11:29:02 -0800 (PST) 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=@oracle.com header.s=corp-2020-01-29 header.b=Dl9SFax0; 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=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728217AbgKFT0c (ORCPT + 99 others); Fri, 6 Nov 2020 14:26:32 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:37388 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728167AbgKFT0c (ORCPT ); Fri, 6 Nov 2020 14:26:32 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0A6JDaPt041942; Fri, 6 Nov 2020 19:26:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2020-01-29; bh=v8aUxlzhOmPPnjHBTuKWh9NcWoNY4jT3BjUF/BStqrA=; b=Dl9SFax0z/C9Urha1XxIsRDM1wQtZiLG0tmmxzIl+Z9/Jm0QD98A7uKqjHlGUe0xr4Go IPgRtPvoI+ieaCn12yCouXOWLoog+x1p0exk4E+F78AhdsP3SN5+lWZm8VA0+cYiCJRS /jA8iN/rq6FOOPoiZyajwFPFMd+xH9V/x1UH2xadYs62/x+hhW/JnjpvPsjLMGafEOmG gACrZvO4QOq0YeXu/Nlri0iby8oBzTudkskTOS7OI8zpbXLwbtptmbhv0E3srA4/VpPA lx8MU+8BOQt30WO7kxw1UDAzsnRt+I4a/yiXb0R7Fj16pnts0RFrZaLkQmFEEVtAfS/U jw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 34hhvctkvq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 06 Nov 2020 19:26:24 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0A6JEqa8042516; Fri, 6 Nov 2020 19:24:23 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3020.oracle.com with ESMTP id 34hw0kqkm0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 06 Nov 2020 19:24:23 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 0A6JOMax006726; Fri, 6 Nov 2020 19:24:22 GMT Received: from mwanda (/41.57.98.10) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 06 Nov 2020 11:24:21 -0800 Date: Fri, 6 Nov 2020 22:24:15 +0300 From: Dan Carpenter To: Miguel Ojeda Sandonis , Lars Poeschel Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] auxdisplay: fix use after free in lcd2s_i2c_remove() Message-ID: <20201106192415.GA2696904@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Mailer: git-send-email haha only kidding X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9797 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 mlxlogscore=999 phishscore=0 bulkscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011060135 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9797 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=2 impostorscore=0 malwarescore=0 priorityscore=1501 mlxlogscore=999 bulkscore=0 phishscore=0 adultscore=0 mlxscore=0 lowpriorityscore=0 clxscore=1011 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011060135 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The kfree() needs to be moved down a line to prevent a use after free. Fixes: 8c9108d014c5 ("auxdisplay: add a driver for lcd2s character display") Signed-off-by: Dan Carpenter --- drivers/auxdisplay/lcd2s.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/auxdisplay/lcd2s.c b/drivers/auxdisplay/lcd2s.c index cfa5f86deeef..3eb7f04db6cb 100644 --- a/drivers/auxdisplay/lcd2s.c +++ b/drivers/auxdisplay/lcd2s.c @@ -348,8 +348,8 @@ static int lcd2s_i2c_remove(struct i2c_client *i2c) { struct lcd2s_data *lcd2s = i2c_get_clientdata(i2c); - kfree(lcd2s->charlcd); charlcd_unregister(lcd2s->charlcd); + kfree(lcd2s->charlcd); return 0; } -- 2.28.0