From patchwork Sat Jan 5 18:18:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10749333 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AE9026C5 for ; Sat, 5 Jan 2019 18:18:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9BD552880A for ; Sat, 5 Jan 2019 18:18:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8B6A528818; Sat, 5 Jan 2019 18:18:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 109A92880A for ; Sat, 5 Jan 2019 18:18:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726394AbfAESSd (ORCPT ); Sat, 5 Jan 2019 13:18:33 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:58564 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726252AbfAESSd (ORCPT ); Sat, 5 Jan 2019 13:18:33 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id x05IA9Oi041044; Sat, 5 Jan 2019 18:18:15 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-2018-07-02; bh=s/5hbzHT6u3Z7RGDp0OnOblEQnirgIkNIZdWWZ0mSnk=; b=xCMQobabhs5tlEah5vdZEU469zBlQ3cF2tJN/gWo4rQqYEvrgFAMhv3P8son6o1mjI2Z PxM1GhGFx00b/+een9urx8KK3bFE81aB9wmzO/ngmVSceae4RwOIe8PNGOFGItOFCFNh z6uV078biNoJAuLiAbilQoQhg7EZ8x1i7TGwwTBpJIZ7GphmFTiwPei71h3ZMq84Yqwd S19LvmQVnGrw3NBdsy6vy+9jh1dUDzjqY1D7xQi7epdmVEEmz5g9KxsKc2KDQ8YGir+w khM/R2D8+dKm5zaa9NrChXyAIDg88mFg9C5Ph0WZBUx0tVcwShOjBx/PW4pXgsVA2voO 0g== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2ptm0ts73x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 05 Jan 2019 18:18:15 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id x05IIE0P005157 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 5 Jan 2019 18:18:14 GMT Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x05IICr2006209; Sat, 5 Jan 2019 18:18:12 GMT Received: from kadam (/41.202.241.48) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 05 Jan 2019 10:18:12 -0800 Date: Sat, 5 Jan 2019 21:18:03 +0300 From: Dan Carpenter To: Steve French , Paulo Alcantara Cc: linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, kernel-janitors@vger.kernel.org Subject: [PATCH] cifs: Fix a tiny potential memory leak Message-ID: <20190105181803.GD3288@kadam> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9127 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=965 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901050161 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The most recent "it" allocation is leaked on this error path. I believe that small allocations always succeed in current kernels so this doesn't really affect run time. Fixes: 54be1f6c1c37 ("cifs: Add DFS cache routines") Signed-off-by: Dan Carpenter --- fs/cifs/dfs_cache.c | 1 + 1 file changed, 1 insertion(+) -- 2.17.1 diff --git a/fs/cifs/dfs_cache.c b/fs/cifs/dfs_cache.c index cd63c4a70875..09b7d0d4f6e4 100644 --- a/fs/cifs/dfs_cache.c +++ b/fs/cifs/dfs_cache.c @@ -776,6 +776,7 @@ static int get_tgt_list(const struct dfs_cache_entry *ce, it->it_name = kstrndup(t->t_name, strlen(t->t_name), GFP_KERNEL); if (!it->it_name) { + kfree(it); rc = -ENOMEM; goto err_free_it; }