From patchwork Wed Aug 20 10:39:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namjae Jeon X-Patchwork-Id: 4748921 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6AFBE9F375 for ; Wed, 20 Aug 2014 10:40:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B6AA12015E for ; Wed, 20 Aug 2014 10:40:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D27B82014A for ; Wed, 20 Aug 2014 10:40:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752315AbaHTKjq (ORCPT ); Wed, 20 Aug 2014 06:39:46 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:18237 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750939AbaHTKjp (ORCPT ); Wed, 20 Aug 2014 06:39:45 -0400 Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NAL000R9PLY9360@mailout2.samsung.com> for linux-cifs@vger.kernel.org; Wed, 20 Aug 2014 19:39:34 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.113]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id 01.00.19786.6EA74F35; Wed, 20 Aug 2014 19:39:34 +0900 (KST) X-AuditID: cbfee68e-b7fab6d000004d4a-87-53f47ae69f8e Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id E4.1E.05196.6EA74F35; Wed, 20 Aug 2014 19:39:34 +0900 (KST) Received: from DONAMJAEJEO06 ([10.88.104.63]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NAL00IOLPLY5MA0@mmp2.samsung.com>; Wed, 20 Aug 2014 19:39:34 +0900 (KST) From: Namjae Jeon To: 'Steve French' Cc: 'Shirish Pargaonkar' , 'Pavel Shilovsky' , linux-cifs@vger.kernel.org, Ashish Sangwan Subject: [PATCH 5/7] cifs: fix memory leak when password is supplied multiple times Date: Wed, 20 Aug 2014 19:39:34 +0900 Message-id: <003801cfbc63$08767980$19636c80$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: Ac+8Yrc1gA3pK+vBQTiOfCYUgQN+FA== Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrKIsWRmVeSWpSXmKPExsWyRsSkUPdZ1Zdgg7nvRCyWTrzEbPHi/y5m i3N7WS1ezGlgtHjz4jCbA6vHzll32T3m7upj9OjbsorR4/MmuQCWKC6blNSczLLUIn27BK6M Pw0/mQqmclRc7TzK3MC4m62LkYNDQsBE4vN0uy5GTiBTTOLCvfVAYS4OIYGljBJ/2qaxQyRM JLbcOcgGYgsJTGeU+LeLD6LoL6PEuX/PwAaxCWhL/NkiClIjIqAu8Xn5X2YQm1lgBaPEo18m ICXCAqESZ/7pgoRZBFQlzq49xwhi8wpYSnxfNxnKFpT4MfkeC0SrlsT6nceZIGx5ic1r3jJD nKMgsePsa0aQkSICehI/7pRBlIhI7HvxjhGiZBu7xOJP6RCrBCS+TT7EAvGtrMSmA1BTJCUO rrjBMoFRbBaSxbOQLJ6FZPEsJBsWMLKsYhRNLUguKE5KLzLSK07MLS7NS9dLzs/dxAiMstP/ nvXtYLx5wPoQYzLQ+onMUqLJ+cAozSuJNzQ2M7IwNTE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A p3uXRh8/dGCOkMHH3zPC1+28XnCZtVKWYf92P6O+WjGj61MbhXzu7w1QDrj7/jln0LeVk74p sRRnJBpqMRcVJwIAWhQN/fkCAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Unlikely but possible. When password is supplied multiple times, we have to free the previous allocation. Signed-off-by: Namjae Jeon Signed-off-by: Ashish Sangwan --- fs/cifs/connect.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index b4b6d10..91512fd 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -1583,6 +1583,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, * Check if this is a case where the password * starts with a delimiter */ + kfree(vol->password); tmp_end = strchr(data, '='); tmp_end++; if (!(tmp_end < end && tmp_end[1] == delim)) { @@ -1624,6 +1625,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, options = end; } + kfree(vol->password); /* Now build new password string */ temp_len = strlen(value); vol->password = kzalloc(temp_len+1, GFP_KERNEL);