From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oi1-f200.google.com (mail-oi1-f200.google.com [209.85.167.200]) (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 D17233A6417 for ; Tue, 28 Jul 2026 17:25:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.200 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785259524; cv=none; b=RR0Z2LVjatZn5xXuOmgdx3wxeuAwtcS5ihEugfJudglqHR85QXHv8T+B/YhGQKWAwxOFdLh0moHY93mAyX0mUKATzTgwWeijLTUg5YMlcZeaIvyaksr/PbvXHTnTPyCDmLeDa3YjC66+Akt1YICk0hoFUqoZCvInuHfvMaIaYTA= 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=G+gWaE3N5Hwxb0yt0qhu5MwFGgGVh5ANaV8lFTM36pgENFADpebaptMk0WABCIDN9wHm7xmUS6KHXS7rsprBiO8Z0zcqgyXQgeYg8ZxiuIU/s4GglQHn6DnfgWCSqKetMCpIG6H4NKs0C658P/tGSquZPBtylk1rZzEC0E40icg= 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.200 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-f200.google.com with SMTP id 5614622812f47-49f3a97f1caso29588b6e.0 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=1785259522; x=1785864322; 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=DIcDKQQd6hZ2n8vUQ0AZdbJz1DSzOwP28Br2bwjP2dUUzriHiBJiS9dHlOOfW2MDy0 lqK0YYB/xXTbbe0rUllquxJGyMa3CIsubaslWUUWZgxHPBG0CdM1IGy3Co5jlwVXRlzn QGIMFBYgYyHJhaSTfCnf+RoMGBpEhAaEQCrfBxJA9fK1wq3LjcjBY5TAOsVe/UXuDH6y R4BOnhUw+tHUF/ttMdbQdeyCpAFV++8h4FlPzMR0lvaxV/2FZtS1lg9mRwNJCDeh0D+E zOQsk2BpfYgQDbB3EwS4JfXzdRcZAJSThoelskOokyVu3Y5iyZ+vmjmqFaZQSBxUrDPf 4OzQ== X-Gm-Message-State: AOJu0YyKlzhInu+K5axuF1/9B21/KPX0mqMS8pAg7BRalTDYgqeptFCU NhISmE4lFAjmSPM+QH9tdYJuU+lduEBVDHShxK0sRzyo3Gl/J0Q0Kz2W5PgqEjmxatjirKzdmuJ XKmVOtA+z0EtzWZUmuRh33OTztmEizX2rvVRAHVebbWruRZ3/teridlE1eY0= 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:2381:b0:4ab:6662:4e97 with SMTP id 5614622812f47-4ad5ba6b602mr1849515b6e.16.1785259521802; 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.0019.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