Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp405401ima; Thu, 31 Jan 2019 19:24:04 -0800 (PST) X-Google-Smtp-Source: ALg8bN44TspJugprmF1YuGFPqqnqejou+t/1/NSzvJ6yoCSTRSh5jd/fo6BaUsZim50Qi/FIr1fI X-Received: by 2002:a17:902:a40f:: with SMTP id p15mr38516725plq.286.1548991444793; Thu, 31 Jan 2019 19:24:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548991444; cv=none; d=google.com; s=arc-20160816; b=fKNlYk75HDlg/MqzhMwxYydXInBoCKwrvQxJ7E1XFRg3mVIbtaLTHEzOxQC01FZ/V2 RGQ7allzeOk7Ou9oefFEeFKSHCE7o1I4UzjLvqAw0uW6e+jgpibhSlndcjGTJAL6+bUL WnmOn3cvU2Q63qaIk7Tnj21MJZfSMN2UulyQXOE6kNCML/6KDjAFdDgI02t/3HN0rGf+ fttEj9aE1OeFYVced5Hd22iObh1gA87BK5+HUCGXD9WuqJR7XIi1PMntbfvuuwTmmD73 sWNkzgkAW9rzNznd2Gr9ziEVvqIwihDhC5qZtYMJREveAc/q4RRUVQOnVF8lrqgRWk2o bEjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=xWOHkorzl46yUcts0Gp+33sADXl8BN35HLxnQbh6xG4=; b=UP4u54519oeid7JlAMfhD1iW+Tmpi/j9t5bYKBvYtIDRcsN7PGZ8tl6dR1nQg8LCel f1dQCi/xguqoLDAavE2klXyImGrYxhlMeOcHgIvLHmlLstMKybV0duyrUAa2oVsYfM4v +KEHgByVL2G9r9yM2wXQbqZepHnJj4rOdUk0Ijv945NsIhGrKXL/znUOJnjJTm2wZExa 8mwxeJjCOx3MGAtMZ75N5Jibm0O89FH0IR9WyT5OM8l21MfH+q7A+GntSfpQwcJg2hZk zJQoOzyQyRMVV6aCBfR8CbThXqABpewjSbbbjrqX3psRxo8bdt40iTP1+SRCTwJ0P7TT c25A== 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 97si6439019plb.3.2019.01.31.19.23.45; Thu, 31 Jan 2019 19:24:04 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727382AbfBABpV convert rfc822-to-8bit (ORCPT + 99 others); Thu, 31 Jan 2019 20:45:21 -0500 Received: from szxga08-in.huawei.com ([45.249.212.255]:59528 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726425AbfBABpV (ORCPT ); Thu, 31 Jan 2019 20:45:21 -0500 Received: from DGGEMM401-HUB.china.huawei.com (unknown [172.30.72.54]) by Forcepoint Email with ESMTP id E5C3184347B16684D83C; Fri, 1 Feb 2019 09:45:18 +0800 (CST) Received: from DGGEMM422-HUB.china.huawei.com (10.1.198.39) by DGGEMM401-HUB.china.huawei.com (10.3.20.209) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 1 Feb 2019 09:45:19 +0800 Received: from DGGEMM528-MBX.china.huawei.com ([169.254.8.130]) by dggemm422-hub.china.huawei.com ([10.1.198.39]) with mapi id 14.03.0415.000; Fri, 1 Feb 2019 09:45:14 +0800 From: "liujian (CE)" To: Greg KH CC: "xiubli@redhat.com" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH v5] driver: uio: fix possible memory leak in uio_open Thread-Topic: [PATCH v5] driver: uio: fix possible memory leak in uio_open Thread-Index: AQHUsk9Xli2nkkNmlU2QOYPShi2DXaXJCrOAgAEmm7A= Date: Fri, 1 Feb 2019 01:45:14 +0000 Message-ID: <4F88C5DDA1E80143B232E89585ACE27D025EBEBB@DGGEMM528-MBX.china.huawei.com> References: <1548196704-352035-1-git-send-email-liujian56@huawei.com> <20190131153621.GA16678@kroah.com> In-Reply-To: <20190131153621.GA16678@kroah.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.177.97.126] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: Greg KH [mailto:gregkh@linuxfoundation.org] > Sent: Thursday, January 31, 2019 11:36 PM > To: liujian (CE) > Cc: xiubli@redhat.com; linux-kernel@vger.kernel.org > Subject: Re: [PATCH v5] driver: uio: fix possible memory leak in uio_open > > On Wed, Jan 23, 2019 at 06:38:24AM +0800, Liu Jian wrote: > > If 'idev->info' is NULL, we need to free 'listener' > > > > Fixes: 57c5f4df0a5a ("uio: fix crash after the device is > > unregistered") > > Signed-off-by: Liu Jian > > --- > > v1->v2: > > rename the "err_infoopen" to "err_idev_info" > > v2->3: > > put the extra info after the "--" > > v3-v4: > > add git log > > v4-v5: > > correct git log > > > > drivers/uio/uio.c | 7 ++++--- > > 1 file changed, 4 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index > > 1313422..b4ae2d9 100644 > > --- a/drivers/uio/uio.c > > +++ b/drivers/uio/uio.c > > @@ -491,18 +491,19 @@ static int uio_open(struct inode *inode, struct > file *filep) > > if (!idev->info) { > > mutex_unlock(&idev->info_lock); > > ret = -EINVAL; > > - goto err_alloc_listener; > > + goto err_idev_info; > > } > > > > if (idev->info && idev->info->open) > > ret = idev->info->open(idev->info, inode); > > mutex_unlock(&idev->info_lock); > > if (ret) > > - goto err_infoopen; > > + goto err_idev_info; > > > > return 0; > > > > -err_infoopen: > > +err_idev_info: > > + filep->private_data = NULL; > > kfree(listener); > > > > err_alloc_listener: > > -- > > 2.7.4 > > > > This does not apply to my tree at all :( I am sorry to have sent so many versions, during which this issue has been resolved by commit 1e09cdd506c8833a9d52cb61009798660cff4051. So please ignore this patch , and thank you and Xiubo Li in this patch~ > Please rebase it against the char-misc-next branch of my char-misc.git > tree and resend. > > thanks, > > greg k-h