Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp370830imu; Wed, 2 Jan 2019 22:32:13 -0800 (PST) X-Google-Smtp-Source: ALg8bN63Kun+wV/WoNw6CBPHJLYD3fnnigH1OuDypLgfpYxYKLIHUvy1j1fh94Zk35F7oLEwlEIv X-Received: by 2002:a17:902:583:: with SMTP id f3mr47171558plf.202.1546497133285; Wed, 02 Jan 2019 22:32:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546497133; cv=none; d=google.com; s=arc-20160816; b=uPzthaC1oq/zZDd9HoASvagwQ6v0usgMqYgysc5VzbHMAFQIpTh3HzmdFL1RykyP+w hq8uRwP/6Xji5Rjln0fTt9drSBUDoiFzbue2Aa4aw2vIbDebagqa7IJRjXhzPcPAJPmx uKISiJ5EhDgNYwxbEyuiQNDLV86ezQ+tUiD+1CgO8LpdXu6l/uL2QJEqHf1/XA/eunHX Eb4GRKHQOPc5YrpeueWBW8CxX1ITStPtUkPncJwIBLLX/uSwRmV0jqygfgg0d65gi7FW sF0PhZr2jBsu++9q7c5l8scgj+5O290bKVqzw5pnUc2abMGldujI7NMOKmXvGQWdBc6k j3VQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=bPKaT3MufGA9R++UlWuKpVhfa3YRbLB0LLoUMeNd1+o=; b=MEBjW58NTl+iOB0Kn6B+pv+RZef+olkIrDgx2cXxy5E43xthjK93yQQnfn0PUGwBJa VebVQ64Qtix2p7u+rzHIF3l2xkQBwXukJJWNl6L7cBh/WDV7aboWt01ARH/0rJb2I+jO CTIC7FDlGPfEF+fQFD3UejNWH6S/ovl5JChTUekrA8hsOCnlZ0K5JOze9cGrDh4dVyS/ L0n7/cCtJIrOJm8GciRqLyuIZFvu+EruC8ihwOE5CY4Ka3hLobxZkuxt/Ru7kNoc7t+P hFJxC547Eah1Vmn9YRIHb6JOfEGZBQwgHs8GsYplFTpbqNfQ8dRyFETt8XOXtcETILxW lGzw== 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 w12si52624171pfn.212.2019.01.02.22.31.58; Wed, 02 Jan 2019 22:32:13 -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 S1729185AbfACCxm (ORCPT + 99 others); Wed, 2 Jan 2019 21:53:42 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:37603 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728132AbfACCxm (ORCPT ); Wed, 2 Jan 2019 21:53:42 -0500 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id BA0306DAADF18; Thu, 3 Jan 2019 10:53:39 +0800 (CST) Received: from huawei.com (10.175.104.208) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.408.0; Thu, 3 Jan 2019 10:53:30 +0800 From: liujian To: CC: , , Subject: [PATCH v2] driver: uio: fix possible memory leak in uio_open Date: Thu, 3 Jan 2019 20:54:21 +0800 Message-ID: <1546520061-312904-1-git-send-email-liujian56@huawei.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.104.208] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org v1->v2: rename the "err_infoopen" to "err_idev_info" Fixes: 57c5f4df0a5a ("uio: fix crash after the device is unregistered") Signed-off-by: liujian --- 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 5c10fc7..aab3520 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c @@ -496,18 +496,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