Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7267836imu; Thu, 31 Jan 2019 07:38:34 -0800 (PST) X-Google-Smtp-Source: ALg8bN53RlVvQe2NsoRcgylIvDYK1jdnl7RtV7k6bMFuqG18OpinjWUNOWP5F4iOfvP1pD2TXe3o X-Received: by 2002:a63:6207:: with SMTP id w7mr30767428pgb.90.1548949114663; Thu, 31 Jan 2019 07:38:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548949114; cv=none; d=google.com; s=arc-20160816; b=VxyFYIN4Kj3eYsR1W/o6+S8cN4gxn+uzoSRwz8lBYuJfCR3+h+4Ri/EsTi3FXcBaFp cXPWP7HH0Bdf17GlNrhHaLQJ839y6Uk1QjSF+/R0E+6J/OT7UYdpxXVa5FrstcD4aFYI uSgsCTxL+dRiGaWHy6fGJShjRtj6lLi8e4xYnBEL/9O0eQi0X0SDjLi/qDSiy9vIUWlQ BT0TbXUeLABec+pyzyLXXlXr+h7fsofa4nWKIWJTXpDJHvhCaMCobLjJ9UiItYwYflFo 8w1dFOcxaJ8FzYBuIgesb6oiQORqcDGNgJ6lJTz++hu0uA0v7F6TxnU8HjCD6ywJkSRU fnSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=23o56l7JEXkyVcQY6PEuKwyu+SjYAt5X93M8ToEQqDU=; b=oswFH1OQHGfhr4r8lx03vvlfsioVFg0WCU4xPJYMJY48LgVRDa+yqmrhKgvVkRxAP7 z2rv6aHH50EZU2ahTdOOMnX7EFsCqNlSNGN68a15zTs74QrMgYRUKK810IbCQo4qWQL6 HnV8p0oSK2b2JMqimJdCkYzMUT73aktVsZOUvV+O10qPF8R63JtnuDMHc2Vtzt35DxIU Tf+krGdGVLGGa7mUwFEjCufwVCJ5Vi2GynlIwrRvocwwVUSwndadgltBrhZbbbjE5htq Mhpz07We1JYM7ROFPBcR9in60I11FKNjtxQZoFrgdA1/OyyqjslOU2dAyAsMUlZKmOCi oU5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="i/kS357R"; 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 a19si4616202pgj.429.2019.01.31.07.38.15; Thu, 31 Jan 2019 07:38:34 -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; dkim=pass header.i=@kernel.org header.s=default header.b="i/kS357R"; 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 S1732719AbfAaPgZ (ORCPT + 99 others); Thu, 31 Jan 2019 10:36:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:43966 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726714AbfAaPgY (ORCPT ); Thu, 31 Jan 2019 10:36:24 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 786AE20B1F; Thu, 31 Jan 2019 15:36:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548948984; bh=mWopoVAjgMRfkLrl+BMNDnHxKYQbwDyd8WmgxzENBmA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=i/kS357R/V/dgijJaOgSRkAg30aYhM32Wvu8uw+5OybtZSy5QijjBcMNBcD2JPl0y RTKwujRGFEhIQLl/3n+TG17p9yfV/9Jw4/Xbl/63evcTLBg6VfbLdM1X70z+oTDhCw 90BqrrtXjnckI4GjOHjAGryJ7vnt8DN7M5mtPz40= Date: Thu, 31 Jan 2019 16:36:21 +0100 From: Greg KH To: Liu Jian Cc: xiubli@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5] driver: uio: fix possible memory leak in uio_open Message-ID: <20190131153621.GA16678@kroah.com> References: <1548196704-352035-1-git-send-email-liujian56@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1548196704-352035-1-git-send-email-liujian56@huawei.com> User-Agent: Mutt/1.11.2 (2019-01-07) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 :( Please rebase it against the char-misc-next branch of my char-misc.git tree and resend. thanks, greg k-h