From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oi1-f199.google.com (mail-oi1-f199.google.com [209.85.167.199]) (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 D167C3A6407 for ; Tue, 28 Jul 2026 17:25:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785259524; cv=none; b=ZPG51mz+foOBF3n2wLZ+RlpfXGGvlFm4WSrnzcOKxxMATaSeKMuNgHDq+844Rc1P65gzlaxMVLEPHbzS19u9bG0vygMcwesAuhjgkoVpUkfqzlRXR+ryXAOIfy+VS20IBsFLgd4ZxtW+g6Z92GygjWrULT4VzVU3fUo8WHI4zIs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785259524; c=relaxed/simple; bh=mUcGrFaM60j9IiojUYdcI6D2xyy0NefH8iSG6ot+hWw=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=pSmT2zUD7l6/jMATf5YBSXtAgHwc++r5QgK6zGHnm+iPWxOiPWezPmfXx3vhwv4kJDjR2KV5d/tWKgJkYiEC41u7DQUhuM4uLl9qip0aew9V3n6yB1wv6o5TKoZkKA+5FEUym9oiJmtgEoF2oFnek3a+GsyFStkSxITrV1Fqias= 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.167.199 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-oi1-f199.google.com with SMTP id 5614622812f47-4ab4dd46ddeso14484b6e.3 for ; Tue, 28 Jul 2026 10:25:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785259521; x=1785864321; h=content-type: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=N708/ihwgxJGkDia5rPMorqjLcboertpBaAxlVnhjG4=; b=Nk+6Y9agpcoPlbcmyAZitqLAHazWGEmGhVMBVh59OrumWY7aFryN2E5uJMW5lmDfyg 8zq0/CPP5bY2RJ3XlHBQwfCrBDR6mM/uL9qUFlj0riMjaDy7uvGCHBW25x73Cqx1P039 FmFhOSraXk6mIv/q9wRmG+qtueBsrYNZInEOsMfPT7RxK5LzgutI6j51229uHw/rd4sZ BJqyLMQv5mCLRws4w2uVLO7jyhBzc1hcM8LHITNKWXKSmI2qGYnvHkErU1gSrZWZOu8l 6XB6Obeu6oEYKYgmS5WhNDY+oaf2AmxNDfO4kuf/p5CQ8tvBg5O3qI2M0pcmeleM2hM2 AyAw== X-Gm-Message-State: AOJu0YxhpIMgVtCEODEEYGV4fv9hlcuF4gTdvT3pEOgj+fHXdH6KHp8F 09jiPRiUqa7JwpEdDiOcDT5YLHD0vCmUewKKlB/hKoAxTpgOLRd3Z8wrQlf1j2yiUt31dJKnwQR LUt+ElKD4f0ESRGyfBodizODzdsaw+NK80e35Ti7+ByOkGhQ/SWpHZdqQ+t8= 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:1587:b0:4a3:d333:2258 with SMTP id 5614622812f47-4ad5ba67401mr1968901b6e.14.1785259521671; Tue, 28 Jul 2026 10:25:21 -0700 (PDT) Date: Tue, 28 Jul 2026 10:25:21 -0700 In-Reply-To: <6a68b182.4c659fcc.19cd90.0020.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <6a68e601.e3659fcc.2a40b8.0018.GAE@google.com> Subject: Forwarded: [PATCH] usb: gadget: f_midi2: Fix null dereference From: syzbot To: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org. *** Subject: [PATCH] usb: gadget: f_midi2: Fix null dereference Author: michail.tatas@gmail.com #syz test f_midi2_bind only binds if if (... != SNDRV_UMP_DIR_OUTPUT) ... if (... != SNDRV_UMP_DIR_INPUT) ... When f_midi2_set_alt gets called, it uncoditionally calls f_midi2_stop_eps which triggers a null dereference in f_midi2_free_ep_reqs Add guard to catch dereference in f_midi2_free_ep_reqs like f_midi2_drop_reqs already has Signed-off-by: Michail Tatas --- drivers/usb/gadget/function/f_midi2.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/gadget/function/f_midi2.c b/drivers/usb/gadget/function/f_midi2.c index 19fdac024343..b9bb09c4b51a 100644 --- a/drivers/usb/gadget/function/f_midi2.c +++ b/drivers/usb/gadget/function/f_midi2.c @@ -1163,6 +1163,9 @@ static void f_midi2_free_ep_reqs(struct f_midi2_usb_ep *usb_ep) struct f_midi2 *midi2 = usb_ep->card; int i; + if (!usb_ep->usb_ep || !usb_ep->num_reqs) + return; + for (i = 0; i < midi2->info.num_reqs; i++) { if (!usb_ep->reqs[i].req) continue; @@ -1203,6 +1206,9 @@ static int f_midi2_init_ep(struct f_midi2 *midi2, struct f_midi2_ep *ep, /* Free EP */ static void f_midi2_free_ep(struct f_midi2_usb_ep *usb_ep) { + if(!usb_ep->usb_ep) + return; + f_midi2_drop_reqs(usb_ep); f_midi2_free_ep_reqs(usb_ep); -- 2.43.0