From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f71.google.com (mail-ot1-f71.google.com [209.85.210.71]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7605A17D6 for ; Wed, 29 Jul 2026 00:16:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.71 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785284212; cv=none; b=F3910mu4COXK788f64Hy1rN5KQGdg9VSwoxI1M4+P5SgBgLCN1G4aeMuFRenUBKCxztw0/HsyQZlMgpzkMHbuhMUcm0PpDnVEwVCpRcAElSSNXqblV9pdjw3Zftzn8l4/UxFghPYlshXXlEK8FCQCaSHRGM5rothUuoAOPc9tAc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785284212; c=relaxed/simple; bh=/8vnW9jfPt4vbnRGQ542LSTPCVdbphdkHrxNA/OTSeo=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To:Cc: Content-Type; b=R9Q+7agv+4Mo0xWlOJsLhKEh6mmvELkvS1OgtQFHeh2TGanAIhVmo4+Bgvc9mnja1Usu4NpIbFafl8zH4MMh+QPpk5291Cpb3/XMJupSWmpfZ4fxk6wJGZ4rv9a5djK0aWmkiCDmo9b8FdqvBLN140jfEuONpVrcKyTYqtFWJdo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.210.71 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com Received: by mail-ot1-f71.google.com with SMTP id 46e09a7af769-7e9f565a6e7so570864a34.2 for ; Tue, 28 Jul 2026 17:16:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785284210; x=1785889010; h=content-type:cc:to:from:subject:message-id:in-reply-to:date :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=5nG+cxIZxWCKkmI5pJ3qLEXHKnHcqPA5am4ClkeNh1o=; b=A+tfiyRU5ALCZc54rRASou+EbWlJtFkVbACYearyHLeW1WBuJ67t+QLxZdZniU1YIw T91LfCZWsbujny6ZjbVZAoxjEdMqeJFvLBNTQHAOfoepoGOTxDo+49qp/QfKaJXn/vj4 9/leI1XmFn8a5WzfZxHcxOZukEsyuRtQcUObhQVk6V8HLv/5bKg4bzNzovbtirXk1nMt r8VdQwesLGYdqScelq9Y+6Rr2IoJbGcN0CR0KqOdXSNZEztxg17jrj+MDBZFQAQj53pD zWWIIpw3stY4YrfeQJ9AG+3LTVcv3ixEMWAbOe//LhPLTUsNuZZQlkY9nGdpJ1bukFc7 4QOw== X-Forwarded-Encrypted: i=1; AHgh+Rqv4RdX01ICvTIPwjrlOqpq3YekGEkl51yclyrI4zx9T83aa8kvP2ozhzaTvcDO4REiZu/fMRvQ1YSbr9w=@vger.kernel.org X-Gm-Message-State: AOJu0YxuHrqWJanooGllue2VnZotNjTwmoNaHuLLDNUfQ5iibopbddGO hfFlxc0QVxMlNy5uXmkBWf2wTLPprDs3HW0joRx6sGZ9qp0X7X9l4NAhYM5DGCPCVPWuKJKXteL ByzT1Dk+xKO6Te+7hqHyPMwPPEPKfJ9feNsMTURji2n9EljZU3kgieTMxZ0A= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a05:6808:179c:b0:46a:ccae:5517 with SMTP id 5614622812f47-4ad5b84086cmr2728955b6e.28.1785284210469; Tue, 28 Jul 2026 17:16:50 -0700 (PDT) Date: Tue, 28 Jul 2026 17:16:50 -0700 In-Reply-To: <20260729001642.11188-1-kartikey406@gmail.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <6a694672.e3659fcc.2a40b8.0022.GAE@google.com> Subject: Re: [PATCH] ALSA: ump: Fix double-free of ump->out_cvts on legacy rawmidi attach failure From: syzbot To: kartikey406@gmail.com Cc: kartikey406@gmail.com, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Type: text/plain; charset="UTF-8" > #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master This crash does not have a reproducer. I cannot test it. > > > If snd_rawmidi_new() fails inside snd_ump_attach_legacy_rawmidi(), the > error path frees ump->out_cvts but leaves the pointer dangling. Since > ump->out_cvts is a field of the long-lived struct snd_ump_endpoint > (not the rawmidi device that failed to be created), it gets freed a > second time later during normal endpoint teardown, in > snd_ump_endpoint_free(), invoked via snd_rawmidi_free()'s > private_free callback when the sound card is released. This results > in a KASAN double-free/invalid-free. > > Clear ump->out_cvts to NULL after freeing it on the error path, so > the later unconditional kfree() in snd_ump_endpoint_free() becomes a > harmless no-op. > > Reported-by: syzbot+b6cab840e6a85641c7ad@syzkaller.appspotmail.com > Closes: https://syzkaller.appspot.com/bug?extid=b6cab840e6a85641c7ad > Signed-off-by: Deepanshu Kartikey > --- > sound/core/ump.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/sound/core/ump.c b/sound/core/ump.c > index 70520c7ca293..632c13baf21e 100644 > --- a/sound/core/ump.c > +++ b/sound/core/ump.c > @@ -1365,6 +1365,7 @@ int snd_ump_attach_legacy_rawmidi(struct snd_ump_endpoint *ump, > &rmidi); > if (err < 0) { > kfree(ump->out_cvts); > + ump->out_cvts = NULL; > return err; > } > > -- > 2.43.0 >