Received: by 10.192.165.148 with SMTP id m20csp538886imm; Fri, 20 Apr 2018 10:49:40 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/A/h7KXlOxxZhbQwMRKzgpsLw7Nk43EQcg+OT1Uj3hLMk2YTYTjqxIHACRkISroF9iTfvx X-Received: by 10.99.117.2 with SMTP id q2mr9456479pgc.248.1524246580637; Fri, 20 Apr 2018 10:49:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524246580; cv=none; d=google.com; s=arc-20160816; b=ENGF5SHneI4cMNRhesUmzsX62t2Pgpx73ZSpby4QgukhQn/KktIUuCS+JbHZ5nBR0p uUAzm89uqtvT9JE/RJZ5HMbSSi8sUGkBfA+sWHrraMpPZSBrnL03fpgdS/ydYsMrM5Gg YBbGJ3YCx3lrNr9x5Z9qS/yJaH00K8rCub6+iTW7/HIbQCypho3pLDKm1c0yRZTVql/v N0Y+wkjOvozuoNfowtf96CZUh3IQ6x9NjiOEiE6OHeaCdIyhWkogyZI6AeJzA01s+pBy gv0yspbXvKKtJp/N5a3Z8+NLtwuB4K6rJFX4BGD0RB0OlOMY4FskPTgeGUtow+NkNLiH 7dzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=6JkZ42ifSYpwZc0BtgoOLkQ85jPDvm986DQrMSbc7kM=; b=VmJkAjKYTHDV84KcMmyO6DxkZA97EgWqH6xuVm5zqvza121FcJVv8ngP/k48Hz8rB+ XJSs1F5rtB1MG6EaaRlN47zC7lt0k99JsCS3/6e+gkf+fD3K7B5hpSZ1GHrP+vFC1iKE vKCmWKMpmpYEsLSX2vTV/UVJSt8n4Zdui7I0TTbihbvIPW7JarVqc26Z7YpiptTTHoiE 5AyF37pByOgzxl9jwhx4uYmrbD/McL7gZefRuJb7EBu/tMGAw+5pKzf3IWGDSUtHlOKZ 6lv5TsU7NF9xDTWbxQKjDyQd3DNiOpfCqkRXJgfll6G9qTHO1bIdXCMEPp7N6XO7ping Dipw== 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 y6si5116415pfn.303.2018.04.20.10.49.26; Fri, 20 Apr 2018 10:49:40 -0700 (PDT) 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 S1753466AbeDTRsJ (ORCPT + 99 others); Fri, 20 Apr 2018 13:48:09 -0400 Received: from gateway22.websitewelcome.com ([192.185.46.156]:20477 "EHLO gateway22.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752831AbeDTRsI (ORCPT ); Fri, 20 Apr 2018 13:48:08 -0400 Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway22.websitewelcome.com (Postfix) with ESMTP id F0D97CD71 for ; Fri, 20 Apr 2018 12:48:07 -0500 (CDT) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id 9a8lfaTsJ5CKD9a8lf9FbJ; Fri, 20 Apr 2018 12:48:07 -0500 X-Authority-Reason: nr=8 Received: from [189.175.6.211] (port=34550 helo=[192.168.1.71]) by gator4166.hostgator.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.89_1) (envelope-from ) id 1f9a8l-000V4Z-Fo; Fri, 20 Apr 2018 12:48:07 -0500 Subject: Re: [PATCH] cifs: dir: fix memory leak in cifs_mknod To: Steve French , Colin King Cc: Ronnie Sahlberg , Steve French , CIFS , samba-technical , LKML , kernel-janitors References: <20180420131919.GA1766@embeddedor.com> From: "Gustavo A. R. Silva" Message-ID: <67525f3c-f6f2-d1b2-c6eb-66b2315e6530@embeddedor.com> Date: Fri, 20 Apr 2018 12:48:05 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 189.175.6.211 X-Source-L: No X-Exim-ID: 1f9a8l-000V4Z-Fo X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: ([192.168.1.71]) [189.175.6.211]:34550 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 7 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Steve, On 04/20/2018 12:37 PM, Steve French wrote: > I noticed a similar problem with the tcon link leak on that (which > Colin and Gustavo pointed out - thank you!) but also in another return > statement, so updated the original patch of Ronnie's merging the fixes > > https://git.samba.org/sfrench/cifs-2.6.git/?p=sfrench/cifs-2.6.git;a=commit;h=167bc5de08dc97695f9d5c7069c3e69f409ff80b > > > Let me know if you see any problems with it. > Looks correct to me. Thanks -- Gustavo > On Fri, Apr 20, 2018 at 8:19 AM, Gustavo A. R. Silva > wrote: >> Free allocated memory for full_path and xid before return. >> >> Addresses-Coverity-ID: 1468029 ("Resource leak") >> Fixes: 49162bfde140 ("cifs: do not allow creating sockets except with >> SMB1 posix exensions") >> Signed-off-by: Gustavo A. R. Silva >> --- >> fs/cifs/dir.c | 5 ++++- >> 1 file changed, 4 insertions(+), 1 deletion(-) >> >> diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c >> index f0a759d..71e32d9 100644 >> --- a/fs/cifs/dir.c >> +++ b/fs/cifs/dir.c >> @@ -684,8 +684,11 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, umode_t mode, >> goto mknod_out; >> } >> >> - if (!S_ISCHR(mode) && !S_ISBLK(mode)) >> + if (!S_ISCHR(mode) && !S_ISBLK(mode)) { >> + kfree(full_path); >> + free_xid(xid); >> return -EPERM; >> + } >> >> if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL)) >> goto mknod_out; >> -- >> 2.7.4 >> >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in >> the body of a message to majordomo@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html > > >