From patchwork Wed May 8 13:35:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 10935681 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 2DDC013AD for ; Wed, 8 May 2019 13:35:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C33C26253 for ; Wed, 8 May 2019 13:35:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0FD56281D2; Wed, 8 May 2019 13:35:40 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 B955A26253 for ; Wed, 8 May 2019 13:35:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725778AbfEHNfi (ORCPT ); Wed, 8 May 2019 09:35:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58974 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726762AbfEHNfi (ORCPT ); Wed, 8 May 2019 09:35:38 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C20F42DA990 for ; Wed, 8 May 2019 13:35:38 +0000 (UTC) Received: from madhat.boston.devel.redhat.com (ovpn-116-59.phx2.redhat.com [10.3.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7E0831724D for ; Wed, 8 May 2019 13:35:38 +0000 (UTC) From: Steve Dickson To: Linux NFS Mailing list Subject: [PATCH 01/19] Removed resource leaks from junction/path.c Date: Wed, 8 May 2019 09:35:18 -0400 Message-Id: <20190508133536.6077-2-steved@redhat.com> In-Reply-To: <20190508133536.6077-1-steved@redhat.com> References: <20190508133536.6077-1-steved@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 08 May 2019 13:35:38 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP junction/path.c:167: leaked_storage: Variable "start" going out of scope leaks the storage it points to. junction/path.c:331: leaked_storage: Variable "normalized" going out of scope leaks the storage it points to. junction/path.c:340: leaked_storage: Variable "normalized" going out of scope leaks the storage it points to. Signed-off-by: Steve Dickson --- support/junction/path.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/support/junction/path.c b/support/junction/path.c index e74e4c4..13a1438 100644 --- a/support/junction/path.c +++ b/support/junction/path.c @@ -163,8 +163,10 @@ nsdb_count_components(const char *pathname, size_t *len, break; next = strchrnul(component, '/'); tmp = (size_t)(next - component); - if (tmp > 255) + if (tmp > 255) { + free(start); return false; + } length += XDR_UINT_BYTES + (nsdb_quadlen(tmp) << 2); count++; @@ -328,11 +330,13 @@ nsdb_posix_to_path_array(const char *pathname, char ***path_array) length = (size_t)(next - component); if (length > 255) { nsdb_free_string_array(result); + free(normalized); return FEDFS_ERR_SVRFAULT; } result[i] = strndup(component, length); if (result[i] == NULL) { + free(normalized); nsdb_free_string_array(result); return FEDFS_ERR_SVRFAULT; } From patchwork Wed May 8 13:35:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 10935683 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 B8F6D912 for ; Wed, 8 May 2019 13:35:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A941726253 for ; Wed, 8 May 2019 13:35:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D552281D2; Wed, 8 May 2019 13:35:40 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 5071426253 for ; Wed, 8 May 2019 13:35:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726776AbfEHNfj (ORCPT ); Wed, 8 May 2019 09:35:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49030 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726762AbfEHNfj (ORCPT ); Wed, 8 May 2019 09:35:39 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 37507307B481 for ; Wed, 8 May 2019 13:35:39 +0000 (UTC) Received: from madhat.boston.devel.redhat.com (ovpn-116-59.phx2.redhat.com [10.3.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id E5F8C5C640 for ; Wed, 8 May 2019 13:35:38 +0000 (UTC) From: Steve Dickson To: Linux NFS Mailing list Subject: [PATCH 02/19] Removed resource leaks from nfs/exports.c Date: Wed, 8 May 2019 09:35:19 -0400 Message-Id: <20190508133536.6077-3-steved@redhat.com> In-Reply-To: <20190508133536.6077-1-steved@redhat.com> References: <20190508133536.6077-1-steved@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 08 May 2019 13:35:39 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP nfs/exports.c:717: leaked_storage: Variable "id" going out of scope leaks the storage it points to. nfs/exports.c:727: leaked_storage: Variable "id" going out of scope leaks the storage it points to. Signed-off-by: Steve Dickson --- support/nfs/exports.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/support/nfs/exports.c b/support/nfs/exports.c index b59d187..5f4cb95 100644 --- a/support/nfs/exports.c +++ b/support/nfs/exports.c @@ -714,6 +714,7 @@ parsesquash(char *list, int **idp, int *lenp, char **ep) } if (id0 == -1 || id1 == -1) { syntaxerr("uid/gid -1 not permitted"); + xfree(id); return -1; } if ((len % 8) == 0) @@ -724,6 +725,7 @@ parsesquash(char *list, int **idp, int *lenp, char **ep) break; if (*cp != ',') { syntaxerr("bad uid/gid list"); + xfree(id); return -1; } cp++; From patchwork Wed May 8 13:35:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 10935685 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 E6AC2912 for ; Wed, 8 May 2019 13:35:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D784226253 for ; Wed, 8 May 2019 13:35:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CBF79281D2; Wed, 8 May 2019 13:35:41 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 8A57626253 for ; Wed, 8 May 2019 13:35:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726534AbfEHNfl (ORCPT ); Wed, 8 May 2019 09:35:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53062 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726762AbfEHNfk (ORCPT ); Wed, 8 May 2019 09:35:40 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9F6E33088B77 for ; Wed, 8 May 2019 13:35:40 +0000 (UTC) Received: from madhat.boston.devel.redhat.com (ovpn-116-59.phx2.redhat.com [10.3.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5A9611724D for ; Wed, 8 May 2019 13:35:40 +0000 (UTC) From: Steve Dickson To: Linux NFS Mailing list Subject: [PATCH 03/19] Removed a resource leak from nfs/mydaemon.c Date: Wed, 8 May 2019 09:35:20 -0400 Message-Id: <20190508133536.6077-4-steved@redhat.com> In-Reply-To: <20190508133536.6077-1-steved@redhat.com> References: <20190508133536.6077-1-steved@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Wed, 08 May 2019 13:35:40 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP nfs/mydaemon.c:130: leaked_handle: Handle variable "tempfd" going out of scope leaks the handle. Signed-off-by: Steve Dickson --- support/nfs/mydaemon.c | 1 + 1 file changed, 1 insertion(+) diff --git a/support/nfs/mydaemon.c b/support/nfs/mydaemon.c index 343e80b..d1cf08d 100644 --- a/support/nfs/mydaemon.c +++ b/support/nfs/mydaemon.c @@ -123,6 +123,7 @@ daemon_init(bool fg) dup2(tempfd, 0); dup2(tempfd, 1); dup2(tempfd, 2); + close(tempfd); closelog(); dup2(pipefds[1], 3); pipefds[1] = 3; From patchwork Wed May 8 13:35:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 10935687 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 98F0B112C for ; Wed, 8 May 2019 13:35:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 897ED26253 for ; Wed, 8 May 2019 13:35:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7DFDD281D2; Wed, 8 May 2019 13:35:42 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 2766C26253 for ; Wed, 8 May 2019 13:35:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726882AbfEHNfl (ORCPT ); Wed, 8 May 2019 09:35:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57483 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726762AbfEHNfl (ORCPT ); Wed, 8 May 2019 09:35:41 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 196E53087950 for ; Wed, 8 May 2019 13:35:41 +0000 (UTC) Received: from madhat.boston.devel.redhat.com (ovpn-116-59.phx2.redhat.com [10.3.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id C46595C269 for ; Wed, 8 May 2019 13:35:40 +0000 (UTC) From: Steve Dickson To: Linux NFS Mailing list Subject: [PATCH 04/19] Removed a resource leak from nfs/rpcmisc.c Date: Wed, 8 May 2019 09:35:21 -0400 Message-Id: <20190508133536.6077-5-steved@redhat.com> In-Reply-To: <20190508133536.6077-1-steved@redhat.com> References: <20190508133536.6077-1-steved@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Wed, 08 May 2019 13:35:41 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP nfs/rpcmisc.c:105: leaked_handle: Handle variable "sock" going out of scope leaks the handle. Signed-off-by: Steve Dickson --- support/nfs/rpcmisc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/support/nfs/rpcmisc.c b/support/nfs/rpcmisc.c index abe89ba..d84c04f 100644 --- a/support/nfs/rpcmisc.c +++ b/support/nfs/rpcmisc.c @@ -102,6 +102,7 @@ makesock(int port, int proto) if (bind(sock, (struct sockaddr *) &sin, sizeof(sin)) == -1) { xlog(L_FATAL, "Could not bind name to socket: %s", strerror(errno)); + close(sock); return -1; } From patchwork Wed May 8 13:35:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 10935689 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 F3290112C for ; Wed, 8 May 2019 13:35:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E394A26253 for ; Wed, 8 May 2019 13:35:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D833A281D2; Wed, 8 May 2019 13:35:43 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 945AB26253 for ; Wed, 8 May 2019 13:35:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726762AbfEHNfm (ORCPT ); Wed, 8 May 2019 09:35:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50484 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726254AbfEHNfm (ORCPT ); Wed, 8 May 2019 09:35:42 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7F8798FADD for ; Wed, 8 May 2019 13:35:42 +0000 (UTC) Received: from madhat.boston.devel.redhat.com (ovpn-116-59.phx2.redhat.com [10.3.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3B72D5C640 for ; Wed, 8 May 2019 13:35:41 +0000 (UTC) From: Steve Dickson To: Linux NFS Mailing list Subject: [PATCH 05/19] Removed a resource leak from nfs/svc_socket.c Date: Wed, 8 May 2019 09:35:22 -0400 Message-Id: <20190508133536.6077-6-steved@redhat.com> In-Reply-To: <20190508133536.6077-1-steved@redhat.com> References: <20190508133536.6077-1-steved@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 08 May 2019 13:35:42 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP nfs/svc_socket.c:137: leaked_handle: Handle variable "sock" going out of scope leaks the handle. Signed-off-by: Steve Dickson --- support/nfs/svc_socket.c | 1 + 1 file changed, 1 insertion(+) diff --git a/support/nfs/svc_socket.c b/support/nfs/svc_socket.c index d56507a..5afc6aa 100644 --- a/support/nfs/svc_socket.c +++ b/support/nfs/svc_socket.c @@ -134,6 +134,7 @@ svc_socket (u_long number, int type, int protocol, int reuse) if (ret < 0) { xlog(L_ERROR, "svc_socket: socket reuse problem: %m"); + (void) __close(sock); return ret; } } From patchwork Wed May 8 13:35:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 10935691 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 489E6912 for ; Wed, 8 May 2019 13:35:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3951826253 for ; Wed, 8 May 2019 13:35:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2DA162842E; Wed, 8 May 2019 13:35:45 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 CC96326253 for ; Wed, 8 May 2019 13:35:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727270AbfEHNfo (ORCPT ); Wed, 8 May 2019 09:35:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53868 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727242AbfEHNfn (ORCPT ); Wed, 8 May 2019 09:35:43 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E9DA13079B90 for ; Wed, 8 May 2019 13:35:42 +0000 (UTC) Received: from madhat.boston.devel.redhat.com (ovpn-116-59.phx2.redhat.com [10.3.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id A33415C640 for ; Wed, 8 May 2019 13:35:42 +0000 (UTC) From: Steve Dickson To: Linux NFS Mailing list Subject: [PATCH 06/19] Removed bad frees from nfs/xcommon.c Date: Wed, 8 May 2019 09:35:23 -0400 Message-Id: <20190508133536.6077-7-steved@redhat.com> In-Reply-To: <20190508133536.6077-1-steved@redhat.com> References: <20190508133536.6077-1-steved@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 08 May 2019 13:35:42 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP nfs/xcommon.c:63: incorrect_free: "free" frees incorrect pointer "(void *)s". nfs/xcommon.c:81: incorrect_free: "free" frees incorrect pointer "(void *)s". Signed-off-by: Steve Dickson --- support/nfs/xcommon.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/support/nfs/xcommon.c b/support/nfs/xcommon.c index 14e580e..3989f0b 100644 --- a/support/nfs/xcommon.c +++ b/support/nfs/xcommon.c @@ -53,14 +53,17 @@ char * xstrconcat3 (const char *s, const char *t, const char *u) { char *res; - if (!s) s = ""; + int dofree = 1; + + if (!s) s = "", dofree=0; if (!t) t = ""; if (!u) u = ""; res = xmalloc(strlen(s) + strlen(t) + strlen(u) + 1); strcpy(res, s); strcat(res, t); strcat(res, u); - free((void *) s); + if (dofree) + free((void *) s); return res; } @@ -69,7 +72,9 @@ char * xstrconcat4 (const char *s, const char *t, const char *u, const char *v) { char *res; - if (!s) s = ""; + int dofree = 1; + + if (!s) s = "", dofree=0; if (!t) t = ""; if (!u) u = ""; if (!v) v = ""; @@ -78,7 +83,8 @@ xstrconcat4 (const char *s, const char *t, const char *u, const char *v) { strcat(res, t); strcat(res, u); strcat(res, v); - free((void *) s); + if (dofree) + free((void *) s); return res; } From patchwork Wed May 8 13:35:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 10935693 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 63F7413AD for ; Wed, 8 May 2019 13:35:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 52CEB26253 for ; Wed, 8 May 2019 13:35:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 475322856D; Wed, 8 May 2019 13:35:45 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 051CA26E75 for ; Wed, 8 May 2019 13:35:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727242AbfEHNfo (ORCPT ); Wed, 8 May 2019 09:35:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50794 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726254AbfEHNfn (ORCPT ); Wed, 8 May 2019 09:35:43 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 61D0D3087BD2 for ; Wed, 8 May 2019 13:35:43 +0000 (UTC) Received: from madhat.boston.devel.redhat.com (ovpn-116-59.phx2.redhat.com [10.3.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 18AE95C269 for ; Wed, 8 May 2019 13:35:43 +0000 (UTC) From: Steve Dickson To: Linux NFS Mailing list Subject: [PATCH 07/19] Removed resource leaks from nfs/xlog.c Date: Wed, 8 May 2019 09:35:24 -0400 Message-Id: <20190508133536.6077-8-steved@redhat.com> In-Reply-To: <20190508133536.6077-1-steved@redhat.com> References: <20190508133536.6077-1-steved@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Wed, 08 May 2019 13:35:43 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP nfs/xlog.c:139: leaked_storage: Variable "kinds" going out of scope leaks the storage it points to. nfs/xlog.c:142: leaked_storage: Variable "kinds" going out of scope leaks the storage it points to. Signed-off-by: Steve Dickson --- support/nfs/xlog.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/support/nfs/xlog.c b/support/nfs/xlog.c index f75a9ab..687d862 100644 --- a/support/nfs/xlog.c +++ b/support/nfs/xlog.c @@ -135,10 +135,14 @@ xlog_from_conffile(char *service) struct conf_list_node *n; kinds = conf_get_list(service, "debug"); - if (!kinds || !kinds->cnt) + if (!kinds || !kinds->cnt) { + free(kinds); return; + } TAILQ_FOREACH(n, &(kinds->fields), link) xlog_sconfig(n->field, 1); + + conf_free_list(kinds); } int From patchwork Wed May 8 13:35:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 10935695 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 D17AB1515 for ; Wed, 8 May 2019 13:35:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C265A26253 for ; Wed, 8 May 2019 13:35:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B6B42281D2; Wed, 8 May 2019 13:35:45 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 6E8D026253 for ; Wed, 8 May 2019 13:35:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726254AbfEHNfo (ORCPT ); Wed, 8 May 2019 09:35:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36228 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726656AbfEHNfn (ORCPT ); Wed, 8 May 2019 09:35:43 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C58C1DC8FF for ; Wed, 8 May 2019 13:35:43 +0000 (UTC) Received: from madhat.boston.devel.redhat.com (ovpn-116-59.phx2.redhat.com [10.3.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 813E95C269 for ; Wed, 8 May 2019 13:35:43 +0000 (UTC) From: Steve Dickson To: Linux NFS Mailing list Subject: [PATCH 08/19] Removed resource leaks from nfsidmap/libnfsidmap.c Date: Wed, 8 May 2019 09:35:25 -0400 Message-Id: <20190508133536.6077-9-steved@redhat.com> In-Reply-To: <20190508133536.6077-1-steved@redhat.com> References: <20190508133536.6077-1-steved@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 08 May 2019 13:35:43 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP nfsidmap/libnfsidmap.c:410: leaked_storage: Variable "nfs4_methods" going out of scope leaks the storage it points to. ibnfsidmap.c:483: leaked_storage: Variable "gss_methods" going out of scope leaks the storage it points to. Signed-off-by: Steve Dickson --- support/nfsidmap/libnfsidmap.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/support/nfsidmap/libnfsidmap.c b/support/nfsidmap/libnfsidmap.c index 35ddf01..7b8a871 100644 --- a/support/nfsidmap/libnfsidmap.c +++ b/support/nfsidmap/libnfsidmap.c @@ -406,8 +406,10 @@ int nfs4_init_name_mapping(char *conffile) nfs4_methods = conf_get_list("Translation", "Method"); if (nfs4_methods) { IDMAP_LOG(1, ("libnfsidmap: processing 'Method' list")); - if (load_plugins(nfs4_methods, &nfs4_plugins) == -1) + if (load_plugins(nfs4_methods, &nfs4_plugins) == -1) { + conf_free_list(nfs4_methods); return -ENOENT; + } } else { struct conf_list list; struct conf_list_node node; @@ -475,11 +477,15 @@ out: if (ret) { if (nfs4_plugins) unload_plugins(nfs4_plugins); - if (gss_plugins) + if (gss_plugins) { unload_plugins(gss_plugins); + } nfs4_plugins = gss_plugins = NULL; } + if (gss_methods) + conf_free_list(gss_methods); + return ret ? -ENOENT: 0; } From patchwork Wed May 8 13:35:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 10935699 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 0523D13AD for ; Wed, 8 May 2019 13:35:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA6DF26253 for ; Wed, 8 May 2019 13:35:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF2812842E; Wed, 8 May 2019 13:35:46 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 8F55826253 for ; Wed, 8 May 2019 13:35:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726656AbfEHNfp (ORCPT ); Wed, 8 May 2019 09:35:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50820 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727271AbfEHNfo (ORCPT ); Wed, 8 May 2019 09:35:44 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3BB09308795C for ; Wed, 8 May 2019 13:35:44 +0000 (UTC) Received: from madhat.boston.devel.redhat.com (ovpn-116-59.phx2.redhat.com [10.3.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id E939E5C269 for ; Wed, 8 May 2019 13:35:43 +0000 (UTC) From: Steve Dickson To: Linux NFS Mailing list Subject: [PATCH 09/19] Removed resource leaks from nfsidmap/static.c Date: Wed, 8 May 2019 09:35:26 -0400 Message-Id: <20190508133536.6077-10-steved@redhat.com> In-Reply-To: <20190508133536.6077-1-steved@redhat.com> References: <20190508133536.6077-1-steved@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Wed, 08 May 2019 13:35:44 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP nfsidmap/static.c:350: leaked_storage: Variable "princ_list" going out of scope leaks the storage it points to. nfsidmap/static.c:358: leaked_storage: Variable "princ_list" going out of scope leaks the storage it points to. nfsidmap/static.c:360: leaked_storage: Variable "unode" going out of scope leaks the storage it points to. nfsidmap/static.c:382: leaked_storage: Variable "princ_list" going out of scope leaks the storage it points to. nfsidmap/static.c:390: leaked_storage: Variable "gnode" going out of scope leaks the storage it points to. Signed-off-by: Steve Dickson --- support/nfsidmap/static.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/support/nfsidmap/static.c b/support/nfsidmap/static.c index f7b8a67..8ac4a39 100644 --- a/support/nfsidmap/static.c +++ b/support/nfsidmap/static.c @@ -347,6 +347,7 @@ static int static_init(void) { warnx("static_init: calloc (1, %lu) failed", (unsigned long)sizeof *unode); free(pw); + conf_free_list(princ_list); return -ENOMEM; } unode->uid = pw->pw_uid; @@ -355,6 +356,9 @@ static int static_init(void) { unode->localname = conf_get_str("Static", cln->field); if (!unode->localname) { free(pw); + free(unode->principal); + free(unode); + conf_free_list(princ_list); return -ENOENT; } @@ -379,6 +383,7 @@ static int static_init(void) { warnx("static_init: calloc (1, %lu) failed", (unsigned long)sizeof *gnode); free(gr); + conf_free_list(princ_list); return -ENOMEM; } gnode->gid = gr->gr_gid; @@ -387,6 +392,9 @@ static int static_init(void) { gnode->localgroup = conf_get_str("Static", cln->field); if (!gnode->localgroup) { free(gr); + free(gnode->principal); + free(gnode); + conf_free_list(princ_list); return -ENOENT; } @@ -394,6 +402,8 @@ static int static_init(void) { LIST_INSERT_HEAD (&gid_mappings[gid_hash(gnode->gid)], gnode, link); } + + conf_free_list(princ_list); return 0; } From patchwork Wed May 8 13:35:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 10935697 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 72C7A912 for ; Wed, 8 May 2019 13:35:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6264326253 for ; Wed, 8 May 2019 13:35:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 56F94281D2; Wed, 8 May 2019 13:35:46 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 1656226253 for ; Wed, 8 May 2019 13:35:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727106AbfEHNfp (ORCPT ); Wed, 8 May 2019 09:35:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50580 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726656AbfEHNfo (ORCPT ); Wed, 8 May 2019 09:35:44 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A21E5811D8 for ; Wed, 8 May 2019 13:35:44 +0000 (UTC) Received: from madhat.boston.devel.redhat.com (ovpn-116-59.phx2.redhat.com [10.3.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5D2555C269 for ; Wed, 8 May 2019 13:35:44 +0000 (UTC) From: Steve Dickson To: Linux NFS Mailing list Subject: [PATCH 10/19] Removed a resource leak from nsm/file.c Date: Wed, 8 May 2019 09:35:27 -0400 Message-Id: <20190508133536.6077-11-steved@redhat.com> In-Reply-To: <20190508133536.6077-1-steved@redhat.com> References: <20190508133536.6077-1-steved@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 08 May 2019 13:35:44 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP nsm/file.c:536: leaked_handle: Handle variable "fd" going out of scope leaks the handle Signed-off-by: Steve Dickson --- support/nsm/file.c | 1 + 1 file changed, 1 insertion(+) diff --git a/support/nsm/file.c b/support/nsm/file.c index 52f5401..0b66f12 100644 --- a/support/nsm/file.c +++ b/support/nsm/file.c @@ -533,6 +533,7 @@ nsm_update_kernel_state(const int state) len = snprintf(buf, sizeof(buf), "%d", state); if (error_check(len, sizeof(buf))) { xlog_warn("Failed to form NSM state number string"); + close(fd); return; } From patchwork Wed May 8 13:35:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 10935701 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 26EA2912 for ; Wed, 8 May 2019 13:35:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1446D26E75 for ; Wed, 8 May 2019 13:35:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0860626253; Wed, 8 May 2019 13:35:47 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 B044A26E75 for ; Wed, 8 May 2019 13:35:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727071AbfEHNfp (ORCPT ); Wed, 8 May 2019 09:35:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39054 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727256AbfEHNfp (ORCPT ); Wed, 8 May 2019 09:35:45 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 15461821EF for ; Wed, 8 May 2019 13:35:45 +0000 (UTC) Received: from madhat.boston.devel.redhat.com (ovpn-116-59.phx2.redhat.com [10.3.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id C4DE15C269 for ; Wed, 8 May 2019 13:35:44 +0000 (UTC) From: Steve Dickson To: Linux NFS Mailing list Subject: [PATCH 11/19] Removed resource leaks from systemd/rpc-pipefs-generator.c Date: Wed, 8 May 2019 09:35:28 -0400 Message-Id: <20190508133536.6077-12-steved@redhat.com> In-Reply-To: <20190508133536.6077-1-steved@redhat.com> References: <20190508133536.6077-1-steved@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 08 May 2019 13:35:45 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP systemd/rpc-pipefs-generator.c:73: leaked_storage: Variable "pipefs_unit" going out of scope leaks the storage it points to systemd/rpc-pipefs-generator.c:77: leaked_storage: Variable "pipefs_unit" going out of scope leaks the storage it points to. systemd/rpc-pipefs-generator.c:85: leaked_storage: Variable "pipefs_unit" going out of scope leaks the storage it points to. systemd/rpc-pipefs-generator.c:94: leaked_storage: Variable "pipefs_unit" going out of scope leaks the storage it points to. Signed-off-by: Steve Dickson --- systemd/rpc-pipefs-generator.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/systemd/rpc-pipefs-generator.c b/systemd/rpc-pipefs-generator.c index 0b5da11..8e218aa 100644 --- a/systemd/rpc-pipefs-generator.c +++ b/systemd/rpc-pipefs-generator.c @@ -69,12 +69,16 @@ int generate_target(char *pipefs_path, const char *dirname) return 1; ret = generate_mount_unit(pipefs_path, pipefs_unit, dirname); - if (ret) + if (ret) { + free(pipefs_unit); return ret; + } path = malloc(strlen(dirname) + 1 + sizeof(filebase)); - if (!path) + if (!path) { + free(pipefs_unit); return 2; + } sprintf(path, "%s", dirname); mkdir(path, 0755); strcat(path, filebase); @@ -82,6 +86,7 @@ int generate_target(char *pipefs_path, const char *dirname) if (!f) { free(path); + free(pipefs_unit); return 1; } @@ -90,6 +95,7 @@ int generate_target(char *pipefs_path, const char *dirname) fprintf(f, "After=%s\n", pipefs_unit); fclose(f); free(path); + free(pipefs_unit); return 0; } From patchwork Wed May 8 13:35:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 10935703 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 0820E912 for ; Wed, 8 May 2019 13:35:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB59026253 for ; Wed, 8 May 2019 13:35:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DFC4B281D2; Wed, 8 May 2019 13:35:47 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 8D61726253 for ; Wed, 8 May 2019 13:35:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727256AbfEHNfq (ORCPT ); Wed, 8 May 2019 09:35:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36197 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727271AbfEHNfq (ORCPT ); Wed, 8 May 2019 09:35:46 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 826783060486 for ; Wed, 8 May 2019 13:35:46 +0000 (UTC) Received: from madhat.boston.devel.redhat.com (ovpn-116-59.phx2.redhat.com [10.3.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 379A65C640 for ; Wed, 8 May 2019 13:35:45 +0000 (UTC) From: Steve Dickson To: Linux NFS Mailing list Subject: [PATCH 12/19] Removed resource leaks from blkmapd/device-discovery.c Date: Wed, 8 May 2019 09:35:29 -0400 Message-Id: <20190508133536.6077-13-steved@redhat.com> In-Reply-To: <20190508133536.6077-1-steved@redhat.com> References: <20190508133536.6077-1-steved@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Wed, 08 May 2019 13:35:46 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP blkmapd/device-discovery.c:190: leaked_storage: Variable "serial" going out of scope leaks the storage it points to. blkmapd/device-discovery.c:378: overwrite_var: Overwriting handle "bl_pipe_fd" in "bl_pipe_fd = open(bl_pipe_file, 2)" leaks the handle. Signed-off-by: Steve Dickson --- utils/blkmapd/device-discovery.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/utils/blkmapd/device-discovery.c b/utils/blkmapd/device-discovery.c index 2ce60f8..e811703 100644 --- a/utils/blkmapd/device-discovery.c +++ b/utils/blkmapd/device-discovery.c @@ -186,8 +186,13 @@ static void bl_add_disk(char *filepath) } } - if (disk && diskpath) + if (disk && diskpath) { + if (serial) { + free(serial->data); + free(serial); + } return; + } /* add path */ path = malloc(sizeof(struct bl_disk_path)); @@ -223,6 +228,10 @@ static void bl_add_disk(char *filepath) disk->size = size; disk->valid_path = path; } + if (serial) { + free(serial->data); + free(serial); + } } return; @@ -232,6 +241,10 @@ static void bl_add_disk(char *filepath) free(path->full_path); free(path); } + if (serial) { + free(serial->data); + free(serial); + } return; } @@ -375,7 +388,12 @@ static void bl_rpcpipe_cb(void) if (event->mask & IN_CREATE) { BL_LOG_WARNING("nfs pipe dir created\n"); bl_watch_dir(nfspipe_dir, &nfs_pipedir_wfd); + if (bl_pipe_fd >= 0) + close(bl_pipe_fd); bl_pipe_fd = open(bl_pipe_file, O_RDWR); + if (bl_pipe_fd < 0) + BL_LOG_ERR("open %s failed: %s\n", + event->name, strerror(errno)); } else if (event->mask & IN_DELETE) { BL_LOG_WARNING("nfs pipe dir deleted\n"); inotify_rm_watch(bl_watch_fd, nfs_pipedir_wfd); @@ -388,6 +406,8 @@ static void bl_rpcpipe_cb(void) continue; if (event->mask & IN_CREATE) { BL_LOG_WARNING("blocklayout pipe file created\n"); + if (bl_pipe_fd >= 0) + close(bl_pipe_fd); bl_pipe_fd = open(bl_pipe_file, O_RDWR); if (bl_pipe_fd < 0) BL_LOG_ERR("open %s failed: %s\n", From patchwork Wed May 8 13:35:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 10935705 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 7F74313AD for ; Wed, 8 May 2019 13:35:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6EDBE26253 for ; Wed, 8 May 2019 13:35:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 63467281D2; Wed, 8 May 2019 13:35:48 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 1490226253 for ; Wed, 8 May 2019 13:35:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727316AbfEHNfr (ORCPT ); Wed, 8 May 2019 09:35:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31589 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727271AbfEHNfr (ORCPT ); Wed, 8 May 2019 09:35:47 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E6F05305B886 for ; Wed, 8 May 2019 13:35:46 +0000 (UTC) Received: from madhat.boston.devel.redhat.com (ovpn-116-59.phx2.redhat.com [10.3.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id A0A585C269 for ; Wed, 8 May 2019 13:35:46 +0000 (UTC) From: Steve Dickson To: Linux NFS Mailing list Subject: [PATCH 13/19] Removed resource leaks from gssd/krb5_util.c Date: Wed, 8 May 2019 09:35:30 -0400 Message-Id: <20190508133536.6077-14-steved@redhat.com> In-Reply-To: <20190508133536.6077-1-steved@redhat.com> References: <20190508133536.6077-1-steved@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 08 May 2019 13:35:46 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP gssd/krb5_util.c:696: overwrite_var: Overwriting "k5err" in "k5err = gssd_k5_err_msg(context, code)" leaks the storage that "k5err" points to. gssd/krb5_util.c:737: overwrite_var: Overwriting "k5err" in "k5err = gssd_k5_err_msg(context, code)" leaks the storage that "k5err" points to. gssd/krb5_util.c:899: overwrite_var: Overwriting "k5err" in "k5err = gssd_k5_err_msg(context, code)" leaks the storage that "k5err" points to. krb5_util.c:1173: leaked_storage: Variable "l" going out of scope leaks the storage it points to. Signed-off-by: Steve Dickson --- utils/gssd/krb5_util.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c index 6daba44..454a6eb 100644 --- a/utils/gssd/krb5_util.c +++ b/utils/gssd/krb5_util.c @@ -699,6 +699,8 @@ gssd_search_krb5_keytab(krb5_context context, krb5_keytab kt, "we failed to unparse principal name: %s\n", k5err); k5_free_kt_entry(context, kte); + free(k5err); + k5err = NULL; continue; } printerr(4, "Processing keytab entry for principal '%s'\n", @@ -900,6 +902,8 @@ find_keytab_entry(krb5_context context, krb5_keytab kt, k5err = gssd_k5_err_msg(context, code); printerr(1, "%s while building principal for '%s'\n", k5err, spn); + free(k5err); + k5err = NULL; continue; } code = krb5_kt_get_entry(context, kt, princ, 0, 0, kte); @@ -1169,7 +1173,8 @@ gssd_get_krb5_machine_cred_list(char ***list) *list = l; retval = 0; goto out; - } + } else + free((void *)l); out: return retval; } @@ -1217,6 +1222,8 @@ gssd_destroy_krb5_machine_creds(void) printerr(0, "WARNING: %s while resolving credential " "cache '%s' for destruction\n", k5err, ple->ccname); + free(k5err); + k5err = NULL; continue; } From patchwork Wed May 8 13:35:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 10935707 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 E6B72112C for ; Wed, 8 May 2019 13:35:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5E3A26253 for ; Wed, 8 May 2019 13:35:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA704281D2; Wed, 8 May 2019 13:35:48 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 85AD226253 for ; Wed, 8 May 2019 13:35:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727271AbfEHNfr (ORCPT ); Wed, 8 May 2019 09:35:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35119 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727370AbfEHNfr (ORCPT ); Wed, 8 May 2019 09:35:47 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5B6E33087951 for ; Wed, 8 May 2019 13:35:47 +0000 (UTC) Received: from madhat.boston.devel.redhat.com (ovpn-116-59.phx2.redhat.com [10.3.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 14F021724D for ; Wed, 8 May 2019 13:35:47 +0000 (UTC) From: Steve Dickson To: Linux NFS Mailing list Subject: [PATCH 14/19] Removed a resource leak from mount/configfile.c Date: Wed, 8 May 2019 09:35:31 -0400 Message-Id: <20190508133536.6077-15-steved@redhat.com> In-Reply-To: <20190508133536.6077-1-steved@redhat.com> References: <20190508133536.6077-1-steved@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Wed, 08 May 2019 13:35:47 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP mount/configfile.c:410: leaked_storage: Variable "config_opts" going out of scope leaks the storage it points to. Signed-off-by: Steve Dickson --- utils/mount/configfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/mount/configfile.c b/utils/mount/configfile.c index b48b25e..93fe500 100644 --- a/utils/mount/configfile.c +++ b/utils/mount/configfile.c @@ -404,7 +404,7 @@ char *conf_get_mntopts(char *spec, char *mount_point, /* list_size + optlen + ',' + '\0' */ config_opts = calloc(1, (list_size+optlen+2)); - if (server == NULL) { + if (config_opts == NULL) { xlog_warn("conf_get_mountops: Unable calloc memory for config_opts"); free_all(); return mount_opts; From patchwork Wed May 8 13:35:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 10935709 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 4E7F9112C for ; Wed, 8 May 2019 13:35:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E08226E75 for ; Wed, 8 May 2019 13:35:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 30FF92842E; Wed, 8 May 2019 13:35:50 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 DA3E526E75 for ; Wed, 8 May 2019 13:35:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727383AbfEHNft (ORCPT ); Wed, 8 May 2019 09:35:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50498 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727370AbfEHNfs (ORCPT ); Wed, 8 May 2019 09:35:48 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C2FAF2D7FB for ; Wed, 8 May 2019 13:35:48 +0000 (UTC) Received: from madhat.boston.devel.redhat.com (ovpn-116-59.phx2.redhat.com [10.3.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7CF591724D for ; Wed, 8 May 2019 13:35:47 +0000 (UTC) From: Steve Dickson To: Linux NFS Mailing list Subject: [PATCH 15/19] Removed a resource leak from mount/nfsmount.c Date: Wed, 8 May 2019 09:35:32 -0400 Message-Id: <20190508133536.6077-16-steved@redhat.com> In-Reply-To: <20190508133536.6077-1-steved@redhat.com> References: <20190508133536.6077-1-steved@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 08 May 2019 13:35:48 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP mount/nfsmount.c:455: leaked_storage: Variable "mounthost" going out of scope leaks the storage it points to. Signed-off-by: Steve Dickson --- utils/mount/nfsmount.c | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/mount/nfsmount.c b/utils/mount/nfsmount.c index 952a755..3d95da9 100644 --- a/utils/mount/nfsmount.c +++ b/utils/mount/nfsmount.c @@ -452,6 +452,7 @@ parse_options(char *old_opts, struct nfs_mount_data *data, nfs_error(_("%s: Bad nfs mount parameter: %s\n"), progname, opt); out_bad: free(tmp_opts); + free(mounthost); return 0; } From patchwork Wed May 8 13:35:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 10935711 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 AAB1B912 for ; Wed, 8 May 2019 13:35:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B55226E75 for ; Wed, 8 May 2019 13:35:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8F26A281D2; Wed, 8 May 2019 13:35:50 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 49C5E28458 for ; Wed, 8 May 2019 13:35:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727370AbfEHNft (ORCPT ); Wed, 8 May 2019 09:35:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58744 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727404AbfEHNft (ORCPT ); Wed, 8 May 2019 09:35:49 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 370833078ABB for ; Wed, 8 May 2019 13:35:49 +0000 (UTC) Received: from madhat.boston.devel.redhat.com (ovpn-116-59.phx2.redhat.com [10.3.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id E66745C269 for ; Wed, 8 May 2019 13:35:48 +0000 (UTC) From: Steve Dickson To: Linux NFS Mailing list Subject: [PATCH 16/19] Removed a resource leak from mount/stropts.c Date: Wed, 8 May 2019 09:35:33 -0400 Message-Id: <20190508133536.6077-17-steved@redhat.com> In-Reply-To: <20190508133536.6077-1-steved@redhat.com> References: <20190508133536.6077-1-steved@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 08 May 2019 13:35:49 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP mount/stropts.c:986: leaked_storage: Variable "address" going out of scope leaks the storage it points to. Signed-off-by: Steve Dickson --- utils/mount/stropts.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c index a093926..1bb7a73 100644 --- a/utils/mount/stropts.c +++ b/utils/mount/stropts.c @@ -983,8 +983,11 @@ static int nfs_try_mount(struct nfsmount_info *mi) } if (!nfs_append_addr_option(address->ai_addr, - address->ai_addrlen, mi->options)) + address->ai_addrlen, mi->options)) { + nfs_freeaddrinfo(address); + errno = ENOMEM; return 0; + } mi->address = address; } From patchwork Wed May 8 13:35:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 10935713 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 5238813AD for ; Wed, 8 May 2019 13:35:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 42A8D2842E for ; Wed, 8 May 2019 13:35:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3721B28458; Wed, 8 May 2019 13:35:51 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 E293326E75 for ; Wed, 8 May 2019 13:35:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727406AbfEHNft (ORCPT ); Wed, 8 May 2019 09:35:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36442 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727404AbfEHNft (ORCPT ); Wed, 8 May 2019 09:35:49 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A0E9ECA1DF for ; Wed, 8 May 2019 13:35:49 +0000 (UTC) Received: from madhat.boston.devel.redhat.com (ovpn-116-59.phx2.redhat.com [10.3.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5B2561724D for ; Wed, 8 May 2019 13:35:49 +0000 (UTC) From: Steve Dickson To: Linux NFS Mailing list Subject: [PATCH 17/19] Removed resource leaks from mountd/cache.c Date: Wed, 8 May 2019 09:35:34 -0400 Message-Id: <20190508133536.6077-18-steved@redhat.com> In-Reply-To: <20190508133536.6077-1-steved@redhat.com> References: <20190508133536.6077-1-steved@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 08 May 2019 13:35:49 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP mountd/cache.c:1244:3: warning: statement will never be executed [-Wswitch-unreachable] mountd/cache.c:1260: leaked_storage: Variable "locations" going out of scope leaks the storage it points to. Signed-off-by: Steve Dickson --- utils/mountd/cache.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c index 2cb370f..bdbd190 100644 --- a/utils/mountd/cache.c +++ b/utils/mountd/cache.c @@ -1240,7 +1240,7 @@ static struct exportent *lookup_junction(char *dom, const char *pathname, goto out; } status = nfs_get_basic_junction(pathname, &locations); - switch (status) { + if (status) { xlog(L_WARNING, "Dangling junction %s: %s", pathname, strerror(status)); goto out; @@ -1248,10 +1248,11 @@ static struct exportent *lookup_junction(char *dom, const char *pathname, parent = lookup_parent_export(dom, pathname, ai); if (parent == NULL) - goto out; + goto free_locations; exp = locations_to_export(locations, pathname, parent); +free_locations: nfs_free_locations(locations->ns_list); free(locations); From patchwork Wed May 8 13:35:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 10935715 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 6B741912 for ; Wed, 8 May 2019 13:35:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C09126E75 for ; Wed, 8 May 2019 13:35:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 502D62856D; Wed, 8 May 2019 13:35:51 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 10182281D2 for ; Wed, 8 May 2019 13:35:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727404AbfEHNfu (ORCPT ); Wed, 8 May 2019 09:35:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57555 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727414AbfEHNfu (ORCPT ); Wed, 8 May 2019 09:35:50 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 159CC3079B66 for ; Wed, 8 May 2019 13:35:50 +0000 (UTC) Received: from madhat.boston.devel.redhat.com (ovpn-116-59.phx2.redhat.com [10.3.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id C42761724D for ; Wed, 8 May 2019 13:35:49 +0000 (UTC) From: Steve Dickson To: Linux NFS Mailing list Subject: [PATCH 18/19] Removed a resource leak from mountd/fsloc.c Date: Wed, 8 May 2019 09:35:35 -0400 Message-Id: <20190508133536.6077-19-steved@redhat.com> In-Reply-To: <20190508133536.6077-1-steved@redhat.com> References: <20190508133536.6077-1-steved@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 08 May 2019 13:35:50 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP mountd/fsloc.c:97: overwrite_var: Overwriting "mp" in "mp = calloc(1UL, 16UL)" leaks the storage that "mp" points to. Signed-off-by: Steve Dickson --- utils/mountd/fsloc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/mountd/fsloc.c b/utils/mountd/fsloc.c index bc737d1..cf42944 100644 --- a/utils/mountd/fsloc.c +++ b/utils/mountd/fsloc.c @@ -102,6 +102,7 @@ static struct servers *parse_list(char **list) cp = strchr(list[i], '@'); if ((!cp) || list[i][0] != '/') { xlog(L_WARNING, "invalid entry '%s'", list[i]); + free(mp); continue; /* XXX Need better error handling */ } res->h_mp[i] = mp; From patchwork Wed May 8 13:35:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 10935717 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 72AC9912 for ; Wed, 8 May 2019 13:35:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6325D26E75 for ; Wed, 8 May 2019 13:35:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 57B832842E; Wed, 8 May 2019 13:35:52 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 08F4F26E75 for ; Wed, 8 May 2019 13:35:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727477AbfEHNfv (ORCPT ); Wed, 8 May 2019 09:35:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:9289 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727414AbfEHNfu (ORCPT ); Wed, 8 May 2019 09:35:50 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 800AD2D7EF for ; Wed, 8 May 2019 13:35:50 +0000 (UTC) Received: from madhat.boston.devel.redhat.com (ovpn-116-59.phx2.redhat.com [10.3.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 37C0F61D02 for ; Wed, 8 May 2019 13:35:50 +0000 (UTC) From: Steve Dickson To: Linux NFS Mailing list Subject: [PATCH 19/19] Removed a resource leak from nfsdcltrack/sqlite.c Date: Wed, 8 May 2019 09:35:36 -0400 Message-Id: <20190508133536.6077-20-steved@redhat.com> In-Reply-To: <20190508133536.6077-1-steved@redhat.com> References: <20190508133536.6077-1-steved@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 08 May 2019 13:35:50 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP nfsdcltrack/sqlite.c:218: leaked_storage: Variable "err" going out of scope leaks the storage it points to. Signed-off-by: Steve Dickson --- utils/nfsdcltrack/sqlite.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utils/nfsdcltrack/sqlite.c b/utils/nfsdcltrack/sqlite.c index c59f777..2801201 100644 --- a/utils/nfsdcltrack/sqlite.c +++ b/utils/nfsdcltrack/sqlite.c @@ -215,6 +215,8 @@ sqlite_maindb_init_v2(void) &err); if (ret != SQLITE_OK) { xlog(L_ERROR, "Unable to begin transaction: %s", err); + if (err) + sqlite3_free(err); return ret; }