From owner-svn-src-all@freebsd.org Mon Apr 9 12:53:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C757FFA1F87; Mon, 9 Apr 2018 12:53:16 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 775FC86D34; Mon, 9 Apr 2018 12:53:16 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 711ED1EF51; Mon, 9 Apr 2018 12:53:16 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w39CrG6H013967; Mon, 9 Apr 2018 12:53:16 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w39CrGZa013963; Mon, 9 Apr 2018 12:53:16 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201804091253.w39CrGZa013963@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 9 Apr 2018 12:53:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r332320 - stable/10/sys/dev/ath X-SVN-Group: stable-10 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/10/sys/dev/ath X-SVN-Commit-Revision: 332320 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Apr 2018 12:53:17 -0000 Author: emaste Date: Mon Apr 9 12:53:15 2018 New Revision: 332320 URL: https://svnweb.freebsd.org/changeset/base/332320 Log: MFC ath(4) potential memory disclosure fixes [1] r327499: ath: fix memory disclosure from ath_btcoex_ioctl The ath_btcoex_ioctl handler allocated a buffer without M_ZERO and returned it to userland without writing to it. The device has permissions only for root so this is not urgent, and the fix can be MFCd and considered for a future EN. [2] r327500: ath: fix possible memory disclosures in ioctl handlers Apply the fix from r327499 to additional ioctl handlers. Note: related fix in r327529 does not apply directly to stable/10 and will be addressed in a followup commit. Submitted by: Domagoj Stolfa [1] Reported by: Ilja van Sprundel [1,2] Reviewed by: adrian [1] Sponsored by: The FreeBSD Foundation Modified: stable/10/sys/dev/ath/if_ath_btcoex.c stable/10/sys/dev/ath/if_ath_lna_div.c stable/10/sys/dev/ath/if_ath_spectral.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ath/if_ath_btcoex.c ============================================================================== --- stable/10/sys/dev/ath/if_ath_btcoex.c Mon Apr 9 09:24:26 2018 (r332319) +++ stable/10/sys/dev/ath/if_ath_btcoex.c Mon Apr 9 12:53:15 2018 (r332320) @@ -321,7 +321,7 @@ ath_btcoex_ioctl(struct ath_softc *sc, struct ath_diag * pointer for us to use below in reclaiming the buffer; * may want to be more defensive. */ - outdata = malloc(outsize, M_TEMP, M_NOWAIT); + outdata = malloc(outsize, M_TEMP, M_NOWAIT | M_ZERO); if (outdata == NULL) { error = ENOMEM; goto bad; @@ -330,6 +330,7 @@ ath_btcoex_ioctl(struct ath_softc *sc, struct ath_diag switch (id) { default: error = EINVAL; + goto bad; } if (outsize < ad->ad_out_size) ad->ad_out_size = outsize; Modified: stable/10/sys/dev/ath/if_ath_lna_div.c ============================================================================== --- stable/10/sys/dev/ath/if_ath_lna_div.c Mon Apr 9 09:24:26 2018 (r332319) +++ stable/10/sys/dev/ath/if_ath_lna_div.c Mon Apr 9 12:53:15 2018 (r332320) @@ -185,7 +185,7 @@ ath_lna_div_ioctl(struct ath_softc *sc, struct ath_dia * pointer for us to use below in reclaiming the buffer; * may want to be more defensive. */ - outdata = malloc(outsize, M_TEMP, M_NOWAIT); + outdata = malloc(outsize, M_TEMP, M_NOWAIT | M_ZERO); if (outdata == NULL) { error = ENOMEM; goto bad; @@ -194,6 +194,7 @@ ath_lna_div_ioctl(struct ath_softc *sc, struct ath_dia switch (id) { default: error = EINVAL; + goto bad; } if (outsize < ad->ad_out_size) ad->ad_out_size = outsize; Modified: stable/10/sys/dev/ath/if_ath_spectral.c ============================================================================== --- stable/10/sys/dev/ath/if_ath_spectral.c Mon Apr 9 09:24:26 2018 (r332319) +++ stable/10/sys/dev/ath/if_ath_spectral.c Mon Apr 9 12:53:15 2018 (r332320) @@ -210,7 +210,7 @@ ath_ioctl_spectral(struct ath_softc *sc, struct ath_di * pointer for us to use below in reclaiming the buffer; * may want to be more defensive. */ - outdata = malloc(outsize, M_TEMP, M_NOWAIT); + outdata = malloc(outsize, M_TEMP, M_NOWAIT | M_ZERO); if (outdata == NULL) { error = ENOMEM; goto bad; @@ -273,6 +273,7 @@ ath_ioctl_spectral(struct ath_softc *sc, struct ath_di break; default: error = EINVAL; + goto bad; } if (outsize < ad->ad_out_size) ad->ad_out_size = outsize;