Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 May 2007 04:41:09 +0400
From:      fate <fate10@gmail.com>
To:        freebsd-arm@freebsd.org
Subject:   missing M_ZERO malloc flag in src/sys/arm/arm/busdma_machdep.c
Message-ID:  <7b8b6fbc0705141741n4ee98fateb5ab34a2f307a6c@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi,
It would be good to apply this small patch:

*** busdma_machdep.c.orig
--- busdma_machdep.c
***************
*** 345,351 ****
        if (!parent)
                parent = arm_root_dma_tag;

!       newtag = (bus_dma_tag_t)malloc(sizeof(*newtag), M_DEVBUF, M_NOWAIT);
        if (newtag == NULL) {
                CTR4(KTR_BUSDMA, "%s returned tag %p tag flags 0x%x error %d",
                    __func__, newtag, 0, error);
--- 345,351 ----
        if (!parent)
                parent = arm_root_dma_tag;

!       newtag = (bus_dma_tag_t)malloc(sizeof(*newtag), M_DEVBUF,
M_NOWAIT | M_ZERO);
        if (newtag == NULL) {
                CTR4(KTR_BUSDMA, "%s returned tag %p tag flags 0x%x error %d",
                    __func__, newtag, 0, error);

or the structure newtag would not be initialized correctly in case of
dirty memory and failed on this if block:

		if (dmat->bounce_zone == NULL) {
			if ((error = alloc_bounce_zone(dmat)) != 0) {
				_busdma_free_dmamap(newmap);
				*mapp = NULL;
				return (error);
			}
		}

left bounce_zone unallocated with kernel crash as result

SY, Vladimir Belian



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