From nobody Tue Sep 29 14:54:10 2026 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 9EABC30EF91 for ; Fri, 7 Aug 2026 04:38:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786077500; cv=none; b=lEUZWVf9742qWmyjdyZUGebHKNp3Wd794HQ7Tgu8jPEsAQtn6XL06SR02NsZYM7olEKAYzGiwSxOj/uxq4khO8pZED+YcXg6bzPhDpnhlJFwVX+Cb4VsJYZ+39ho4hhajXzp+BZQfEyKqKgpcSsmqa+EbTpI9VTyxB84Shk/BeY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786077500; c=relaxed/simple; bh=c2eJmS6Fidv7OQwOFciceAX1dEuewckWJWc+sV7tPN0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=GmfmH2ksJtWjJiZZ80xGLKYu8gRbbHluFJmgPQBx4DhFdz/dJi1jLSYl9bghS9RTbOEwcTkDTD2mFsymS01TMQu8yZE6VVBNYn4+gLBWs1t+7p9bxVWkHNU23PdJavgVwljatg8fR9UXWyma6NP6033VC6tiKtXOJvh2bYVOCcM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=DriXPxRR; arc=none smtp.client-ip=209.85.214.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DriXPxRR" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-2cacb8416a1so31046515ad.1 for ; Thu, 06 Aug 2026 21:38:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786077499; x=1786682299; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=OApPi/aBpyIH8HD0zKAoJ3Rb4TUBRhQUqTZcuTXFIYw=; b=DriXPxRR25QIAiZxJUvKBtEBiG9Viz8SAvEWMVyc4WvX3wptR2w6KynyU9cmlDaVHp dxjMsermDzK1US/Uca5lkvgj5PuiNyqgS/7bsbbgH+WQKiAhduT51eueELDYCMIMmZeN owX/bIVpn8HMvieMc2kfmiqbbsE7E193QTwCScSXybFulRDcl7nAQQ/GJHj/12RMw6Tb JSEOXRgPi1Vsdtw20TLXUa7RNuQanPF+SMf6yCHFqLMTxMvsLLmhHRj2gy6LdfRNP8Wc v67jteEzlRzpx5vQoNlJDKm6EtXyu+NW7F5i23+qUvpqBX2n1L4J9d8cGDBYvWNlFNg2 mlAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786077499; x=1786682299; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=OApPi/aBpyIH8HD0zKAoJ3Rb4TUBRhQUqTZcuTXFIYw=; b=HcbXOmEvyRETiSC0v6ZfvhTBB0cCNcU/oUMD41DxlB55Brfkzexje/bfLgXCZ1wslK nmAIpr6YtiNkU5SlFXooZ1uG9lLsYAPvL9AG/e0EfeB45qGVFh9hj81a5YeyWcFbep6W yE62oAIg2TQ1gt/SNEvJQM7bFkMILn2LkLGHy3tCEjCyRv87i2jz7t9m98mh8CKBP60D U4VVIcxIdZcmbsj/4XGslguMX1gLLPivn4s572cbXHmZhdLvsdb/VoQ/3QKC8XRCzEMl iKVxT4wg4N9B69RDTBBaUbQJZnBrQ1CcsPcQ+hGwmcudtZgeprHiU9nM7cngZywE5chR OV3A== X-Forwarded-Encrypted: i=1; AHgh+Rp8S9WhpVOchxCxr3yX/dFk66QmNMG8lEDk7MT9S+EXBrNdQTd/lzLIigjM5bTUeK4Ps5Ve+92Sv+iql+4=@vger.kernel.org X-Gm-Message-State: AOJu0Yz2e/Ix/GdhaQafk0rcsZkv4b7gSIZOwM1rNtspvlV0b8lsLeer alxbLA6NX2c5aITt53AC/T18sMBFWzOFaZpXVM43skmIeILMnbb5kcz1 X-Gm-Gg: AR+sD13wSQES0gclAHbjxUWunEK0c2Nx97SqT2gc8ST7N+ewM1BwZX4f6xrEzCRf8h6 8P6PuAwwQ9O31HaF9qOrcb4/SduQaSOI0oMj91Q+Tg0OlS9gfuFpxqoaecdUM8LC2ifnL1qPgXD yzwPLONWUaEsyNK7WoEjdyjwwwjdsiXzAtOWP4eB+s15O8K/klHmF3+Dy5IGO3FvFt4M/Y+p/0w BbKVM/M5d6ko0jSmAZJJQBrLxTOFHvtrdc7btqmd6ft/UXgsWW6Y2pm+xSmtW21/bvV/bhVIggr DBWcscTOtfLPgG6LMOHWuCrMKFCxGjF+VOV3MWE6fOrIqftUgiBp2jo71rgcOhouI1VrazsR/DQ LJ2qJWe1I+VkzqjdXS6b3VAuN02hidoGvBIstVv/e4mnwpixqwOJHzit4SRH+M9B4pi1c4Y23v+ /UJxCMNhVf1lkpifb2jU3GgIQbzP4+IKd0L/7Wx9cCd690RZlE1/f/deZRWVDI0wsMBA== X-Received: by 2002:a17:90b:520a:b0:38f:efed:5445 with SMTP id 98e67ed59e1d1-3903c54adafmr20909787a91.4.1786077498756; Thu, 06 Aug 2026 21:38:18 -0700 (PDT) Received: from Default ([2409:40f4:102d:3eaf:6f2d:c1cd:a882:e082]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-315bec2ec20sm2749192eec.28.2026.08.06.21.38.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2026 21:38:18 -0700 (PDT) From: Jeffin Philip To: linux-usb@vger.kernel.org Cc: valentina.manea.m@gmail.com, shuah@kernel.org, i@zenithal.me, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, syzbot+af76b01c9a0f0ab60fb0@syzkaller.appspotmail.com, Jeffin Philip Subject: [PATCH v2] usbip: usbip_host: fix null pointer dereference in Date: Fri, 7 Aug 2026 10:07:59 +0530 Message-ID: <20260807043759.12218-1-jeffinphilip14@gmail.com> X-Mailer: git-send-email 2.55.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" rebind_store calls do_rebind which dereferences udev without checking if it is NULL. If busid is registered using match_busid but the device is never bound to the driver or it is never present in the first place, it triggers a null pointer dereference when we attempt to rebind the device. Fix this by checking explicitly for udev first and returning -ENODEV if udev is NULL. Add usb_get_dev in addition to the null check to get a reference to udev to prevent udev from becoming NULL after the check. Drop the reference after using it in do_rebind(). Reported-by: syzbot+af76b01c9a0f0ab60fb0@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3Daf76b01c9a0f0ab60fb0 Fixes: 4bfb141bc013 ("usbip: usbip_host: fix to hold parent lock for device= _attach() calls") Cc: stable@vger.kernel.org Signed-off-by: Jeffin Philip --- Changes in v2: - Addressed concerns raised by the maintainer in v1 discussion - Added usb_get_dev() to get a reference to udev preventing it from becoming null after the null check. Drop the reference after using it in do_rebind() --- drivers/usb/usbip/stub_main.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/usb/usbip/stub_main.c b/drivers/usb/usbip/stub_main.c index 79110a69d697..c911626427dc 100644 --- a/drivers/usb/usbip/stub_main.c +++ b/drivers/usb/usbip/stub_main.c @@ -256,12 +256,21 @@ static ssize_t rebind_store(struct device_driver *dev= , const char *buf, if (!bid) return -ENODEV; =20 + if (!bid->udev) { + put_busid_priv(bid); + return -ENODEV; + } + + /* get a reference to udev to prevent it from becoming NULL */ + usb_get_dev(bid->udev); /* mark the device for deletion so probe ignores it during rescan */ bid->status =3D STUB_BUSID_OTHER; /* release the busid lock */ put_busid_priv(bid); =20 ret =3D do_rebind((char *) buf, bid); + /* we finished using udev and don't need the reference anymore, drop it */ + usb_put_dev(bid->udev); if (ret < 0) return ret; =20 --=20 2.55.0