Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Dec 2016 00:49:12 +0100
From:      Oliver Pinter <oliver.pinter@hardenedbsd.org>
To:        "Kenneth D. Merry" <ken@freebsd.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r307684 - head/sbin/camcontrol
Message-ID:  <CAPQ4ffvpCmQmo2qwdmeNqdOAKZxieq5BAdptvtmT58nu2oMdqQ@mail.gmail.com>
In-Reply-To: <201610201942.u9KJgQOR062772@repo.freebsd.org>
References:  <201610201942.u9KJgQOR062772@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 10/20/16, Kenneth D. Merry <ken@freebsd.org> wrote:
> Author: ken
> Date: Thu Oct 20 19:42:26 2016
> New Revision: 307684
> URL: https://svnweb.freebsd.org/changeset/base/307684
>
> Log:
>   For CCBs allocated on the stack, we need to clear the entire CCB, not
> just
>   the header.  Otherwise stack garbage can lead to random flags getting
> set.
>
>   This showed up as 'camcontrol rescan all' failing with EINVAL because the
>   address type wasn't CAM_DATA_VADDR.
>
>   sbin/camcontrol/camcontrol.c:
>   	In rescan_or_reset_bus(), bzero the stack-allocated CCBs before
>   	use instead of clearing the body.
>
>   MFC after:	3 days
>   Sponsored by:	Spectra Logic

The MFC of this commit is missed both for 10-STABLE and 11-STABLE. Is
this still in plan to do?

>
> Modified:
>   head/sbin/camcontrol/camcontrol.c
>
> Modified: head/sbin/camcontrol/camcontrol.c
> ==============================================================================
> --- head/sbin/camcontrol/camcontrol.c	Thu Oct 20 18:43:12 2016	(r307683)
> +++ head/sbin/camcontrol/camcontrol.c	Thu Oct 20 19:42:26 2016	(r307684)
> @@ -3139,6 +3139,8 @@ rescan_or_reset_bus(path_id_t bus, int r
>  		return(1);
>  	}
>
> +	bzero(&ccb, sizeof(ccb));
> +
>  	if (bus != CAM_BUS_WILDCARD) {
>  		ccb.ccb_h.func_code = rescan ? XPT_SCAN_BUS : XPT_RESET_BUS;
>  		ccb.ccb_h.path_id = bus;
> @@ -3181,7 +3183,7 @@ rescan_or_reset_bus(path_id_t bus, int r
>  	 * no-op, sending a rescan to the xpt bus would result in a status of
>  	 * CAM_REQ_INVALID.
>  	 */
> -	CCB_CLEAR_ALL_EXCEPT_HDR(&matchccb.cdm);
> +	bzero(&matchccb, sizeof(matchccb));
>  	matchccb.ccb_h.func_code = XPT_DEV_MATCH;
>  	matchccb.ccb_h.path_id = CAM_BUS_WILDCARD;
>  	bufsize = sizeof(struct dev_match_result) * 20;
> _______________________________________________
> svn-src-head@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-head
> To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org"
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAPQ4ffvpCmQmo2qwdmeNqdOAKZxieq5BAdptvtmT58nu2oMdqQ>