Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp302796pxf; Thu, 1 Apr 2021 01:18:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNPudTaUjNbvadqBhUWyEG7SzPqUjhMLpVUumImU5bQuOHiRjf0ar08tRRl3UjgmH7jtQJ X-Received: by 2002:a50:ec81:: with SMTP id e1mr8516035edr.0.1617265130713; Thu, 01 Apr 2021 01:18:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617265130; cv=none; d=google.com; s=arc-20160816; b=ivlv94ie8Rjv5PbckT1zMdam/OD6KRo3AuO8VmJosjI6PgAQ7nQe+eDZSOs7aPZwJK QDrzW+rJ3GIOIcdfV016+1HF+4Dzuigc/LukOU7gAiwTItJ/lwXeL1XkeoIM87U/ExrJ h/kbE+m5YMll93wl18CgE03VrIOjbHNmd7r3ov9tbSyIouYgC/6RSqgkNLcw3nzCCH+y TMqazMCf7CpYcGwDD6GhmKOgHQC2j8lglvd47YtLtDpu+6QqptarffbcAqd6b4Omf1/g dfghOJKKKGap7igC2xtfT07TJOwp1q/2F34ZcW+1aSy2eCkjW3TSNFb8Cre8jTn5o6Pi knAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type:content-language :thread-index:content-transfer-encoding:mime-version:message-id:date :subject:in-reply-to:to:from:dkim-signature:dkim-filter; bh=vgbPXoR2wLvBR7QZ88GMHoPZAHxfQlH41VOC/Czif9g=; b=b4AOlPxnfvZQspEK4B9xXARIyD+qOthJrrkHyov52cL7OlUFolX97ywbVNrdp1Pqcd yaegYN8zJPqvN4Qj9R7mL7eoSAybJe7x6xwZ3FdOR71Lo7vgBIfQXfafi5ynChyPdQ0u fHTCcERJtI4V5X+5gbPvCoPBOHisruC4NQv/U1i65GOUmhuH6zLUW/CLV39FaeI8JwnU u6WNDeS7SlOB3koGrxtgK1G53bW+ghjnz4m3VT+fRd3GPemzn39FVPHOF94axDn5o2Yf caBfTcS/u+GHu6OUgwLIrOCBZzhiZLMGilbYp2d8plEY4rBk/+t4U187wwETY4W1ITOO SFSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=Hvj54Vdw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v21si4133030ejg.244.2021.04.01.01.18.28; Thu, 01 Apr 2021 01:18:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=Hvj54Vdw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232565AbhDAIRa (ORCPT + 99 others); Thu, 1 Apr 2021 04:17:30 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:45132 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232951AbhDAIRR (ORCPT ); Thu, 1 Apr 2021 04:17:17 -0400 Received: from epcas1p2.samsung.com (unknown [182.195.41.46]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20210401081715epoutp02e9afa73eb866322a1eedd5ab410a4663~xrfseB8Pw0212702127epoutp026 for ; Thu, 1 Apr 2021 08:17:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20210401081715epoutp02e9afa73eb866322a1eedd5ab410a4663~xrfseB8Pw0212702127epoutp026 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1617265035; bh=vgbPXoR2wLvBR7QZ88GMHoPZAHxfQlH41VOC/Czif9g=; h=From:To:In-Reply-To:Subject:Date:References:From; b=Hvj54Vdw77qFxPIbwOqZM4WJ1bjFsqFn6hNbGApgo/3pEL3p7vRVoUW1rs5o7ufVW qbGb7H87rI7Oywh2aFzQr0y8fcKqmoeYmUG65HF4QAIV+EqC8+BvRJeBwWYtIX/ur0 DNgWLu7rXjT/cEjA8P5e8U7MK0SxyyJWShCRlKas= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20210401081714epcas1p3d04cef095c860f8d0fca63940df1e2c4~xrfr8_lVe1503215032epcas1p33; Thu, 1 Apr 2021 08:17:14 +0000 (GMT) Received: from epsmges1p2.samsung.com (unknown [182.195.40.160]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4F9wyd5lsXz4x9Q2; Thu, 1 Apr 2021 08:17:13 +0000 (GMT) Received: from epcas1p4.samsung.com ( [182.195.41.48]) by epsmges1p2.samsung.com (Symantec Messaging Gateway) with SMTP id CA.45.02277.98185606; Thu, 1 Apr 2021 17:17:13 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas1p3.samsung.com (KnoxPortal) with ESMTPA id 20210401081713epcas1p3aee989bb7fdfb07918cafe96ab6be33c~xrfqnQLhi1504115041epcas1p3t; Thu, 1 Apr 2021 08:17:13 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210401081713epsmtrp248a9eb5cfb39cb2fe6be4e61d6b8e9e4~xrfqmcNSP2201922019epsmtrp2T; Thu, 1 Apr 2021 08:17:13 +0000 (GMT) X-AuditID: b6c32a36-4d7ff700000108e5-b0-606581897d8c Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id F3.A2.08745.98185606; Thu, 1 Apr 2021 17:17:13 +0900 (KST) Received: from namjaejeon01 (unknown [10.88.104.63]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20210401081712epsmtip1f1cb5e77e7f1ca84725115f2c061b3da~xrfqXktBa0332003320epsmtip11; Thu, 1 Apr 2021 08:17:12 +0000 (GMT) From: "Namjae Jeon" To: "'Muhammad Usama Anjum'" , "'Sergey Senozhatsky'" , "'Steve French'" , "'Hyunchul Lee'" , "'open list:COMMON INTERNET FILE SYSTEM SERVER \(CIFSD\)'" , "'open list:COMMON INTERNET FILE SYSTEM SERVER \(CIFSD\)'" , "'open list'" , , , In-Reply-To: <20210401075531.GA2766105@LEGION> Subject: RE: [PATCH] cifsd: fix memory leak when loop ends Date: Thu, 1 Apr 2021 17:17:13 +0900 Message-ID: <003901d726cf$6b75d890$426189b0$@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQG8FoHjOwNMvoZKP6UmJNrFtYqTewIzYq1UqsPWbrA= Content-Language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrNJsWRmVeSWpSXmKPExsWy7bCmgW5nY2qCwdZ36ha/V/eyWbz+N53F 4tr99+wWW29JW7z4v4vZ4uf/74wWl3fNYbPY27qN0WLt58fsFh0vjzI7cHnMauhl89g56y67 x+4Fn5k8Pj69xeIxd1cfo8fnTXIBbFE5NhmpiSmpRQqpecn5KZl56bZK3sHxzvGmZgaGuoaW FuZKCnmJuam2Si4+AbpumTlAlykplCXmlAKFAhKLi5X07WyK8ktLUhUy8otLbJVSC1JyCgwN CvSKE3OLS/PS9ZLzc60MDQyMTIEqE3Iy2k6eZiqYwVwxZdZMlgbG00xdjBwcEgImEidWmnYx cnEICexglFj9sIsFwvnEKLGocxk7hPOZUWL7unVsXYycYB2L77yAqtrFKLFm8ylmCOclo8S6 +VPAqtgEdCX+/dnPBp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TJk1k6WB8TRT FyMnh4SAicTiOy9Yuhi5OIQEdjBKbNn3jR0iIS1x7MQZ5i5GDiBbWOLw4WKImueMEu+3vgGr YRPQlfj3Zz8bSEJEYCKLxLcFF8ESQgL1Emumv2UDsTkF9CQmfvjBDGILC1hJ/N+yhgXEZhFQ kXi3bhYjiM0rYClx+NotFghbUOLkzCcsIIuZgXrbNoKVMAvIS2x/O4cZ4jYFiZ9Pl7GC2CJA I1csn84MUSMiMbuzjXkCo9AsJJNmIUyahWTSLCQdCxhZVjFKphYU56bnFhsWGOWllusVJ+YW l+al6yXn525iBEeWltYOxj2rPugdYmTiYDzEKMHBrCTCK3wgMUGINyWxsiq1KD++qDQntfgQ ozQHi5I474Wuk/FCAumJJanZqakFqUUwWSYOTqkGJr2zEb8XPVu3t8oy511Zadj6SK53gZVF Tk5TPorabWZiTlBVdgvZyP5w7RfFt4s/xvKvnPtwu+Tlc68UVyXJ1TvO+a4h5iDGOW850+9/ 3Rfl9JaqxS9+LWx7PjyCqeFkYZCibTn7588BhhuvTfLO/b+6Xz5YNnfRxolmXz3LC/5NNRTf /HiT5aNLvp3ZmhuL/D8UHPy6TSNroaVWXCWz1Bz2rN/tlzZ0FCsUdm89I7zW0u/T1bvPVN3D mRMYhF7fevBj0gyOv7qfE94lC/xnLRbwybTacYi9dUZWtgPbr7jZJvsyZ4ql3rl2ib3yUcGU H1a/f971cT7iovrDybbwDJPZNPtdT3Yau73O+MnBqMRSnJFoqMVcVJwIAHtoyzcbAwAA X-CMS-MailID: 20210401081713epcas1p3aee989bb7fdfb07918cafe96ab6be33c X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20210401075539epcas1p3b7cb52923217b212c80185aab135fe22 References: <20210401075531.GA2766105@LEGION> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > Memory is being allocated and if veto_list is zero, the loop breaks without cleaning up the allocated > memory. In this patch, the length check has been moved before allocation. If loop breaks, the memory > isn't allocated in the first place. Thus the memory is being protected from leaking. > > Signed-off-by: Muhammad Usama Anjum I will apply. Thanks for your patch!