dri-devel Archive on lore.kernel.org
 help / color / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: butt3rflyh4ck <butterflyhuangxx@gmail.com>
Cc: robdclark@chromium.org, security@kernel.org, airlied@linux.ie,
	syzkaller-bugs@googlegroups.com, dri-devel@lists.freedesktop.org,
	chris@chris-wilson.co.uk, seanpaul@chromium.org,
	sam@ravnborg.org, emil.velikov@collabora.com
Subject: Re: KASAN: use-after-free Read in drm_gem_object_release
Date: Fri, 10 Jul 2020 14:52:40 +0300
Message-ID: <20200710115240.GI2571@kadam> (raw)
In-Reply-To: <CAFcO6XO58pV+j9gu5Hha3JUW555EPQo6ELTvxRyQ5PWu_1gsUA@mail.gmail.com>

On Fri, Jul 10, 2020 at 04:24:03PM +0800, butt3rflyh4ck wrote:
> I report a bug (in linux-5.8.0-rc4) found by syzkaller.
> kernel config: https://github.com/butterflyhack/syzkaller-fuzz/blob/master/v5.8.0-rc4.config
> I test the reproducer and crash too.
> In the drm_em_vram_t() function,  ttm_bo_init() function call
This a typo.  The function name is drm_gem_vram_init().

> ttm_bo_init_reserved(),
> the ttm_bo_init_reserved() function  call ttm_bo_put(), it will free
> gbo->bo that is struct ttm_buffer_object.
> then, goto the err_drm_gem_object_release lable,
> drm_gem_object_release() function will free gbo->bo.base, so cause use
> after free.

There is a third free in drm_gem_vram_create().  This is a triple free
bug.  The correct place to free this is in drm_gem_vram_create() because
that's where it was allocated.

This code is quite subtle so I'm not going to attempt to fix it because
I can't test it.

dan carpenter

dri-devel mailing list

  parent reply index

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-10  8:24 butt3rflyh4ck
2020-07-10 10:39 ` Greg KH
2020-07-10 11:52 ` Dan Carpenter [this message]
2020-07-10 14:01   ` butt3rflyh4ck
2020-07-10 14:03   ` butt3rflyh4ck
2020-07-13 16:12   ` Daniel Vetter
2020-07-13 16:47     ` butt3rflyh4ck
2020-07-14  7:41 ` Thomas Zimmermann
2020-07-14  8:46   ` Thomas Zimmermann
     [not found] <00000000000053fea105791276d8@google.com>
2018-10-29 11:51 ` Dmitry Vyukov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200710115240.GI2571@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=airlied@linux.ie \
    --cc=butterflyhuangxx@gmail.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emil.velikov@collabora.com \
    --cc=robdclark@chromium.org \
    --cc=sam@ravnborg.org \
    --cc=seanpaul@chromium.org \
    --cc=security@kernel.org \
    --cc=syzkaller-bugs@googlegroups.com \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

dri-devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dri-devel/0 dri-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dri-devel dri-devel/ https://lore.kernel.org/dri-devel \
	public-inbox-index dri-devel

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git