public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Hillf Danton <hdanton@sina.com>
To: syzbot <syzbot+9b4adfed366b14496e7e@syzkaller.appspotmail.com>
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [dri?] [media?] memory leak in get_sg_table
Date: Mon,  1 Jan 2024 10:25:25 +0800	[thread overview]
Message-ID: <20240101022525.2537-1-hdanton@sina.com> (raw)
In-Reply-To: <0000000000009e6825060dd6c287@google.com>

On Sun, 31 Dec 2023 15:38:19 -0800
> HEAD commit:    fbafc3e621c3 Merge tag 'for_linus' of git://git.kernel.org..
> git tree:       upstream
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=15e8171ae80000

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git  master

--- x/drivers/dma-buf/udmabuf.c
+++ y/drivers/dma-buf/udmabuf.c
@@ -153,7 +153,12 @@ static int begin_cpu_udmabuf(struct dma_
 	int ret = 0;
 
 	if (!ubuf->sg) {
-		ubuf->sg = get_sg_table(dev, buf, direction);
+		static DEFINE_MUTEX(lock);
+
+		mutex_lock(&lock);
+		if (!ubuf->sg)
+			ubuf->sg = get_sg_table(dev, buf, direction);
+		mutex_unlock(&lock);
 		if (IS_ERR(ubuf->sg)) {
 			ret = PTR_ERR(ubuf->sg);
 			ubuf->sg = NULL;
--

  reply	other threads:[~2024-01-01  2:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-31 23:38 [syzbot] [dri?] [media?] memory leak in get_sg_table syzbot
2024-01-01  2:25 ` Hillf Danton [this message]
2024-01-01  2:45   ` syzbot
2024-01-01  2:42 ` Edward Adam Davis
2024-01-01  3:07   ` syzbot
2024-01-01  4:01 ` Edward Adam Davis
2024-01-01  4:27   ` syzbot

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=20240101022525.2537-1-hdanton@sina.com \
    --to=hdanton@sina.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+9b4adfed366b14496e7e@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox