Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 536A62820C5 for ; Wed, 18 Jun 2025 11:03:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750244609; cv=none; b=dsjRJw7iVRb0KW05R66r8PC9KMENnrl875QvGOdiwO17ZY0sckOuj3UzGRSMLGxcfoUI6jEwiSyMM/MQ6Vy+OTCkHO124e25D2pOzA9erQvLwFaXe6AB+wSWvpguJnxn7Up+UDJblVtDPzKultDYZqe8lM7oZUzEDgCCYap46Yg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750244609; c=relaxed/simple; bh=paW2x6mw+r2bdHfwVp06EpvPgOtAnqQY3iCjAosNIkY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=XoEq6WBTAmnTQlzwEkreoLQlAEfY2/y/wDp5BEgnqr3BPkmwIgbCJCawVebi1RzwjPCCnzd5A4vJoSdj05VGQxth3B0aHOMSTZ58H0AsLc2bqjN3YffWB98FqWQ4hgcTg7AwQyWlYoJIcZcLfEplp3BufSxBu0BCs9z8I9hMlfc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=2k46BAM6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="2k46BAM6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9FC4C4CEED; Wed, 18 Jun 2025 11:03:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750244609; bh=paW2x6mw+r2bdHfwVp06EpvPgOtAnqQY3iCjAosNIkY=; h=From:To:Cc:Subject:Date:Reply-to:From; b=2k46BAM6U/M5pl6rUFTOXoA0Z9oxR+KWNhv4WbLV0lb2MJ6vf4HeVen0/P4GTZGeI to3GQ6OQjRW0MdHIWSdaoDi5CmGcM/7JkTSSxKVcFozxgUfmUMoTJjrEf2F25U9LvD aKo/5gjut1ApISSuzSqRM4fSPI99ZRn7QAk5VY0M= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-49980: USB: gadget: Fix use-after-free Read in usb_udc_uevent() Date: Wed, 18 Jun 2025 13:00:45 +0200 Message-ID: <2025061820-CVE-2022-49980-982c@gregkh> X-Mailer: git-send-email 2.49.0 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=2979; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=ZlbS36S5CaA83BsrsBlXHnM4DAnmSlnusxWM1l2Lkag=; b=owGbwMvMwCRo6H6F97bub03G02pJDBlBc1zLq11+Lf5+73bk0XTFRvEKR7b4l8dnXWdgqpt7W q7spf33jlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZhIdjbDgu0bTI4qem7VnWQi fbvgnpjeC0+1YwwLZhbH7DswbctDrhfZ+4MeSOevnvzlIAA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: USB: gadget: Fix use-after-free Read in usb_udc_uevent() The syzbot fuzzer found a race between uevent callbacks and gadget driver unregistration that can cause a use-after-free bug: --------------------------------------------------------------- BUG: KASAN: use-after-free in usb_udc_uevent+0x11f/0x130 drivers/usb/gadget/udc/core.c:1732 Read of size 8 at addr ffff888078ce2050 by task udevd/2968 CPU: 1 PID: 2968 Comm: udevd Not tainted 5.19.0-rc4-next-20220628-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/29/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:317 [inline] print_report.cold+0x2ba/0x719 mm/kasan/report.c:433 kasan_report+0xbe/0x1f0 mm/kasan/report.c:495 usb_udc_uevent+0x11f/0x130 drivers/usb/gadget/udc/core.c:1732 dev_uevent+0x290/0x770 drivers/base/core.c:2424 --------------------------------------------------------------- The bug occurs because usb_udc_uevent() dereferences udc->driver but does so without acquiring the udc_lock mutex, which protects this field. If the gadget driver is unbound from the udc concurrently with uevent processing, the driver structure may be accessed after it has been deallocated. To prevent the race, we make sure that the routine holds the mutex around the racing accesses. The Linux kernel CVE team has assigned CVE-2022-49980 to this issue. Affected and fixed versions =========================== Fixed in 5.19.7 with commit f44b0b95d50fffeca036e1ba36770390e0b519dd Fixed in 6.0 with commit 2191c00855b03aa59c20e698be713d952d51fc18 Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2022-49980 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: drivers/usb/gadget/udc/core.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/f44b0b95d50fffeca036e1ba36770390e0b519dd https://git.kernel.org/stable/c/2191c00855b03aa59c20e698be713d952d51fc18