Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp12399933imu; Tue, 1 Jan 2019 23:01:07 -0800 (PST) X-Google-Smtp-Source: ALg8bN5SJBKalI7tWlkJPZLy8OwiIkVbxk0CyF0IFJntloag+baqkbnRECkoBDHIsDd3ubK6OopT X-Received: by 2002:a63:2744:: with SMTP id n65mr12531117pgn.65.1546412467862; Tue, 01 Jan 2019 23:01:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546412467; cv=none; d=google.com; s=arc-20160816; b=agVYeok1i61ierh047q+g4SAnZ6NSl+pFY16EtouYlns88v7mPYpCSlm2J3LPKYlBD f0IvQ2qoPVAPXJX7xRFbrdFVhxK3IM36SQ7fpZx7+E1HYgx7OM6V7zTHzl1I+Jr/nWwH by4GaW60RmQ8cSq0++jABP678IIEYtUatct0mcPn2tmX8yY4rPWKefu3JcqRW7aif0Hg +09onY1hlzPYstsdqp95VJ/bdahV2TYGCxm0TjXmeP5UGp764UK3kNJXZV8sNJ4ZqhH4 lhA8IXFwGu+twleQTGsPReP7m+gmhgsdnnFT/zr+nvcD3PuYJ2sQNRMKpbK2hGxFOxw6 l0cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=RIlNLZmlVIT3ZsupsLniE1O2NMGFWZECSOXXxJZ1hwg=; b=hOpm8rGI7wy5J1ESmZc2A83E5Z3et6gc9tessxYCAGHQzLDRk9RMIt3L4xzYxcbJ+a KTAGn2N9pMKBz9DqVX71MOPgVMVHwalDFDSC1Bu4UXXDGrY03tyaHbwamGbftmyGE+vE g/oZvoLC2wjwOZ6Wzc39rsAqHX+IFpsHt4DGi8B7MtstTpVtJFsu4sVDtkicrybuMIRK 1AMuPwIgMbbdqI5Hm4smxFh9Z6Cpt+nl3k/IHZ7Vw6rVb7AhIiagFJMdrdj9sgr0x6Or 2TLH6uB3ZXRfhJ/Ye1WVdvk+CI/O15uNHmCAL5+IbgK+mdlMJ8gQjCFgsG68Cc2dR/GA WW0A== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k14si4748876pll.346.2019.01.01.23.00.52; Tue, 01 Jan 2019 23:01:07 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728665AbfABGhB (ORCPT + 99 others); Wed, 2 Jan 2019 01:37:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52420 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726533AbfABGhB (ORCPT ); Wed, 2 Jan 2019 01:37:01 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 47644C056807; Wed, 2 Jan 2019 06:37:01 +0000 (UTC) Received: from [10.72.12.82] (ovpn-12-82.pek2.redhat.com [10.72.12.82]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EF83860C67; Wed, 2 Jan 2019 06:36:59 +0000 (UTC) Subject: Re: [PATCH] driver: uio: fix possible memory leak in uio_open To: liujian Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org References: <1546446416-40831-1-git-send-email-liujian56@huawei.com> From: Xiubo Li Message-ID: <50ee4818-a154-5ea7-20f8-3c0f0859f4fa@redhat.com> Date: Wed, 2 Jan 2019 14:36:55 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <1546446416-40831-1-git-send-email-liujian56@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 02 Jan 2019 06:37:01 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/1/3 0:26, liujian wrote: > Fixes: 57c5f4df0a5a ("uio: fix crash after the device is unregistered") > Signed-off-by: liujian > --- > drivers/uio/uio.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c > index 5c10fc7..bde7d7a 100644 > --- a/drivers/uio/uio.c > +++ b/drivers/uio/uio.c > @@ -496,7 +496,7 @@ 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_infoopen; > } > > if (idev->info && idev->info->open) > @@ -508,6 +508,7 @@ static int uio_open(struct inode *inode, struct file *filep) > return 0; > > err_infoopen: Maybe we should rename the "err_infoopen" to something like "err_idev_info"... Thanks. BRs > + filep->private_data = NULL; > kfree(listener); > > err_alloc_listener: