ID Workflow Result Correct Bug Created Started Finished Revision
d40043f8 patching KASAN: slab-use-after-free Write in gadgetfs_kill_sb 2026/08/06 07:07 2026/08/07 05:35 2026/08/07 06:25 c38879ea
Agent: prod-syz-agent-0
External Bug ID: ---

Inputs:
BaseBranch master
BaseCommit RC
BaseRepository git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
BugTitle KASAN: slab-use-after-free Write in gadgetfs_kill_sb
CrashLogID 5582408327364608
CrashReportID 6662957892632576
KernelCommit 0d839570765118029aa8bf4a95444c6a11aacf85
KernelConfig
Show (272107 bytes)
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86_64 syzkaller Kernel Configuration
#
CONFIG_CC_VERSION_TEXT="Debian clang version 22.1.8 (++20260613092233+e80beda6e255-1~exp1~20260613092250.77)"
CONFIG_GCC_VERSION=0
CONFIG_CC_IS_CLANG=y
CONFIG_CLANG_VERSION=220108
CONFIG_AS_IS_LLVM=y
CONFIG_AS_VERSION=220108
CONFIG_LD_VERSION=0
CONFIG_LD_IS_LLD=y
CONFIG_LLD_VERSION=220108
CONFIG_RUSTC_VERSION=109600
CONFIG_RUST_IS_AVAILABLE=y
CONFIG_RUSTC_LLVM_VERSION=220102
CONFIG_RUSTC_LLVM_MAJOR_VERSION=22
CONFIG_RUSTC_CLANG_LLVM_COMPATIBLE=y
CONFIG_CC_CAN_LINK=y
CONFIG_CC_HAS_ASM_GOTO_OUTPUT=y
CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT=y
CONFIG_TOOLS_SUPPORT_RELR=y
CONFIG_CC_HAS_ASM_INLINE=y
CONFIG_CC_HAS_ASSUME=y
CONFIG_CC_HAS_NO_PROFILE_FN_ATTR=y
CONFIG_CC_HAS_COUNTED_BY=y
CONFIG_CC_HAS_COUNTED_BY_PTR=y
CONFIG_CC_HAS_ALLOC_TOKEN=y
CONFIG_CC_HAS_MULTIDIMENSIONAL_NONSTRING=y
CONFIG_LD_CAN_USE_KEEP_IN_OVERLAY=y
CONFIG_RUSTC_HAS_SPAN_FILE=y
CONFIG_RUSTC_HAS_UNNECESSARY_TRANSMUTES=y
CONFIG_RUSTC_HAS_FILE_WITH_NUL=y
CONFIG_RUSTC_HAS_FILE_AS_C_STR=y
CONFIG_PAHOLE_VERSION=130
CONFIG_CONSTRUCTORS=y
CONFIG_IRQ_WORK=y
CONFIG_BUILDTIME_TABLE_SORT=y
CONFIG_THREAD_INFO_IN_TASK=y

#
# General setup
#
CONFIG_INIT_ENV_ARG_LIMIT=32
# CONFIG_COMPILE_TEST is not set
# CONFIG_WERROR is not set
CONFIG_LOCALVERSION=""
CONFIG_LOCALVERSION_AUTO=y
CONFIG_BUILD_SALT=""
CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_HAVE_KERNEL_BZIP2=y
CONFIG_HAVE_KERNEL_LZMA=y
CONFIG_HAVE_KERNEL_XZ=y
CONFIG_HAVE_KERNEL_LZO=y
CONFIG_HAVE_KERNEL_LZ4=y
CONFIG_HAVE_KERNEL_ZSTD=y
CONFIG_KERNEL_GZIP=y
# CONFIG_KERNEL_BZIP2 is not set
# CONFIG_KERNEL_LZMA is not set
# CONFIG_KERNEL_XZ is not set
# CONFIG_KERNEL_LZO is not set
# CONFIG_KERNEL_LZ4 is not set
# CONFIG_KERNEL_ZSTD is not set
CONFIG_DEFAULT_INIT=""
CONFIG_DEFAULT_HOSTNAME="(none)"
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_SYSVIPC_COMPAT=y
CONFIG_POSIX_MQUEUE=y
CONFIG_POSIX_MQUEUE_SYSCTL=y
CONFIG_WATCH_QUEUE=y
CONFIG_CROSS_MEMORY_ATTACH=y
CONFIG_AUDIT=y
CONFIG_HAVE_ARCH_AUDITSYSCALL=y
CONFIG_AUDITSYSCALL=y

#
# IRQ subsystem
#
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_GENERIC_IRQ_SHOW=y
CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y
CONFIG_GENERIC_PENDING_IRQ=y
CONFIG_GENERIC_IRQ_MIGRATION=y
CONFIG_HARDIRQS_SW_RESEND=y
CONFIG_IRQ_DOMAIN=y
CONFIG_IRQ_DOMAIN_HIERARCHY=y
CONFIG_GENERIC_MSI_IRQ=y
CONFIG_GENERIC_IRQ_MATRIX_ALLOCATOR=y
CONFIG_GENERIC_IRQ_RESERVATION_MODE=y
CONFIG_IRQ_FORCED_THREADING=y
CONFIG_SPARSE_IRQ=y
# CONFIG_GENERIC_IRQ_DEBUGFS is not set
# end of IRQ subsystem

CONFIG_CLOCKSOURCE_WATCHDOG=y
CONFIG_ARCH_CLOCKSOURCE_INIT=y
CONFIG_ARCH_WANTS_CLOCKSOURCE_READ_INLINE=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
CONFIG_GENERIC_CLOCKEVENTS_BROADCAST_IDLE=y
CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=y
CONFIG_GENERIC_CLOCKEVENTS_COUPLED=y
CONFIG_GENERIC_CLOCKEVENTS_COUPLED_INLINE=y
CONFIG_GENERIC_CMOS_UPDATE=y
CONFIG_HRTIMER_REARM_DEFERRED=y
CONFIG_HAVE_POSIX_CPU_TIMERS_TASK_WORK=y
CONFIG_POSIX_CPU_TIMERS_TASK_WORK=y
CONFIG_CONTEXT_TRACKING=y
CONFIG_CONTEXT_TRACKING_IDLE=y

#
# Timers subsystem
#
CONFIG_TICK_ONESHOT=y
CONFIG_NO_HZ_COMMON=y
# CONFIG_HZ_PERIODIC is not set
CONFIG_NO_HZ_IDLE=y
# CONFIG_NO_HZ_FULL is not set
CONFIG_CONTEXT_TRACKING_USER=y
# CONFIG_CONTEXT_TRACKING_USER_FORCE is not set
CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_POSIX_AUX_CLOCKS=y
# end of Timers subsystem

CONFIG_BPF=y
CONFIG_HAVE_EBPF_JIT=y
CONFIG_ARCH_WANT_DEFAULT_BPF_JIT=y

#
# BPF subsystem
#
CONFIG_BPF_SYSCALL=y
CONFIG_BPF_JIT=y
CONFIG_BPF_JIT_ALWAYS_ON=y
CONFIG_BPF_JIT_DEFAULT_ON=y
# CONFIG_BPF_UNPRIV_DEFAULT_OFF is not set
CONFIG_BPF_PRELOAD=y
CONFIG_BPF_PRELOAD_UMD=y
CONFIG_BPF_LSM=y
# end of BPF subsystem

CONFIG_PREEMPT_BUILD=y
CONFIG_ARCH_HAS_PREEMPT_LAZY=y
CONFIG_PREEMPT=y
# CONFIG_PREEMPT_LAZY is not set
CONFIG_PREEMPT_RT=y
# CONFIG_PREEMPT_RT_NEEDS_BH_LOCK is not set
CONFIG_PREEMPT_COUNT=y
CONFIG_PREEMPTION=y
CONFIG_PREEMPT_DYNAMIC=y
CONFIG_SCHED_CORE=y

#
# CPU/Task time and stats accounting
#
CONFIG_VIRT_CPU_ACCOUNTING=y
# CONFIG_TICK_CPU_ACCOUNTING is not set
CONFIG_VIRT_CPU_ACCOUNTING_GEN=y
CONFIG_IRQ_TIME_ACCOUNTING=y
CONFIG_HAVE_SCHED_AVG_IRQ=y
CONFIG_BSD_PROCESS_ACCT=y
CONFIG_BSD_PROCESS_ACCT_V3=y
CONFIG_TASKSTATS=y
CONFIG_TASK_DELAY_ACCT=y
CONFIG_TASK_XACCT=y
CONFIG_TASK_IO_ACCOUNTING=y
CONFIG_PSI=y
# CONFIG_PSI_DEFAULT_DISABLED is not set
# end of CPU/Task time and stats accounting

CONFIG_CPU_ISOLATION=y

#
# RCU Subsystem
#
CONFIG_TREE_RCU=y
CONFIG_PREEMPT_RCU=y
# CONFIG_RCU_EXPERT is not set
CONFIG_TREE_SRCU=y
CONFIG_TASKS_RCU_GENERIC=y
CONFIG_NEED_TASKS_RCU=y
CONFIG_TASKS_RCU=y
CONFIG_TASKS_TRACE_RCU=y
CONFIG_RCU_STALL_COMMON=y
CONFIG_RCU_NEED_SEGCBLIST=y
# CONFIG_RCU_BOOST is not set
# end of RCU Subsystem

CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
# CONFIG_IKHEADERS is not set
CONFIG_LOG_BUF_SHIFT=18
CONFIG_LOG_CPU_MAX_BUF_SHIFT=12
# CONFIG_PRINTK_INDEX is not set
CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y

#
# Scheduler features
#
# CONFIG_UCLAMP_TASK is not set
# end of Scheduler features

CONFIG_ARCH_SUPPORTS_NUMA_BALANCING=y
CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH=y
CONFIG_CC_HAS_INT128=y
CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough"
CONFIG_CC_MS_EXTENSIONS="-fms-extensions"
CONFIG_GCC10_NO_ARRAY_BOUNDS=y
CONFIG_GCC_NO_STRINGOP_OVERFLOW=y
CONFIG_ARCH_SUPPORTS_INT128=y
CONFIG_SCHED_CACHE=y
CONFIG_SLAB_OBJ_EXT=y
CONFIG_CGROUPS=y
CONFIG_PAGE_COUNTER=y
# CONFIG_CGROUP_FAVOR_DYNMODS is not set
CONFIG_MEMCG=y
CONFIG_MEMCG_V1=y
CONFIG_BLK_CGROUP=y
CONFIG_CGROUP_WRITEBACK=y
CONFIG_CGROUP_SCHED=y
CONFIG_GROUP_SCHED_WEIGHT=y
CONFIG_GROUP_SCHED_BANDWIDTH=y
CONFIG_FAIR_GROUP_SCHED=y
CONFIG_CFS_BANDWIDTH=y
# CONFIG_RT_GROUP_SCHED is not set
CONFIG_SCHED_MM_CID=y
CONFIG_CGROUP_PIDS=y
CONFIG_CGROUP_RDMA=y
# CONFIG_CGROUP_DMEM is not set
CONFIG_CGROUP_FREEZER=y
CONFIG_CGROUP_HUGETLB=y
CONFIG_CPUSETS=y
# CONFIG_CPUSETS_V1 is not set
CONFIG_CGROUP_DEVICE=y
CONFIG_CGROUP_CPUACCT=y
CONFIG_CGROUP_PERF=y
# CONFIG_CGROUP_BPF is not set
CONFIG_CGROUP_MISC=y
CONFIG_CGROUP_DEBUG=y
CONFIG_SOCK_CGROUP_DATA=y
CONFIG_NAMESPACES=y
CONFIG_UTS_NS=y
CONFIG_TIME_NS=y
CONFIG_TIME_NS_VDSO=y
CONFIG_IPC_NS=y
CONFIG_USER_NS=y
CONFIG_PID_NS=y
CONFIG_NET_NS=y
CONFIG_CHECKPOINT_RESTORE=y
# CONFIG_SCHED_AUTOGROUP is not set
CONFIG_RELAY=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_RD_GZIP=y
CONFIG_RD_BZIP2=y
CONFIG_RD_LZMA=y
CONFIG_RD_XZ=y
CONFIG_RD_LZO=y
CONFIG_RD_LZ4=y
CONFIG_RD_ZSTD=y
# CONFIG_BOOT_CONFIG is not set
CONFIG_CMDLINE_LOG_WRAP_IDEAL_LEN=1021
CONFIG_INITRAMFS_PRESERVE_MTIME=y
CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y
# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
CONFIG_LD_ORPHAN_WARN=y
CONFIG_LD_ORPHAN_WARN_LEVEL="warn"
CONFIG_SYSCTL=y
CONFIG_HAVE_UID16=y
CONFIG_SYSCTL_EXCEPTION_TRACE=y
CONFIG_SYSFS_SYSCALL=y
CONFIG_HAVE_PCSPKR_PLATFORM=y
CONFIG_EXPERT=y
CONFIG_UID16=y
CONFIG_MULTIUSER=y
CONFIG_SGETMASK_SYSCALL=y
CONFIG_FHANDLE=y
CONFIG_POSIX_TIMERS=y
CONFIG_PRINTK=y
CONFIG_BUG=y
CONFIG_ELF_CORE=y
CONFIG_PCSPKR_PLATFORM=y
# CONFIG_BASE_SMALL is not set
CONFIG_FUTEX=y
CONFIG_FUTEX_PI=y
CONFIG_FUTEX_PRIVATE_HASH=y
CONFIG_FUTEX_MPOL=y
CONFIG_HAVE_FUTEX_ROBUST_UNLOCK=y
CONFIG_FUTEX_ROBUST_UNLOCK=y
CONFIG_EPOLL=y
CONFIG_SIGNALFD=y
CONFIG_TIMERFD=y
CONFIG_EVENTFD=y
CONFIG_SHMEM=y
CONFIG_AIO=y
CONFIG_IO_URING=y
CONFIG_IO_URING_MOCK_FILE=y
CONFIG_ADVISE_SYSCALLS=y
CONFIG_MEMBARRIER=y
CONFIG_KCMP=y
CONFIG_RSEQ=y
CONFIG_RSEQ_SLICE_EXTENSION=y
# CONFIG_RSEQ_STATS is not set
# CONFIG_RSEQ_DEBUG_DEFAULT_ENABLE is not set
CONFIG_CACHESTAT_SYSCALL=y
CONFIG_KALLSYMS=y
# CONFIG_KALLSYMS_SELFTEST is not set
CONFIG_KALLSYMS_ALL=y
CONFIG_ARCH_HAS_MEMBARRIER_SYNC_CORE=y
CONFIG_ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS=y
CONFIG_HAVE_PERF_EVENTS=y
CONFIG_GUEST_PERF_EVENTS=y
CONFIG_PERF_GUEST_MEDIATED_PMU=y

#
# Kernel Performance Events And Counters
#
CONFIG_PERF_EVENTS=y
# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
# end of Kernel Performance Events And Counters

CONFIG_SYSTEM_DATA_VERIFICATION=y
CONFIG_PROFILING=y
# CONFIG_RUST is not set
CONFIG_TRACEPOINTS=y

#
# Kexec and crash features
#
CONFIG_CRASH_RESERVE=y
CONFIG_VMCORE_INFO=y
CONFIG_KEXEC_CORE=y
CONFIG_KEXEC=y
# CONFIG_KEXEC_FILE is not set
# CONFIG_KEXEC_JUMP is not set
CONFIG_CRASH_DUMP=y
CONFIG_CRASH_HOTPLUG=y
CONFIG_CRASH_MAX_MEMORY_RANGES=8192
# end of Kexec and crash features

#
# Live Update and Kexec HandOver
#
# CONFIG_KEXEC_HANDOVER is not set
# end of Live Update and Kexec HandOver
# end of General setup

CONFIG_64BIT=y
CONFIG_X86_64=y
CONFIG_X86=y
CONFIG_INSTRUCTION_DECODER=y
CONFIG_OUTPUT_FORMAT="elf64-x86-64"
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_MMU=y
CONFIG_ARCH_MMAP_RND_BITS_MIN=28
CONFIG_ARCH_MMAP_RND_BITS_MAX=32
CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=8
CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16
CONFIG_GENERIC_ISA_DMA=y
CONFIG_GENERIC_CSUM=y
CONFIG_GENERIC_BUG=y
CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y
CONFIG_ARCH_MAY_HAVE_PC_FDC=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_ARCH_HAS_CPU_RELAX=y
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_AUDIT_ARCH=y
CONFIG_KASAN_SHADOW_OFFSET=0xdffffc0000000000
CONFIG_HAVE_INTEL_TXT=y
CONFIG_ARCH_SUPPORTS_UPROBES=y
CONFIG_FIX_EARLYCON_MEM=y
CONFIG_PGTABLE_LEVELS=5

#
# Processor type and features
#
CONFIG_SMP=y
CONFIG_X86_X2APIC=y
# CONFIG_X86_POSTED_MSI is not set
CONFIG_X86_MPPARSE=y
# CONFIG_X86_CPU_RESCTRL is not set
CONFIG_X86_FRED=y
CONFIG_X86_EXTENDED_PLATFORM=y
# CONFIG_X86_NUMACHIP is not set
# CONFIG_X86_VSMP is not set
# CONFIG_X86_INTEL_MID is not set
# CONFIG_X86_GOLDFISH is not set
# CONFIG_X86_INTEL_LPSS is not set
# CONFIG_X86_AMD_PLATFORM_DEVICE is not set
CONFIG_IOSF_MBI=y
# CONFIG_IOSF_MBI_DEBUG is not set
CONFIG_X86_SUPPORTS_MEMORY_FAILURE=y
CONFIG_SCHED_OMIT_FRAME_POINTER=y
CONFIG_HYPERVISOR_GUEST=y
CONFIG_PARAVIRT=y
CONFIG_PARAVIRT_SPINLOCKS=y
CONFIG_X86_HV_CALLBACK_VECTOR=y
# CONFIG_XEN is not set
CONFIG_KVM_GUEST=y
CONFIG_ARCH_CPUIDLE_HALTPOLL=y
CONFIG_PVH=y
# CONFIG_PARAVIRT_TIME_ACCOUNTING is not set
CONFIG_PARAVIRT_CLOCK=y
# CONFIG_JAILHOUSE_GUEST is not set
# CONFIG_ACRN_GUEST is not set
# CONFIG_BHYVE_GUEST is not set
CONFIG_CC_HAS_MARCH_NATIVE=y
# CONFIG_X86_NATIVE_CPU is not set
CONFIG_X86_INTERNODE_CACHE_SHIFT=6
CONFIG_X86_L1_CACHE_SHIFT=6
CONFIG_X86_TSC=y
CONFIG_X86_HAVE_PAE=y
CONFIG_X86_CX8=y
CONFIG_X86_CMOV=y
CONFIG_X86_MINIMUM_CPU_FAMILY=64
CONFIG_X86_DEBUGCTLMSR=y
CONFIG_IA32_FEAT_CTL=y
CONFIG_X86_VMX_FEATURE_NAMES=y
CONFIG_PROCESSOR_SELECT=y
CONFIG_CPU_SUP_INTEL=y
CONFIG_CPU_SUP_AMD=y
# CONFIG_CPU_SUP_HYGON is not set
# CONFIG_CPU_SUP_CENTAUR is not set
# CONFIG_CPU_SUP_ZHAOXIN is not set
CONFIG_BROADCAST_TLB_FLUSH=y
CONFIG_HPET_TIMER=y
CONFIG_HPET_EMULATE_RTC=y
CONFIG_DMI=y
# CONFIG_GART_IOMMU is not set
CONFIG_BOOT_VESA_SUPPORT=y
# CONFIG_MAXSMP is not set
CONFIG_NR_CPUS_RANGE_BEGIN=2
CONFIG_NR_CPUS_RANGE_END=512
CONFIG_NR_CPUS_DEFAULT=64
CONFIG_NR_CPUS=8
CONFIG_SCHED_MC_PRIO=y
CONFIG_X86_LOCAL_APIC=y
CONFIG_ACPI_MADT_WAKEUP=y
CONFIG_X86_IO_APIC=y
CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS=y
CONFIG_X86_MCE=y
# CONFIG_X86_MCELOG_LEGACY is not set
CONFIG_X86_MCE_INTEL=y
CONFIG_X86_MCE_AMD=y
CONFIG_X86_MCE_THRESHOLD=y
# CONFIG_X86_MCE_INJECT is not set

#
# Performance monitoring
#
CONFIG_PERF_EVENTS_INTEL_UNCORE=y
CONFIG_PERF_EVENTS_INTEL_RAPL=y
CONFIG_PERF_EVENTS_INTEL_CSTATE=y
# CONFIG_PERF_EVENTS_AMD_POWER is not set
CONFIG_PERF_EVENTS_AMD_UNCORE=y
# CONFIG_PERF_EVENTS_AMD_BRS is not set
# end of Performance monitoring

CONFIG_X86_16BIT=y
CONFIG_X86_ESPFIX64=y
CONFIG_X86_VSYSCALL_EMULATION=y
CONFIG_X86_IOPL_IOPERM=y
CONFIG_MICROCODE=y
# CONFIG_MICROCODE_LATE_LOADING is not set
# CONFIG_MICROCODE_DBG is not set
CONFIG_X86_MSR=y
CONFIG_X86_CPUID=y
CONFIG_X86_DIRECT_GBPAGES=y
# CONFIG_X86_CPA_STATISTICS is not set
CONFIG_NUMA=y
CONFIG_AMD_NUMA=y
CONFIG_X86_64_ACPI_NUMA=y
CONFIG_NODES_SHIFT=6
CONFIG_ARCH_SPARSEMEM_ENABLE=y
CONFIG_ARCH_SPARSEMEM_DEFAULT=y
# CONFIG_ARCH_MEMORY_PROBE is not set
CONFIG_ARCH_PROC_KCORE_TEXT=y
CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000
# CONFIG_X86_PMEM_LEGACY is not set
# CONFIG_X86_CHECK_BIOS_CORRUPTION is not set
CONFIG_MTRR=y
# CONFIG_MTRR_SANITIZER is not set
CONFIG_X86_PAT=y
CONFIG_X86_UMIP=y
CONFIG_CC_HAS_IBT=y
CONFIG_X86_CET=y
CONFIG_X86_KERNEL_IBT=y
CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS=y
CONFIG_ARCH_PKEY_BITS=4
# CONFIG_X86_INTEL_TSX_MODE_OFF is not set
CONFIG_X86_INTEL_TSX_MODE_ON=y
# CONFIG_X86_INTEL_TSX_MODE_AUTO is not set
CONFIG_X86_SGX=y
CONFIG_X86_USER_SHADOW_STACK=y
# CONFIG_INTEL_TDX_HOST is not set
# CONFIG_EFI is not set
CONFIG_HZ_100=y
# CONFIG_HZ_250 is not set
# CONFIG_HZ_300 is not set
# CONFIG_HZ_1000 is not set
CONFIG_HZ=100
CONFIG_SCHED_HRTICK=y
CONFIG_ARCH_SUPPORTS_KEXEC=y
CONFIG_ARCH_SUPPORTS_KEXEC_FILE=y
CONFIG_ARCH_SUPPORTS_KEXEC_PURGATORY=y
CONFIG_ARCH_SUPPORTS_KEXEC_SIG=y
CONFIG_ARCH_SUPPORTS_KEXEC_SIG_FORCE=y
CONFIG_ARCH_SUPPORTS_KEXEC_BZIMAGE_VERIFY_SIG=y
CONFIG_ARCH_SUPPORTS_KEXEC_JUMP=y
CONFIG_ARCH_SUPPORTS_KEXEC_HANDOVER=y
CONFIG_ARCH_SUPPORTS_CRASH_DUMP=y
CONFIG_ARCH_DEFAULT_CRASH_DUMP=y
CONFIG_ARCH_SUPPORTS_CRASH_HOTPLUG=y
CONFIG_ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION=y
CONFIG_PHYSICAL_START=0x1000000
# CONFIG_RELOCATABLE is not set
CONFIG_PHYSICAL_ALIGN=0x200000
CONFIG_HOTPLUG_CPU=y
# CONFIG_COMPAT_VDSO is not set
CONFIG_LEGACY_VSYSCALL_XONLY=y
# CONFIG_LEGACY_VSYSCALL_NONE is not set
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="earlyprintk=serial net.ifnames=0 sysctl.kernel.hung_task_all_cpu_backtrace=1 ima_policy=tcb nf-conntrack-ftp.ports=20000 nf-conntrack-tftp.ports=20000 nf-conntrack-sip.ports=20000 nf-conntrack-irc.ports=20000 nf-conntrack-sane.ports=20000 binder.debug_mask=0 rcupdate.rcu_expedited=1 rcupdate.rcu_cpu_stall_cputime=1 no_hash_pointers page_owner=on sysctl.vm.nr_hugepages=4 sysctl.vm.nr_overcommit_hugepages=4 secretmem.enable=1 sysctl.max_rcu_stall_to_panic=1 msr.allow_writes=off coredump_filter=0xffff root=/dev/sda console=ttyS0 vsyscall=native numa=fake=2 kvm-intel.nested=1 spec_store_bypass_disable=prctl nopcid vivid.n_devs=64 vivid.multiplanar=1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2 netrom.nr_ndevs=32 rose.rose_ndevs=32 smp.csd_lock_timeout=100000 watchdog_thresh=55 workqueue.watchdog_thresh=140 sysctl.net.core.netdev_unregister_timeout_secs=140 dummy_hcd.num=32 max_loop=32 nbds_max=32 comedi.comedi_num_legacy_minors=4 panic_on_warn=1"
# CONFIG_CMDLINE_OVERRIDE is not set
CONFIG_MODIFY_LDT_SYSCALL=y
# CONFIG_STRICT_SIGALTSTACK_SIZE is not set
CONFIG_HAVE_LIVEPATCH=y
CONFIG_HAVE_KLP_BUILD=y
CONFIG_X86_BUS_LOCK_DETECT=y
# end of Processor type and features

CONFIG_CC_HAS_SLS=y
CONFIG_CC_HAS_RETURN_THUNK=y
CONFIG_CC_HAS_ENTRY_PADDING=y
CONFIG_CC_HAS_KCFI_ARITY=y
CONFIG_FUNCTION_PADDING_CFI=11
CONFIG_FUNCTION_PADDING_BYTES=16
CONFIG_CALL_PADDING=y
CONFIG_HAVE_CALL_THUNKS=y
CONFIG_CALL_THUNKS=y
CONFIG_CPU_MITIGATIONS=y
CONFIG_MITIGATION_PAGE_TABLE_ISOLATION=y
CONFIG_MITIGATION_RETPOLINE=y
CONFIG_MITIGATION_RETHUNK=y
CONFIG_MITIGATION_UNRET_ENTRY=y
CONFIG_MITIGATION_CALL_DEPTH_TRACKING=y
# CONFIG_CALL_THUNKS_DEBUG is not set
CONFIG_MITIGATION_IBPB_ENTRY=y
CONFIG_MITIGATION_IBRS_ENTRY=y
CONFIG_MITIGATION_SRSO=y
# CONFIG_MITIGATION_SLS is not set
CONFIG_MITIGATION_GDS=y
CONFIG_MITIGATION_RFDS=y
CONFIG_MITIGATION_SPECTRE_BHI=y
CONFIG_MITIGATION_MDS=y
CONFIG_MITIGATION_TAA=y
CONFIG_MITIGATION_MMIO_STALE_DATA=y
CONFIG_MITIGATION_L1TF=y
CONFIG_MITIGATION_RETBLEED=y
CONFIG_MITIGATION_SPECTRE_V1=y
CONFIG_MITIGATION_SPECTRE_V2=y
CONFIG_MITIGATION_SRBDS=y
CONFIG_MITIGATION_SSB=y
CONFIG_MITIGATION_ITS=y
CONFIG_MITIGATION_TSA=y
# CONFIG_MITIGATION_VMSCAPE is not set
CONFIG_ARCH_HAS_ADD_PAGES=y

#
# Power management and ACPI options
#
CONFIG_ARCH_HIBERNATION_HEADER=y
CONFIG_SUSPEND=y
CONFIG_SUSPEND_FREEZER=y
# CONFIG_SUSPEND_SKIP_SYNC is not set
CONFIG_HIBERNATE_CALLBACKS=y
CONFIG_HIBERNATION=y
CONFIG_HIBERNATION_SNAPSHOT_DEV=y
CONFIG_HIBERNATION_COMP_LZO=y
# CONFIG_HIBERNATION_COMP_LZ4 is not set
CONFIG_HIBERNATION_DEF_COMP="lzo"
CONFIG_PM_STD_PARTITION=""
CONFIG_PM_SLEEP=y
CONFIG_PM_SLEEP_SMP=y
# CONFIG_PM_AUTOSLEEP is not set
# CONFIG_PM_USERSPACE_AUTOSLEEP is not set
# CONFIG_PM_WAKELOCKS is not set
# CONFIG_PM_QOS_CPU_SYSTEM_WAKEUP is not set
CONFIG_PM=y
CONFIG_PM_DEBUG=y
# CONFIG_PM_ADVANCED_DEBUG is not set
# CONFIG_PM_TEST_SUSPEND is not set
CONFIG_PM_SLEEP_DEBUG=y
# CONFIG_DPM_WATCHDOG is not set
CONFIG_PM_TRACE=y
CONFIG_PM_TRACE_RTC=y
CONFIG_PM_CLK=y
# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set
# CONFIG_ENERGY_MODEL is not set
CONFIG_ARCH_SUPPORTS_ACPI=y
CONFIG_ACPI=y
CONFIG_ACPI_LEGACY_TABLES_LOOKUP=y
CONFIG_ARCH_MIGHT_HAVE_ACPI_PDC=y
CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT=y
CONFIG_ACPI_THERMAL_LIB=y
# CONFIG_ACPI_DEBUGGER is not set
CONFIG_ACPI_SPCR_TABLE=y
# CONFIG_ACPI_FPDT is not set
CONFIG_ACPI_LPIT=y
CONFIG_ACPI_SLEEP=y
CONFIG_ACPI_REV_OVERRIDE_POSSIBLE=y
CONFIG_ACPI_EC=y
# CONFIG_ACPI_EC_DEBUGFS is not set
CONFIG_ACPI_AC=y
CONFIG_ACPI_BATTERY=y
CONFIG_ACPI_BUTTON=y
CONFIG_ACPI_VIDEO=y
CONFIG_ACPI_FAN=y
# CONFIG_ACPI_TAD is not set
CONFIG_ACPI_DOCK=y
CONFIG_ACPI_CPU_FREQ_PSS=y
CONFIG_ACPI_PROCESSOR_CSTATE=y
CONFIG_ACPI_PROCESSOR_IDLE=y
CONFIG_ACPI_CPPC_LIB=y
CONFIG_ACPI_PROCESSOR=y
CONFIG_ACPI_HOTPLUG_CPU=y
# CONFIG_ACPI_PROCESSOR_AGGREGATOR is not set
CONFIG_ACPI_THERMAL=y
CONFIG_ACPI_PLATFORM_PROFILE=y
CONFIG_ARCH_HAS_ACPI_TABLE_UPGRADE=y
CONFIG_ACPI_TABLE_UPGRADE=y
CONFIG_ACPI_DEBUG=y
# CONFIG_ACPI_PCI_SLOT is not set
CONFIG_ACPI_CONTAINER=y
# CONFIG_ACPI_HOTPLUG_MEMORY is not set
CONFIG_ACPI_HOTPLUG_IOAPIC=y
# CONFIG_ACPI_SBS is not set
# CONFIG_ACPI_HED is not set
# CONFIG_ACPI_REDUCED_HARDWARE_ONLY is not set
CONFIG_ACPI_NHLT=y
CONFIG_ACPI_NFIT=y
# CONFIG_NFIT_SECURITY_DEBUG is not set
CONFIG_ACPI_NUMA=y
# CONFIG_ACPI_HMAT is not set
CONFIG_HAVE_ACPI_APEI=y
CONFIG_HAVE_ACPI_APEI_NMI=y
# CONFIG_ACPI_APEI is not set
# CONFIG_ACPI_DPTF is not set
# CONFIG_ACPI_EXTLOG is not set
# CONFIG_ACPI_CONFIGFS is not set
# CONFIG_ACPI_PFRUT is not set
CONFIG_ACPI_PCC=y
# CONFIG_ACPI_FFH is not set
CONFIG_ACPI_MRRM=y
CONFIG_PMIC_OPREGION=y
CONFIG_BXT_WC_PMIC_OPREGION=y
# CONFIG_CHT_WC_PMIC_OPREGION is not set
CONFIG_X86_PM_TIMER=y

#
# CPU Frequency scaling
#
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_GOV_ATTR_SET=y
CONFIG_CPU_FREQ_GOV_COMMON=y
# CONFIG_CPU_FREQ_STAT is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL is not set
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y

#
# CPU frequency scaling drivers
#
# CONFIG_CPUFREQ_DT is not set
# CONFIG_CPUFREQ_DT_PLATDEV is not set
CONFIG_X86_INTEL_PSTATE=y
# CONFIG_X86_PCC_CPUFREQ is not set
CONFIG_X86_AMD_PSTATE=y
CONFIG_X86_AMD_PSTATE_DEFAULT_MODE=3
# CONFIG_X86_AMD_PSTATE_UT is not set
CONFIG_X86_ACPI_CPUFREQ=y
CONFIG_X86_ACPI_CPUFREQ_CPB=y
# CONFIG_X86_POWERNOW_K8 is not set
# CONFIG_X86_AMD_FREQ_SENSITIVITY is not set
# CONFIG_X86_SPEEDSTEP_CENTRINO is not set
# CONFIG_X86_P4_CLOCKMOD is not set

#
# shared options
#
CONFIG_CPUFREQ_ARCH_CUR_FREQ=y
# end of CPU Frequency scaling

#
# CPU Idle
#
CONFIG_CPU_IDLE=y
# CONFIG_CPU_IDLE_GOV_LADDER is not set
CONFIG_CPU_IDLE_GOV_MENU=y
# CONFIG_CPU_IDLE_GOV_TEO is not set
CONFIG_CPU_IDLE_GOV_HALTPOLL=y
CONFIG_HALTPOLL_CPUIDLE=y
# end of CPU Idle

CONFIG_INTEL_IDLE=y
# end of Power management and ACPI options

#
# Bus options (PCI etc.)
#
CONFIG_PCI_DIRECT=y
CONFIG_PCI_MMCONFIG=y
CONFIG_MMCONF_FAM10H=y
CONFIG_ISA_BUS=y
CONFIG_ISA_DMA_API=y
CONFIG_AMD_NB=y
CONFIG_AMD_NODE=y
# end of Bus options (PCI etc.)

#
# Binary Emulations
#
CONFIG_IA32_EMULATION=y
# CONFIG_IA32_EMULATION_DEFAULT_DISABLED is not set
CONFIG_COMPAT_32=y
CONFIG_COMPAT=y
CONFIG_COMPAT_FOR_U64_ALIGNMENT=y
# end of Binary Emulations

CONFIG_KVM_COMMON=y
CONFIG_HAVE_KVM_PFNCACHE=y
CONFIG_HAVE_KVM_IRQCHIP=y
CONFIG_HAVE_KVM_IRQ_ROUTING=y
CONFIG_HAVE_KVM_DIRTY_RING=y
CONFIG_HAVE_KVM_DIRTY_RING_TSO=y
CONFIG_HAVE_KVM_DIRTY_RING_ACQ_REL=y
CONFIG_KVM_MMIO=y
CONFIG_KVM_ASYNC_PF=y
CONFIG_HAVE_KVM_MSI=y
CONFIG_HAVE_KVM_READONLY_MEM=y
CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT=y
CONFIG_KVM_VFIO=y
CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT=y
CONFIG_KVM_GENERIC_PRE_FAULT_MEMORY=y
CONFIG_KVM_COMPAT=y
CONFIG_HAVE_KVM_IRQ_BYPASS=y
CONFIG_HAVE_KVM_NO_POLL=y
CONFIG_VIRT_XFER_TO_GUEST_WORK=y
CONFIG_HAVE_KVM_PM_NOTIFIER=y
CONFIG_KVM_GENERIC_HARDWARE_ENABLING=y
CONFIG_KVM_ELIDE_TLB_FLUSH_IF_YOUNG=y
CONFIG_KVM_MMU_LOCKLESS_AGING=y
CONFIG_KVM_GENERIC_MEMORY_ATTRIBUTES=y
CONFIG_KVM_GUEST_MEMFD=y
CONFIG_VIRTUALIZATION=y
CONFIG_KVM_X86=y
CONFIG_KVM=y
CONFIG_KVM_SW_PROTECTED_VM=y
CONFIG_KVM_INTEL=y
# CONFIG_KVM_INTEL_PROVE_VE is not set
CONFIG_X86_SGX_KVM=y
CONFIG_KVM_AMD=y
CONFIG_KVM_IOAPIC=y
CONFIG_KVM_SMM=y
CONFIG_KVM_HYPERV=y
CONFIG_KVM_XEN=y
CONFIG_KVM_PROVE_MMU=y
CONFIG_KVM_MAX_NR_VCPUS=1024
CONFIG_X86_REQUIRED_FEATURE_ALWAYS=y
CONFIG_X86_REQUIRED_FEATURE_NOPL=y
CONFIG_X86_REQUIRED_FEATURE_CX8=y
CONFIG_X86_REQUIRED_FEATURE_CMOV=y
CONFIG_X86_REQUIRED_FEATURE_CPUID=y
CONFIG_X86_REQUIRED_FEATURE_FPU=y
CONFIG_X86_REQUIRED_FEATURE_PAE=y
CONFIG_X86_REQUIRED_FEATURE_PSE=y
CONFIG_X86_REQUIRED_FEATURE_PGE=y
CONFIG_X86_REQUIRED_FEATURE_MSR=y
CONFIG_X86_REQUIRED_FEATURE_FXSR=y
CONFIG_X86_REQUIRED_FEATURE_XMM=y
CONFIG_X86_REQUIRED_FEATURE_XMM2=y
CONFIG_X86_REQUIRED_FEATURE_LM=y
CONFIG_X86_DISABLED_FEATURE_VME=y
CONFIG_X86_DISABLED_FEATURE_K6_MTRR=y
CONFIG_X86_DISABLED_FEATURE_CYRIX_ARR=y
CONFIG_X86_DISABLED_FEATURE_CENTAUR_MCR=y
CONFIG_X86_DISABLED_FEATURE_LAM=y
CONFIG_X86_DISABLED_FEATURE_XENPV=y
CONFIG_X86_DISABLED_FEATURE_TDX_GUEST=y
CONFIG_X86_DISABLED_FEATURE_SEV_SNP=y
CONFIG_AS_WRUSS=y
CONFIG_ARCH_CONFIGURES_CPU_MITIGATIONS=y

#
# General architecture-dependent options
#
CONFIG_HOTPLUG_SMT=y
CONFIG_ARCH_SUPPORTS_SCHED_SMT=y
CONFIG_ARCH_SUPPORTS_SCHED_CLUSTER=y
CONFIG_ARCH_SUPPORTS_SCHED_MC=y
CONFIG_SCHED_SMT=y
CONFIG_SCHED_CLUSTER=y
CONFIG_SCHED_MC=y
CONFIG_HOTPLUG_CORE_SYNC=y
CONFIG_HOTPLUG_CORE_SYNC_DEAD=y
CONFIG_HOTPLUG_CORE_SYNC_FULL=y
CONFIG_HOTPLUG_SPLIT_STARTUP=y
CONFIG_HOTPLUG_PARALLEL=y
CONFIG_GENERIC_IRQ_ENTRY=y
CONFIG_GENERIC_SYSCALL=y
CONFIG_GENERIC_ENTRY=y
# CONFIG_KPROBES is not set
CONFIG_JUMP_LABEL=y
# CONFIG_STATIC_KEYS_SELFTEST is not set
# CONFIG_STATIC_CALL_SELFTEST is not set
CONFIG_UPROBES=y
CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
CONFIG_ARCH_USE_BUILTIN_BSWAP=y
CONFIG_USER_RETURN_NOTIFIER=y
CONFIG_HAVE_IOREMAP_PROT=y
CONFIG_HAVE_KPROBES=y
CONFIG_HAVE_KRETPROBES=y
CONFIG_HAVE_OPTPROBES=y
CONFIG_HAVE_KPROBES_ON_FTRACE=y
CONFIG_ARCH_CORRECT_STACKTRACE_ON_KRETPROBE=y
CONFIG_HAVE_FUNCTION_ERROR_INJECTION=y
CONFIG_HAVE_NMI=y
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
CONFIG_TRACE_IRQFLAGS_NMI_SUPPORT=y
CONFIG_HAVE_ARCH_TRACEHOOK=y
CONFIG_HAVE_DMA_CONTIGUOUS=y
CONFIG_GENERIC_SMP_IDLE_THREAD=y
CONFIG_ARCH_HAS_FORTIFY_SOURCE=y
CONFIG_ARCH_HAS_SET_MEMORY=y
CONFIG_ARCH_HAS_SET_DIRECT_MAP=y
CONFIG_ARCH_HAS_CPU_FINALIZE_INIT=y
CONFIG_ARCH_HAS_CPU_PASID=y
CONFIG_HAVE_ARCH_THREAD_STRUCT_WHITELIST=y
CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT=y
CONFIG_ARCH_WANTS_NO_INSTR=y
CONFIG_ARCH_MEMORY_ORDER_TSO=y
CONFIG_HAVE_ASM_MODVERSIONS=y
CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
CONFIG_HAVE_RSEQ=y
CONFIG_HAVE_RUST=y
CONFIG_HAVE_FUNCTION_ARG_ACCESS_API=y
CONFIG_HAVE_HW_BREAKPOINT=y
CONFIG_HAVE_MIXED_BREAKPOINTS_REGS=y
CONFIG_HAVE_USER_RETURN_NOTIFIER=y
CONFIG_HAVE_PERF_EVENTS_NMI=y
CONFIG_HAVE_HARDLOCKUP_DETECTOR_PERF=y
CONFIG_UNWIND_USER=y
CONFIG_HAVE_UNWIND_USER_FP=y
CONFIG_HAVE_PERF_REGS=y
CONFIG_HAVE_PERF_USER_STACK_DUMP=y
CONFIG_HAVE_ARCH_JUMP_LABEL=y
CONFIG_HAVE_ARCH_JUMP_LABEL_RELATIVE=y
CONFIG_MMU_GATHER_TABLE_FREE=y
CONFIG_MMU_GATHER_RCU_TABLE_FREE=y
CONFIG_MMU_GATHER_MERGE_VMAS=y
CONFIG_ARCH_WANT_IRQS_OFF_ACTIVATE_MM=y
CONFIG_MMU_LAZY_TLB_REFCOUNT=y
CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y
CONFIG_ARCH_HAVE_EXTRA_ELF_NOTES=y
CONFIG_ARCH_HAS_NMI_SAFE_THIS_CPU_OPS=y
CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y
CONFIG_HAVE_CMPXCHG_LOCAL=y
CONFIG_HAVE_CMPXCHG_DOUBLE=y
CONFIG_ARCH_WANT_COMPAT_IPC_PARSE_VERSION=y
CONFIG_ARCH_WANT_OLD_COMPAT_IPC=y
CONFIG_HAVE_ARCH_SECCOMP=y
CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
CONFIG_SECCOMP=y
CONFIG_SECCOMP_FILTER=y
# CONFIG_SECCOMP_CACHE_DEBUG is not set
CONFIG_HAVE_ARCH_KSTACK_ERASE=y
CONFIG_HAVE_STACKPROTECTOR=y
CONFIG_STACKPROTECTOR=y
CONFIG_STACKPROTECTOR_STRONG=y
CONFIG_ARCH_SUPPORTS_LTO_CLANG=y
CONFIG_ARCH_SUPPORTS_LTO_CLANG_THIN=y
CONFIG_HAS_LTO_CLANG=y
CONFIG_LTO_NONE=y
# CONFIG_LTO_CLANG_FULL is not set
# CONFIG_LTO_CLANG_THIN is not set
# CONFIG_LTO_CLANG_THIN_DIST is not set
CONFIG_AUTOFDO_CLANG=y
CONFIG_PROPELLER_CLANG=y
CONFIG_ARCH_SUPPORTS_CFI=y
# CONFIG_CFI is not set
CONFIG_HAVE_CFI_ICALL_NORMALIZE_INTEGERS=y
CONFIG_HAVE_CFI_ICALL_NORMALIZE_INTEGERS_RUSTC=y
CONFIG_HAVE_ARCH_WITHIN_STACK_FRAMES=y
CONFIG_HAVE_CONTEXT_TRACKING_USER=y
CONFIG_HAVE_CONTEXT_TRACKING_USER_OFFSTACK=y
CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y
CONFIG_HAVE_PV_STEAL_CLOCK_GEN=y
CONFIG_HAVE_MOVE_PUD=y
CONFIG_HAVE_MOVE_PMD=y
CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y
CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD=y
CONFIG_HAVE_ARCH_HUGE_VMAP=y
CONFIG_HAVE_ARCH_HUGE_VMALLOC=y
CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y
CONFIG_HAVE_ARCH_SOFT_DIRTY=y
CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
CONFIG_MODULES_USE_ELF_RELA=y
CONFIG_ARCH_HAS_EXECMEM_ROX=y
CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y
CONFIG_HAVE_SOFTIRQ_ON_OWN_STACK=y
CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
CONFIG_HAVE_ARCH_MMAP_RND_BITS=y
CONFIG_HAVE_EXIT_THREAD=y
CONFIG_ARCH_MMAP_RND_BITS=28
CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS=y
CONFIG_ARCH_MMAP_RND_COMPAT_BITS=8
CONFIG_HAVE_ARCH_COMPAT_MMAP_BASES=y
CONFIG_HAVE_PAGE_SIZE_4KB=y
CONFIG_PAGE_SIZE_4KB=y
CONFIG_PAGE_SIZE_LESS_THAN_64KB=y
CONFIG_PAGE_SIZE_LESS_THAN_256KB=y
CONFIG_PAGE_SHIFT=12
CONFIG_HAVE_OBJTOOL=y
CONFIG_HAVE_JUMP_LABEL_HACK=y
CONFIG_HAVE_NOINSTR_HACK=y
CONFIG_HAVE_NOINSTR_VALIDATION=y
CONFIG_HAVE_UACCESS_VALIDATION=y
CONFIG_HAVE_STACK_VALIDATION=y
CONFIG_HAVE_RELIABLE_STACKTRACE=y
CONFIG_OLD_SIGSUSPEND3=y
CONFIG_COMPAT_OLD_SIGACTION=y
CONFIG_COMPAT_32BIT_TIME=y
CONFIG_ARCH_SUPPORTS_RT=y
CONFIG_HAVE_ARCH_VMAP_STACK=y
CONFIG_VMAP_STACK=y
CONFIG_HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET=y
CONFIG_RANDOMIZE_KSTACK_OFFSET=y
# CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT is not set
CONFIG_ARCH_HAS_STRICT_KERNEL_RWX=y
CONFIG_STRICT_KERNEL_RWX=y
CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y
CONFIG_STRICT_MODULE_RWX=y
CONFIG_HAVE_ARCH_PREL32_RELOCATIONS=y
# CONFIG_LOCK_EVENT_COUNTS is not set
CONFIG_ARCH_HAS_MEM_ENCRYPT=y
CONFIG_HAVE_STATIC_CALL=y
CONFIG_HAVE_STATIC_CALL_INLINE=y
CONFIG_HAVE_PREEMPT_DYNAMIC=y
CONFIG_HAVE_PREEMPT_DYNAMIC_CALL=y
CONFIG_ARCH_WANT_LD_ORPHAN_WARN=y
CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
CONFIG_ARCH_SUPPORTS_PAGE_TABLE_CHECK=y
CONFIG_ARCH_HAS_ELFCORE_COMPAT=y
CONFIG_ARCH_HAS_PARANOID_L1D_FLUSH=y
CONFIG_DYNAMIC_SIGFRAME=y
CONFIG_HAVE_ARCH_NODE_DEV_GROUP=y
CONFIG_ARCH_HAS_HW_PTE_YOUNG=y
CONFIG_ARCH_HAS_NONLEAF_PMD_YOUNG=y
CONFIG_ARCH_HAS_KERNEL_FPU_SUPPORT=y
CONFIG_HAVE_GENERIC_TIF_BITS=y

#
# GCOV-based kernel profiling
#
# CONFIG_GCOV_KERNEL is not set
CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y
# end of GCOV-based kernel profiling

CONFIG_HAVE_GCC_PLUGINS=y
CONFIG_FUNCTION_ALIGNMENT_4B=y
CONFIG_FUNCTION_ALIGNMENT_16B=y
CONFIG_FUNCTION_ALIGNMENT=16
CONFIG_CC_HAS_SANE_FUNCTION_ALIGNMENT=y
CONFIG_ARCH_HAS_CPU_ATTACK_VECTORS=y
# end of General architecture-dependent options

CONFIG_RT_MUTEXES=y
CONFIG_MODULE_SIG_FORMAT=y
CONFIG_MODULES=y
# CONFIG_MODULE_DEBUG is not set
# CONFIG_MODULE_FORCE_LOAD is not set
CONFIG_MODULE_UNLOAD=y
CONFIG_MODULE_FORCE_UNLOAD=y
# CONFIG_MODULE_UNLOAD_TAINT_TRACKING is not set
CONFIG_MODVERSIONS=y
# CONFIG_GENKSYMS is not set
CONFIG_GENDWARFKSYMS=y
CONFIG_ASM_MODVERSIONS=y
# CONFIG_EXTENDED_MODVERSIONS is not set
# CONFIG_BASIC_MODVERSIONS is not set
CONFIG_MODULE_SRCVERSION_ALL=y
CONFIG_MODULE_SIG=y
# CONFIG_MODULE_SIG_FORCE is not set
# CONFIG_MODULE_SIG_ALL is not set
CONFIG_MODULE_SIG_SHA256=y
# CONFIG_MODULE_SIG_SHA384 is not set
# CONFIG_MODULE_SIG_SHA512 is not set
# CONFIG_MODULE_SIG_SHA3_256 is not set
# CONFIG_MODULE_SIG_SHA3_384 is not set
# CONFIG_MODULE_SIG_SHA3_512 is not set
CONFIG_MODULE_SIG_HASH="sha256"
# CONFIG_MODULE_COMPRESS is not set
# CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS is not set
CONFIG_MODPROBE_PATH="/sbin/modprobe"
# CONFIG_TRIM_UNUSED_KSYMS is not set
CONFIG_MODULES_TREE_LOOKUP=y
CONFIG_BLOCK=y
CONFIG_BLOCK_LEGACY_AUTOLOAD=y
CONFIG_BLK_RQ_ALLOC_TIME=y
CONFIG_BLK_CGROUP_RWSTAT=y
CONFIG_BLK_CGROUP_PUNT_BIO=y
CONFIG_BLK_DEV_BSG_COMMON=y
CONFIG_BLK_ICQ=y
CONFIG_BLK_DEV_BSGLIB=y
CONFIG_BLK_DEV_INTEGRITY=y
# CONFIG_BLK_DEV_WRITE_MOUNTED is not set
CONFIG_BLK_DEV_ZONED=y
CONFIG_BLK_DEV_THROTTLING=y
CONFIG_BLK_WBT=y
CONFIG_BLK_WBT_MQ=y
CONFIG_BLK_CGROUP_IOLATENCY=y
# CONFIG_BLK_CGROUP_FC_APPID is not set
CONFIG_BLK_CGROUP_IOCOST=y
CONFIG_BLK_CGROUP_IOPRIO=y
CONFIG_BLK_DEBUG_FS=y
# CONFIG_BLK_SED_OPAL is not set
CONFIG_BLK_INLINE_ENCRYPTION=y
CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK=y

#
# Partition Types
#
CONFIG_PARTITION_ADVANCED=y
CONFIG_ACORN_PARTITION=y
CONFIG_ACORN_PARTITION_CUMANA=y
CONFIG_ACORN_PARTITION_EESOX=y
CONFIG_ACORN_PARTITION_ICS=y
CONFIG_ACORN_PARTITION_ADFS=y
CONFIG_ACORN_PARTITION_POWERTEC=y
CONFIG_ACORN_PARTITION_RISCIX=y
CONFIG_AIX_PARTITION=y
CONFIG_OSF_PARTITION=y
CONFIG_AMIGA_PARTITION=y
CONFIG_ATARI_PARTITION=y
CONFIG_MAC_PARTITION=y
CONFIG_MSDOS_PARTITION=y
CONFIG_BSD_DISKLABEL=y
CONFIG_MINIX_SUBPARTITION=y
CONFIG_SOLARIS_X86_PARTITION=y
CONFIG_UNIXWARE_DISKLABEL=y
CONFIG_LDM_PARTITION=y
# CONFIG_LDM_DEBUG is not set
CONFIG_SGI_PARTITION=y
CONFIG_ULTRIX_PARTITION=y
CONFIG_SUN_PARTITION=y
CONFIG_KARMA_PARTITION=y
CONFIG_EFI_PARTITION=y
CONFIG_SYSV68_PARTITION=y
CONFIG_CMDLINE_PARTITION=y
# CONFIG_OF_PARTITION is not set
# end of Partition Types

CONFIG_BLK_PM=y
CONFIG_BLOCK_HOLDER_DEPRECATED=y
CONFIG_BLK_MQ_STACKING=y
# CONFIG_BLK_ERROR_INJECTION is not set

#
# IO Schedulers
#
CONFIG_MQ_IOSCHED_DEADLINE=y
CONFIG_MQ_IOSCHED_KYBER=y
CONFIG_IOSCHED_BFQ=y
CONFIG_BFQ_GROUP_IOSCHED=y
CONFIG_BFQ_CGROUP_DEBUG=y
# end of IO Schedulers

CONFIG_PREEMPT_NOTIFIERS=y
CONFIG_PADATA=y
CONFIG_ASN1=y
CONFIG_UNINLINE_SPIN_UNLOCK=y
CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y
CONFIG_MUTEX_SPIN_ON_OWNER=y
CONFIG_RWSEM_SPIN_ON_OWNER=y
CONFIG_LOCK_SPIN_ON_OWNER=y
CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y
CONFIG_QUEUED_SPINLOCKS=y
CONFIG_ARCH_USE_QUEUED_RWLOCKS=y
CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE=y
CONFIG_ARCH_HAS_SYNC_CORE_BEFORE_USERMODE=y
CONFIG_ARCH_HAS_SYSCALL_WRAPPER=y
CONFIG_FREEZER=y

#
# Executable file formats
#
CONFIG_BINFMT_ELF=y
CONFIG_COMPAT_BINFMT_ELF=y
CONFIG_ELFCORE=y
CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
CONFIG_BINFMT_SCRIPT=y
CONFIG_BINFMT_MISC=y
CONFIG_COREDUMP=y
# end of Executable file formats

#
# Memory Management options
#
CONFIG_SWAP=y
CONFIG_ZSWAP=y
CONFIG_ZSWAP_DEFAULT_ON=y
CONFIG_ZSWAP_SHRINKER_DEFAULT_ON=y
# CONFIG_ZSWAP_COMPRESSOR_DEFAULT_DEFLATE is not set
# CONFIG_ZSWAP_COMPRESSOR_DEFAULT_LZO is not set
CONFIG_ZSWAP_COMPRESSOR_DEFAULT_842=y
# CONFIG_ZSWAP_COMPRESSOR_DEFAULT_LZ4 is not set
# CONFIG_ZSWAP_COMPRESSOR_DEFAULT_LZ4HC is not set
# CONFIG_ZSWAP_COMPRESSOR_DEFAULT_ZSTD is not set
CONFIG_ZSWAP_COMPRESSOR_DEFAULT="842"
CONFIG_ZSMALLOC=y

#
# Zsmalloc allocator options
#

#
# Zsmalloc is a common backend allocator for zswap & zram
#
# CONFIG_ZSMALLOC_STAT is not set
CONFIG_ZSMALLOC_CHAIN_SIZE=8
# end of Zsmalloc allocator options

#
# Slab allocator options
#
CONFIG_SLUB=y
CONFIG_KVFREE_RCU_BATCHED=y
# CONFIG_SLUB_TINY is not set
CONFIG_SLAB_MERGE_DEFAULT=y
# CONFIG_SLAB_FREELIST_RANDOM is not set
# CONFIG_SLAB_FREELIST_HARDENED is not set
# CONFIG_SLAB_BUCKETS is not set
# CONFIG_SLUB_STATS is not set
# CONFIG_KMALLOC_PARTITION_CACHES is not set
# end of Slab allocator options

# CONFIG_SHUFFLE_PAGE_ALLOCATOR is not set
# CONFIG_COMPAT_BRK is not set
CONFIG_SPARSEMEM=y
CONFIG_SPARSEMEM_EXTREME=y
CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
CONFIG_SPARSEMEM_VMEMMAP=y
CONFIG_SPARSEMEM_VMEMMAP_PREINIT=y
CONFIG_ARCH_WANT_OPTIMIZE_DAX_VMEMMAP=y
CONFIG_ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP=y
CONFIG_ARCH_WANT_HUGETLB_VMEMMAP_PREINIT=y
CONFIG_HAVE_GUP_FAST=y
CONFIG_NUMA_KEEP_MEMINFO=y
CONFIG_MEMORY_ISOLATION=y
CONFIG_EXCLUSIVE_SYSTEM_RAM=y
CONFIG_HAVE_BOOTMEM_INFO_NODE=y
CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
CONFIG_MEMORY_HOTPLUG=y
# CONFIG_MHP_DEFAULT_ONLINE_TYPE_OFFLINE is not set
CONFIG_MHP_DEFAULT_ONLINE_TYPE_ONLINE_AUTO=y
# CONFIG_MHP_DEFAULT_ONLINE_TYPE_ONLINE_KERNEL is not set
# CONFIG_MHP_DEFAULT_ONLINE_TYPE_ONLINE_MOVABLE is not set
CONFIG_MEMORY_HOTREMOVE=y
CONFIG_MHP_MEMMAP_ON_MEMORY=y
CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE=y
CONFIG_SPLIT_PTE_PTLOCKS=y
CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK=y
CONFIG_SPLIT_PMD_PTLOCKS=y
CONFIG_BALLOON=y
# CONFIG_BALLOON_MIGRATION is not set
CONFIG_COMPACTION=y
CONFIG_COMPACT_UNEVICTABLE_DEFAULT=0
CONFIG_PAGE_REPORTING=y
CONFIG_NUMA_MIGRATION=y
CONFIG_MIGRATION=y
CONFIG_DEVICE_MIGRATION=y
CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION=y
CONFIG_CONTIG_ALLOC=y
CONFIG_PCP_BATCH_SCALE_MAX=5
CONFIG_PHYS_ADDR_T_64BIT=y
CONFIG_MMU_NOTIFIER=y
CONFIG_KSM=y
CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
CONFIG_ARCH_SUPPORTS_MEMORY_FAILURE=y
# CONFIG_MEMORY_FAILURE is not set
CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
CONFIG_ARCH_WANTS_THP_SWAP=y
CONFIG_PAGE_MAPCOUNT=y
CONFIG_PGTABLE_HAS_HUGE_LEAVES=y
CONFIG_HAVE_GIGANTIC_FOLIOS=y
CONFIG_ASYNC_KERNEL_PGTABLE_FREE=y
CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y
CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y
CONFIG_USE_PERCPU_NUMA_NODE_ID=y
CONFIG_HAVE_SETUP_PER_CPU_AREA=y
CONFIG_CMA=y
# CONFIG_CMA_DEBUGFS is not set
# CONFIG_CMA_SYSFS is not set
CONFIG_CMA_AREAS=20
CONFIG_PAGE_BLOCK_MAX_ORDER=10
CONFIG_MEM_SOFT_DIRTY=y
CONFIG_GENERIC_EARLY_IOREMAP=y
# CONFIG_DEFERRED_STRUCT_PAGE_INIT is not set
CONFIG_PAGE_IDLE_FLAG=y
# CONFIG_IDLE_PAGE_TRACKING is not set
CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y
CONFIG_ARCH_HAS_CURRENT_STACK_POINTER=y
CONFIG_ARCH_HAS_ZONE_DMA_SET=y
CONFIG_ZONE_DMA=y
CONFIG_ZONE_DMA32=y
CONFIG_ZONE_DEVICE=y
CONFIG_HMM_MIRROR=y
CONFIG_GET_FREE_REGION=y
CONFIG_DEVICE_PRIVATE=y
CONFIG_ARCH_USES_HIGH_VMA_FLAGS=y
CONFIG_ARCH_HAS_PKEYS=y
CONFIG_ARCH_USES_PG_ARCH_2=y
CONFIG_VM_EVENT_COUNTERS=y
CONFIG_PERCPU_STATS=y
# CONFIG_GUP_TEST is not set
# CONFIG_DMAPOOL_TEST is not set
CONFIG_ARCH_HAS_PTE_SPECIAL=y
CONFIG_MAPPING_DIRTY_HELPERS=y
CONFIG_KMAP_LOCAL=y
CONFIG_MEMFD_CREATE=y
CONFIG_SECRETMEM=y
CONFIG_ANON_VMA_NAME=y
CONFIG_HAVE_ARCH_USERFAULTFD_WP=y
CONFIG_HAVE_ARCH_USERFAULTFD_MINOR=y
CONFIG_USERFAULTFD=y
# CONFIG_PTE_MARKER_UFFD_WP is not set
# CONFIG_LRU_GEN is not set
CONFIG_ARCH_SUPPORTS_PER_VMA_LOCK=y
CONFIG_PER_VMA_LOCK=y
CONFIG_LOCK_MM_AND_FIND_VMA=y
CONFIG_IOMMU_MM_DATA=y
CONFIG_EXECMEM=y
CONFIG_NUMA_MEMBLKS=y
CONFIG_NUMA_EMU=y
CONFIG_ARCH_HAS_USER_SHADOW_STACK=y
CONFIG_PT_RECLAIM=y

#
# Data Access Monitoring
#
CONFIG_DAMON=y
# CONFIG_DAMON_DEBUG_SANITY is not set
CONFIG_DAMON_VADDR=y
CONFIG_DAMON_PADDR=y
# CONFIG_DAMON_SYSFS is not set
CONFIG_DAMON_RECLAIM=y
# CONFIG_DAMON_LRU_SORT is not set
# CONFIG_DAMON_STAT is not set
# end of Data Access Monitoring
# end of Memory Management options

CONFIG_NET=y
CONFIG_WANT_COMPAT_NETLINK_MESSAGES=y
CONFIG_COMPAT_NETLINK_MESSAGES=y
CONFIG_NET_INGRESS=y
CONFIG_NET_EGRESS=y
CONFIG_NET_XGRESS=y
CONFIG_NET_REDIRECT=y
CONFIG_SKB_DECRYPTED=y
CONFIG_SKB_EXTENSIONS=y
CONFIG_NET_DEVMEM=y
CONFIG_NET_SHAPER=y
CONFIG_NET_CRC32C=y

#
# Networking options
#
CONFIG_PACKET=y
CONFIG_PACKET_DIAG=y
CONFIG_INET_PSP=y
CONFIG_UNIX=y
CONFIG_AF_UNIX_OOB=y
CONFIG_UNIX_DIAG=y
CONFIG_TLS=y
CONFIG_TLS_DEVICE=y
CONFIG_XFRM=y
CONFIG_XFRM_OFFLOAD=y
CONFIG_XFRM_ALGO=y
CONFIG_XFRM_USER=y
CONFIG_XFRM_USER_COMPAT=y
CONFIG_XFRM_INTERFACE=y
CONFIG_XFRM_SUB_POLICY=y
CONFIG_XFRM_MIGRATE=y
CONFIG_XFRM_STATISTICS=y
CONFIG_XFRM_AH=y
CONFIG_XFRM_ESP=y
CONFIG_XFRM_IPCOMP=y
CONFIG_NET_KEY=y
CONFIG_NET_KEY_MIGRATE=y
# CONFIG_XFRM_IPTFS is not set
CONFIG_XFRM_ESPINTCP=y
CONFIG_SMC=y
CONFIG_SMC_DIAG=y
# CONFIG_SMC_HS_CTRL_BPF is not set
CONFIG_DIBS=y
CONFIG_DIBS_LO=y
CONFIG_XDP_SOCKETS=y
CONFIG_XDP_SOCKETS_DIAG=y
CONFIG_NET_HANDSHAKE=y
CONFIG_INET=y
CONFIG_IP_MULTICAST=y
CONFIG_IP_ADVANCED_ROUTER=y
CONFIG_IP_FIB_TRIE_STATS=y
CONFIG_IP_MULTIPLE_TABLES=y
CONFIG_IP_ROUTE_MULTIPATH=y
CONFIG_IP_ROUTE_VERBOSE=y
CONFIG_IP_ROUTE_CLASSID=y
CONFIG_IP_PNP=y
CONFIG_IP_PNP_DHCP=y
CONFIG_IP_PNP_BOOTP=y
CONFIG_IP_PNP_RARP=y
CONFIG_NET_IPIP=y
CONFIG_NET_IPGRE_DEMUX=y
CONFIG_NET_IP_TUNNEL=y
CONFIG_NET_IPGRE=y
CONFIG_NET_IPGRE_BROADCAST=y
CONFIG_IP_MROUTE_COMMON=y
CONFIG_IP_MROUTE=y
CONFIG_IP_MROUTE_MULTIPLE_TABLES=y
CONFIG_IP_PIMSM_V1=y
CONFIG_IP_PIMSM_V2=y
CONFIG_SYN_COOKIES=y
CONFIG_NET_IPVTI=y
CONFIG_NET_UDP_TUNNEL=y
CONFIG_NET_FOU=y
CONFIG_NET_FOU_IP_TUNNELS=y
CONFIG_INET_AH=y
CONFIG_INET_ESP=y
CONFIG_INET_ESP_OFFLOAD=y
CONFIG_INET_ESPINTCP=y
CONFIG_INET_IPCOMP=y
CONFIG_INET_TABLE_PERTURB_ORDER=16
CONFIG_INET_XFRM_TUNNEL=y
CONFIG_INET_TUNNEL=y
CONFIG_INET_DIAG=y
CONFIG_INET_TCP_DIAG=y
CONFIG_INET_UDP_DIAG=y
CONFIG_INET_RAW_DIAG=y
CONFIG_INET_DIAG_DESTROY=y
CONFIG_TCP_CONG_ADVANCED=y
CONFIG_TCP_CONG_BIC=y
CONFIG_TCP_CONG_CUBIC=y
CONFIG_TCP_CONG_WESTWOOD=y
CONFIG_TCP_CONG_HTCP=y
CONFIG_TCP_CONG_HSTCP=y
CONFIG_TCP_CONG_HYBLA=y
CONFIG_TCP_CONG_VEGAS=y
CONFIG_TCP_CONG_NV=y
CONFIG_TCP_CONG_SCALABLE=y
CONFIG_TCP_CONG_LP=y
CONFIG_TCP_CONG_VENO=y
CONFIG_TCP_CONG_YEAH=y
CONFIG_TCP_CONG_ILLINOIS=y
CONFIG_TCP_CONG_DCTCP=y
CONFIG_TCP_CONG_CDG=y
CONFIG_TCP_CONG_BBR=y
# CONFIG_DEFAULT_BIC is not set
CONFIG_DEFAULT_CUBIC=y
# CONFIG_DEFAULT_HTCP is not set
# CONFIG_DEFAULT_HYBLA is not set
# CONFIG_DEFAULT_VEGAS is not set
# CONFIG_DEFAULT_VENO is not set
# CONFIG_DEFAULT_WESTWOOD is not set
# CONFIG_DEFAULT_DCTCP is not set
# CONFIG_DEFAULT_CDG is not set
# CONFIG_DEFAULT_BBR is not set
# CONFIG_DEFAULT_RENO is not set
CONFIG_DEFAULT_TCP_CONG="cubic"
# CONFIG_TCP_AO is not set
CONFIG_TCP_MD5SIG=y
CONFIG_IPV6=y
CONFIG_IPV6_ROUTER_PREF=y
CONFIG_IPV6_ROUTE_INFO=y
CONFIG_IPV6_OPTIMISTIC_DAD=y
CONFIG_INET6_AH=y
CONFIG_INET6_ESP=y
CONFIG_INET6_ESP_OFFLOAD=y
CONFIG_INET6_ESPINTCP=y
CONFIG_INET6_IPCOMP=y
CONFIG_IPV6_MIP6=y
CONFIG_IPV6_ILA=y
CONFIG_INET6_XFRM_TUNNEL=y
CONFIG_INET6_TUNNEL=y
CONFIG_IPV6_VTI=y
CONFIG_IPV6_SIT=y
CONFIG_IPV6_SIT_6RD=y
CONFIG_IPV6_NDISC_NODETYPE=y
CONFIG_IPV6_TUNNEL=y
CONFIG_IPV6_GRE=y
CONFIG_IPV6_FOU=y
CONFIG_IPV6_FOU_TUNNEL=y
CONFIG_IPV6_MULTIPLE_TABLES=y
CONFIG_IPV6_SUBTREES=y
CONFIG_IPV6_MROUTE=y
CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y
CONFIG_IPV6_PIMSM_V2=y
CONFIG_IPV6_SEG6_LWTUNNEL=y
CONFIG_IPV6_SEG6_HMAC=y
CONFIG_IPV6_SEG6_BPF=y
CONFIG_IPV6_RPL_LWTUNNEL=y
# CONFIG_IPV6_IOAM6_LWTUNNEL is not set
CONFIG_NETLABEL=y
CONFIG_MPTCP=y
CONFIG_INET_MPTCP_DIAG=y
CONFIG_MPTCP_IPV6=y
CONFIG_NETWORK_SECMARK=y
CONFIG_NET_PTP_CLASSIFY=y
# CONFIG_NETWORK_PHY_TIMESTAMPING is not set
CONFIG_NETFILTER=y
CONFIG_NETFILTER_ADVANCED=y
CONFIG_BRIDGE_NETFILTER=y

#
# Core Netfilter Configuration
#
CONFIG_NETFILTER_INGRESS=y
CONFIG_NETFILTER_EGRESS=y
CONFIG_NETFILTER_SKIP_EGRESS=y
CONFIG_NETFILTER_NETLINK=y
CONFIG_NETFILTER_FAMILY_BRIDGE=y
CONFIG_NETFILTER_FAMILY_ARP=y
CONFIG_NETFILTER_BPF_LINK=y
# CONFIG_NETFILTER_NETLINK_HOOK is not set
CONFIG_NETFILTER_NETLINK_ACCT=y
CONFIG_NETFILTER_NETLINK_QUEUE=y
CONFIG_NETFILTER_NETLINK_LOG=y
CONFIG_NETFILTER_NETLINK_OSF=y
CONFIG_NF_CONNTRACK=y
CONFIG_NF_LOG_SYSLOG=y
CONFIG_NETFILTER_CONNCOUNT=y
CONFIG_NF_CONNTRACK_MARK=y
CONFIG_NF_CONNTRACK_SECMARK=y
CONFIG_NF_CONNTRACK_ZONES=y
# CONFIG_NF_CONNTRACK_PROCFS is not set
CONFIG_NF_CONNTRACK_EVENTS=y
CONFIG_NF_CONNTRACK_TIMEOUT=y
CONFIG_NF_CONNTRACK_TIMESTAMP=y
CONFIG_NF_CONNTRACK_LABELS=y
CONFIG_NF_CONNTRACK_OVS=y
CONFIG_NF_CT_PROTO_GRE=y
CONFIG_NF_CT_PROTO_SCTP=y
CONFIG_NF_CONNTRACK_AMANDA=y
CONFIG_NF_CONNTRACK_FTP=y
CONFIG_NF_CONNTRACK_H323=y
CONFIG_NF_CONNTRACK_IRC=y
CONFIG_NF_CONNTRACK_BROADCAST=y
CONFIG_NF_CONNTRACK_NETBIOS_NS=y
CONFIG_NF_CONNTRACK_SNMP=y
CONFIG_NF_CONNTRACK_PPTP=y
CONFIG_NF_CONNTRACK_SANE=y
CONFIG_NF_CONNTRACK_SIP=y
CONFIG_NF_CONNTRACK_TFTP=y
CONFIG_NF_CT_NETLINK=y
CONFIG_NF_CT_NETLINK_TIMEOUT=y
CONFIG_NF_CT_NETLINK_HELPER=y
CONFIG_NETFILTER_NETLINK_GLUE_CT=y
CONFIG_NF_NAT=y
CONFIG_NF_NAT_AMANDA=y
CONFIG_NF_NAT_FTP=y
CONFIG_NF_NAT_IRC=y
CONFIG_NF_NAT_SIP=y
CONFIG_NF_NAT_TFTP=y
CONFIG_NF_NAT_REDIRECT=y
CONFIG_NF_NAT_MASQUERADE=y
CONFIG_NF_NAT_OVS=y
CONFIG_NETFILTER_SYNPROXY=y
CONFIG_NF_TABLES=y
CONFIG_NF_TABLES_INET=y
CONFIG_NF_TABLES_NETDEV=y
CONFIG_NFT_NUMGEN=y
CONFIG_NFT_CT=y
CONFIG_NFT_EXTHDR_DCCP=y
CONFIG_NFT_FLOW_OFFLOAD=y
CONFIG_NFT_CONNLIMIT=y
CONFIG_NFT_LOG=y
CONFIG_NFT_LIMIT=y
CONFIG_NFT_MASQ=y
CONFIG_NFT_REDIR=y
CONFIG_NFT_NAT=y
CONFIG_NFT_TUNNEL=y
CONFIG_NFT_QUEUE=y
CONFIG_NFT_QUOTA=y
CONFIG_NFT_REJECT=y
CONFIG_NFT_REJECT_INET=y
CONFIG_NFT_COMPAT=y
CONFIG_NFT_HASH=y
CONFIG_NFT_FIB=y
CONFIG_NFT_FIB_INET=y
CONFIG_NFT_XFRM=y
CONFIG_NFT_SOCKET=y
CONFIG_NFT_OSF=y
CONFIG_NFT_TPROXY=y
CONFIG_NFT_SYNPROXY=y
CONFIG_NF_DUP_NETDEV=y
CONFIG_NFT_DUP_NETDEV=y
CONFIG_NFT_FWD_NETDEV=y
CONFIG_NFT_FIB_NETDEV=y
CONFIG_NFT_REJECT_NETDEV=y
CONFIG_NF_FLOW_TABLE_INET=y
CONFIG_NF_FLOW_TABLE=y
# CONFIG_NF_FLOW_TABLE_PROCFS is not set
CONFIG_NETFILTER_XTABLES=y
CONFIG_NETFILTER_XTABLES_COMPAT=y

#
# Xtables combined modules
#
CONFIG_NETFILTER_XT_MARK=y
CONFIG_NETFILTER_XT_CONNMARK=y
CONFIG_NETFILTER_XT_SET=y

#
# Xtables targets
#
CONFIG_NETFILTER_XT_TARGET_AUDIT=y
CONFIG_NETFILTER_XT_TARGET_CHECKSUM=y
CONFIG_NETFILTER_XT_TARGET_CLASSIFY=y
CONFIG_NETFILTER_XT_TARGET_CONNMARK=y
CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=y
# CONFIG_NETFILTER_XT_TARGET_CT is not set
CONFIG_NETFILTER_XT_TARGET_DSCP=y
# CONFIG_NETFILTER_XT_TARGET_HL is not set
CONFIG_NETFILTER_XT_TARGET_HMARK=y
CONFIG_NETFILTER_XT_TARGET_IDLETIMER=y
CONFIG_NETFILTER_XT_TARGET_LED=y
CONFIG_NETFILTER_XT_TARGET_LOG=y
CONFIG_NETFILTER_XT_TARGET_MARK=y
CONFIG_NETFILTER_XT_NAT=y
# CONFIG_NETFILTER_XT_TARGET_NETMAP is not set
CONFIG_NETFILTER_XT_TARGET_NFLOG=y
CONFIG_NETFILTER_XT_TARGET_NFQUEUE=y
CONFIG_NETFILTER_XT_TARGET_RATEEST=y
# CONFIG_NETFILTER_XT_TARGET_REDIRECT is not set
CONFIG_NETFILTER_XT_TARGET_MASQUERADE=y
CONFIG_NETFILTER_XT_TARGET_TEE=y
CONFIG_NETFILTER_XT_TARGET_TPROXY=y
CONFIG_NETFILTER_XT_TARGET_SECMARK=y
CONFIG_NETFILTER_XT_TARGET_TCPMSS=y
CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=y

#
# Xtables matches
#
CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=y
CONFIG_NETFILTER_XT_MATCH_BPF=y
CONFIG_NETFILTER_XT_MATCH_CGROUP=y
CONFIG_NETFILTER_XT_MATCH_CLUSTER=y
CONFIG_NETFILTER_XT_MATCH_COMMENT=y
CONFIG_NETFILTER_XT_MATCH_CONNBYTES=y
CONFIG_NETFILTER_XT_MATCH_CONNLABEL=y
CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=y
CONFIG_NETFILTER_XT_MATCH_CONNMARK=y
CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
CONFIG_NETFILTER_XT_MATCH_CPU=y
CONFIG_NETFILTER_XT_MATCH_DCCP=y
CONFIG_NETFILTER_XT_MATCH_DEVGROUP=y
CONFIG_NETFILTER_XT_MATCH_DSCP=y
CONFIG_NETFILTER_XT_MATCH_ECN=y
CONFIG_NETFILTER_XT_MATCH_ESP=y
CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=y
CONFIG_NETFILTER_XT_MATCH_HELPER=y
CONFIG_NETFILTER_XT_MATCH_HL=y
CONFIG_NETFILTER_XT_MATCH_IPCOMP=y
CONFIG_NETFILTER_XT_MATCH_IPRANGE=y
CONFIG_NETFILTER_XT_MATCH_IPVS=y
CONFIG_NETFILTER_XT_MATCH_L2TP=y
CONFIG_NETFILTER_XT_MATCH_LENGTH=y
CONFIG_NETFILTER_XT_MATCH_LIMIT=y
CONFIG_NETFILTER_XT_MATCH_MAC=y
CONFIG_NETFILTER_XT_MATCH_MARK=y
CONFIG_NETFILTER_XT_MATCH_MULTIPORT=y
CONFIG_NETFILTER_XT_MATCH_NFACCT=y
CONFIG_NETFILTER_XT_MATCH_OSF=y
CONFIG_NETFILTER_XT_MATCH_OWNER=y
CONFIG_NETFILTER_XT_MATCH_POLICY=y
CONFIG_NETFILTER_XT_MATCH_PHYSDEV=y
CONFIG_NETFILTER_XT_MATCH_PKTTYPE=y
CONFIG_NETFILTER_XT_MATCH_QUOTA=y
CONFIG_NETFILTER_XT_MATCH_RATEEST=y
CONFIG_NETFILTER_XT_MATCH_REALM=y
CONFIG_NETFILTER_XT_MATCH_RECENT=y
CONFIG_NETFILTER_XT_MATCH_SCTP=y
CONFIG_NETFILTER_XT_MATCH_SOCKET=y
CONFIG_NETFILTER_XT_MATCH_STATE=y
CONFIG_NETFILTER_XT_MATCH_STATISTIC=y
CONFIG_NETFILTER_XT_MATCH_STRING=y
CONFIG_NETFILTER_XT_MATCH_TCPMSS=y
CONFIG_NETFILTER_XT_MATCH_TIME=y
CONFIG_NETFILTER_XT_MATCH_U32=y
# end of Core Netfilter Configuration

CONFIG_IP_SET=y
CONFIG_IP_SET_MAX=256
CONFIG_IP_SET_BITMAP_IP=y
CONFIG_IP_SET_BITMAP_IPMAC=y
CONFIG_IP_SET_BITMAP_PORT=y
CONFIG_IP_SET_HASH_IP=y
CONFIG_IP_SET_HASH_IPMARK=y
CONFIG_IP_SET_HASH_IPPORT=y
CONFIG_IP_SET_HASH_IPPORTIP=y
CONFIG_IP_SET_HASH_IPPORTNET=y
CONFIG_IP_SET_HASH_IPMAC=y
CONFIG_IP_SET_HASH_MAC=y
CONFIG_IP_SET_HASH_NETPORTNET=y
CONFIG_IP_SET_HASH_NET=y
CONFIG_IP_SET_HASH_NETNET=y
CONFIG_IP_SET_HASH_NETPORT=y
CONFIG_IP_SET_HASH_NETIFACE=y
CONFIG_IP_SET_LIST_SET=y
CONFIG_IP_VS=y
CONFIG_IP_VS_IPV6=y
# CONFIG_IP_VS_DEBUG is not set
CONFIG_IP_VS_TAB_BITS=12

#
# IPVS transport protocol load balancing support
#
CONFIG_IP_VS_PROTO_TCP=y
CONFIG_IP_VS_PROTO_UDP=y
CONFIG_IP_VS_PROTO_AH_ESP=y
CONFIG_IP_VS_PROTO_ESP=y
CONFIG_IP_VS_PROTO_AH=y
CONFIG_IP_VS_PROTO_SCTP=y

#
# IPVS scheduler
#
CONFIG_IP_VS_RR=y
CONFIG_IP_VS_WRR=y
CONFIG_IP_VS_LC=y
CONFIG_IP_VS_WLC=y
CONFIG_IP_VS_FO=y
CONFIG_IP_VS_OVF=y
CONFIG_IP_VS_LBLC=y
CONFIG_IP_VS_LBLCR=y
CONFIG_IP_VS_DH=y
CONFIG_IP_VS_SH=y
CONFIG_IP_VS_MH=y
CONFIG_IP_VS_SED=y
CONFIG_IP_VS_NQ=y
CONFIG_IP_VS_TWOS=y

#
# IPVS SH scheduler
#
CONFIG_IP_VS_SH_TAB_BITS=8

#
# IPVS MH scheduler
#
CONFIG_IP_VS_MH_TAB_INDEX=12

#
# IPVS application helper
#
CONFIG_IP_VS_FTP=y
CONFIG_IP_VS_NFCT=y
CONFIG_IP_VS_PE_SIP=y

#
# IP: Netfilter Configuration
#
CONFIG_NF_DEFRAG_IPV4=y
CONFIG_NF_SOCKET_IPV4=y
CONFIG_NF_TPROXY_IPV4=y
CONFIG_NF_TABLES_IPV4=y
CONFIG_NFT_REJECT_IPV4=y
CONFIG_NFT_DUP_IPV4=y
CONFIG_NFT_FIB_IPV4=y
CONFIG_NF_TABLES_ARP=y
CONFIG_NF_DUP_IPV4=y
CONFIG_NF_LOG_ARP=y
CONFIG_NF_LOG_IPV4=y
CONFIG_NF_REJECT_IPV4=y
CONFIG_NF_NAT_SNMP_BASIC=y
CONFIG_NF_NAT_PPTP=y
CONFIG_NF_NAT_H323=y
CONFIG_IP_NF_IPTABLES=y
CONFIG_IP_NF_MATCH_AH=y
CONFIG_IP_NF_MATCH_ECN=y
CONFIG_IP_NF_MATCH_RPFILTER=y
CONFIG_IP_NF_MATCH_TTL=y
CONFIG_IP_NF_TARGET_REJECT=y
CONFIG_IP_NF_TARGET_SYNPROXY=y
CONFIG_IP_NF_TARGET_ECN=y
CONFIG_NFT_COMPAT_ARP=y
CONFIG_IP_NF_ARP_MANGLE=y
# end of IP: Netfilter Configuration

#
# IPv6: Netfilter Configuration
#
CONFIG_NF_SOCKET_IPV6=y
CONFIG_NF_TPROXY_IPV6=y
CONFIG_NF_TABLES_IPV6=y
CONFIG_NFT_REJECT_IPV6=y
CONFIG_NFT_DUP_IPV6=y
CONFIG_NFT_FIB_IPV6=y
CONFIG_NF_DUP_IPV6=y
CONFIG_NF_REJECT_IPV6=y
CONFIG_NF_LOG_IPV6=y
CONFIG_IP6_NF_IPTABLES=y
CONFIG_IP6_NF_MATCH_AH=y
CONFIG_IP6_NF_MATCH_EUI64=y
CONFIG_IP6_NF_MATCH_FRAG=y
CONFIG_IP6_NF_MATCH_OPTS=y
CONFIG_IP6_NF_MATCH_HL=y
CONFIG_IP6_NF_MATCH_IPV6HEADER=y
CONFIG_IP6_NF_MATCH_MH=y
CONFIG_IP6_NF_MATCH_RPFILTER=y
CONFIG_IP6_NF_MATCH_RT=y
CONFIG_IP6_NF_MATCH_SRH=y
CONFIG_IP6_NF_TARGET_REJECT=y
CONFIG_IP6_NF_TARGET_SYNPROXY=y
CONFIG_IP6_NF_TARGET_NPT=y
# end of IPv6: Netfilter Configuration

CONFIG_NF_DEFRAG_IPV6=y
CONFIG_NF_TABLES_BRIDGE=y
CONFIG_NFT_BRIDGE_META=y
CONFIG_NFT_BRIDGE_REJECT=y
CONFIG_NF_CONNTRACK_BRIDGE=y
CONFIG_BRIDGE_NF_EBTABLES=y
CONFIG_BRIDGE_EBT_802_3=y
CONFIG_BRIDGE_EBT_AMONG=y
CONFIG_BRIDGE_EBT_ARP=y
CONFIG_BRIDGE_EBT_IP=y
CONFIG_BRIDGE_EBT_IP6=y
CONFIG_BRIDGE_EBT_LIMIT=y
CONFIG_BRIDGE_EBT_MARK=y
CONFIG_BRIDGE_EBT_PKTTYPE=y
CONFIG_BRIDGE_EBT_STP=y
CONFIG_BRIDGE_EBT_VLAN=y
CONFIG_BRIDGE_EBT_ARPREPLY=y
CONFIG_BRIDGE_EBT_DNAT=y
CONFIG_BRIDGE_EBT_MARK_T=y
CONFIG_BRIDGE_EBT_REDIRECT=y
CONFIG_BRIDGE_EBT_SNAT=y
CONFIG_BRIDGE_EBT_LOG=y
CONFIG_BRIDGE_EBT_NFLOG=y
CONFIG_IP_SCTP=y
# CONFIG_SCTP_DBG_OBJCNT is not set
CONFIG_SCTP_DEFAULT_COOKIE_HMAC_SHA256=y
# CONFIG_SCTP_DEFAULT_COOKIE_HMAC_NONE is not set
CONFIG_INET_SCTP_DIAG=y
CONFIG_RDS=y
CONFIG_RDS_RDMA=y
CONFIG_RDS_TCP=y
# CONFIG_RDS_DEBUG is not set
CONFIG_TIPC=y
CONFIG_TIPC_MEDIA_IB=y
CONFIG_TIPC_MEDIA_UDP=y
CONFIG_TIPC_CRYPTO=y
CONFIG_TIPC_DIAG=y
CONFIG_ATM=y
CONFIG_ATM_BR2684=y
# CONFIG_ATM_BR2684_IPFILTER is not set
CONFIG_L2TP=y
# CONFIG_L2TP_DEBUGFS is not set
CONFIG_L2TP_V3=y
CONFIG_L2TP_IP=y
CONFIG_L2TP_ETH=y
CONFIG_STP=y
CONFIG_GARP=y
CONFIG_MRP=y
CONFIG_BRIDGE=y
CONFIG_BRIDGE_IGMP_SNOOPING=y
CONFIG_BRIDGE_VLAN_FILTERING=y
CONFIG_BRIDGE_MRP=y
CONFIG_BRIDGE_CFM=y
CONFIG_NET_DSA=y
# CONFIG_NET_DSA_TAG_NONE is not set
# CONFIG_NET_DSA_TAG_AR9331 is not set
CONFIG_NET_DSA_TAG_BRCM_COMMON=y
CONFIG_NET_DSA_TAG_BRCM=y
# CONFIG_NET_DSA_TAG_BRCM_LEGACY is not set
# CONFIG_NET_DSA_TAG_BRCM_LEGACY_FCS is not set
CONFIG_NET_DSA_TAG_BRCM_PREPEND=y
# CONFIG_NET_DSA_TAG_HELLCREEK is not set
# CONFIG_NET_DSA_TAG_GSWIP is not set
# CONFIG_NET_DSA_TAG_DSA is not set
# CONFIG_NET_DSA_TAG_EDSA is not set
CONFIG_NET_DSA_TAG_MTK=y
# CONFIG_NET_DSA_TAG_MXL_862XX is not set
# CONFIG_NET_DSA_TAG_MXL_GSW1XX is not set
# CONFIG_NET_DSA_TAG_KSZ is not set
# CONFIG_NET_DSA_TAG_NETC is not set
# CONFIG_NET_DSA_TAG_OCELOT is not set
# CONFIG_NET_DSA_TAG_OCELOT_8021Q is not set
CONFIG_NET_DSA_TAG_QCA=y
CONFIG_NET_DSA_TAG_RTL4_A=y
# CONFIG_NET_DSA_TAG_RTL8_4 is not set
# CONFIG_NET_DSA_TAG_RZN1_A5PSW is not set
# CONFIG_NET_DSA_TAG_LAN9303 is not set
# CONFIG_NET_DSA_TAG_SJA1105 is not set
# CONFIG_NET_DSA_TAG_TRAILER is not set
# CONFIG_NET_DSA_TAG_VSC73XX_8021Q is not set
# CONFIG_NET_DSA_TAG_XRS700X is not set
# CONFIG_NET_DSA_TAG_YT921X is not set
CONFIG_VLAN_8021Q=y
CONFIG_VLAN_8021Q_GVRP=y
CONFIG_VLAN_8021Q_MVRP=y
CONFIG_LLC=y
CONFIG_LLC2=y
CONFIG_X25=y
CONFIG_LAPB=y
CONFIG_PHONET=y
CONFIG_6LOWPAN=y
# CONFIG_6LOWPAN_DEBUGFS is not set
CONFIG_6LOWPAN_NHC=y
CONFIG_6LOWPAN_NHC_DEST=y
CONFIG_6LOWPAN_NHC_FRAGMENT=y
CONFIG_6LOWPAN_NHC_HOP=y
CONFIG_6LOWPAN_NHC_IPV6=y
CONFIG_6LOWPAN_NHC_MOBILITY=y
CONFIG_6LOWPAN_NHC_ROUTING=y
CONFIG_6LOWPAN_NHC_UDP=y
CONFIG_6LOWPAN_GHC_EXT_HDR_HOP=y
CONFIG_6LOWPAN_GHC_UDP=y
CONFIG_6LOWPAN_GHC_ICMPV6=y
CONFIG_6LOWPAN_GHC_EXT_HDR_DEST=y
CONFIG_6LOWPAN_GHC_EXT_HDR_FRAG=y
CONFIG_6LOWPAN_GHC_EXT_HDR_ROUTE=y
CONFIG_IEEE802154=y
CONFIG_IEEE802154_NL802154_EXPERIMENTAL=y
CONFIG_IEEE802154_SOCKET=y
CONFIG_IEEE802154_6LOWPAN=y
CONFIG_MAC802154=y
CONFIG_NET_SCHED=y

#
# Queueing/Scheduling
#
CONFIG_NET_SCH_HTB=y
CONFIG_NET_SCH_HFSC=y
CONFIG_NET_SCH_PRIO=y
CONFIG_NET_SCH_MULTIQ=y
CONFIG_NET_SCH_RED=y
CONFIG_NET_SCH_SFB=y
CONFIG_NET_SCH_SFQ=y
CONFIG_NET_SCH_TEQL=y
CONFIG_NET_SCH_TBF=y
CONFIG_NET_SCH_CBS=y
CONFIG_NET_SCH_ETF=y
CONFIG_NET_SCH_MQPRIO_LIB=y
CONFIG_NET_SCH_TAPRIO=y
CONFIG_NET_SCH_GRED=y
CONFIG_NET_SCH_NETEM=y
CONFIG_NET_SCH_DRR=y
CONFIG_NET_SCH_MQPRIO=y
CONFIG_NET_SCH_SKBPRIO=y
CONFIG_NET_SCH_CHOKE=y
CONFIG_NET_SCH_QFQ=y
CONFIG_NET_SCH_CODEL=y
CONFIG_NET_SCH_FQ_CODEL=y
CONFIG_NET_SCH_CAKE=y
CONFIG_NET_SCH_FQ=y
CONFIG_NET_SCH_HHF=y
CONFIG_NET_SCH_PIE=y
CONFIG_NET_SCH_FQ_PIE=y
CONFIG_NET_SCH_INGRESS=y
CONFIG_NET_SCH_PLUG=y
CONFIG_NET_SCH_ETS=y
# CONFIG_NET_SCH_DUALPI2 is not set
CONFIG_NET_SCH_DEFAULT=y
# CONFIG_DEFAULT_FQ is not set
CONFIG_DEFAULT_CODEL=y
# CONFIG_DEFAULT_FQ_CODEL is not set
# CONFIG_DEFAULT_FQ_PIE is not set
# CONFIG_DEFAULT_SFQ is not set
# CONFIG_DEFAULT_PFIFO_FAST is not set
CONFIG_DEFAULT_NET_SCH="pfifo_fast"

#
# Classification
#
CONFIG_NET_CLS=y
CONFIG_NET_CLS_BASIC=y
CONFIG_NET_CLS_ROUTE4=y
CONFIG_NET_CLS_FW=y
CONFIG_NET_CLS_U32=y
CONFIG_CLS_U32_PERF=y
CONFIG_CLS_U32_MARK=y
CONFIG_NET_CLS_FLOW=y
CONFIG_NET_CLS_CGROUP=y
CONFIG_NET_CLS_BPF=y
CONFIG_NET_CLS_FLOWER=y
CONFIG_NET_CLS_MATCHALL=y
CONFIG_NET_EMATCH=y
CONFIG_NET_EMATCH_STACK=32
CONFIG_NET_EMATCH_CMP=y
CONFIG_NET_EMATCH_NBYTE=y
CONFIG_NET_EMATCH_U32=y
CONFIG_NET_EMATCH_META=y
CONFIG_NET_EMATCH_TEXT=y
CONFIG_NET_EMATCH_CANID=y
CONFIG_NET_EMATCH_IPSET=y
CONFIG_NET_EMATCH_IPT=y
CONFIG_NET_CLS_ACT=y
CONFIG_NET_ACT_POLICE=y
CONFIG_NET_ACT_GACT=y
CONFIG_GACT_PROB=y
CONFIG_NET_ACT_MIRRED=y
CONFIG_NET_ACT_SAMPLE=y
CONFIG_NET_ACT_NAT=y
CONFIG_NET_ACT_PEDIT=y
CONFIG_NET_ACT_SIMP=y
CONFIG_NET_ACT_SKBEDIT=y
CONFIG_NET_ACT_CSUM=y
CONFIG_NET_ACT_MPLS=y
CONFIG_NET_ACT_VLAN=y
CONFIG_NET_ACT_BPF=y
CONFIG_NET_ACT_CONNMARK=y
CONFIG_NET_ACT_CTINFO=y
CONFIG_NET_ACT_SKBMOD=y
CONFIG_NET_ACT_IFE=y
CONFIG_NET_ACT_TUNNEL_KEY=y
CONFIG_NET_ACT_CT=y
CONFIG_NET_ACT_GATE=y
CONFIG_NET_IFE_SKBMARK=y
CONFIG_NET_IFE_SKBPRIO=y
CONFIG_NET_IFE_SKBTCINDEX=y
CONFIG_NET_TC_SKB_EXT=y
CONFIG_NET_SCH_FIFO=y
CONFIG_DCB=y
CONFIG_DNS_RESOLVER=y
CONFIG_BATMAN_ADV=y
CONFIG_BATMAN_ADV_BATMAN_V=y
CONFIG_BATMAN_ADV_BLA=y
CONFIG_BATMAN_ADV_DAT=y
CONFIG_BATMAN_ADV_MCAST=y
# CONFIG_BATMAN_ADV_DEBUG is not set
# CONFIG_BATMAN_ADV_TRACING is not set
CONFIG_OPENVSWITCH=y
CONFIG_OPENVSWITCH_GRE=y
CONFIG_OPENVSWITCH_VXLAN=y
CONFIG_OPENVSWITCH_GENEVE=y
CONFIG_VSOCKETS=y
CONFIG_VSOCKETS_DIAG=y
CONFIG_VSOCKETS_LOOPBACK=y
# CONFIG_VMWARE_VMCI_VSOCKETS is not set
CONFIG_VIRTIO_VSOCKETS=y
CONFIG_VIRTIO_VSOCKETS_COMMON=y
CONFIG_NETLINK_DIAG=y
CONFIG_MPLS=y
CONFIG_NET_MPLS_GSO=y
CONFIG_MPLS_ROUTING=y
CONFIG_MPLS_IPTUNNEL=y
CONFIG_NET_NSH=y
CONFIG_HSR=y
CONFIG_NET_SWITCHDEV=y
CONFIG_NET_L3_MASTER_DEV=y
CONFIG_QRTR=y
CONFIG_QRTR_TUN=y
# CONFIG_QRTR_MHI is not set
CONFIG_NET_NCSI=y
# CONFIG_NCSI_OEM_CMD_GET_MAC is not set
# CONFIG_NCSI_OEM_CMD_KEEP_PHY is not set
# CONFIG_PCPU_DEV_REFCNT is not set
CONFIG_MAX_SKB_FRAGS=17
CONFIG_RPS=y
CONFIG_RFS_ACCEL=y
CONFIG_SOCK_RX_QUEUE_MAPPING=y
CONFIG_XPS=y
CONFIG_CGROUP_NET_PRIO=y
CONFIG_CGROUP_NET_CLASSID=y
CONFIG_BQL=y
CONFIG_NET_FLOW_LIMIT=y

#
# Network testing
#
# CONFIG_NET_PKTGEN is not set
CONFIG_NET_DROP_MONITOR=y
# end of Network testing
# end of Networking options

CONFIG_CAN=y
CONFIG_CAN_RAW=y
CONFIG_CAN_BCM=y
CONFIG_CAN_GW=y
CONFIG_CAN_J1939=y
CONFIG_CAN_ISOTP=y
CONFIG_BT=y
CONFIG_BT_BREDR=y
CONFIG_BT_RFCOMM=y
CONFIG_BT_RFCOMM_TTY=y
CONFIG_BT_BNEP=y
CONFIG_BT_BNEP_MC_FILTER=y
CONFIG_BT_BNEP_PROTO_FILTER=y
CONFIG_BT_HIDP=y
CONFIG_BT_LE=y
CONFIG_BT_LE_L2CAP_ECRED=y
CONFIG_BT_6LOWPAN=y
CONFIG_BT_LEDS=y
CONFIG_BT_MSFTEXT=y
# CONFIG_BT_AOSPEXT is not set
# CONFIG_BT_DEBUGFS is not set
# CONFIG_BT_SELFTEST is not set

#
# Bluetooth device drivers
#
CONFIG_BT_INTEL=y
CONFIG_BT_BCM=y
CONFIG_BT_RTL=y
CONFIG_BT_QCA=y
CONFIG_BT_MTK=y
CONFIG_BT_HCIBTUSB=y
CONFIG_BT_HCIBTUSB_AUTOSUSPEND=y
CONFIG_BT_HCIBTUSB_POLL_SYNC=y
CONFIG_BT_HCIBTUSB_BCM=y
CONFIG_BT_HCIBTUSB_MTK=y
CONFIG_BT_HCIBTUSB_RTL=y
# CONFIG_BT_HCIBTSDIO is not set
CONFIG_BT_HCIUART=y
CONFIG_BT_HCIUART_SERDEV=y
CONFIG_BT_HCIUART_H4=y
# CONFIG_BT_HCIUART_NOKIA is not set
CONFIG_BT_HCIUART_BCSP=y
# CONFIG_BT_HCIUART_ATH3K is not set
CONFIG_BT_HCIUART_LL=y
CONFIG_BT_HCIUART_3WIRE=y
# CONFIG_BT_HCIUART_INTEL is not set
# CONFIG_BT_HCIUART_BCM is not set
# CONFIG_BT_HCIUART_RTL is not set
CONFIG_BT_HCIUART_QCA=y
CONFIG_BT_HCIUART_AG6XX=y
CONFIG_BT_HCIUART_MRVL=y
# CONFIG_BT_HCIUART_AML is not set
CONFIG_BT_HCIBCM203X=y
# CONFIG_BT_HCIBCM4377 is not set
CONFIG_BT_HCIBPA10X=y
CONFIG_BT_HCIBFUSB=y
CONFIG_BT_HCIVHCI=y
CONFIG_BT_MRVL=y
CONFIG_BT_MRVL_SDIO=y
CONFIG_BT_ATH3K=y
CONFIG_BT_MTKSDIO=y
CONFIG_BT_MTKUART=y
# CONFIG_BT_VIRTIO is not set
# CONFIG_BT_NXPUART is not set
# CONFIG_BT_INTEL_PCIE is not set
# end of Bluetooth device drivers

CONFIG_AF_RXRPC=y
CONFIG_AF_RXRPC_IPV6=y
# CONFIG_AF_RXRPC_INJECT_LOSS is not set
# CONFIG_AF_RXRPC_INJECT_RX_DELAY is not set
# CONFIG_AF_RXRPC_DEBUG is not set
CONFIG_RXKAD=y
# CONFIG_RXGK is not set
# CONFIG_RXPERF is not set
CONFIG_AF_KCM=y
CONFIG_STREAM_PARSER=y
CONFIG_MCTP=y
CONFIG_FIB_RULES=y
CONFIG_WIRELESS=y
CONFIG_WEXT_CORE=y
CONFIG_WEXT_PROC=y
CONFIG_CFG80211=y
# CONFIG_NL80211_TESTMODE is not set
# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set
# CONFIG_CFG80211_CERTIFICATION_ONUS is not set
CONFIG_CFG80211_REQUIRE_SIGNED_REGDB=y
CONFIG_CFG80211_USE_KERNEL_REGDB_KEYS=y
CONFIG_CFG80211_DEFAULT_PS=y
CONFIG_CFG80211_DEBUGFS=y
CONFIG_CFG80211_CRDA_SUPPORT=y
CONFIG_CFG80211_WEXT=y
CONFIG_MAC80211=y
CONFIG_MAC80211_HAS_RC=y
CONFIG_MAC80211_RC_MINSTREL=y
CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y
CONFIG_MAC80211_RC_DEFAULT="minstrel_ht"
CONFIG_MAC80211_MESH=y
CONFIG_MAC80211_LEDS=y
CONFIG_MAC80211_DEBUGFS=y
# CONFIG_MAC80211_MESSAGE_TRACING is not set
# CONFIG_MAC80211_DEBUG_MENU is not set
CONFIG_MAC80211_STA_HASH_MAX_SIZE=0
CONFIG_RFKILL=y
CONFIG_RFKILL_LEDS=y
CONFIG_RFKILL_INPUT=y
# CONFIG_RFKILL_GPIO is not set
CONFIG_NET_9P=y
CONFIG_NET_9P_FD=y
CONFIG_NET_9P_VIRTIO=y
# CONFIG_NET_9P_USBG is not set
CONFIG_NET_9P_RDMA=y
# CONFIG_NET_9P_DEBUG is not set
CONFIG_CEPH_LIB=y
# CONFIG_CEPH_LIB_PRETTYDEBUG is not set
CONFIG_CEPH_LIB_USE_DNS_RESOLVER=y
CONFIG_NFC=y
CONFIG_NFC_DIGITAL=y
CONFIG_NFC_NCI=y
# CONFIG_NFC_NCI_SPI is not set
CONFIG_NFC_NCI_UART=y
CONFIG_NFC_HCI=y
CONFIG_NFC_SHDLC=y

#
# Near Field Communication (NFC) devices
#
# CONFIG_NFC_TRF7970A is not set
# CONFIG_NFC_MEI_PHY is not set
CONFIG_NFC_SIM=y
CONFIG_NFC_PORT100=y
CONFIG_NFC_VIRTUAL_NCI=y
CONFIG_NFC_FDP=y
# CONFIG_NFC_FDP_I2C is not set
# CONFIG_NFC_PN544_I2C is not set
CONFIG_NFC_PN533=y
CONFIG_NFC_PN533_USB=y
# CONFIG_NFC_PN533_I2C is not set
# CONFIG_NFC_PN532_UART is not set
# CONFIG_NFC_MICROREAD_I2C is not set
CONFIG_NFC_MRVL=y
CONFIG_NFC_MRVL_USB=y
# CONFIG_NFC_MRVL_UART is not set
# CONFIG_NFC_MRVL_I2C is not set
# CONFIG_NFC_ST21NFCA_I2C is not set
# CONFIG_NFC_ST_NCI_I2C is not set
# CONFIG_NFC_ST_NCI_SPI is not set
# CONFIG_NFC_NXP_NCI is not set
# CONFIG_NFC_S3FWRN5_I2C is not set
# CONFIG_NFC_S3FWRN82_UART is not set
# CONFIG_NFC_ST95HF is not set
# end of Near Field Communication (NFC) devices

CONFIG_PSAMPLE=y
CONFIG_NET_IFE=y
CONFIG_LWTUNNEL=y
CONFIG_LWTUNNEL_BPF=y
CONFIG_DST_CACHE=y
CONFIG_GRO_CELLS=y
CONFIG_SOCK_VALIDATE_XMIT=y
CONFIG_NET_SELFTESTS=y
CONFIG_NET_SOCK_MSG=y
CONFIG_NET_DEVLINK=y
CONFIG_PAGE_POOL=y
# CONFIG_PAGE_POOL_STATS is not set
CONFIG_FAILOVER=y
CONFIG_ETHTOOL_NETLINK=y

#
# Device Drivers
#
CONFIG_HAVE_PCI=y
CONFIG_GENERIC_PCI_IOMAP=y
CONFIG_PCI=y
CONFIG_PCI_DOMAINS=y
CONFIG_PCIEPORTBUS=y
CONFIG_HOTPLUG_PCI_PCIE=y
CONFIG_PCIEAER=y
# CONFIG_PCIEAER_INJECT is not set
# CONFIG_PCIE_ECRC is not set
CONFIG_PCIEASPM=y
CONFIG_PCIEASPM_DEFAULT=y
# CONFIG_PCIEASPM_POWERSAVE is not set
# CONFIG_PCIEASPM_POWER_SUPERSAVE is not set
# CONFIG_PCIEASPM_PERFORMANCE is not set
CONFIG_PCIE_PME=y
# CONFIG_PCIE_DPC is not set
# CONFIG_PCIE_PTM is not set
CONFIG_PCI_MSI=y
CONFIG_PCI_QUIRKS=y
# CONFIG_PCI_DEBUG is not set
# CONFIG_PCI_REALLOC_ENABLE_AUTO is not set
# CONFIG_PCI_STUB is not set
# CONFIG_PCI_PF_STUB is not set
CONFIG_PCI_ATS=y
# CONFIG_PCI_TSM is not set
# CONFIG_PCI_DOE is not set
CONFIG_PCI_ECAM=y
CONFIG_PCI_LOCKLESS_CONFIG=y
CONFIG_PCI_IOV=y
# CONFIG_PCI_NPEM is not set
CONFIG_PCI_PRI=y
CONFIG_PCI_PASID=y
# CONFIG_PCIE_TPH is not set
# CONFIG_PCI_P2PDMA is not set
CONFIG_PCI_LABEL=y
# CONFIG_PCI_DYNAMIC_OF_NODES is not set
CONFIG_VGA_ARB=y
CONFIG_VGA_ARB_MAX_GPUS=16
CONFIG_HOTPLUG_PCI=y
# CONFIG_HOTPLUG_PCI_ACPI is not set
# CONFIG_HOTPLUG_PCI_CPCI is not set
# CONFIG_HOTPLUG_PCI_OCTEONEP is not set
# CONFIG_HOTPLUG_PCI_SHPC is not set

#
# PCI controller drivers
#
CONFIG_PCI_HOST_COMMON=y
# CONFIG_PCI_FTPCI100 is not set
CONFIG_PCI_HOST_GENERIC=y
# CONFIG_VMD is not set
# CONFIG_PCIE_XILINX is not set

#
# Cadence-based PCIe controllers
#
# CONFIG_PCIE_CADENCE_PLAT_HOST is not set
# CONFIG_PCIE_CADENCE_PLAT_EP is not set
# end of Cadence-based PCIe controllers

#
# DesignWare-based PCIe controllers
#
# CONFIG_PCI_MESON is not set
# CONFIG_PCIE_INTEL_GW is not set
# CONFIG_PCIE_DW_PLAT_HOST is not set
# CONFIG_PCIE_DW_PLAT_EP is not set
# end of DesignWare-based PCIe controllers

#
# Mobiveil-based PCIe controllers
#
# end of Mobiveil-based PCIe controllers

#
# PLDA-based PCIe controllers
#
# CONFIG_PCIE_MICROCHIP_HOST is not set
# end of PLDA-based PCIe controllers
# end of PCI controller drivers

#
# PCI Endpoint
#
CONFIG_PCI_ENDPOINT=y
# CONFIG_PCI_ENDPOINT_CONFIGFS is not set
# CONFIG_PCI_ENDPOINT_MSI_DOORBELL is not set
# CONFIG_PCI_EPF_TEST is not set
# CONFIG_PCI_EPF_NTB is not set
# end of PCI Endpoint

#
# PCI switch controller drivers
#
# CONFIG_PCI_SW_SWITCHTEC is not set
# end of PCI switch controller drivers

# CONFIG_PCI_PWRCTRL_GENERIC is not set
# CONFIG_PCI_PWRCTRL_TC9563 is not set
# CONFIG_CXL_BUS is not set
CONFIG_PCCARD=y
CONFIG_PCMCIA=y
CONFIG_PCMCIA_LOAD_CIS=y
CONFIG_CARDBUS=y

#
# PC-card bridges
#
CONFIG_YENTA=y
CONFIG_YENTA_O2=y
CONFIG_YENTA_RICOH=y
CONFIG_YENTA_TI=y
CONFIG_YENTA_ENE_TUNE=y
CONFIG_YENTA_TOSHIBA=y
# CONFIG_PD6729 is not set
CONFIG_PCCARD_NONSTATIC=y
# CONFIG_RAPIDIO is not set
# CONFIG_PC104 is not set

#
# Generic Driver Options
#
CONFIG_AUXILIARY_BUS=y
CONFIG_UEVENT_HELPER=y
CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
# CONFIG_DEVTMPFS_SAFE is not set
CONFIG_DRIVER_DEFERRED_PROBE_TIMEOUT=10
CONFIG_STANDALONE=y
CONFIG_PREVENT_FIRMWARE_BUILD=y

#
# Firmware loader
#
CONFIG_FW_LOADER=y
# CONFIG_FW_LOADER_DEBUG is not set
CONFIG_FW_LOADER_PAGED_BUF=y
CONFIG_FW_LOADER_SYSFS=y
CONFIG_EXTRA_FIRMWARE=""
CONFIG_FW_LOADER_USER_HELPER=y
CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y
CONFIG_FW_LOADER_COMPRESS=y
# CONFIG_FW_LOADER_COMPRESS_XZ is not set
# CONFIG_FW_LOADER_COMPRESS_ZSTD is not set
CONFIG_FW_CACHE=y
# CONFIG_FW_UPLOAD is not set
# end of Firmware loader

CONFIG_WANT_DEV_COREDUMP=y
CONFIG_ALLOW_DEV_COREDUMP=y
CONFIG_DEV_COREDUMP=y
# CONFIG_DEBUG_DRIVER is not set
CONFIG_DEBUG_DEVRES=y
# CONFIG_DEBUG_TEST_DRIVER_REMOVE is not set
# CONFIG_TEST_ASYNC_DRIVER_PROBE is not set
CONFIG_GENERIC_CPU_DEVICES=y
CONFIG_GENERIC_CPU_AUTOPROBE=y
CONFIG_GENERIC_CPU_VULNERABILITIES=y
CONFIG_REGMAP=y
CONFIG_REGMAP_I2C=y
CONFIG_REGMAP_SPI=y
CONFIG_REGMAP_MMIO=y
CONFIG_REGMAP_IRQ=y
CONFIG_DMA_SHARED_BUFFER=y
# CONFIG_DMA_FENCE_TRACE is not set
# CONFIG_FW_DEVLINK_SYNC_STATE_TIMEOUT is not set
# end of Generic Driver Options

#
# Bus devices
#
# CONFIG_MOXTET is not set
CONFIG_MHI_BUS=y
# CONFIG_MHI_BUS_DEBUG is not set
# CONFIG_MHI_BUS_PCI_GENERIC is not set
# CONFIG_MHI_BUS_EP is not set
# end of Bus devices

CONFIG_CONNECTOR=y
CONFIG_PROC_EVENTS=y

#
# Firmware Drivers
#

#
# ARM System Control and Management Interface Protocol
#
# end of ARM System Control and Management Interface Protocol

# CONFIG_EDD is not set
CONFIG_FIRMWARE_MEMMAP=y
CONFIG_DMIID=y
# CONFIG_DMI_SYSFS is not set
CONFIG_DMI_SCAN_MACHINE_NON_EFI_FALLBACK=y
# CONFIG_ISCSI_IBFT is not set
# CONFIG_FW_CFG_SYSFS is not set
CONFIG_SYSFB=y
# CONFIG_SYSFB_SIMPLEFB is not set
CONFIG_GOOGLE_FIRMWARE=y
# CONFIG_GOOGLE_SMI is not set
# CONFIG_GOOGLE_CBMEM is not set
CONFIG_GOOGLE_COREBOOT_TABLE=y
CONFIG_GOOGLE_MEMCONSOLE=y
# CONFIG_GOOGLE_MEMCONSOLE_X86_LEGACY is not set
# CONFIG_GOOGLE_FRAMEBUFFER_COREBOOT is not set
CONFIG_GOOGLE_MEMCONSOLE_COREBOOT=y
CONFIG_GOOGLE_VPD=y

#
# Qualcomm firmware drivers
#
# end of Qualcomm firmware drivers

#
# Tegra firmware driver
#
# end of Tegra firmware driver
# end of Firmware Drivers

# CONFIG_FWCTL is not set
CONFIG_GNSS=y
# CONFIG_GNSS_MTK_SERIAL is not set
# CONFIG_GNSS_SIRF_SERIAL is not set
# CONFIG_GNSS_UBX_SERIAL is not set
CONFIG_GNSS_USB=y
CONFIG_MTD=y
# CONFIG_MTD_TESTS is not set

#
# Partition parsers
#
# CONFIG_MTD_CMDLINE_PARTS is not set
# CONFIG_MTD_OF_PARTS is not set
# CONFIG_MTD_REDBOOT_PARTS is not set
# end of Partition parsers

#
# User Modules And Translation Layers
#
CONFIG_MTD_BLKDEVS=y
CONFIG_MTD_BLOCK=y

#
# Note that in some cases UBI block is preferred. See MTD_UBI_BLOCK.
#
CONFIG_FTL=y
# CONFIG_NFTL is not set
# CONFIG_INFTL is not set
# CONFIG_RFD_FTL is not set
# CONFIG_SSFDC is not set
# CONFIG_SM_FTL is not set
# CONFIG_MTD_OOPS is not set
# CONFIG_MTD_SWAP is not set
# CONFIG_MTD_PARTITIONED_MASTER is not set

#
# RAM/ROM/Flash chip drivers
#
# CONFIG_MTD_CFI is not set
# CONFIG_MTD_JEDECPROBE is not set
CONFIG_MTD_MAP_BANK_WIDTH_1=y
CONFIG_MTD_MAP_BANK_WIDTH_2=y
CONFIG_MTD_MAP_BANK_WIDTH_4=y
CONFIG_MTD_CFI_I1=y
CONFIG_MTD_CFI_I2=y
# CONFIG_MTD_RAM is not set
# CONFIG_MTD_ROM is not set
# CONFIG_MTD_ABSENT is not set
# end of RAM/ROM/Flash chip drivers

#
# Mapping drivers for chip access
#
# CONFIG_MTD_COMPLEX_MAPPINGS is not set
# CONFIG_MTD_PLATRAM is not set
# end of Mapping drivers for chip access

#
# Self-contained MTD device drivers
#
# CONFIG_MTD_PMC551 is not set
# CONFIG_MTD_DATAFLASH is not set
# CONFIG_MTD_MCHP23K256 is not set
# CONFIG_MTD_MCHP48L640 is not set
# CONFIG_MTD_SST25L is not set
CONFIG_MTD_SLRAM=y
CONFIG_MTD_PHRAM=y
CONFIG_MTD_MTDRAM=y
CONFIG_MTDRAM_TOTAL_SIZE=128
CONFIG_MTDRAM_ERASE_SIZE=4
CONFIG_MTD_BLOCK2MTD=y

#
# Disk-On-Chip Device Drivers
#
# CONFIG_MTD_DOCG3 is not set
# end of Self-contained MTD device drivers

#
# NAND
#
# CONFIG_MTD_ONENAND is not set
# CONFIG_MTD_RAW_NAND is not set
# CONFIG_MTD_SPI_NAND is not set

#
# ECC engine support
#
# CONFIG_MTD_NAND_ECC_SW_HAMMING is not set
# CONFIG_MTD_NAND_ECC_SW_BCH is not set
# CONFIG_MTD_NAND_ECC_MXIC is not set
# end of ECC engine support
# end of NAND

#
# LPDDR & LPDDR2 PCM memory drivers
#
# CONFIG_MTD_LPDDR is not set
# end of LPDDR & LPDDR2 PCM memory drivers

# CONFIG_MTD_SPI_NOR is not set
CONFIG_MTD_UBI=y
CONFIG_MTD_UBI_WL_THRESHOLD=4096
CONFIG_MTD_UBI_BEB_LIMIT=20
# CONFIG_MTD_UBI_FASTMAP is not set
# CONFIG_MTD_UBI_GLUEBI is not set
# CONFIG_MTD_UBI_BLOCK is not set
# CONFIG_MTD_UBI_FAULT_INJECTION is not set
# CONFIG_MTD_UBI_NVMEM is not set
# CONFIG_MTD_HYPERBUS is not set
CONFIG_DTC=y
CONFIG_OF=y
# CONFIG_OF_UNITTEST is not set
CONFIG_OF_FLATTREE=y
CONFIG_OF_EARLY_FLATTREE=y
CONFIG_OF_KOBJ=y
CONFIG_OF_ADDRESS=y
CONFIG_OF_IRQ=y
CONFIG_OF_RESERVED_MEM=y
# CONFIG_OF_OVERLAY is not set
CONFIG_OF_NUMA=y
CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
CONFIG_PARPORT=y
# CONFIG_PARPORT_PC is not set
# CONFIG_PARPORT_1284 is not set
CONFIG_PARPORT_NOT_PC=y
CONFIG_PNP=y
CONFIG_PNP_DEBUG_MESSAGES=y

#
# Protocols
#
CONFIG_PNPACPI=y
CONFIG_BLK_DEV=y
CONFIG_BLK_DEV_NULL_BLK=y
CONFIG_BLK_DEV_NULL_BLK_FAULT_INJECTION=y
# CONFIG_BLK_DEV_FD is not set
CONFIG_CDROM=y
# CONFIG_BLK_DEV_PCIESSD_MTIP32XX is not set
CONFIG_ZRAM=y
# CONFIG_ZRAM_BACKEND_LZ4 is not set
# CONFIG_ZRAM_BACKEND_LZ4HC is not set
# CONFIG_ZRAM_BACKEND_ZSTD is not set
# CONFIG_ZRAM_BACKEND_DEFLATE is not set
# CONFIG_ZRAM_BACKEND_842 is not set
CONFIG_ZRAM_BACKEND_FORCE_LZO=y
CONFIG_ZRAM_BACKEND_LZO=y
# CONFIG_ZRAM_DEF_COMP_LZORLE is not set
CONFIG_ZRAM_DEF_COMP_LZO=y
CONFIG_ZRAM_DEF_COMP="lzo"
# CONFIG_ZRAM_WRITEBACK is not set
# CONFIG_ZRAM_TRACK_ENTRY_ACTIME is not set
# CONFIG_ZRAM_MEMORY_TRACKING is not set
# CONFIG_ZRAM_MULTI_COMP is not set
CONFIG_BLK_DEV_LOOP=y
CONFIG_BLK_DEV_LOOP_MIN_COUNT=16
# CONFIG_BLK_DEV_DRBD is not set
CONFIG_BLK_DEV_NBD=y
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_BLK_DEV_RAM_SIZE=4096
CONFIG_ATA_OVER_ETH=y
CONFIG_VIRTIO_BLK=y
# CONFIG_BLK_DEV_RBD is not set
CONFIG_BLK_DEV_UBLK=y
CONFIG_BLKDEV_UBLK_LEGACY_OPCODES=y
CONFIG_BLK_DEV_RNBD=y
CONFIG_BLK_DEV_RNBD_CLIENT=y
# CONFIG_BLK_DEV_ZONED_LOOP is not set

#
# NVME Support
#
CONFIG_NVME_CORE=y
CONFIG_BLK_DEV_NVME=y
CONFIG_NVME_MULTIPATH=y
# CONFIG_NVME_VERBOSE_ERRORS is not set
# CONFIG_NVME_HWMON is not set
CONFIG_NVME_FABRICS=y
CONFIG_NVME_RDMA=y
CONFIG_NVME_FC=y
CONFIG_NVME_TCP=y
# CONFIG_NVME_TCP_TLS is not set
# CONFIG_NVME_HOST_AUTH is not set
CONFIG_NVME_TARGET=y
# CONFIG_NVME_TARGET_DEBUGFS is not set
# CONFIG_NVME_TARGET_PASSTHRU is not set
CONFIG_NVME_TARGET_LOOP=y
CONFIG_NVME_TARGET_RDMA=y
CONFIG_NVME_TARGET_FC=y
CONFIG_NVME_TARGET_FCLOOP=y
CONFIG_NVME_TARGET_TCP=y
# CONFIG_NVME_TARGET_TCP_TLS is not set
# CONFIG_NVME_TARGET_AUTH is not set
# CONFIG_NVME_TARGET_PCI_EPF is not set
# end of NVME Support

#
# Misc devices
#
# CONFIG_AD525X_DPOT is not set
# CONFIG_DUMMY_IRQ is not set
# CONFIG_IBM_ASM is not set
# CONFIG_PHANTOM is not set
# CONFIG_RPMB is not set
# CONFIG_TI_FPC202 is not set
# CONFIG_TIFM_CORE is not set
# CONFIG_ICS932S401 is not set
# CONFIG_ENCLOSURE_SERVICES is not set
# CONFIG_HP_ILO is not set
# CONFIG_APDS9802ALS is not set
# CONFIG_ISL29003 is not set
# CONFIG_ISL29020 is not set
# CONFIG_SENSORS_TSL2550 is not set
# CONFIG_SENSORS_BH1770 is not set
# CONFIG_HMC6352 is not set
# CONFIG_DS1682 is not set
# CONFIG_VMWARE_BALLOON is not set
# CONFIG_LATTICE_ECP3_CONFIG is not set
# CONFIG_SRAM is not set
# CONFIG_DW_XDATA_PCIE is not set
# CONFIG_PCI_ENDPOINT_TEST is not set
# CONFIG_XILINX_SDFEC is not set
CONFIG_MISC_RTSX=y
# CONFIG_HISI_HIKEY_USB is not set
# CONFIG_OPEN_DICE is not set
# CONFIG_NTSYNC is not set
# CONFIG_VCPU_STALL_DETECTOR is not set
# CONFIG_NSM is not set
# CONFIG_C2PORT is not set

#
# EEPROM support
#
# CONFIG_EEPROM_AT24 is not set
# CONFIG_EEPROM_AT25 is not set
# CONFIG_EEPROM_MAX6875 is not set
CONFIG_EEPROM_93CX6=y
# CONFIG_EEPROM_93XX46 is not set
# CONFIG_EEPROM_IDT_89HPESX is not set
# CONFIG_EEPROM_EE1004 is not set
# CONFIG_EEPROM_M24LR is not set
# end of EEPROM support

# CONFIG_CB710_CORE is not set
# CONFIG_SENSORS_LIS3_I2C is not set
# CONFIG_ALTERA_STAPL is not set
CONFIG_INTEL_MEI=y
CONFIG_INTEL_MEI_ME=y
# CONFIG_INTEL_MEI_TXE is not set
# CONFIG_INTEL_MEI_CSC is not set
# CONFIG_INTEL_MEI_VSC_HW is not set
CONFIG_VMWARE_VMCI=y
# CONFIG_GENWQE is not set
# CONFIG_BCM_VK is not set
# CONFIG_MISC_ALCOR_PCI is not set
# CONFIG_MISC_RTSX_PCI is not set
CONFIG_MISC_RTSX_USB=y
# CONFIG_UACCE is not set
# CONFIG_PVPANIC is not set
# CONFIG_GP_PCI1XXXX is not set
# CONFIG_KEBA_CP500 is not set
# CONFIG_MISC_RP1 is not set
# end of Misc devices

#
# SCSI device support
#
CONFIG_SCSI_MOD=y
CONFIG_RAID_ATTRS=y
CONFIG_SCSI_COMMON=y
CONFIG_SCSI=y
CONFIG_SCSI_DMA=y
CONFIG_SCSI_NETLINK=y
CONFIG_SCSI_PROC_FS=y

#
# SCSI support type (disk, tape, CD-ROM)
#
CONFIG_BLK_DEV_SD=y
CONFIG_CHR_DEV_ST=y
CONFIG_BLK_DEV_SR=y
CONFIG_CHR_DEV_SG=y
CONFIG_BLK_DEV_BSG=y
# CONFIG_CHR_DEV_SCH is not set
CONFIG_SCSI_CONSTANTS=y
CONFIG_SCSI_LOGGING=y
CONFIG_SCSI_SCAN_ASYNC=y

#
# SCSI Transports
#
CONFIG_SCSI_SPI_ATTRS=y
CONFIG_SCSI_FC_ATTRS=y
CONFIG_SCSI_ISCSI_ATTRS=y
CONFIG_SCSI_SAS_ATTRS=y
CONFIG_SCSI_SAS_LIBSAS=y
CONFIG_SCSI_SAS_ATA=y
# CONFIG_SCSI_SAS_HOST_SMP is not set
CONFIG_SCSI_SRP_ATTRS=y
# end of SCSI Transports

CONFIG_SCSI_LOWLEVEL=y
# CONFIG_ISCSI_TCP is not set
# CONFIG_ISCSI_BOOT_SYSFS is not set
# CONFIG_SCSI_CXGB3_ISCSI is not set
# CONFIG_SCSI_CXGB4_ISCSI is not set
# CONFIG_SCSI_BNX2_ISCSI is not set
# CONFIG_BE2ISCSI is not set
# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
CONFIG_SCSI_HPSA=y
# CONFIG_SCSI_3W_9XXX is not set
# CONFIG_SCSI_3W_SAS is not set
# CONFIG_SCSI_ACARD is not set
# CONFIG_SCSI_AACRAID is not set
# CONFIG_SCSI_AIC7XXX is not set
# CONFIG_SCSI_AIC79XX is not set
# CONFIG_SCSI_AIC94XX is not set
# CONFIG_SCSI_MVSAS is not set
# CONFIG_SCSI_MVUMI is not set
# CONFIG_SCSI_ADVANSYS is not set
# CONFIG_SCSI_ARCMSR is not set
# CONFIG_SCSI_ESAS2R is not set
# CONFIG_MEGARAID_NEWGEN is not set
# CONFIG_MEGARAID_LEGACY is not set
# CONFIG_MEGARAID_SAS is not set
# CONFIG_SCSI_MPT3SAS is not set
# CONFIG_SCSI_MPT2SAS is not set
# CONFIG_SCSI_MPI3MR is not set
# CONFIG_SCSI_SMARTPQI is not set
# CONFIG_SCSI_HPTIOP is not set
# CONFIG_SCSI_BUSLOGIC is not set
# CONFIG_SCSI_MYRB is not set
# CONFIG_SCSI_MYRS is not set
# CONFIG_VMWARE_PVSCSI is not set
# CONFIG_LIBFC is not set
# CONFIG_SCSI_SNIC is not set
# CONFIG_SCSI_DMX3191D is not set
# CONFIG_SCSI_FDOMAIN_PCI is not set
# CONFIG_SCSI_ISCI is not set
# CONFIG_SCSI_IPS is not set
# CONFIG_SCSI_INITIO is not set
# CONFIG_SCSI_INIA100 is not set
# CONFIG_SCSI_STEX is not set
# CONFIG_SCSI_SYM53C8XX_2 is not set
# CONFIG_SCSI_IPR is not set
# CONFIG_SCSI_QLOGIC_1280 is not set
# CONFIG_SCSI_QLA_FC is not set
# CONFIG_SCSI_QLA_ISCSI is not set
# CONFIG_SCSI_LPFC is not set
# CONFIG_SCSI_EFCT is not set
# CONFIG_SCSI_DC395x is not set
# CONFIG_SCSI_AM53C974 is not set
# CONFIG_SCSI_WD719X is not set
# CONFIG_SCSI_DEBUG is not set
# CONFIG_SCSI_PMCRAID is not set
# CONFIG_SCSI_PM8001 is not set
# CONFIG_SCSI_BFA_FC is not set
CONFIG_SCSI_VIRTIO=y
# CONFIG_SCSI_CHELSIO_FCOE is not set
# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set
# CONFIG_SCSI_DH is not set
# end of SCSI device support

CONFIG_ATA=y
CONFIG_SATA_HOST=y
CONFIG_PATA_TIMINGS=y
CONFIG_ATA_VERBOSE_ERROR=y
CONFIG_ATA_FORCE=y
CONFIG_ATA_ACPI=y
# CONFIG_SATA_ZPODD is not set
CONFIG_SATA_PMP=y

#
# Controllers with non-SFF native interface
#
CONFIG_SATA_AHCI=y
CONFIG_SATA_MOBILE_LPM_POLICY=3
# CONFIG_SATA_AHCI_PLATFORM is not set
# CONFIG_AHCI_DWC is not set
# CONFIG_AHCI_CEVA is not set
# CONFIG_SATA_INIC162X is not set
# CONFIG_SATA_ACARD_AHCI is not set
# CONFIG_SATA_SIL24 is not set
CONFIG_ATA_SFF=y

#
# SFF controllers with custom DMA interface
#
# CONFIG_PDC_ADMA is not set
# CONFIG_SATA_QSTOR is not set
# CONFIG_SATA_SX4 is not set
CONFIG_ATA_BMDMA=y

#
# SATA SFF controllers with BMDMA
#
CONFIG_ATA_PIIX=y
# CONFIG_SATA_DWC is not set
# CONFIG_SATA_MV is not set
# CONFIG_SATA_NV is not set
# CONFIG_SATA_PROMISE is not set
# CONFIG_SATA_SIL is not set
# CONFIG_SATA_SIS is not set
# CONFIG_SATA_SVW is not set
# CONFIG_SATA_ULI is not set
# CONFIG_SATA_VIA is not set
# CONFIG_SATA_VITESSE is not set

#
# PATA SFF controllers with BMDMA
#
# CONFIG_PATA_ALI is not set
CONFIG_PATA_AMD=y
# CONFIG_PATA_ARTOP is not set
# CONFIG_PATA_ATIIXP is not set
# CONFIG_PATA_ATP867X is not set
# CONFIG_PATA_CMD64X is not set
# CONFIG_PATA_CYPRESS is not set
# CONFIG_PATA_EFAR is not set
# CONFIG_PATA_HPT366 is not set
# CONFIG_PATA_HPT37X is not set
# CONFIG_PATA_HPT3X2N is not set
# CONFIG_PATA_HPT3X3 is not set
# CONFIG_PATA_IT8213 is not set
# CONFIG_PATA_IT821X is not set
# CONFIG_PATA_JMICRON is not set
# CONFIG_PATA_MARVELL is not set
# CONFIG_PATA_NETCELL is not set
# CONFIG_PATA_NINJA32 is not set
# CONFIG_PATA_NS87415 is not set
CONFIG_PATA_OLDPIIX=y
# CONFIG_PATA_OPTIDMA is not set
# CONFIG_PATA_PDC2027X is not set
# CONFIG_PATA_PDC_OLD is not set
# CONFIG_PATA_RADISYS is not set
# CONFIG_PATA_RDC is not set
CONFIG_PATA_SCH=y
# CONFIG_PATA_SERVERWORKS is not set
# CONFIG_PATA_SIL680 is not set
# CONFIG_PATA_SIS is not set
# CONFIG_PATA_TOSHIBA is not set
# CONFIG_PATA_TRIFLEX is not set
# CONFIG_PATA_VIA is not set
# CONFIG_PATA_WINBOND is not set

#
# PIO-only SFF controllers
#
# CONFIG_PATA_CMD640_PCI is not set
# CONFIG_PATA_MPIIX is not set
# CONFIG_PATA_NS87410 is not set
# CONFIG_PATA_OPTI is not set
# CONFIG_PATA_PCMCIA is not set
# CONFIG_PATA_OF_PLATFORM is not set
# CONFIG_PATA_RZ1000 is not set

#
# Generic fallback / legacy drivers
#
# CONFIG_PATA_ACPI is not set
CONFIG_ATA_GENERIC=y
# CONFIG_PATA_LEGACY is not set
CONFIG_MD=y
CONFIG_BLK_DEV_MD=y
CONFIG_MD_BITMAP=y
# CONFIG_MD_LLBITMAP is not set
CONFIG_MD_AUTODETECT=y
CONFIG_MD_BITMAP_FILE=y
# CONFIG_MD_LINEAR is not set
CONFIG_MD_RAID0=y
CONFIG_MD_RAID1=y
CONFIG_MD_RAID10=y
CONFIG_MD_RAID456=y
# CONFIG_MD_CLUSTER is not set
CONFIG_BCACHE=y
# CONFIG_BCACHE_DEBUG is not set
# CONFIG_BCACHE_ASYNC_REGISTRATION is not set
CONFIG_BLK_DEV_DM_BUILTIN=y
CONFIG_BLK_DEV_DM=y
# CONFIG_DM_DEBUG is not set
CONFIG_DM_BUFIO=y
# CONFIG_DM_DEBUG_BLOCK_MANAGER_LOCKING is not set
CONFIG_DM_BIO_PRISON=y
CONFIG_DM_PERSISTENT_DATA=y
# CONFIG_DM_UNSTRIPED is not set
CONFIG_DM_CRYPT=y
# CONFIG_DM_INLINECRYPT is not set
CONFIG_DM_SNAPSHOT=y
CONFIG_DM_THIN_PROVISIONING=y
CONFIG_DM_CACHE=y
CONFIG_DM_CACHE_SMQ=y
CONFIG_DM_WRITECACHE=y
# CONFIG_DM_EBS is not set
# CONFIG_DM_ERA is not set
CONFIG_DM_CLONE=y
CONFIG_DM_MIRROR=y
# CONFIG_DM_LOG_USERSPACE is not set
CONFIG_DM_RAID=y
CONFIG_DM_ZERO=y
CONFIG_DM_MULTIPATH=y
CONFIG_DM_MULTIPATH_QL=y
CONFIG_DM_MULTIPATH_ST=y
# CONFIG_DM_MULTIPATH_HST is not set
# CONFIG_DM_MULTIPATH_IOA is not set
# CONFIG_DM_DELAY is not set
# CONFIG_DM_DUST is not set
# CONFIG_DM_INIT is not set
CONFIG_DM_UEVENT=y
CONFIG_DM_FLAKEY=y
CONFIG_DM_VERITY=y
# CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG is not set
CONFIG_DM_VERITY_FEC=y
# CONFIG_DM_SWITCH is not set
# CONFIG_DM_LOG_WRITES is not set
CONFIG_DM_INTEGRITY=y
CONFIG_DM_ZONED=y
CONFIG_DM_AUDIT=y
# CONFIG_DM_VDO is not set
CONFIG_TARGET_CORE=y
# CONFIG_TCM_IBLOCK is not set
# CONFIG_TCM_FILEIO is not set
# CONFIG_TCM_PSCSI is not set
# CONFIG_LOOPBACK_TARGET is not set
# CONFIG_ISCSI_TARGET is not set
# CONFIG_SBP_TARGET is not set
# CONFIG_REMOTE_TARGET is not set
# CONFIG_FUSION is not set

#
# IEEE 1394 (FireWire) support
#
CONFIG_FIREWIRE=y
CONFIG_FIREWIRE_OHCI=y
CONFIG_FIREWIRE_SBP2=y
CONFIG_FIREWIRE_NET=y
# CONFIG_FIREWIRE_NOSY is not set
# end of IEEE 1394 (FireWire) support

# CONFIG_MACINTOSH_DRIVERS is not set
CONFIG_NETDEVICES=y
CONFIG_MII=y
CONFIG_NET_CORE=y
CONFIG_BONDING=y
CONFIG_DUMMY=y
CONFIG_WIREGUARD=y
# CONFIG_WIREGUARD_DEBUG is not set
# CONFIG_OVPN is not set
CONFIG_EQUALIZER=y
CONFIG_NET_FC=y
CONFIG_IFB=y
CONFIG_NET_TEAM=y
CONFIG_NET_TEAM_MODE_BROADCAST=y
CONFIG_NET_TEAM_MODE_ROUNDROBIN=y
CONFIG_NET_TEAM_MODE_RANDOM=y
CONFIG_NET_TEAM_MODE_ACTIVEBACKUP=y
CONFIG_NET_TEAM_MODE_LOADBALANCE=y
CONFIG_MACVLAN=y
CONFIG_MACVTAP=y
CONFIG_IPVLAN_L3S=y
CONFIG_IPVLAN=y
CONFIG_IPVTAP=y
CONFIG_VXLAN=y
CONFIG_GENEVE=y
CONFIG_BAREUDP=y
CONFIG_GTP=y
# CONFIG_PFCP is not set
# CONFIG_AMT is not set
CONFIG_MACSEC=y
CONFIG_NETCONSOLE=y
# CONFIG_NETCONSOLE_DYNAMIC is not set
# CONFIG_NETCONSOLE_EXTENDED_LOG is not set
CONFIG_NETPOLL=y
CONFIG_NET_POLL_CONTROLLER=y
CONFIG_TUN=y
CONFIG_TAP=y
CONFIG_TUN_VNET_CROSS_LE=y
CONFIG_VETH=y
CONFIG_VIRTIO_NET=y
CONFIG_NLMON=y
# CONFIG_NETKIT is not set
CONFIG_NET_VRF=y
CONFIG_VSOCKMON=y
# CONFIG_MHI_NET is not set
# CONFIG_ARCNET is not set
CONFIG_ATM_DRIVERS=y
# CONFIG_ATM_SOLOS is not set

#
# Distributed Switch Architecture drivers
#
# CONFIG_B53 is not set
# CONFIG_NET_DSA_BCM_SF2 is not set
# CONFIG_NET_DSA_LOOP is not set
# CONFIG_NET_DSA_HIRSCHMANN_HELLCREEK is not set
# CONFIG_NET_DSA_LANTIQ_GSWIP is not set
# CONFIG_NET_DSA_MXL_GSW1XX is not set
# CONFIG_NET_DSA_MT7530 is not set
# CONFIG_NET_DSA_MV88E6060 is not set
# CONFIG_NET_DSA_MICROCHIP_KSZ_COMMON is not set
# CONFIG_NET_DSA_MV88E6XXX is not set
# CONFIG_NET_DSA_MXL862 is not set
# CONFIG_NET_DSA_AR9331 is not set
# CONFIG_NET_DSA_QCA8K is not set
# CONFIG_NET_DSA_SJA1105 is not set
# CONFIG_NET_DSA_XRS700X_I2C is not set
# CONFIG_NET_DSA_XRS700X_MDIO is not set
# CONFIG_NET_DSA_REALTEK is not set
# CONFIG_NET_DSA_KS8995 is not set
# CONFIG_NET_DSA_SMSC_LAN9303_I2C is not set
# CONFIG_NET_DSA_SMSC_LAN9303_MDIO is not set
# CONFIG_NET_DSA_VITESSE_VSC73XX_SPI is not set
# CONFIG_NET_DSA_VITESSE_VSC73XX_PLATFORM is not set
# CONFIG_NET_DSA_YT921X is not set
# end of Distributed Switch Architecture drivers

CONFIG_ETHERNET=y
# CONFIG_NET_VENDOR_3COM is not set
# CONFIG_NET_VENDOR_ADAPTEC is not set
# CONFIG_NET_VENDOR_AGERE is not set
# CONFIG_NET_VENDOR_ALACRITECH is not set
CONFIG_NET_VENDOR_ALIBABA=y
# CONFIG_ALIBABA_EEA is not set
# CONFIG_ALTERA_TSE is not set
CONFIG_NET_VENDOR_AMAZON=y
# CONFIG_ENA_ETHERNET is not set
# CONFIG_NET_VENDOR_AMD is not set
# CONFIG_NET_VENDOR_AQUANTIA is not set
# CONFIG_NET_VENDOR_ARC is not set
CONFIG_NET_VENDOR_ASIX=y
# CONFIG_SPI_AX88796C is not set
# CONFIG_NET_VENDOR_ATHEROS is not set
# CONFIG_CX_ECAT is not set
# CONFIG_NET_VENDOR_BROADCOM is not set
# CONFIG_NET_VENDOR_CADENCE is not set
# CONFIG_NET_VENDOR_CAVIUM is not set
# CONFIG_NET_VENDOR_CHELSIO is not set
CONFIG_NET_VENDOR_CISCO=y
# CONFIG_ENIC is not set
# CONFIG_NET_VENDOR_CORTINA is not set
CONFIG_NET_VENDOR_DAVICOM=y
# CONFIG_DM9051 is not set
# CONFIG_NET_VENDOR_DEC is not set
# CONFIG_NET_VENDOR_DLINK is not set
# CONFIG_NET_VENDOR_EMULEX is not set
CONFIG_NET_VENDOR_ENGLEDER=y
# CONFIG_TSNEP is not set
# CONFIG_NET_VENDOR_EZCHIP is not set
CONFIG_NET_VENDOR_FUNGIBLE=y
# CONFIG_FUN_ETH is not set
CONFIG_NET_VENDOR_GOOGLE=y
CONFIG_GVE=y
CONFIG_NET_VENDOR_HISILICON=y
# CONFIG_HIBMCGE is not set
# CONFIG_NET_VENDOR_HUAWEI is not set
CONFIG_NET_VENDOR_I825XX=y
CONFIG_NET_VENDOR_INTEL=y
CONFIG_E100=y
CONFIG_E1000=y
CONFIG_E1000E=y
CONFIG_E1000E_HWTS=y
# CONFIG_IGB is not set
# CONFIG_IGBVF is not set
# CONFIG_IXGBE is not set
# CONFIG_IXGBEVF is not set
# CONFIG_I40E is not set
# CONFIG_I40EVF is not set
# CONFIG_ICE is not set
# CONFIG_FM10K is not set
# CONFIG_IGC is not set
# CONFIG_IDPF is not set
# CONFIG_JME is not set
# CONFIG_NET_VENDOR_ADI is not set
CONFIG_NET_VENDOR_LITEX=y
# CONFIG_LITEX_LITEETH is not set
# CONFIG_NET_VENDOR_MARVELL is not set
CONFIG_NET_VENDOR_MELLANOX=y
# CONFIG_MLX4_EN is not set
CONFIG_MLX4_CORE=y
# CONFIG_MLX4_DEBUG is not set
# CONFIG_MLX4_CORE_GEN2 is not set
# CONFIG_MLX5_CORE is not set
# CONFIG_MLXSW_CORE is not set
# CONFIG_MLXFW is not set
CONFIG_NET_VENDOR_META=y
# CONFIG_FBNIC is not set
# CONFIG_NET_VENDOR_MICREL is not set
# CONFIG_NET_VENDOR_MICROCHIP is not set
# CONFIG_NET_VENDOR_MICROSEMI is not set
CONFIG_NET_VENDOR_MICROSOFT=y
CONFIG_NET_VENDOR_MUCSE=y
# CONFIG_MGBE is not set
# CONFIG_NET_VENDOR_MYRI is not set
# CONFIG_FEALNX is not set
# CONFIG_NET_VENDOR_NI is not set
# CONFIG_NET_VENDOR_NATSEMI is not set
# CONFIG_NET_VENDOR_NETRONOME is not set
# CONFIG_NET_VENDOR_NVIDIA is not set
# CONFIG_NET_VENDOR_OKI is not set
# CONFIG_ETHOC is not set
# CONFIG_NET_VENDOR_PENSANDO is not set
# CONFIG_NET_VENDOR_QLOGIC is not set
# CONFIG_NET_VENDOR_BROCADE is not set
# CONFIG_NET_VENDOR_QUALCOMM is not set
# CONFIG_NET_VENDOR_RDC is not set
# CONFIG_NET_VENDOR_REALTEK is not set
# CONFIG_NET_VENDOR_RENESAS is not set
# CONFIG_NET_VENDOR_ROCKER is not set
# CONFIG_NET_VENDOR_SAMSUNG is not set
# CONFIG_NET_VENDOR_SEEQ is not set
# CONFIG_NET_VENDOR_SILAN is not set
# CONFIG_NET_VENDOR_SIS is not set
# CONFIG_NET_VENDOR_SOLARFLARE is not set
# CONFIG_NET_VENDOR_SMSC is not set
# CONFIG_NET_VENDOR_SOCIONEXT is not set
# CONFIG_NET_VENDOR_STMICRO is not set
# CONFIG_NET_VENDOR_SUN is not set
# CONFIG_NET_VENDOR_SYNOPSYS is not set
# CONFIG_NET_VENDOR_TEHUTI is not set
# CONFIG_NET_VENDOR_TI is not set
CONFIG_NET_VENDOR_VERTEXCOM=y
# CONFIG_MSE102X is not set
# CONFIG_NET_VENDOR_VIA is not set
CONFIG_NET_VENDOR_WANGXUN=y
# CONFIG_NGBE is not set
# CONFIG_TXGBE is not set
# CONFIG_TXGBEVF is not set
# CONFIG_NGBEVF is not set
# CONFIG_NET_VENDOR_WIZNET is not set
# CONFIG_NET_VENDOR_XILINX is not set
# CONFIG_NET_VENDOR_XIRCOM is not set
CONFIG_FDDI=y
# CONFIG_DEFXX is not set
# CONFIG_SKFP is not set
CONFIG_PHYLINK=y
CONFIG_PHYLIB=y
CONFIG_SWPHY=y
CONFIG_PHY_PACKAGE=y
# CONFIG_LED_TRIGGER_PHY is not set
CONFIG_PHYLIB_LEDS=y
CONFIG_FIXED_PHY=y
# CONFIG_SFP is not set

#
# MII PHY device drivers
#
# CONFIG_AS21XXX_PHY is not set
# CONFIG_AIR_AN8801_PHY is not set
# CONFIG_AIR_EN8811H_PHY is not set
# CONFIG_AMD_PHY is not set
# CONFIG_ADIN_PHY is not set
# CONFIG_ADIN1100_PHY is not set
# CONFIG_AQUANTIA_PHY is not set
CONFIG_AX88796B_PHY=y
# CONFIG_BROADCOM_PHY is not set
# CONFIG_BCM54140_PHY is not set
# CONFIG_BCM7XXX_PHY is not set
# CONFIG_BCM84881_PHY is not set
# CONFIG_BCM87XX_PHY is not set
# CONFIG_CICADA_PHY is not set
# CONFIG_CORTINA_PHY is not set
# CONFIG_DAVICOM_PHY is not set
# CONFIG_ICPLUS_PHY is not set
# CONFIG_LXT_PHY is not set
# CONFIG_INTEL_XWAY_PHY is not set
# CONFIG_LSI_ET1011C_PHY is not set
# CONFIG_MARVELL_PHY is not set
# CONFIG_MARVELL_10G_PHY is not set
# CONFIG_MARVELL_88Q2XXX_PHY is not set
# CONFIG_MARVELL_88X2222_PHY is not set
# CONFIG_MAXLINEAR_GPHY is not set
# CONFIG_MAXLINEAR_86110_PHY is not set
# CONFIG_MEDIATEK_GE_PHY is not set
# CONFIG_MICREL_PHY is not set
# CONFIG_MICROCHIP_T1S_PHY is not set
CONFIG_MICROCHIP_PHY=y
# CONFIG_MICROCHIP_T1_PHY is not set
# CONFIG_MICROSEMI_PHY is not set
# CONFIG_MOTORCOMM_PHY is not set
# CONFIG_NATIONAL_PHY is not set
# CONFIG_NXP_CBTX_PHY is not set
# CONFIG_NXP_C45_TJA11XX_PHY is not set
# CONFIG_NXP_TJA11XX_PHY is not set
# CONFIG_NCN26000_PHY is not set
# CONFIG_AT803X_PHY is not set
# CONFIG_QCA83XX_PHY is not set
# CONFIG_QCA808X_PHY is not set
# CONFIG_QCA807X_PHY is not set
# CONFIG_QSEMI_PHY is not set
CONFIG_REALTEK_PHY=y
# CONFIG_REALTEK_PHY_HWMON is not set
# CONFIG_RENESAS_PHY is not set
# CONFIG_ROCKCHIP_PHY is not set
CONFIG_SMSC_PHY=y
# CONFIG_STE10XP is not set
# CONFIG_TERANETICS_PHY is not set
# CONFIG_DP83822_PHY is not set
# CONFIG_DP83TC811_PHY is not set
# CONFIG_DP83848_PHY is not set
# CONFIG_DP83867_PHY is not set
# CONFIG_DP83869_PHY is not set
# CONFIG_DP83TD510_PHY is not set
# CONFIG_DP83TG720_PHY is not set
# CONFIG_VITESSE_PHY is not set
# CONFIG_XILINX_GMII2RGMII is not set
# CONFIG_PSE_CONTROLLER is not set
CONFIG_CAN_DEV=y
CONFIG_CAN_VCAN=y
CONFIG_CAN_VXCAN=y
CONFIG_CAN_NETLINK=y
CONFIG_CAN_CALC_BITTIMING=y
CONFIG_CAN_RX_OFFLOAD=y
# CONFIG_CAN_CAN327 is not set
# CONFIG_CAN_DUMMY is not set
# CONFIG_CAN_FLEXCAN is not set
# CONFIG_CAN_GRCAN is not set
# CONFIG_CAN_KVASER_PCIEFD is not set
CONFIG_CAN_SLCAN=y
# CONFIG_CAN_VIRTIO_CAN is not set
# CONFIG_CAN_C_CAN is not set
# CONFIG_CAN_CC770 is not set
# CONFIG_CAN_CTUCANFD_PCI is not set
# CONFIG_CAN_CTUCANFD_PLATFORM is not set
# CONFIG_CAN_ESD_402_PCI is not set
CONFIG_CAN_IFI_CANFD=y
# CONFIG_CAN_M_CAN is not set
# CONFIG_CAN_PEAK_PCIEFD is not set
# CONFIG_CAN_SJA1000 is not set
# CONFIG_CAN_SOFTING is not set

#
# CAN SPI interfaces
#
# CONFIG_CAN_HI311X is not set
# CONFIG_CAN_MCP251X is not set
# CONFIG_CAN_MCP251XFD is not set
# end of CAN SPI interfaces

#
# CAN USB interfaces
#
CONFIG_CAN_8DEV_USB=y
CONFIG_CAN_EMS_USB=y
CONFIG_CAN_ESD_USB=y
CONFIG_CAN_ETAS_ES58X=y
CONFIG_CAN_F81604=y
CONFIG_CAN_GS_USB=y
CONFIG_CAN_KVASER_USB=y
CONFIG_CAN_MCBA_USB=y
CONFIG_CAN_PEAK_USB=y
CONFIG_CAN_UCAN=y
# end of CAN USB interfaces

# CONFIG_CAN_DEBUG_DEVICES is not set

#
# MCTP Device Drivers
#
# CONFIG_MCTP_SERIAL is not set
# CONFIG_MCTP_TRANSPORT_I2C is not set
# CONFIG_MCTP_TRANSPORT_USB is not set
# end of MCTP Device Drivers

CONFIG_FWNODE_MDIO=y
CONFIG_OF_MDIO=y
CONFIG_ACPI_MDIO=y
# CONFIG_MDIO_BITBANG is not set
# CONFIG_MDIO_BCM_UNIMAC is not set
# CONFIG_MDIO_HISI_FEMAC is not set
CONFIG_MDIO_MVUSB=y
# CONFIG_MDIO_MSCC_MIIM is not set
# CONFIG_MDIO_OCTEON is not set
# CONFIG_MDIO_IPQ4019 is not set
# CONFIG_MDIO_IPQ8064 is not set
# CONFIG_MDIO_THUNDER is not set

#
# MDIO Multiplexers
#
# CONFIG_MDIO_BUS_MUX_GPIO is not set
# CONFIG_MDIO_BUS_MUX_MULTIPLEXER is not set
# CONFIG_MDIO_BUS_MUX_MMIOREG is not set

#
# PCS device drivers
#
# CONFIG_PCS_XPCS is not set
# end of PCS device drivers

# CONFIG_PLIP is not set
CONFIG_PPP=y
CONFIG_PPP_BSDCOMP=y
CONFIG_PPP_DEFLATE=y
CONFIG_PPP_FILTER=y
CONFIG_PPP_MPPE=y
CONFIG_PPP_MULTILINK=y
CONFIG_PPPOATM=y
CONFIG_PPPOX=y
CONFIG_PPPOE=y
CONFIG_PPPOE_HASH_BITS_1=y
# CONFIG_PPPOE_HASH_BITS_2 is not set
# CONFIG_PPPOE_HASH_BITS_4 is not set
# CONFIG_PPPOE_HASH_BITS_8 is not set
CONFIG_PPPOE_HASH_BITS=1
CONFIG_PPTP=y
CONFIG_PPPOL2TP=y
CONFIG_PPP_ASYNC=y
CONFIG_PPP_SYNC_TTY=y
CONFIG_SLIP=y
CONFIG_SLHC=y
CONFIG_SLIP_COMPRESSED=y
CONFIG_SLIP_SMART=y
CONFIG_SLIP_MODE_SLIP6=y
CONFIG_USB_NET_DRIVERS=y
CONFIG_USB_CATC=y
CONFIG_USB_KAWETH=y
CONFIG_USB_PEGASUS=y
CONFIG_USB_RTL8150=y
CONFIG_USB_RTL8152=y
CONFIG_USB_LAN78XX=y
CONFIG_USB_USBNET=y
CONFIG_USB_NET_AX8817X=y
CONFIG_USB_NET_AX88179_178A=y
CONFIG_USB_NET_CDCETHER=y
CONFIG_USB_NET_CDC_EEM=y
CONFIG_USB_NET_CDC_NCM=y
CONFIG_USB_NET_HUAWEI_CDC_NCM=y
CONFIG_USB_NET_CDC_MBIM=y
CONFIG_USB_NET_DM9601=y
CONFIG_USB_NET_SR9700=y
CONFIG_USB_NET_SR9800=y
CONFIG_USB_NET_SMSC75XX=y
CONFIG_USB_NET_SMSC95XX=y
CONFIG_USB_NET_GL620A=y
CONFIG_USB_NET_NET1080=y
CONFIG_USB_NET_PLUSB=y
CONFIG_USB_NET_MCS7830=y
CONFIG_USB_NET_RNDIS_HOST=y
CONFIG_USB_NET_CDC_SUBSET_ENABLE=y
CONFIG_USB_NET_CDC_SUBSET=y
CONFIG_USB_ALI_M5632=y
CONFIG_USB_AN2720=y
CONFIG_USB_BELKIN=y
CONFIG_USB_ARMLINUX=y
CONFIG_USB_EPSON2888=y
CONFIG_USB_KC2190=y
CONFIG_USB_NET_ZAURUS=y
CONFIG_USB_NET_CX82310_ETH=y
CONFIG_USB_NET_KALMIA=y
CONFIG_USB_NET_QMI_WWAN=y
CONFIG_USB_HSO=y
CONFIG_USB_NET_INT51X1=y
CONFIG_USB_CDC_PHONET=y
CONFIG_USB_IPHETH=y
CONFIG_USB_SIERRA_NET=y
CONFIG_USB_VL600=y
CONFIG_USB_NET_CH9200=y
CONFIG_USB_NET_AQC111=y
CONFIG_USB_RTL8153_ECM=y
CONFIG_WLAN=y
CONFIG_WLAN_VENDOR_ADMTEK=y
# CONFIG_ADM8211 is not set
CONFIG_ATH_COMMON=y
CONFIG_WLAN_VENDOR_ATH=y
# CONFIG_ATH_DEBUG is not set
# CONFIG_ATH5K is not set
# CONFIG_ATH5K_PCI is not set
CONFIG_ATH9K_HW=y
CONFIG_ATH9K_COMMON=y
CONFIG_ATH9K_COMMON_DEBUG=y
CONFIG_ATH9K_BTCOEX_SUPPORT=y
CONFIG_ATH9K=y
CONFIG_ATH9K_PCI=y
CONFIG_ATH9K_AHB=y
CONFIG_ATH9K_DEBUGFS=y
# CONFIG_ATH9K_STATION_STATISTICS is not set
CONFIG_ATH9K_DYNACK=y
# CONFIG_ATH9K_WOW is not set
CONFIG_ATH9K_RFKILL=y
CONFIG_ATH9K_CHANNEL_CONTEXT=y
CONFIG_ATH9K_PCOEM=y
# CONFIG_ATH9K_PCI_NO_EEPROM is not set
CONFIG_ATH9K_HTC=y
CONFIG_ATH9K_HTC_DEBUGFS=y
# CONFIG_ATH9K_HWRNG is not set
CONFIG_ATH9K_COMMON_SPECTRAL=y
CONFIG_CARL9170=y
CONFIG_CARL9170_LEDS=y
# CONFIG_CARL9170_DEBUGFS is not set
CONFIG_CARL9170_WPC=y
CONFIG_CARL9170_HWRNG=y
CONFIG_ATH6KL=y
# CONFIG_ATH6KL_SDIO is not set
CONFIG_ATH6KL_USB=y
# CONFIG_ATH6KL_DEBUG is not set
# CONFIG_ATH6KL_TRACING is not set
CONFIG_AR5523=y
# CONFIG_WIL6210 is not set
CONFIG_ATH10K=y
CONFIG_ATH10K_CE=y
CONFIG_ATH10K_PCI=y
# CONFIG_ATH10K_AHB is not set
# CONFIG_ATH10K_SDIO is not set
CONFIG_ATH10K_USB=y
# CONFIG_ATH10K_DEBUG is not set
# CONFIG_ATH10K_DEBUGFS is not set
CONFIG_ATH10K_LEDS=y
# CONFIG_ATH10K_TRACING is not set
# CONFIG_WCN36XX is not set
CONFIG_ATH11K=y
# CONFIG_ATH11K_PCI is not set
# CONFIG_ATH11K_DEBUG is not set
# CONFIG_ATH11K_DEBUGFS is not set
# CONFIG_ATH11K_TRACING is not set
# CONFIG_ATH12K is not set
# CONFIG_WLAN_VENDOR_ATMEL is not set
# CONFIG_WLAN_VENDOR_BROADCOM is not set
# CONFIG_WLAN_VENDOR_INTEL is not set
# CONFIG_WLAN_VENDOR_INTERSIL is not set
# CONFIG_WLAN_VENDOR_MARVELL is not set
# CONFIG_WLAN_VENDOR_MEDIATEK is not set
# CONFIG_WLAN_VENDOR_MICROCHIP is not set
CONFIG_WLAN_VENDOR_PURELIFI=y
CONFIG_PLFXLC=y
# CONFIG_WLAN_VENDOR_RALINK is not set
# CONFIG_WLAN_VENDOR_REALTEK is not set
# CONFIG_WLAN_VENDOR_RSI is not set
CONFIG_WLAN_VENDOR_SILABS=y
# CONFIG_WFX is not set
# CONFIG_WLAN_VENDOR_ST is not set
# CONFIG_WLAN_VENDOR_TI is not set
# CONFIG_WLAN_VENDOR_ZYDAS is not set
# CONFIG_WLAN_VENDOR_QUANTENNA is not set
CONFIG_MAC80211_HWSIM=y
CONFIG_VIRT_WIFI=y
CONFIG_WAN=y
CONFIG_HDLC=y
CONFIG_HDLC_RAW=y
CONFIG_HDLC_RAW_ETH=y
CONFIG_HDLC_CISCO=y
CONFIG_HDLC_FR=y
CONFIG_HDLC_PPP=y
CONFIG_HDLC_X25=y
# CONFIG_FRAMER is not set
# CONFIG_PCI200SYN is not set
# CONFIG_WANXL is not set
# CONFIG_PC300TOO is not set
# CONFIG_FARSYNC is not set
CONFIG_LAPBETHER=y
CONFIG_IEEE802154_DRIVERS=y
# CONFIG_IEEE802154_FAKELB is not set
# CONFIG_IEEE802154_AT86RF230 is not set
# CONFIG_IEEE802154_MRF24J40 is not set
# CONFIG_IEEE802154_CC2520 is not set
CONFIG_IEEE802154_ATUSB=y
# CONFIG_IEEE802154_ADF7242 is not set
# CONFIG_IEEE802154_CA8210 is not set
# CONFIG_IEEE802154_MCR20A is not set
CONFIG_IEEE802154_HWSIM=y

#
# Wireless WAN
#
CONFIG_WWAN=y
# CONFIG_WWAN_DEBUGFS is not set
# CONFIG_WWAN_HWSIM is not set
CONFIG_MHI_WWAN_CTRL=y
# CONFIG_MHI_WWAN_MBIM is not set
# CONFIG_IOSM is not set
# CONFIG_MTK_T7XX is not set
# end of Wireless WAN

CONFIG_VMXNET3=y
# CONFIG_FUJITSU_ES is not set
CONFIG_USB4_NET=y
CONFIG_NETDEVSIM=y
CONFIG_NET_FAILOVER=y

#
# Input device support
#
CONFIG_INPUT=y
CONFIG_INPUT_LEDS=y
CONFIG_INPUT_FF_MEMLESS=y
CONFIG_INPUT_SPARSEKMAP=y
# CONFIG_INPUT_MATRIXKMAP is not set
CONFIG_INPUT_VIVALDIFMAP=y

#
# Userland interfaces
#
CONFIG_INPUT_MOUSEDEV=y
CONFIG_INPUT_MOUSEDEV_PSAUX=y
CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
CONFIG_INPUT_JOYDEV=y
CONFIG_INPUT_EVDEV=y

#
# Input Device Drivers
#
CONFIG_INPUT_KEYBOARD=y
# CONFIG_KEYBOARD_ADC is not set
# CONFIG_KEYBOARD_ADP5588 is not set
CONFIG_KEYBOARD_ATKBD=y
# CONFIG_KEYBOARD_QT1050 is not set
# CONFIG_KEYBOARD_QT1070 is not set
# CONFIG_KEYBOARD_QT2160 is not set
# CONFIG_KEYBOARD_DLINK_DIR685 is not set
# CONFIG_KEYBOARD_LKKBD is not set
# CONFIG_KEYBOARD_GPIO is not set
# CONFIG_KEYBOARD_GPIO_POLLED is not set
# CONFIG_KEYBOARD_TCA8418 is not set
# CONFIG_KEYBOARD_MATRIX is not set
# CONFIG_KEYBOARD_CHARLIEPLEX is not set
# CONFIG_KEYBOARD_LM8323 is not set
# CONFIG_KEYBOARD_LM8333 is not set
# CONFIG_KEYBOARD_MAX7359 is not set
# CONFIG_KEYBOARD_MPR121 is not set
# CONFIG_KEYBOARD_NEWTON is not set
# CONFIG_KEYBOARD_OPENCORES is not set
# CONFIG_KEYBOARD_PINEPHONE is not set
# CONFIG_KEYBOARD_SAMSUNG is not set
# CONFIG_KEYBOARD_STOWAWAY is not set
# CONFIG_KEYBOARD_SUNKBD is not set
# CONFIG_KEYBOARD_OMAP4 is not set
# CONFIG_KEYBOARD_TM2_TOUCHKEY is not set
# CONFIG_KEYBOARD_TWL4030 is not set
# CONFIG_KEYBOARD_XTKBD is not set
# CONFIG_KEYBOARD_CAP11XX is not set
# CONFIG_KEYBOARD_BCM is not set
# CONFIG_KEYBOARD_CYPRESS_SF is not set
CONFIG_INPUT_MOUSE=y
CONFIG_MOUSE_PS2=y
CONFIG_MOUSE_PS2_ALPS=y
CONFIG_MOUSE_PS2_BYD=y
CONFIG_MOUSE_PS2_LOGIPS2PP=y
CONFIG_MOUSE_PS2_SYNAPTICS=y
CONFIG_MOUSE_PS2_SYNAPTICS_SMBUS=y
CONFIG_MOUSE_PS2_CYPRESS=y
CONFIG_MOUSE_PS2_LIFEBOOK=y
CONFIG_MOUSE_PS2_TRACKPOINT=y
# CONFIG_MOUSE_PS2_ELANTECH is not set
# CONFIG_MOUSE_PS2_SENTELIC is not set
# CONFIG_MOUSE_PS2_TOUCHKIT is not set
CONFIG_MOUSE_PS2_FOCALTECH=y
# CONFIG_MOUSE_PS2_VMMOUSE is not set
CONFIG_MOUSE_PS2_SMBUS=y
# CONFIG_MOUSE_SERIAL is not set
CONFIG_MOUSE_APPLETOUCH=y
CONFIG_MOUSE_BCM5974=y
# CONFIG_MOUSE_CYAPA is not set
# CONFIG_MOUSE_ELAN_I2C is not set
# CONFIG_MOUSE_VSXXXAA is not set
# CONFIG_MOUSE_GPIO is not set
# CONFIG_MOUSE_SYNAPTICS_I2C is not set
CONFIG_MOUSE_SYNAPTICS_USB=y
CONFIG_INPUT_JOYSTICK=y
# CONFIG_JOYSTICK_ANALOG is not set
# CONFIG_JOYSTICK_A3D is not set
# CONFIG_JOYSTICK_ADC is not set
# CONFIG_JOYSTICK_ADI is not set
# CONFIG_JOYSTICK_COBRA is not set
# CONFIG_JOYSTICK_GF2K is not set
# CONFIG_JOYSTICK_GRIP is not set
# CONFIG_JOYSTICK_GRIP_MP is not set
# CONFIG_JOYSTICK_GUILLEMOT is not set
# CONFIG_JOYSTICK_INTERACT is not set
# CONFIG_JOYSTICK_SIDEWINDER is not set
# CONFIG_JOYSTICK_TMDC is not set
CONFIG_JOYSTICK_IFORCE=y
CONFIG_JOYSTICK_IFORCE_USB=y
# CONFIG_JOYSTICK_IFORCE_232 is not set
# CONFIG_JOYSTICK_WARRIOR is not set
# CONFIG_JOYSTICK_MAGELLAN is not set
# CONFIG_JOYSTICK_SPACEORB is not set
# CONFIG_JOYSTICK_SPACEBALL is not set
# CONFIG_JOYSTICK_STINGER is not set
# CONFIG_JOYSTICK_TWIDJOY is not set
# CONFIG_JOYSTICK_ZHENHUA is not set
# CONFIG_JOYSTICK_DB9 is not set
# CONFIG_JOYSTICK_GAMECON is not set
# CONFIG_JOYSTICK_TURBOGRAFX is not set
# CONFIG_JOYSTICK_AS5011 is not set
# CONFIG_JOYSTICK_JOYDUMP is not set
CONFIG_JOYSTICK_XPAD=y
CONFIG_JOYSTICK_XPAD_FF=y
CONFIG_JOYSTICK_XPAD_LEDS=y
# CONFIG_JOYSTICK_WALKERA0701 is not set
# CONFIG_JOYSTICK_PSXPAD_SPI is not set
CONFIG_JOYSTICK_PXRC=y
# CONFIG_JOYSTICK_QWIIC is not set
# CONFIG_JOYSTICK_FSIA6B is not set
# CONFIG_JOYSTICK_SENSEHAT is not set
# CONFIG_JOYSTICK_SEESAW is not set
CONFIG_INPUT_TABLET=y
CONFIG_TABLET_USB_ACECAD=y
CONFIG_TABLET_USB_AIPTEK=y
CONFIG_TABLET_USB_HANWANG=y
CONFIG_TABLET_USB_KBTAB=y
CONFIG_TABLET_USB_PEGASUS=y
# CONFIG_TABLET_SERIAL_WACOM4 is not set
CONFIG_INPUT_TOUCHSCREEN=y
# CONFIG_TOUCHSCREEN_ADS7846 is not set
# CONFIG_TOUCHSCREEN_AD7877 is not set
# CONFIG_TOUCHSCREEN_AD7879 is not set
# CONFIG_TOUCHSCREEN_ADC is not set
# CONFIG_TOUCHSCREEN_AR1021_I2C is not set
# CONFIG_TOUCHSCREEN_ATMEL_MXT is not set
# CONFIG_TOUCHSCREEN_AUO_PIXCIR is not set
# CONFIG_TOUCHSCREEN_BU21013 is not set
# CONFIG_TOUCHSCREEN_BU21029 is not set
# CONFIG_TOUCHSCREEN_CHIPONE_ICN8318 is not set
# CONFIG_TOUCHSCREEN_CHIPONE_ICN8505 is not set
# CONFIG_TOUCHSCREEN_CY8CTMA140 is not set
# CONFIG_TOUCHSCREEN_CY8CTMG110 is not set
# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set
# CONFIG_TOUCHSCREEN_CYTTSP5 is not set
# CONFIG_TOUCHSCREEN_DYNAPRO is not set
# CONFIG_TOUCHSCREEN_HAMPSHIRE is not set
# CONFIG_TOUCHSCREEN_EETI is not set
# CONFIG_TOUCHSCREEN_EGALAX is not set
# CONFIG_TOUCHSCREEN_EGALAX_SERIAL is not set
# CONFIG_TOUCHSCREEN_EXC3000 is not set
# CONFIG_TOUCHSCREEN_FUJITSU is not set
# CONFIG_TOUCHSCREEN_GOODIX is not set
# CONFIG_TOUCHSCREEN_GOODIX_BERLIN_I2C is not set
# CONFIG_TOUCHSCREEN_GOODIX_BERLIN_SPI is not set
# CONFIG_TOUCHSCREEN_HIDEEP is not set
# CONFIG_TOUCHSCREEN_HIMAX_HX852X is not set
# CONFIG_TOUCHSCREEN_HYCON_HY46XX is not set
# CONFIG_TOUCHSCREEN_HYNITRON_CSTXXX is not set
# CONFIG_TOUCHSCREEN_HYNITRON_CST816X is not set
# CONFIG_TOUCHSCREEN_ILI210X is not set
# CONFIG_TOUCHSCREEN_ILITEK is not set
# CONFIG_TOUCHSCREEN_S6SY761 is not set
# CONFIG_TOUCHSCREEN_GUNZE is not set
# CONFIG_TOUCHSCREEN_EKTF2127 is not set
# CONFIG_TOUCHSCREEN_ELAN is not set
# CONFIG_TOUCHSCREEN_ELO is not set
# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set
# CONFIG_TOUCHSCREEN_WACOM_I2C is not set
# CONFIG_TOUCHSCREEN_WACOM_W9000 is not set
# CONFIG_TOUCHSCREEN_MAX11801 is not set
# CONFIG_TOUCHSCREEN_MMS114 is not set
# CONFIG_TOUCHSCREEN_MELFAS_MIP4 is not set
# CONFIG_TOUCHSCREEN_MSG2638 is not set
# CONFIG_TOUCHSCREEN_MTOUCH is not set
# CONFIG_TOUCHSCREEN_NOVATEK_NVT_TS is not set
# CONFIG_TOUCHSCREEN_IMAGIS is not set
# CONFIG_TOUCHSCREEN_IMX6UL_TSC is not set
# CONFIG_TOUCHSCREEN_INEXIO is not set
# CONFIG_TOUCHSCREEN_PENMOUNT is not set
# CONFIG_TOUCHSCREEN_EDT_FT5X06 is not set
# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
# CONFIG_TOUCHSCREEN_PIXCIR is not set
# CONFIG_TOUCHSCREEN_WDT87XX_I2C is not set
CONFIG_TOUCHSCREEN_USB_COMPOSITE=y
CONFIG_TOUCHSCREEN_USB_EGALAX=y
CONFIG_TOUCHSCREEN_USB_PANJIT=y
CONFIG_TOUCHSCREEN_USB_3M=y
CONFIG_TOUCHSCREEN_USB_ITM=y
CONFIG_TOUCHSCREEN_USB_ETURBO=y
CONFIG_TOUCHSCREEN_USB_GUNZE=y
CONFIG_TOUCHSCREEN_USB_DMC_TSC10=y
CONFIG_TOUCHSCREEN_USB_IRTOUCH=y
CONFIG_TOUCHSCREEN_USB_IDEALTEK=y
CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH=y
CONFIG_TOUCHSCREEN_USB_GOTOP=y
CONFIG_TOUCHSCREEN_USB_JASTEC=y
CONFIG_TOUCHSCREEN_USB_ELO=y
CONFIG_TOUCHSCREEN_USB_E2I=y
CONFIG_TOUCHSCREEN_USB_ZYTRONIC=y
CONFIG_TOUCHSCREEN_USB_ETT_TC45USB=y
CONFIG_TOUCHSCREEN_USB_NEXIO=y
CONFIG_TOUCHSCREEN_USB_EASYTOUCH=y
# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set
# CONFIG_TOUCHSCREEN_TSC_SERIO is not set
# CONFIG_TOUCHSCREEN_TSC2004 is not set
# CONFIG_TOUCHSCREEN_TSC2005 is not set
# CONFIG_TOUCHSCREEN_TSC2007 is not set
# CONFIG_TOUCHSCREEN_RM_TS is not set
# CONFIG_TOUCHSCREEN_SILEAD is not set
# CONFIG_TOUCHSCREEN_SIS_I2C is not set
# CONFIG_TOUCHSCREEN_ST1232 is not set
# CONFIG_TOUCHSCREEN_STMFTS is not set
CONFIG_TOUCHSCREEN_SUR40=y
# CONFIG_TOUCHSCREEN_SURFACE3_SPI is not set
# CONFIG_TOUCHSCREEN_SX8654 is not set
# CONFIG_TOUCHSCREEN_TPS6507X is not set
# CONFIG_TOUCHSCREEN_ZET6223 is not set
# CONFIG_TOUCHSCREEN_ZFORCE is not set
# CONFIG_TOUCHSCREEN_COLIBRI_VF50 is not set
# CONFIG_TOUCHSCREEN_ROHM_BU21023 is not set
# CONFIG_TOUCHSCREEN_IQS5XX is not set
# CONFIG_TOUCHSCREEN_IQS7211 is not set
# CONFIG_TOUCHSCREEN_ZINITIX is not set
# CONFIG_TOUCHSCREEN_HIMAX_HX83112B is not set
CONFIG_INPUT_MISC=y
# CONFIG_INPUT_AD714X is not set
# CONFIG_INPUT_ATMEL_CAPTOUCH is not set
# CONFIG_INPUT_AW86927 is not set
# CONFIG_INPUT_BMA150 is not set
# CONFIG_INPUT_E3X0_BUTTON is not set
# CONFIG_INPUT_PCSPKR is not set
# CONFIG_INPUT_MMA8450 is not set
# CONFIG_INPUT_APANEL is not set
# CONFIG_INPUT_GPIO_BEEPER is not set
# CONFIG_INPUT_GPIO_DECODER is not set
# CONFIG_INPUT_GPIO_VIBRA is not set
# CONFIG_INPUT_ATLAS_BTNS is not set
CONFIG_INPUT_ATI_REMOTE2=y
CONFIG_INPUT_KEYSPAN_REMOTE=y
# CONFIG_INPUT_KXTJ9 is not set
CONFIG_INPUT_POWERMATE=y
CONFIG_INPUT_YEALINK=y
CONFIG_INPUT_CM109=y
# CONFIG_INPUT_REGULATOR_HAPTIC is not set
# CONFIG_INPUT_RETU_PWRBUTTON is not set
# CONFIG_INPUT_TWL4030_PWRBUTTON is not set
# CONFIG_INPUT_TWL4030_VIBRA is not set
CONFIG_INPUT_UINPUT=y
# CONFIG_INPUT_PCF8574 is not set
# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set
# CONFIG_INPUT_DA7280_HAPTICS is not set
# CONFIG_INPUT_ADXL34X is not set
# CONFIG_INPUT_IBM_PANEL is not set
CONFIG_INPUT_IMS_PCU=y
# CONFIG_INPUT_IQS269A is not set
# CONFIG_INPUT_IQS626A is not set
# CONFIG_INPUT_IQS7222 is not set
# CONFIG_INPUT_CMA3000 is not set
# CONFIG_INPUT_IDEAPAD_SLIDEBAR is not set
# CONFIG_INPUT_DRV260X_HAPTICS is not set
# CONFIG_INPUT_DRV2665_HAPTICS is not set
# CONFIG_INPUT_DRV2667_HAPTICS is not set
CONFIG_RMI4_CORE=y
# CONFIG_RMI4_I2C is not set
# CONFIG_RMI4_SPI is not set
# CONFIG_RMI4_SMB is not set
CONFIG_RMI4_F03=y
CONFIG_RMI4_F03_SERIO=y
CONFIG_RMI4_2D_SENSOR=y
CONFIG_RMI4_F11=y
CONFIG_RMI4_F12=y
# CONFIG_RMI4_F1A is not set
# CONFIG_RMI4_F21 is not set
CONFIG_RMI4_F30=y
# CONFIG_RMI4_F34 is not set
CONFIG_RMI4_F3A=y
# CONFIG_RMI4_F54 is not set
# CONFIG_RMI4_F55 is not set

#
# Hardware I/O ports
#
CONFIG_SERIO=y
CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y
CONFIG_SERIO_I8042=y
CONFIG_SERIO_SERPORT=y
# CONFIG_SERIO_PARKBD is not set
# CONFIG_SERIO_PCIPS2 is not set
CONFIG_SERIO_LIBPS2=y
# CONFIG_SERIO_RAW is not set
# CONFIG_SERIO_ALTERA_PS2 is not set
# CONFIG_SERIO_PS2MULT is not set
# CONFIG_SERIO_ARC_PS2 is not set
# CONFIG_SERIO_APBPS2 is not set
# CONFIG_SERIO_GPIO_PS2 is not set
CONFIG_USERIO=y
# CONFIG_GAMEPORT is not set
# end of Hardware I/O ports
# end of Input device support

#
# Character devices
#
CONFIG_TTY=y
CONFIG_VT=y
CONFIG_CONSOLE_TRANSLATIONS=y
CONFIG_VT_CONSOLE=y
CONFIG_VT_CONSOLE_SLEEP=y
CONFIG_VT_HW_CONSOLE_BINDING=y
CONFIG_UNIX98_PTYS=y
CONFIG_LEGACY_PTYS=y
CONFIG_LEGACY_PTY_COUNT=256
CONFIG_LEGACY_TIOCSTI=y
CONFIG_LDISC_AUTOLOAD=y

#
# Serial drivers
#
CONFIG_SERIAL_EARLYCON=y
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_PNP=y
# CONFIG_SERIAL_8250_16550A_VARIANTS is not set
# CONFIG_SERIAL_8250_FINTEK is not set
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_8250_DMA=y
CONFIG_SERIAL_8250_PCILIB=y
CONFIG_SERIAL_8250_PCI=y
# CONFIG_SERIAL_8250_EXAR is not set
# CONFIG_SERIAL_8250_CS is not set
CONFIG_SERIAL_8250_NR_UARTS=32
CONFIG_SERIAL_8250_RUNTIME_UARTS=4
CONFIG_SERIAL_8250_EXTENDED=y
CONFIG_SERIAL_8250_SHARE_IRQ=y
CONFIG_SERIAL_8250_DETECT_IRQ=y
CONFIG_SERIAL_8250_RSA=y
CONFIG_SERIAL_8250_MANY_PORTS=y
# CONFIG_SERIAL_8250_PCI1XXXX is not set
# CONFIG_SERIAL_8250_DW is not set
# CONFIG_SERIAL_8250_RT288X is not set
CONFIG_SERIAL_8250_LPSS=y
CONFIG_SERIAL_8250_MID=y
CONFIG_SERIAL_8250_PERICOM=y
# CONFIG_SERIAL_8250_NI is not set
# CONFIG_SERIAL_OF_PLATFORM is not set
CONFIG_SERIAL_8250_DWLIB=y

#
# Non-8250 serial port support
#
# CONFIG_SERIAL_MAX3100 is not set
# CONFIG_SERIAL_MAX310X is not set
# CONFIG_SERIAL_UARTLITE is not set
CONFIG_SERIAL_CORE=y
CONFIG_SERIAL_CORE_CONSOLE=y
# CONFIG_SERIAL_JSM is not set
# CONFIG_SERIAL_SIFIVE is not set
# CONFIG_SERIAL_LANTIQ is not set
# CONFIG_SERIAL_SCCNXP is not set
# CONFIG_SERIAL_SC16IS7XX is not set
# CONFIG_SERIAL_ALTERA_JTAGUART is not set
# CONFIG_SERIAL_ALTERA_UART is not set
# CONFIG_SERIAL_XILINX_PS_UART is not set
# CONFIG_SERIAL_ARC is not set
# CONFIG_SERIAL_RP2 is not set
# CONFIG_SERIAL_FSL_LPUART is not set
# CONFIG_SERIAL_FSL_LINFLEXUART is not set
# CONFIG_SERIAL_CONEXANT_DIGICOLOR is not set
# CONFIG_SERIAL_SPRD is not set
# end of Serial drivers

CONFIG_SERIAL_MCTRL_GPIO=y
CONFIG_SERIAL_NONSTANDARD=y
# CONFIG_MOXA_INTELLIO is not set
# CONFIG_MOXA_SMARTIO is not set
CONFIG_N_HDLC=y
# CONFIG_IPWIRELESS is not set
CONFIG_N_GSM=y
CONFIG_NOZOMI=y
CONFIG_NULL_TTY=y
CONFIG_HVC_DRIVER=y
CONFIG_SERIAL_DEV_BUS=y
CONFIG_SERIAL_DEV_CTRL_TTYPORT=y
CONFIG_TTY_PRINTK=y
CONFIG_TTY_PRINTK_LEVEL=6
# CONFIG_PRINTER is not set
# CONFIG_PPDEV is not set
CONFIG_VIRTIO_CONSOLE=y
# CONFIG_IPMI_HANDLER is not set
# CONFIG_SSIF_IPMI_BMC is not set
# CONFIG_IPMB_DEVICE_INTERFACE is not set
CONFIG_HW_RANDOM=y
# CONFIG_HW_RANDOM_TIMERIOMEM is not set
# CONFIG_HW_RANDOM_INTEL is not set
# CONFIG_HW_RANDOM_AMD is not set
# CONFIG_HW_RANDOM_BA431 is not set
# CONFIG_HW_RANDOM_VIA is not set
CONFIG_HW_RANDOM_VIRTIO=y
# CONFIG_HW_RANDOM_CCTRNG is not set
# CONFIG_HW_RANDOM_XIPHERA is not set
# CONFIG_DEVMEM is not set
CONFIG_NVRAM=y
# CONFIG_DEVPORT is not set
CONFIG_HPET=y
CONFIG_HPET_MMAP=y
CONFIG_HPET_MMAP_DEFAULT=y
# CONFIG_HANGCHECK_TIMER is not set
CONFIG_TCG_TPM=y
# CONFIG_TCG_TPM2_HMAC is not set
# CONFIG_HW_RANDOM_TPM is not set
CONFIG_TCG_TIS_CORE=y
CONFIG_TCG_TIS=y
# CONFIG_TCG_TIS_SPI is not set
# CONFIG_TCG_TIS_I2C is not set
# CONFIG_TCG_TIS_I2C_CR50 is not set
# CONFIG_TCG_TIS_I2C_ATMEL is not set
# CONFIG_TCG_TIS_I2C_INFINEON is not set
# CONFIG_TCG_TIS_I2C_NUVOTON is not set
# CONFIG_TCG_NSC is not set
# CONFIG_TCG_ATMEL is not set
# CONFIG_TCG_INFINEON is not set
CONFIG_TCG_CRB=y
# CONFIG_TCG_VTPM_PROXY is not set
# CONFIG_TCG_TIS_ST33ZP24_I2C is not set
# CONFIG_TCG_TIS_ST33ZP24_SPI is not set
# CONFIG_TELCLOCK is not set
CONFIG_XILLYBUS_CLASS=y
# CONFIG_XILLYBUS is not set
CONFIG_XILLYUSB=y
# end of Character devices

#
# I2C support
#
CONFIG_I2C=y
CONFIG_ACPI_I2C_OPREGION=y
CONFIG_I2C_BOARDINFO=y
CONFIG_I2C_CHARDEV=y
CONFIG_I2C_MUX=y

#
# Multiplexer I2C Chip support
#
# CONFIG_I2C_ARB_GPIO_CHALLENGE is not set
# CONFIG_I2C_MUX_GPIO is not set
# CONFIG_I2C_MUX_GPMUX is not set
# CONFIG_I2C_MUX_LTC4306 is not set
# CONFIG_I2C_MUX_PCA9541 is not set
# CONFIG_I2C_MUX_PCA954x is not set
CONFIG_I2C_MUX_REG=y
# CONFIG_I2C_MUX_MLXCPLD is not set
# end of Multiplexer I2C Chip support

CONFIG_I2C_HELPER_AUTO=y
CONFIG_I2C_SMBUS=y
CONFIG_I2C_ALGOBIT=y

#
# I2C Hardware Bus support
#

#
# PC SMBus host controller drivers
#
# CONFIG_I2C_ALI1535 is not set
# CONFIG_I2C_ALI1563 is not set
# CONFIG_I2C_ALI15X3 is not set
# CONFIG_I2C_AMD756 is not set
# CONFIG_I2C_AMD8111 is not set
# CONFIG_I2C_AMD_MP2 is not set
CONFIG_I2C_I801=y
# CONFIG_I2C_ISCH is not set
# CONFIG_I2C_ISMT is not set
# CONFIG_I2C_PIIX4 is not set
# CONFIG_I2C_CHT_WC is not set
# CONFIG_I2C_NFORCE2 is not set
# CONFIG_I2C_NVIDIA_GPU is not set
# CONFIG_I2C_SIS5595 is not set
# CONFIG_I2C_SIS630 is not set
# CONFIG_I2C_SIS96X is not set
# CONFIG_I2C_VIA is not set
# CONFIG_I2C_VIAPRO is not set
# CONFIG_I2C_ZHAOXIN is not set

#
# ACPI drivers
#
# CONFIG_I2C_SCMI is not set

#
# I2C system bus drivers (mostly embedded / system-on-chip)
#
# CONFIG_I2C_CBUS_GPIO is not set
CONFIG_I2C_DESIGNWARE_CORE=y
CONFIG_I2C_DESIGNWARE_PLATFORM=y
# CONFIG_I2C_DESIGNWARE_BAYTRAIL is not set
# CONFIG_I2C_DESIGNWARE_PCI is not set
# CONFIG_I2C_EMEV2 is not set
# CONFIG_I2C_GPIO is not set
# CONFIG_I2C_OCORES is not set
# CONFIG_I2C_PCA_PLATFORM is not set
# CONFIG_I2C_RK3X is not set
# CONFIG_I2C_SIMTEC is not set
# CONFIG_I2C_XILINX is not set

#
# External I2C/SMBus adapter drivers
#
CONFIG_I2C_DIOLAN_U2C=y
CONFIG_I2C_DLN2=y
CONFIG_I2C_LJCA=y
CONFIG_I2C_CP2615=y
# CONFIG_I2C_PARPORT is not set
# CONFIG_I2C_PCI1XXXX is not set
CONFIG_I2C_ROBOTFUZZ_OSIF=y
# CONFIG_I2C_TAOS_EVM is not set
CONFIG_I2C_TINY_USB=y
CONFIG_I2C_VIPERBOARD=y

#
# Other I2C/SMBus bus drivers
#
# CONFIG_I2C_MLXCPLD is not set
# CONFIG_I2C_VIRTIO is not set
# end of I2C Hardware Bus support

# CONFIG_I2C_STUB is not set
CONFIG_I2C_SLAVE=y
CONFIG_I2C_SLAVE_EEPROM=y
# CONFIG_I2C_SLAVE_TESTUNIT is not set
# CONFIG_I2C_DEBUG_CORE is not set
# CONFIG_I2C_DEBUG_ALGO is not set
# CONFIG_I2C_DEBUG_BUS is not set
# end of I2C support

# CONFIG_I3C is not set
CONFIG_I3C_OR_I2C=y
CONFIG_SPI=y
# CONFIG_SPI_DEBUG is not set
CONFIG_SPI_MASTER=y
# CONFIG_SPI_MEM is not set

#
# SPI Master Controller Drivers
#
# CONFIG_SPI_ALTERA is not set
# CONFIG_SPI_AXI_SPI_ENGINE is not set
# CONFIG_SPI_BITBANG is not set
# CONFIG_SPI_BUTTERFLY is not set
# CONFIG_SPI_CADENCE is not set
# CONFIG_SPI_CADENCE_QUADSPI is not set
# CONFIG_SPI_CH341 is not set
# CONFIG_SPI_DESIGNWARE is not set
CONFIG_SPI_DLN2=y
# CONFIG_SPI_GPIO is not set
# CONFIG_SPI_LM70_LLP is not set
# CONFIG_SPI_FSL_SPI is not set
CONFIG_SPI_LJCA=y
# CONFIG_SPI_MICROCHIP_CORE_QSPI is not set
# CONFIG_SPI_MICROCHIP_CORE_SPI is not set
# CONFIG_SPI_LANTIQ_SSC is not set
# CONFIG_SPI_OC_TINY is not set
# CONFIG_SPI_PCI1XXXX is not set
# CONFIG_SPI_PXA2XX is not set
# CONFIG_SPI_SC18IS602 is not set
# CONFIG_SPI_SIFIVE is not set
# CONFIG_SPI_MXIC is not set
# CONFIG_SPI_VIRTIO is not set
# CONFIG_SPI_XCOMM is not set
# CONFIG_SPI_XILINX is not set

#
# SPI Multiplexer support
#
# CONFIG_SPI_MUX is not set

#
# SPI Protocol Masters
#
# CONFIG_SPI_SPIDEV is not set
# CONFIG_SPI_LOOPBACK_TEST is not set
# CONFIG_SPI_TLE62X0 is not set
# CONFIG_SPI_SLAVE is not set
CONFIG_SPI_DYNAMIC=y
# CONFIG_SPMI is not set
# CONFIG_HSI is not set
CONFIG_PPS=y
# CONFIG_PPS_DEBUG is not set

#
# PPS clients support
#
# CONFIG_PPS_CLIENT_KTIMER is not set
# CONFIG_PPS_CLIENT_LDISC is not set
# CONFIG_PPS_CLIENT_PARPORT is not set
# CONFIG_PPS_CLIENT_GPIO is not set
# CONFIG_PPS_GENERATOR is not set

#
# PTP clock support
#
CONFIG_PTP_1588_CLOCK=y
CONFIG_PTP_1588_CLOCK_OPTIONAL=y

#
# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks.
#
CONFIG_PTP_1588_CLOCK_KVM=y
CONFIG_PTP_1588_CLOCK_VMCLOCK=y
# CONFIG_PTP_1588_CLOCK_IDT82P33 is not set
# CONFIG_PTP_1588_CLOCK_IDTCM is not set
# CONFIG_PTP_1588_CLOCK_FC3W is not set
# CONFIG_PTP_1588_CLOCK_MOCK is not set
# CONFIG_PTP_1588_CLOCK_VMW is not set
# CONFIG_PTP_1588_CLOCK_OCP is not set
# CONFIG_PTP_NETC_V4_TIMER is not set
# end of PTP clock support

#
# DPLL device support
#
# CONFIG_ZL3073X_I2C is not set
# CONFIG_ZL3073X_SPI is not set
# end of DPLL device support

# CONFIG_PINCTRL is not set
CONFIG_GPIOLIB_LEGACY=y
CONFIG_GPIOLIB=y
CONFIG_GPIOLIB_FASTPATH_LIMIT=512
CONFIG_OF_GPIO=y
CONFIG_GPIO_ACPI=y
CONFIG_GPIOLIB_IRQCHIP=y
# CONFIG_DEBUG_GPIO is not set
# CONFIG_GPIO_SYSFS is not set
# CONFIG_GPIO_CDEV is not set

#
# Memory mapped GPIO drivers
#
# CONFIG_GPIO_74XX_MMIO is not set
# CONFIG_GPIO_ALTERA is not set
# CONFIG_GPIO_AMDPT is not set
# CONFIG_GPIO_BY_PINCTRL is not set
# CONFIG_GPIO_CADENCE is not set
# CONFIG_GPIO_DWAPB is not set
# CONFIG_GPIO_FTGPIO010 is not set
# CONFIG_GPIO_GENERIC_PLATFORM is not set
# CONFIG_GPIO_GRANITERAPIDS is not set
# CONFIG_GPIO_GRGPIO is not set
# CONFIG_GPIO_HLWD is not set
# CONFIG_GPIO_ICH is not set
# CONFIG_GPIO_LOGICVC is not set
# CONFIG_GPIO_MB86S7X is not set
# CONFIG_GPIO_POLARFIRE_SOC is not set
# CONFIG_GPIO_SIFIVE is not set
# CONFIG_GPIO_SYSCON is not set
# CONFIG_GPIO_WAVESHARE_DSI_TOUCH is not set
# CONFIG_GPIO_XILINX is not set
# CONFIG_GPIO_AMD_FCH is not set
# end of Memory mapped GPIO drivers

#
# Port-mapped I/O GPIO drivers
#
# CONFIG_GPIO_VX855 is not set
# CONFIG_GPIO_F7188X is not set
# CONFIG_GPIO_IT87 is not set
# CONFIG_GPIO_NOVALAKE is not set
# CONFIG_GPIO_SCH311X is not set
# CONFIG_GPIO_WINBOND is not set
# CONFIG_GPIO_WS16C48 is not set
# end of Port-mapped I/O GPIO drivers

#
# I2C GPIO expanders
#
# CONFIG_GPIO_ADNP is not set
# CONFIG_GPIO_FXL6408 is not set
# CONFIG_GPIO_DS4520 is not set
# CONFIG_GPIO_GW_PLD is not set
# CONFIG_GPIO_MAX7300 is not set
# CONFIG_GPIO_MAX732X is not set
# CONFIG_GPIO_PCA953X is not set
# CONFIG_GPIO_PCA9570 is not set
# CONFIG_GPIO_PCF857X is not set
# CONFIG_GPIO_TPIC2810 is not set
# end of I2C GPIO expanders

#
# MFD GPIO expanders
#
CONFIG_GPIO_DLN2=y
CONFIG_GPIO_LJCA=y
# CONFIG_GPIO_TWL4030 is not set
# CONFIG_GPIO_WHISKEY_COVE is not set
# end of MFD GPIO expanders

#
# Auxiliary Bus GPIO drivers
#
# end of Auxiliary Bus GPIO drivers

#
# PCI GPIO expanders
#
# CONFIG_GPIO_AMD8111 is not set
# CONFIG_GPIO_BT8XX is not set
# CONFIG_GPIO_ML_IOH is not set
# CONFIG_GPIO_PCI_IDIO_16 is not set
# CONFIG_GPIO_PCIE_IDIO_24 is not set
# CONFIG_GPIO_RDC321X is not set
# CONFIG_GPIO_SODAVILLE is not set
# end of PCI GPIO expanders

#
# SPI GPIO expanders
#
# CONFIG_GPIO_74X164 is not set
# CONFIG_GPIO_MAX3191X is not set
# CONFIG_GPIO_MAX7301 is not set
# CONFIG_GPIO_MC33880 is not set
# CONFIG_GPIO_PISOSR is not set
# CONFIG_GPIO_XRA1403 is not set
# end of SPI GPIO expanders

#
# USB GPIO expanders
#
CONFIG_GPIO_VIPERBOARD=y
# CONFIG_GPIO_MPSSE is not set
# end of USB GPIO expanders

#
# Virtual GPIO drivers
#
# CONFIG_GPIO_AGGREGATOR is not set
# CONFIG_GPIO_LATCH is not set
# CONFIG_GPIO_LINE_MUX is not set
# CONFIG_GPIO_MOCKUP is not set
# CONFIG_GPIO_VIRTIO is not set
# CONFIG_GPIO_SIM is not set
# end of Virtual GPIO drivers

#
# GPIO Debugging utilities
#
# CONFIG_GPIO_SLOPPY_LOGIC_ANALYZER is not set
# CONFIG_GPIO_VIRTUSER is not set
# end of GPIO Debugging utilities

# CONFIG_W1 is not set
# CONFIG_POWER_RESET is not set
# CONFIG_POWER_SEQUENCING is not set
CONFIG_POWER_SUPPLY=y
# CONFIG_POWER_SUPPLY_DEBUG is not set
CONFIG_POWER_SUPPLY_HWMON=y
# CONFIG_GENERIC_ADC_BATTERY is not set
# CONFIG_IP5XXX_POWER is not set
# CONFIG_TEST_POWER is not set
# CONFIG_CHARGER_ADP5061 is not set
# CONFIG_BATTERY_CHAGALL is not set
# CONFIG_BATTERY_CW2015 is not set
# CONFIG_BATTERY_DS2780 is not set
# CONFIG_BATTERY_DS2781 is not set
# CONFIG_BATTERY_DS2782 is not set
# CONFIG_BATTERY_SAMSUNG_SDI is not set
# CONFIG_BATTERY_S2MU005 is not set
# CONFIG_BATTERY_SBS is not set
# CONFIG_CHARGER_SBS is not set
# CONFIG_MANAGER_SBS is not set
# CONFIG_BATTERY_BQ27XXX is not set
# CONFIG_BATTERY_MAX17040 is not set
# CONFIG_BATTERY_MAX17042 is not set
# CONFIG_BATTERY_MAX1720X is not set
CONFIG_CHARGER_ISP1704=y
# CONFIG_CHARGER_MAX8903 is not set
# CONFIG_CHARGER_TWL4030 is not set
# CONFIG_CHARGER_TWL6030 is not set
# CONFIG_CHARGER_LP8727 is not set
# CONFIG_CHARGER_GPIO is not set
# CONFIG_CHARGER_MANAGER is not set
# CONFIG_CHARGER_LT3651 is not set
# CONFIG_CHARGER_LTC4162L is not set
# CONFIG_CHARGER_DETECTOR_MAX14656 is not set
# CONFIG_CHARGER_MAX77976 is not set
# CONFIG_CHARGER_MAX8971 is not set
# CONFIG_CHARGER_MT6360 is not set
# CONFIG_CHARGER_MT6370 is not set
# CONFIG_CHARGER_BQ2415X is not set
CONFIG_CHARGER_BQ24190=y
# CONFIG_CHARGER_BQ24257 is not set
# CONFIG_CHARGER_BQ24735 is not set
# CONFIG_CHARGER_BQ2515X is not set
# CONFIG_CHARGER_BQ25890 is not set
# CONFIG_CHARGER_BQ25980 is not set
# CONFIG_CHARGER_BQ256XX is not set
# CONFIG_CHARGER_SMB347 is not set
# CONFIG_BATTERY_GAUGE_LTC2941 is not set
# CONFIG_BATTERY_GOLDFISH is not set
# CONFIG_BATTERY_RT5033 is not set
# CONFIG_CHARGER_RT9455 is not set
# CONFIG_CHARGER_RT9467 is not set
# CONFIG_CHARGER_RT9471 is not set
# CONFIG_CHARGER_RT9756 is not set
# CONFIG_FUEL_GAUGE_STC3117 is not set
# CONFIG_CHARGER_UCS1002 is not set
# CONFIG_CHARGER_BD99954 is not set
# CONFIG_BATTERY_SURFACE is not set
# CONFIG_CHARGER_SURFACE is not set
# CONFIG_BATTERY_UG3105 is not set
# CONFIG_BATTERY_CHARGER_SURFACE_RT is not set
# CONFIG_FUEL_GAUGE_MM8013 is not set
CONFIG_HWMON=y
# CONFIG_HWMON_DEBUG_CHIP is not set

#
# Native drivers
#
# CONFIG_SENSORS_ABITUGURU is not set
# CONFIG_SENSORS_ABITUGURU3 is not set
# CONFIG_SENSORS_AD7314 is not set
# CONFIG_SENSORS_AD7414 is not set
# CONFIG_SENSORS_AD7418 is not set
# CONFIG_SENSORS_ADM1025 is not set
# CONFIG_SENSORS_ADM1026 is not set
# CONFIG_SENSORS_ADM1029 is not set
# CONFIG_SENSORS_ADM1031 is not set
# CONFIG_SENSORS_ADM1177 is not set
# CONFIG_SENSORS_ADM9240 is not set
# CONFIG_SENSORS_ADT7310 is not set
# CONFIG_SENSORS_ADT7410 is not set
# CONFIG_SENSORS_ADT7411 is not set
# CONFIG_SENSORS_ADT7462 is not set
# CONFIG_SENSORS_ADT7470 is not set
# CONFIG_SENSORS_ADT7475 is not set
# CONFIG_SENSORS_AHT10 is not set
CONFIG_SENSORS_AQUACOMPUTER_D5NEXT=y
# CONFIG_SENSORS_AS370 is not set
# CONFIG_SENSORS_ASC7621 is not set
# CONFIG_SENSORS_ASUS_ROG_RYUJIN is not set
# CONFIG_SENSORS_AXI_FAN_CONTROL is not set
# CONFIG_SENSORS_K8TEMP is not set
# CONFIG_SENSORS_K10TEMP is not set
# CONFIG_SENSORS_FAM15H_POWER is not set
# CONFIG_SENSORS_APPLESMC is not set
# CONFIG_SENSORS_ARCTIC_FAN_CONTROLLER is not set
# CONFIG_SENSORS_ASB100 is not set
# CONFIG_SENSORS_ATXP1 is not set
# CONFIG_SENSORS_CHIPCAP2 is not set
CONFIG_SENSORS_CORSAIR_CPRO=y
CONFIG_SENSORS_CORSAIR_PSU=y
# CONFIG_SENSORS_DRIVETEMP is not set
# CONFIG_SENSORS_DS620 is not set
# CONFIG_SENSORS_DS1621 is not set
# CONFIG_SENSORS_DELL_SMM is not set
# CONFIG_SENSORS_I5K_AMB is not set
# CONFIG_SENSORS_F71805F is not set
# CONFIG_SENSORS_F71882FG is not set
# CONFIG_SENSORS_F75375S is not set
# CONFIG_SENSORS_FSCHMD is not set
# CONFIG_SENSORS_FTSTEUTATES is not set
CONFIG_SENSORS_GIGABYTE_WATERFORCE=y
# CONFIG_SENSORS_GL518SM is not set
# CONFIG_SENSORS_GL520SM is not set
# CONFIG_SENSORS_GPD is not set
# CONFIG_SENSORS_G760A is not set
# CONFIG_SENSORS_G762 is not set
# CONFIG_SENSORS_GPIO_FAN is not set
# CONFIG_SENSORS_HIH6130 is not set
# CONFIG_SENSORS_HS3001 is not set
# CONFIG_SENSORS_HTU31 is not set
# CONFIG_SENSORS_IIO_HWMON is not set
# CONFIG_SENSORS_I5500 is not set
# CONFIG_SENSORS_CORETEMP is not set
# CONFIG_SENSORS_ISL28022 is not set
# CONFIG_SENSORS_IT87 is not set
# CONFIG_SENSORS_JC42 is not set
CONFIG_SENSORS_POWERZ=y
# CONFIG_SENSORS_POWR1220 is not set
# CONFIG_SENSORS_PROM21_XHCI is not set
# CONFIG_SENSORS_LATTEPANDA_SIGMA_EC is not set
# CONFIG_SENSORS_LENOVO_EC is not set
# CONFIG_SENSORS_LINEAGE is not set
# CONFIG_SENSORS_LTC2945 is not set
# CONFIG_SENSORS_LTC2947_I2C is not set
# CONFIG_SENSORS_LTC2947_SPI is not set
# CONFIG_SENSORS_LTC2990 is not set
# CONFIG_SENSORS_LTC2991 is not set
# CONFIG_SENSORS_LTC2992 is not set
# CONFIG_SENSORS_LTC4151 is not set
# CONFIG_SENSORS_LTC4215 is not set
# CONFIG_SENSORS_LTC4222 is not set
# CONFIG_SENSORS_LTC4245 is not set
# CONFIG_SENSORS_LTC4260 is not set
# CONFIG_SENSORS_LTC4261 is not set
# CONFIG_SENSORS_LTC4282 is not set
# CONFIG_SENSORS_LTC4283 is not set
# CONFIG_SENSORS_MAX1111 is not set
# CONFIG_SENSORS_MAX127 is not set
# CONFIG_SENSORS_MAX16065 is not set
# CONFIG_SENSORS_MAX1619 is not set
# CONFIG_SENSORS_MAX1668 is not set
# CONFIG_SENSORS_MAX197 is not set
# CONFIG_SENSORS_MAX31722 is not set
# CONFIG_SENSORS_MAX31730 is not set
# CONFIG_SENSORS_MAX31760 is not set
# CONFIG_MAX31827 is not set
# CONFIG_SENSORS_MAX6620 is not set
# CONFIG_SENSORS_MAX6621 is not set
# CONFIG_SENSORS_MAX6639 is not set
# CONFIG_SENSORS_MAX6650 is not set
# CONFIG_SENSORS_MAX6697 is not set
# CONFIG_SENSORS_MAX31790 is not set
# CONFIG_SENSORS_MC34VR500 is not set
# CONFIG_SENSORS_MCP3021 is not set
# CONFIG_SENSORS_MCP9982 is not set
# CONFIG_SENSORS_TC654 is not set
# CONFIG_SENSORS_TPS23861 is not set
# CONFIG_SENSORS_MR75203 is not set
# CONFIG_SENSORS_ADCXX is not set
# CONFIG_SENSORS_LM63 is not set
# CONFIG_SENSORS_LM70 is not set
# CONFIG_SENSORS_LM73 is not set
# CONFIG_SENSORS_LM75 is not set
# CONFIG_SENSORS_LM77 is not set
# CONFIG_SENSORS_LM78 is not set
# CONFIG_SENSORS_LM80 is not set
# CONFIG_SENSORS_LM83 is not set
# CONFIG_SENSORS_LM85 is not set
# CONFIG_SENSORS_LM87 is not set
# CONFIG_SENSORS_LM90 is not set
# CONFIG_SENSORS_LM92 is not set
# CONFIG_SENSORS_LM93 is not set
# CONFIG_SENSORS_LM95234 is not set
# CONFIG_SENSORS_LM95241 is not set
# CONFIG_SENSORS_LM95245 is not set
# CONFIG_SENSORS_PC87360 is not set
# CONFIG_SENSORS_PC87427 is not set
# CONFIG_SENSORS_NTC_THERMISTOR is not set
# CONFIG_SENSORS_NCT6683 is not set
# CONFIG_SENSORS_NCT6775 is not set
# CONFIG_SENSORS_NCT6775_I2C is not set
# CONFIG_SENSORS_NCT7363 is not set
# CONFIG_SENSORS_NCT7802 is not set
# CONFIG_SENSORS_NCT7904 is not set
# CONFIG_SENSORS_NPCM7XX is not set
CONFIG_SENSORS_NZXT_KRAKEN2=y
# CONFIG_SENSORS_NZXT_KRAKEN3 is not set
CONFIG_SENSORS_NZXT_SMART2=y
# CONFIG_SENSORS_OCC_P8_I2C is not set
# CONFIG_SENSORS_PCF8591 is not set
# CONFIG_PMBUS is not set
# CONFIG_SENSORS_PT5161L is not set
# CONFIG_SENSORS_SBTSI is not set
# CONFIG_SENSORS_SHT15 is not set
# CONFIG_SENSORS_SHT21 is not set
# CONFIG_SENSORS_SHT3x is not set
# CONFIG_SENSORS_SHT4x is not set
# CONFIG_SENSORS_SHTC1 is not set
# CONFIG_SENSORS_SIS5595 is not set
# CONFIG_SENSORS_DME1737 is not set
# CONFIG_SENSORS_EMC1403 is not set
# CONFIG_SENSORS_EMC1812 is not set
# CONFIG_SENSORS_EMC2103 is not set
# CONFIG_SENSORS_EMC2305 is not set
# CONFIG_SENSORS_EMC6W201 is not set
# CONFIG_SENSORS_SMSC47M1 is not set
# CONFIG_SENSORS_SMSC47M192 is not set
# CONFIG_SENSORS_SMSC47B397 is not set
# CONFIG_SENSORS_SCH5627 is not set
# CONFIG_SENSORS_SCH5636 is not set
# CONFIG_SENSORS_STTS751 is not set
# CONFIG_SENSORS_SURFACE_FAN is not set
# CONFIG_SENSORS_SURFACE_TEMP is not set
# CONFIG_SENSORS_ADC128D818 is not set
# CONFIG_SENSORS_ADS7828 is not set
# CONFIG_SENSORS_ADS7871 is not set
# CONFIG_SENSORS_AMC6821 is not set
# CONFIG_SENSORS_INA209 is not set
# CONFIG_SENSORS_INA2XX is not set
# CONFIG_SENSORS_INA238 is not set
# CONFIG_SENSORS_INA3221 is not set
# CONFIG_SENSORS_SPD5118 is not set
# CONFIG_SENSORS_TC74 is not set
# CONFIG_SENSORS_THMC50 is not set
# CONFIG_SENSORS_TMP102 is not set
# CONFIG_SENSORS_TMP103 is not set
# CONFIG_SENSORS_TMP108 is not set
# CONFIG_SENSORS_TMP401 is not set
# CONFIG_SENSORS_TMP421 is not set
# CONFIG_SENSORS_TMP464 is not set
# CONFIG_SENSORS_TMP513 is not set
# CONFIG_SENSORS_TSC1641 is not set
# CONFIG_SENSORS_VIA_CPUTEMP is not set
# CONFIG_SENSORS_VIA686A is not set
# CONFIG_SENSORS_VT1211 is not set
# CONFIG_SENSORS_VT8231 is not set
# CONFIG_SENSORS_W83773G is not set
# CONFIG_SENSORS_W83781D is not set
# CONFIG_SENSORS_W83791D is not set
# CONFIG_SENSORS_W83792D is not set
# CONFIG_SENSORS_W83793 is not set
# CONFIG_SENSORS_W83795 is not set
# CONFIG_SENSORS_W83L785TS is not set
# CONFIG_SENSORS_W83L786NG is not set
# CONFIG_SENSORS_W83627HF is not set
# CONFIG_SENSORS_W83627EHF is not set
# CONFIG_SENSORS_XGENE is not set
# CONFIG_SENSORS_YOGAFAN is not set

#
# ACPI drivers
#
# CONFIG_SENSORS_ACPI_POWER is not set
# CONFIG_SENSORS_ATK0110 is not set
# CONFIG_SENSORS_ASUS_WMI is not set
# CONFIG_SENSORS_ASUS_EC is not set
# CONFIG_SENSORS_HP_WMI is not set
CONFIG_THERMAL=y
CONFIG_THERMAL_NETLINK=y
# CONFIG_THERMAL_STATISTICS is not set
# CONFIG_THERMAL_DEBUGFS is not set
# CONFIG_THERMAL_CORE_TESTING is not set
CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0
CONFIG_THERMAL_HWMON=y
# CONFIG_THERMAL_OF is not set
CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y
# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set
# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set
# CONFIG_THERMAL_GOV_FAIR_SHARE is not set
CONFIG_THERMAL_GOV_STEP_WISE=y
# CONFIG_THERMAL_GOV_BANG_BANG is not set
# CONFIG_THERMAL_GOV_USER_SPACE is not set
# CONFIG_PCIE_THERMAL is not set
# CONFIG_THERMAL_EMULATION is not set
# CONFIG_THERMAL_MMIO is not set

#
# Intel thermal drivers
#
# CONFIG_INTEL_POWERCLAMP is not set
CONFIG_X86_THERMAL_VECTOR=y
# CONFIG_X86_PKG_TEMP_THERMAL is not set
# CONFIG_INTEL_SOC_DTS_THERMAL is not set

#
# ACPI INT340X thermal drivers
#
# CONFIG_INT340X_THERMAL is not set
# end of ACPI INT340X thermal drivers

# CONFIG_INTEL_BXT_PMIC_THERMAL is not set
# CONFIG_INTEL_PCH_THERMAL is not set
# CONFIG_INTEL_TCC_COOLING is not set
# CONFIG_INTEL_HFI_THERMAL is not set
# end of Intel thermal drivers

# CONFIG_GENERIC_ADC_THERMAL is not set
CONFIG_WATCHDOG=y
# CONFIG_WATCHDOG_CORE is not set
# CONFIG_WATCHDOG_NOWAYOUT is not set
CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED=y
CONFIG_WATCHDOG_OPEN_TIMEOUT=0
# CONFIG_WATCHDOG_SYSFS is not set
# CONFIG_WATCHDOG_HRTIMER_PRETIMEOUT is not set

#
# Watchdog Pretimeout Governors
#

#
# Watchdog Device Drivers
#
# CONFIG_SOFT_WATCHDOG is not set
# CONFIG_GPIO_WATCHDOG is not set
# CONFIG_LENOVO_SE10_WDT is not set
# CONFIG_LENOVO_SE30_WDT is not set
# CONFIG_WDAT_WDT is not set
# CONFIG_XILINX_WATCHDOG is not set
# CONFIG_ZIIRAVE_WATCHDOG is not set
# CONFIG_CADENCE_WATCHDOG is not set
# CONFIG_DW_WATCHDOG is not set
# CONFIG_TWL4030_WATCHDOG is not set
# CONFIG_MAX63XX_WATCHDOG is not set
# CONFIG_RETU_WATCHDOG is not set
# CONFIG_ACQUIRE_WDT is not set
# CONFIG_ADVANTECH_WDT is not set
# CONFIG_ADVANTECH_EC_WDT is not set
# CONFIG_ALIM1535_WDT is not set
# CONFIG_ALIM7101_WDT is not set
# CONFIG_EBC_C384_WDT is not set
# CONFIG_EXAR_WDT is not set
# CONFIG_F71808E_WDT is not set
# CONFIG_SP5100_TCO is not set
# CONFIG_SBC_FITPC2_WATCHDOG is not set
# CONFIG_EUROTECH_WDT is not set
# CONFIG_IB700_WDT is not set
# CONFIG_IBMASR is not set
# CONFIG_WAFER_WDT is not set
# CONFIG_I6300ESB_WDT is not set
# CONFIG_IE6XX_WDT is not set
# CONFIG_INTEL_OC_WATCHDOG is not set
# CONFIG_ITCO_WDT is not set
# CONFIG_IT8712F_WDT is not set
# CONFIG_IT87_WDT is not set
# CONFIG_HP_WATCHDOG is not set
# CONFIG_SC1200_WDT is not set
# CONFIG_PC87413_WDT is not set
# CONFIG_NV_TCO is not set
# CONFIG_60XX_WDT is not set
# CONFIG_SMSC_SCH311X_WDT is not set
# CONFIG_SMSC37B787_WDT is not set
# CONFIG_TQMX86_WDT is not set
# CONFIG_VIA_WDT is not set
# CONFIG_W83627HF_WDT is not set
# CONFIG_W83877F_WDT is not set
# CONFIG_W83977F_WDT is not set
# CONFIG_SBC_EPX_C3_WATCHDOG is not set
# CONFIG_INTEL_MEI_WDT is not set
# CONFIG_NI903X_WDT is not set
# CONFIG_NIC7018_WDT is not set
# CONFIG_MEN_A21_WDT is not set

#
# PCI-based Watchdog Cards
#
# CONFIG_PCIPCWATCHDOG is not set
# CONFIG_WDTPCI is not set

#
# USB-based Watchdog Cards
#
CONFIG_USBPCWATCHDOG=y
CONFIG_SSB_POSSIBLE=y
CONFIG_SSB=y
CONFIG_SSB_PCIHOST_POSSIBLE=y
# CONFIG_SSB_PCIHOST is not set
CONFIG_SSB_PCMCIAHOST_POSSIBLE=y
# CONFIG_SSB_PCMCIAHOST is not set
CONFIG_SSB_SDIOHOST_POSSIBLE=y
# CONFIG_SSB_SDIOHOST is not set
# CONFIG_SSB_DRIVER_GPIO is not set
CONFIG_BCMA_POSSIBLE=y
CONFIG_BCMA=y
CONFIG_BCMA_HOST_PCI_POSSIBLE=y
# CONFIG_BCMA_HOST_PCI is not set
# CONFIG_BCMA_HOST_SOC is not set
# CONFIG_BCMA_DRIVER_PCI is not set
# CONFIG_BCMA_DRIVER_GMAC_CMN is not set
# CONFIG_BCMA_DRIVER_GPIO is not set
# CONFIG_BCMA_DEBUG is not set

#
# Multifunction device drivers
#
CONFIG_MFD_CORE=y
# CONFIG_MFD_ADP5585 is not set
# CONFIG_MFD_ACT8945A is not set
# CONFIG_MFD_AS3711 is not set
# CONFIG_MFD_SMPRO is not set
# CONFIG_MFD_AS3722 is not set
# CONFIG_PMIC_ADP5520 is not set
# CONFIG_MFD_AAT2870_CORE is not set
# CONFIG_MFD_ATMEL_FLEXCOM is not set
# CONFIG_MFD_ATMEL_HLCDC is not set
# CONFIG_MFD_BCM590XX is not set
# CONFIG_MFD_BD9571MWV is not set
# CONFIG_MFD_AXP20X_I2C is not set
# CONFIG_MFD_CGBC is not set
# CONFIG_MFD_CS40L50_I2C is not set
# CONFIG_MFD_CS40L50_SPI is not set
# CONFIG_MFD_CS42L43_I2C is not set
# CONFIG_MFD_CS42L43_SDW is not set
# CONFIG_MFD_LOCHNAGAR is not set
# CONFIG_MFD_MADERA is not set
# CONFIG_PMIC_DA903X is not set
# CONFIG_MFD_DA9052_SPI is not set
# CONFIG_MFD_DA9052_I2C is not set
# CONFIG_MFD_DA9055 is not set
# CONFIG_MFD_DA9062 is not set
# CONFIG_MFD_DA9063 is not set
# CONFIG_MFD_DA9150 is not set
CONFIG_MFD_DLN2=y
# CONFIG_MFD_GATEWORKS_GSC is not set
# CONFIG_MFD_MC13XXX_SPI is not set
# CONFIG_MFD_MC13XXX_I2C is not set
# CONFIG_MFD_MP2629 is not set
# CONFIG_MFD_PF1550 is not set
# CONFIG_MFD_HI6421_PMIC is not set
# CONFIG_MFD_INTEL_QUARK_I2C_GPIO is not set
CONFIG_LPC_ICH=y
# CONFIG_LPC_SCH is not set
# CONFIG_INTEL_SOC_PMIC is not set
CONFIG_INTEL_SOC_PMIC_BXTWC=y
CONFIG_INTEL_SOC_PMIC_CHTWC=y
# CONFIG_INTEL_SOC_PMIC_CHTDC_TI is not set
# CONFIG_MFD_INTEL_LPSS_ACPI is not set
# CONFIG_MFD_INTEL_LPSS_PCI is not set
CONFIG_MFD_INTEL_PMC_BXT=y
# CONFIG_MFD_IQS62X is not set
# CONFIG_MFD_JANZ_CMODIO is not set
# CONFIG_MFD_KEMPLD is not set
# CONFIG_MFD_88PM800 is not set
# CONFIG_MFD_88PM805 is not set
# CONFIG_MFD_88PM860X is not set
# CONFIG_MFD_88PM886_PMIC is not set
# CONFIG_MFD_MAX5970 is not set
# CONFIG_MFD_MAX14577 is not set
# CONFIG_MFD_MAX77541 is not set
# CONFIG_MFD_MAX77620 is not set
# CONFIG_MFD_MAX77650 is not set
# CONFIG_MFD_MAX77686 is not set
# CONFIG_MFD_MAX77693 is not set
# CONFIG_MFD_MAX77705 is not set
# CONFIG_MFD_MAX77714 is not set
# CONFIG_MFD_MAX77759 is not set
# CONFIG_MFD_MAX77843 is not set
# CONFIG_MFD_MAX8907 is not set
# CONFIG_MFD_MAX8925 is not set
# CONFIG_MFD_MAX8997 is not set
# CONFIG_MFD_MAX8998 is not set
CONFIG_MFD_MT6360=y
CONFIG_MFD_MT6370=y
# CONFIG_MFD_MT6397 is not set
# CONFIG_MFD_MENF21BMC is not set
# CONFIG_MFD_NCT6694 is not set
# CONFIG_MFD_OCELOT is not set
# CONFIG_MFD_CPCAP is not set
CONFIG_MFD_VIPERBOARD=y
# CONFIG_MFD_NTXEC is not set
CONFIG_MFD_RETU=y
# CONFIG_MFD_SY7636A is not set
# CONFIG_MFD_RDC321X is not set
# CONFIG_MFD_RT4831 is not set
# CONFIG_MFD_RT5033 is not set
# CONFIG_MFD_RT5120 is not set
# CONFIG_MFD_RC5T583 is not set
# CONFIG_MFD_RK8XX_I2C is not set
# CONFIG_MFD_RK8XX_SPI is not set
# CONFIG_MFD_RN5T618 is not set
# CONFIG_MFD_SEC_I2C is not set
# CONFIG_MFD_SI476X_CORE is not set
# CONFIG_MFD_SM501 is not set
# CONFIG_MFD_SKY81452 is not set
# CONFIG_MFD_STMPE is not set
CONFIG_MFD_SYSCON=y
# CONFIG_MFD_LP3943 is not set
# CONFIG_MFD_LP8788 is not set
# CONFIG_MFD_TI_LMU is not set
# CONFIG_MFD_BQ257XX is not set
# CONFIG_MFD_PALMAS is not set
# CONFIG_TPS6105X is not set
# CONFIG_TPS65010 is not set
# CONFIG_TPS6507X is not set
# CONFIG_MFD_TPS65086 is not set
# CONFIG_MFD_TPS65090 is not set
# CONFIG_MFD_TPS65217 is not set
# CONFIG_MFD_TI_LP873X is not set
# CONFIG_MFD_TI_LP87565 is not set
# CONFIG_MFD_TPS65218 is not set
# CONFIG_MFD_TPS65219 is not set
# CONFIG_MFD_TPS6586X is not set
# CONFIG_MFD_TPS65910 is not set
# CONFIG_MFD_TPS65912_I2C is not set
# CONFIG_MFD_TPS65912_SPI is not set
# CONFIG_MFD_TPS6594_I2C is not set
# CONFIG_MFD_TPS6594_SPI is not set
CONFIG_TWL4030_CORE=y
# CONFIG_MFD_TWL4030_AUDIO is not set
# CONFIG_TWL6040_CORE is not set
# CONFIG_MFD_LM3533 is not set
# CONFIG_MFD_TC3589X is not set
# CONFIG_MFD_TQMX86 is not set
# CONFIG_MFD_VX855 is not set
# CONFIG_MFD_ARIZONA_I2C is not set
# CONFIG_MFD_ARIZONA_SPI is not set
# CONFIG_MFD_WM8400 is not set
# CONFIG_MFD_WM831X_I2C is not set
# CONFIG_MFD_WM831X_SPI is not set
# CONFIG_MFD_WM8350_I2C is not set
# CONFIG_MFD_WM8994 is not set
# CONFIG_MFD_ROHM_BD718XX is not set
# CONFIG_MFD_ROHM_BD71828 is not set
# CONFIG_MFD_ROHM_BD957XMUF is not set
# CONFIG_MFD_ROHM_BD96801 is not set
# CONFIG_MFD_STPMIC1 is not set
# CONFIG_MFD_STMFX is not set
# CONFIG_MFD_ATC260X_I2C is not set
# CONFIG_MFD_QCOM_PM8008 is not set
# CONFIG_RAVE_SP_CORE is not set
# CONFIG_MFD_INTEL_M10_BMC_SPI is not set
# CONFIG_MFD_QNAP_MCU is not set
# CONFIG_MFD_RSMU_I2C is not set
# CONFIG_MFD_RSMU_SPI is not set
# CONFIG_MFD_UPBOARD_FPGA is not set
# CONFIG_MFD_MAX7360 is not set
# end of Multifunction device drivers

CONFIG_REGULATOR=y
# CONFIG_REGULATOR_DEBUG is not set
CONFIG_REGULATOR_FIXED_VOLTAGE=y
# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set
# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set
# CONFIG_REGULATOR_NETLINK_EVENTS is not set
# CONFIG_REGULATOR_88PG86X is not set
# CONFIG_REGULATOR_ACT8865 is not set
# CONFIG_REGULATOR_AD5398 is not set
# CONFIG_REGULATOR_ADP5055 is not set
# CONFIG_REGULATOR_AW37503 is not set
# CONFIG_REGULATOR_DA9121 is not set
# CONFIG_REGULATOR_DA9210 is not set
# CONFIG_REGULATOR_DA9211 is not set
# CONFIG_REGULATOR_FAN53555 is not set
# CONFIG_REGULATOR_FAN53880 is not set
# CONFIG_REGULATOR_GPIO is not set
# CONFIG_REGULATOR_ISL9305 is not set
# CONFIG_REGULATOR_ISL6271A is not set
# CONFIG_REGULATOR_FP9931 is not set
# CONFIG_REGULATOR_LP3971 is not set
# CONFIG_REGULATOR_LP3972 is not set
# CONFIG_REGULATOR_LP872X is not set
# CONFIG_REGULATOR_LP8755 is not set
# CONFIG_REGULATOR_LTC3589 is not set
# CONFIG_REGULATOR_LTC3676 is not set
# CONFIG_REGULATOR_MAX1586 is not set
# CONFIG_REGULATOR_MAX77503 is not set
# CONFIG_REGULATOR_MAX77675 is not set
# CONFIG_REGULATOR_MAX77857 is not set
# CONFIG_REGULATOR_MAX8649 is not set
# CONFIG_REGULATOR_MAX8660 is not set
# CONFIG_REGULATOR_MAX8893 is not set
# CONFIG_REGULATOR_MAX8952 is not set
# CONFIG_REGULATOR_MAX20086 is not set
# CONFIG_REGULATOR_MAX20411 is not set
# CONFIG_REGULATOR_MAX77826 is not set
# CONFIG_REGULATOR_MAX77838 is not set
# CONFIG_REGULATOR_MCP16502 is not set
# CONFIG_REGULATOR_MP5416 is not set
# CONFIG_REGULATOR_MP8859 is not set
# CONFIG_REGULATOR_MP886X is not set
# CONFIG_REGULATOR_MPQ7920 is not set
# CONFIG_REGULATOR_MT6311 is not set
# CONFIG_REGULATOR_MT6360 is not set
# CONFIG_REGULATOR_MT6370 is not set
# CONFIG_REGULATOR_PCA9450 is not set
# CONFIG_REGULATOR_PF9453 is not set
# CONFIG_REGULATOR_PF0900 is not set
# CONFIG_REGULATOR_PF530X is not set
# CONFIG_REGULATOR_PF8X00 is not set
# CONFIG_REGULATOR_PFUZE100 is not set
# CONFIG_REGULATOR_PV88060 is not set
# CONFIG_REGULATOR_PV88080 is not set
# CONFIG_REGULATOR_PV88090 is not set
# CONFIG_REGULATOR_RAA215300 is not set
# CONFIG_REGULATOR_RT4801 is not set
# CONFIG_REGULATOR_RT4803 is not set
# CONFIG_REGULATOR_RT5133 is not set
# CONFIG_REGULATOR_RT5190A is not set
# CONFIG_REGULATOR_RT5739 is not set
# CONFIG_REGULATOR_RT5759 is not set
# CONFIG_REGULATOR_RT6160 is not set
# CONFIG_REGULATOR_RT6190 is not set
# CONFIG_REGULATOR_RT6245 is not set
# CONFIG_REGULATOR_RT8092 is not set
# CONFIG_REGULATOR_RTQ2134 is not set
# CONFIG_REGULATOR_RTMV20 is not set
# CONFIG_REGULATOR_RTQ6752 is not set
# CONFIG_REGULATOR_RTQ2208 is not set
# CONFIG_REGULATOR_SGM3804 is not set
# CONFIG_REGULATOR_SLG51000 is not set
# CONFIG_REGULATOR_SY8106A is not set
# CONFIG_REGULATOR_SY8824X is not set
# CONFIG_REGULATOR_SY8827N is not set
# CONFIG_REGULATOR_TPS51632 is not set
# CONFIG_REGULATOR_TPS62360 is not set
# CONFIG_REGULATOR_TPS6286X is not set
# CONFIG_REGULATOR_TPS6287X is not set
# CONFIG_REGULATOR_TPS65023 is not set
# CONFIG_REGULATOR_TPS6507X is not set
# CONFIG_REGULATOR_TPS65132 is not set
# CONFIG_REGULATOR_TPS65185 is not set
# CONFIG_REGULATOR_TPS6524X is not set
CONFIG_REGULATOR_TWL4030=y
# CONFIG_REGULATOR_VCTRL is not set
CONFIG_RC_CORE=y
# CONFIG_LIRC is not set
# CONFIG_RC_MAP is not set
# CONFIG_RC_DECODERS is not set
CONFIG_RC_DEVICES=y
# CONFIG_IR_ENE is not set
# CONFIG_IR_FINTEK is not set
# CONFIG_IR_GPIO_CIR is not set
# CONFIG_IR_HIX5HD2 is not set
CONFIG_IR_IGORPLUGUSB=y
CONFIG_IR_IGUANA=y
CONFIG_IR_IMON=y
CONFIG_IR_IMON_RAW=y
# CONFIG_IR_ITE_CIR is not set
CONFIG_IR_MCEUSB=y
# CONFIG_IR_NUVOTON is not set
CONFIG_IR_REDRAT3=y
# CONFIG_IR_SERIAL is not set
CONFIG_IR_STREAMZAP=y
CONFIG_IR_TOY=y
CONFIG_IR_TTUSBIR=y
# CONFIG_IR_WINBOND_CIR is not set
CONFIG_RC_ATI_REMOTE=y
# CONFIG_RC_LOOPBACK is not set
CONFIG_RC_XBOX_DVD=y
CONFIG_CEC_CORE=y

#
# CEC support
#
# CONFIG_MEDIA_CEC_RC is not set
CONFIG_MEDIA_CEC_SUPPORT=y
# CONFIG_CEC_CH7322 is not set
# CONFIG_CEC_NXP_TDA9950 is not set
# CONFIG_CEC_GPIO is not set
# CONFIG_CEC_SECO is not set
# CONFIG_USB_EXTRON_DA_HD_4K_PLUS_CEC is not set
CONFIG_USB_PULSE8_CEC=y
CONFIG_USB_RAINSHADOW_CEC=y
# end of CEC support

CONFIG_MEDIA_SUPPORT=y
CONFIG_MEDIA_SUPPORT_FILTER=y
# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set

#
# Media device types
#
CONFIG_MEDIA_CAMERA_SUPPORT=y
CONFIG_MEDIA_ANALOG_TV_SUPPORT=y
CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y
CONFIG_MEDIA_RADIO_SUPPORT=y
CONFIG_MEDIA_SDR_SUPPORT=y
CONFIG_MEDIA_PLATFORM_SUPPORT=y
CONFIG_MEDIA_TEST_SUPPORT=y
# end of Media device types

CONFIG_VIDEO_DEV=y
CONFIG_MEDIA_CONTROLLER=y
CONFIG_DVB_CORE=y

#
# Video4Linux options
#
CONFIG_VIDEO_V4L2_I2C=y
CONFIG_VIDEO_V4L2_SUBDEV_API=y
# CONFIG_VIDEO_ADV_DEBUG is not set
# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set
CONFIG_VIDEO_TUNER=y
CONFIG_V4L2_MEM2MEM_DEV=y
# end of Video4Linux options

#
# Media controller options
#
CONFIG_MEDIA_CONTROLLER_DVB=y
# end of Media controller options

#
# Digital TV options
#
# CONFIG_DVB_MMAP is not set
# CONFIG_DVB_NET is not set
CONFIG_DVB_MAX_ADAPTERS=16
# CONFIG_DVB_DYNAMIC_MINORS is not set
# CONFIG_DVB_DEMUX_SECTION_LOSS_LOG is not set
# CONFIG_DVB_ULE_DEBUG is not set
# end of Digital TV options

#
# Media drivers
#

#
# Drivers filtered as selected at 'Filter media drivers'
#

#
# Media drivers
#
CONFIG_MEDIA_USB_SUPPORT=y

#
# Webcam devices
#
CONFIG_USB_GSPCA=y
CONFIG_USB_GSPCA_BENQ=y
CONFIG_USB_GSPCA_CONEX=y
CONFIG_USB_GSPCA_CPIA1=y
CONFIG_USB_GSPCA_DTCS033=y
CONFIG_USB_GSPCA_ETOMS=y
CONFIG_USB_GSPCA_FINEPIX=y
CONFIG_USB_GSPCA_JEILINJ=y
CONFIG_USB_GSPCA_JL2005BCD=y
CONFIG_USB_GSPCA_KINECT=y
CONFIG_USB_GSPCA_KONICA=y
CONFIG_USB_GSPCA_MARS=y
CONFIG_USB_GSPCA_MR97310A=y
CONFIG_USB_GSPCA_NW80X=y
CONFIG_USB_GSPCA_OV519=y
CONFIG_USB_GSPCA_OV534=y
CONFIG_USB_GSPCA_OV534_9=y
CONFIG_USB_GSPCA_PAC207=y
CONFIG_USB_GSPCA_PAC7302=y
CONFIG_USB_GSPCA_PAC7311=y
CONFIG_USB_GSPCA_SE401=y
CONFIG_USB_GSPCA_SN9C2028=y
CONFIG_USB_GSPCA_SN9C20X=y
CONFIG_USB_GSPCA_SONIXB=y
CONFIG_USB_GSPCA_SONIXJ=y
CONFIG_USB_GSPCA_SPCA1528=y
CONFIG_USB_GSPCA_SPCA500=y
CONFIG_USB_GSPCA_SPCA501=y
CONFIG_USB_GSPCA_SPCA505=y
CONFIG_USB_GSPCA_SPCA506=y
CONFIG_USB_GSPCA_SPCA508=y
CONFIG_USB_GSPCA_SPCA561=y
CONFIG_USB_GSPCA_SQ905=y
CONFIG_USB_GSPCA_SQ905C=y
CONFIG_USB_GSPCA_SQ930X=y
CONFIG_USB_GSPCA_STK014=y
CONFIG_USB_GSPCA_STK1135=y
CONFIG_USB_GSPCA_STV0680=y
CONFIG_USB_GSPCA_SUNPLUS=y
CONFIG_USB_GSPCA_T613=y
CONFIG_USB_GSPCA_TOPRO=y
CONFIG_USB_GSPCA_TOUPTEK=y
CONFIG_USB_GSPCA_TV8532=y
CONFIG_USB_GSPCA_VC032X=y
CONFIG_USB_GSPCA_VICAM=y
CONFIG_USB_GSPCA_XIRLINK_CIT=y
CONFIG_USB_GSPCA_ZC3XX=y
CONFIG_USB_GL860=y
CONFIG_USB_M5602=y
CONFIG_USB_STV06XX=y
CONFIG_USB_PWC=y
# CONFIG_USB_PWC_DEBUG is not set
CONFIG_USB_PWC_INPUT_EVDEV=y
CONFIG_USB_S2255=y
CONFIG_VIDEO_USBTV=y
CONFIG_USB_VIDEO_CLASS=y
CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y

#
# Analog TV USB devices
#
CONFIG_VIDEO_GO7007=y
CONFIG_VIDEO_GO7007_USB=y
CONFIG_VIDEO_GO7007_LOADER=y
CONFIG_VIDEO_GO7007_USB_S2250_BOARD=y
CONFIG_VIDEO_HDPVR=y
CONFIG_VIDEO_PVRUSB2=y
CONFIG_VIDEO_PVRUSB2_SYSFS=y
CONFIG_VIDEO_PVRUSB2_DVB=y
# CONFIG_VIDEO_PVRUSB2_DEBUGIFC is not set
CONFIG_VIDEO_STK1160=y

#
# Analog/digital TV USB devices
#
CONFIG_VIDEO_AU0828=y
CONFIG_VIDEO_AU0828_V4L2=y
CONFIG_VIDEO_AU0828_RC=y
CONFIG_VIDEO_CX231XX=y
CONFIG_VIDEO_CX231XX_RC=y
CONFIG_VIDEO_CX231XX_ALSA=y
CONFIG_VIDEO_CX231XX_DVB=y

#
# Digital TV USB devices
#
CONFIG_DVB_AS102=y
CONFIG_DVB_B2C2_FLEXCOP_USB=y
# CONFIG_DVB_B2C2_FLEXCOP_USB_DEBUG is not set
CONFIG_DVB_USB_V2=y
CONFIG_DVB_USB_AF9015=y
CONFIG_DVB_USB_AF9035=y
CONFIG_DVB_USB_ANYSEE=y
CONFIG_DVB_USB_AU6610=y
CONFIG_DVB_USB_AZ6007=y
CONFIG_DVB_USB_CE6230=y
CONFIG_DVB_USB_DVBSKY=y
CONFIG_DVB_USB_EC168=y
CONFIG_DVB_USB_GL861=y
CONFIG_DVB_USB_LME2510=y
CONFIG_DVB_USB_MXL111SF=y
CONFIG_DVB_USB_RTL28XXU=y
CONFIG_DVB_USB_ZD1301=y
CONFIG_DVB_USB=y
# CONFIG_DVB_USB_DEBUG is not set
CONFIG_DVB_USB_A800=y
CONFIG_DVB_USB_AF9005=y
CONFIG_DVB_USB_AF9005_REMOTE=y
CONFIG_DVB_USB_AZ6027=y
CONFIG_DVB_USB_CINERGY_T2=y
CONFIG_DVB_USB_CXUSB=y
CONFIG_DVB_USB_CXUSB_ANALOG=y
CONFIG_DVB_USB_DIB0700=y
CONFIG_DVB_USB_DIB3000MC=y
CONFIG_DVB_USB_DIBUSB_MB=y
# CONFIG_DVB_USB_DIBUSB_MB_FAULTY is not set
CONFIG_DVB_USB_DIBUSB_MC=y
CONFIG_DVB_USB_DIGITV=y
CONFIG_DVB_USB_DTT200U=y
CONFIG_DVB_USB_DTV5100=y
CONFIG_DVB_USB_DW2102=y
CONFIG_DVB_USB_GP8PSK=y
CONFIG_DVB_USB_M920X=y
CONFIG_DVB_USB_NOVA_T_USB2=y
CONFIG_DVB_USB_OPERA1=y
CONFIG_DVB_USB_PCTV452E=y
CONFIG_DVB_USB_TECHNISAT_USB2=y
CONFIG_DVB_USB_TTUSB2=y
CONFIG_DVB_USB_UMT_010=y
CONFIG_DVB_USB_VP702X=y
CONFIG_DVB_USB_VP7045=y
CONFIG_SMS_USB_DRV=y
CONFIG_DVB_TTUSB_BUDGET=y
CONFIG_DVB_TTUSB_DEC=y

#
# Webcam, TV (analog/digital) USB devices
#
CONFIG_VIDEO_EM28XX=y
CONFIG_VIDEO_EM28XX_V4L2=y
CONFIG_VIDEO_EM28XX_ALSA=y
CONFIG_VIDEO_EM28XX_DVB=y
CONFIG_VIDEO_EM28XX_RC=y

#
# Software defined radio USB devices
#
CONFIG_USB_AIRSPY=y
CONFIG_USB_HACKRF=y
CONFIG_USB_MSI2500=y
# CONFIG_MEDIA_PCI_SUPPORT is not set
CONFIG_RADIO_ADAPTERS=y
# CONFIG_RADIO_MAXIRADIO is not set
# CONFIG_RADIO_SAA7706H is not set
CONFIG_RADIO_SHARK=y
CONFIG_RADIO_SHARK2=y
CONFIG_RADIO_SI4713=y
CONFIG_RADIO_TEA575X=y
# CONFIG_RADIO_TEA5764 is not set
# CONFIG_RADIO_TEF6862 is not set
CONFIG_USB_DSBR=y
CONFIG_USB_KEENE=y
CONFIG_USB_MA901=y
CONFIG_USB_MR800=y
CONFIG_USB_RAREMONO=y
CONFIG_RADIO_SI470X=y
CONFIG_USB_SI470X=y
# CONFIG_I2C_SI470X is not set
CONFIG_USB_SI4713=y
# CONFIG_PLATFORM_SI4713 is not set
CONFIG_I2C_SI4713=y
# CONFIG_MEDIA_PLATFORM_DRIVERS is not set

#
# MMC/SDIO DVB adapters
#
CONFIG_SMS_SDIO_DRV=y
CONFIG_V4L_TEST_DRIVERS=y
CONFIG_VIDEO_VIM2M=y
CONFIG_VIDEO_VICODEC=y
CONFIG_VIDEO_VIMC=y
CONFIG_VIDEO_VIVID=y
CONFIG_VIDEO_VIVID_CEC=y
# CONFIG_VIDEO_VIVID_OSD is not set
CONFIG_VIDEO_VIVID_MAX_DEVS=64
# CONFIG_VIDEO_VISL is not set
CONFIG_DVB_TEST_DRIVERS=y
CONFIG_DVB_VIDTV=y

#
# FireWire (IEEE 1394) Adapters
#
# CONFIG_DVB_FIREDTV is not set
CONFIG_MEDIA_COMMON_OPTIONS=y

#
# common driver options
#
CONFIG_CYPRESS_FIRMWARE=y
CONFIG_TTPCI_EEPROM=y
CONFIG_UVC_COMMON=y
CONFIG_VIDEO_CX2341X=y
CONFIG_VIDEO_TVEEPROM=y
CONFIG_DVB_B2C2_FLEXCOP=y
CONFIG_SMS_SIANO_MDTV=y
CONFIG_SMS_SIANO_RC=y
CONFIG_SMS_SIANO_DEBUGFS=y
CONFIG_VIDEO_V4L2_TPG=y
CONFIG_VIDEOBUF2_CORE=y
CONFIG_VIDEOBUF2_V4L2=y
CONFIG_VIDEOBUF2_MEMOPS=y
CONFIG_VIDEOBUF2_DMA_CONTIG=y
CONFIG_VIDEOBUF2_VMALLOC=y
CONFIG_VIDEOBUF2_DMA_SG=y
# end of Media drivers

#
# Media ancillary drivers
#
CONFIG_MEDIA_ATTACH=y
# CONFIG_VIDEO_IR_I2C is not set
# CONFIG_VIDEO_CAMERA_SENSOR is not set

#
# Camera ISPs
#
# CONFIG_VIDEO_THP7312 is not set
# end of Camera ISPs

# CONFIG_VIDEO_CAMERA_LENS is not set

#
# Flash devices
#
# CONFIG_VIDEO_ADP1653 is not set
# CONFIG_VIDEO_LM3560 is not set
# CONFIG_VIDEO_LM3646 is not set
# end of Flash devices

#
# Audio decoders, processors and mixers
#
# CONFIG_VIDEO_CS3308 is not set
# CONFIG_VIDEO_CS5345 is not set
CONFIG_VIDEO_CS53L32A=y
CONFIG_VIDEO_MSP3400=y
# CONFIG_VIDEO_SONY_BTF_MPX is not set
# CONFIG_VIDEO_TDA1997X is not set
# CONFIG_VIDEO_TDA7432 is not set
# CONFIG_VIDEO_TDA9840 is not set
# CONFIG_VIDEO_TEA6415C is not set
# CONFIG_VIDEO_TEA6420 is not set
# CONFIG_VIDEO_TLV320AIC23B is not set
# CONFIG_VIDEO_TVAUDIO is not set
# CONFIG_VIDEO_UDA1342 is not set
# CONFIG_VIDEO_VP27SMPX is not set
# CONFIG_VIDEO_WM8739 is not set
CONFIG_VIDEO_WM8775=y
# end of Audio decoders, processors and mixers

#
# RDS decoders
#
# CONFIG_VIDEO_SAA6588 is not set
# end of RDS decoders

#
# Video decoders
#
# CONFIG_VIDEO_ADV7180 is not set
# CONFIG_VIDEO_ADV7183 is not set
# CONFIG_VIDEO_ADV748X is not set
# CONFIG_VIDEO_ADV7604 is not set
# CONFIG_VIDEO_ADV7842 is not set
# CONFIG_VIDEO_BT819 is not set
# CONFIG_VIDEO_BT856 is not set
# CONFIG_VIDEO_BT866 is not set
# CONFIG_VIDEO_ISL7998X is not set
# CONFIG_VIDEO_LT6911UXE is not set
# CONFIG_VIDEO_KS0127 is not set
# CONFIG_VIDEO_MAX9286 is not set
# CONFIG_VIDEO_ML86V7667 is not set
# CONFIG_VIDEO_SAA7110 is not set
CONFIG_VIDEO_SAA711X=y
# CONFIG_VIDEO_TC358743 is not set
# CONFIG_VIDEO_TC358746 is not set
# CONFIG_VIDEO_TVP514X is not set
# CONFIG_VIDEO_TVP5150 is not set
# CONFIG_VIDEO_TVP7002 is not set
# CONFIG_VIDEO_TW2804 is not set
# CONFIG_VIDEO_TW9900 is not set
# CONFIG_VIDEO_TW9903 is not set
# CONFIG_VIDEO_TW9906 is not set
# CONFIG_VIDEO_TW9910 is not set
# CONFIG_VIDEO_VPX3220 is not set

#
# Video and audio decoders
#
# CONFIG_VIDEO_SAA717X is not set
CONFIG_VIDEO_CX25840=y
# end of Video decoders

#
# Video encoders
#
# CONFIG_VIDEO_ADV7170 is not set
# CONFIG_VIDEO_ADV7175 is not set
# CONFIG_VIDEO_ADV7343 is not set
# CONFIG_VIDEO_ADV7393 is not set
# CONFIG_VIDEO_ADV7511 is not set
# CONFIG_VIDEO_AK881X is not set
# CONFIG_VIDEO_SAA7127 is not set
# CONFIG_VIDEO_SAA7185 is not set
# CONFIG_VIDEO_THS8200 is not set
# end of Video encoders

#
# Video improvement chips
#
# CONFIG_VIDEO_UPD64031A is not set
# CONFIG_VIDEO_UPD64083 is not set
# end of Video improvement chips

#
# Audio/Video compression chips
#
# CONFIG_VIDEO_SAA6752HS is not set
# end of Audio/Video compression chips

#
# SDR tuner chips
#
# CONFIG_SDR_MAX2175 is not set
# end of SDR tuner chips

#
# Miscellaneous helper chips
#
# CONFIG_VIDEO_INTEL_CVS is not set
# CONFIG_VIDEO_I2C is not set
# CONFIG_VIDEO_M52790 is not set
# CONFIG_VIDEO_ST_MIPID02 is not set
# CONFIG_VIDEO_THS7303 is not set
# end of Miscellaneous helper chips

#
# Video serializers and deserializers
#
# CONFIG_VIDEO_DS90UB913 is not set
# CONFIG_VIDEO_DS90UB953 is not set
# CONFIG_VIDEO_DS90UB960 is not set
# CONFIG_VIDEO_MAX96714 is not set
# CONFIG_VIDEO_MAX96717 is not set
# end of Video serializers and deserializers

#
# Media SPI Adapters
#
# CONFIG_CXD2880_SPI_DRV is not set
# CONFIG_VIDEO_GS1662 is not set
# end of Media SPI Adapters

CONFIG_MEDIA_TUNER=y

#
# Customize TV tuners
#
# CONFIG_MEDIA_TUNER_E4000 is not set
# CONFIG_MEDIA_TUNER_FC0011 is not set
# CONFIG_MEDIA_TUNER_FC0012 is not set
# CONFIG_MEDIA_TUNER_FC0013 is not set
# CONFIG_MEDIA_TUNER_FC2580 is not set
# CONFIG_MEDIA_TUNER_IT913X is not set
# CONFIG_MEDIA_TUNER_M88RS6000T is not set
# CONFIG_MEDIA_TUNER_MAX2165 is not set
# CONFIG_MEDIA_TUNER_MC44S803 is not set
CONFIG_MEDIA_TUNER_MSI001=y
# CONFIG_MEDIA_TUNER_MT2060 is not set
# CONFIG_MEDIA_TUNER_MT2063 is not set
# CONFIG_MEDIA_TUNER_MT20XX is not set
# CONFIG_MEDIA_TUNER_MT2131 is not set
# CONFIG_MEDIA_TUNER_MT2266 is not set
# CONFIG_MEDIA_TUNER_MXL301RF is not set
# CONFIG_MEDIA_TUNER_MXL5005S is not set
# CONFIG_MEDIA_TUNER_MXL5007T is not set
# CONFIG_MEDIA_TUNER_QM1D1B0004 is not set
# CONFIG_MEDIA_TUNER_QM1D1C0042 is not set
# CONFIG_MEDIA_TUNER_QT1010 is not set
# CONFIG_MEDIA_TUNER_R820T is not set
# CONFIG_MEDIA_TUNER_SI2157 is not set
# CONFIG_MEDIA_TUNER_SIMPLE is not set
# CONFIG_MEDIA_TUNER_TDA18212 is not set
# CONFIG_MEDIA_TUNER_TDA18218 is not set
# CONFIG_MEDIA_TUNER_TDA18250 is not set
# CONFIG_MEDIA_TUNER_TDA18271 is not set
# CONFIG_MEDIA_TUNER_TDA827X is not set
# CONFIG_MEDIA_TUNER_TDA8290 is not set
# CONFIG_MEDIA_TUNER_TDA9887 is not set
# CONFIG_MEDIA_TUNER_TEA5761 is not set
# CONFIG_MEDIA_TUNER_TEA5767 is not set
# CONFIG_MEDIA_TUNER_TUA9001 is not set
# CONFIG_MEDIA_TUNER_XC2028 is not set
# CONFIG_MEDIA_TUNER_XC4000 is not set
# CONFIG_MEDIA_TUNER_XC5000 is not set
# end of Customize TV tuners

#
# Customise DVB Frontends
#

#
# Multistandard (satellite) frontends
#
# CONFIG_DVB_M88DS3103 is not set
# CONFIG_DVB_MXL5XX is not set
# CONFIG_DVB_STB0899 is not set
# CONFIG_DVB_STB6100 is not set
# CONFIG_DVB_STV090x is not set
# CONFIG_DVB_STV0910 is not set
# CONFIG_DVB_STV6110x is not set
# CONFIG_DVB_STV6111 is not set

#
# Multistandard (cable + terrestrial) frontends
#
# CONFIG_DVB_DRXK is not set
# CONFIG_DVB_MN88472 is not set
# CONFIG_DVB_MN88473 is not set
# CONFIG_DVB_SI2165 is not set
# CONFIG_DVB_TDA18271C2DD is not set

#
# DVB-S (satellite) frontends
#
# CONFIG_DVB_CX24110 is not set
# CONFIG_DVB_CX24116 is not set
# CONFIG_DVB_CX24117 is not set
# CONFIG_DVB_CX24120 is not set
# CONFIG_DVB_CX24123 is not set
# CONFIG_DVB_DS3000 is not set
# CONFIG_DVB_MB86A16 is not set
# CONFIG_DVB_MT312 is not set
# CONFIG_DVB_S5H1420 is not set
# CONFIG_DVB_SI21XX is not set
# CONFIG_DVB_STB6000 is not set
# CONFIG_DVB_STV0288 is not set
# CONFIG_DVB_STV0299 is not set
# CONFIG_DVB_STV0900 is not set
# CONFIG_DVB_STV6110 is not set
# CONFIG_DVB_TDA10071 is not set
# CONFIG_DVB_TDA10086 is not set
# CONFIG_DVB_TDA8083 is not set
# CONFIG_DVB_TDA8261 is not set
# CONFIG_DVB_TDA826X is not set
# CONFIG_DVB_TS2020 is not set
# CONFIG_DVB_TUA6100 is not set
# CONFIG_DVB_TUNER_CX24113 is not set
# CONFIG_DVB_TUNER_ITD1000 is not set
# CONFIG_DVB_VES1X93 is not set
# CONFIG_DVB_ZL10036 is not set
# CONFIG_DVB_ZL10039 is not set

#
# DVB-T (terrestrial) frontends
#
CONFIG_DVB_AF9013=y
CONFIG_DVB_AS102_FE=y
# CONFIG_DVB_CX22700 is not set
# CONFIG_DVB_CX22702 is not set
# CONFIG_DVB_CXD2820R is not set
# CONFIG_DVB_CXD2841ER is not set
CONFIG_DVB_DIB3000MB=y
CONFIG_DVB_DIB3000MC=y
# CONFIG_DVB_DIB7000M is not set
# CONFIG_DVB_DIB7000P is not set
# CONFIG_DVB_DIB9000 is not set
# CONFIG_DVB_DRXD is not set
CONFIG_DVB_EC100=y
CONFIG_DVB_GP8PSK_FE=y
# CONFIG_DVB_L64781 is not set
# CONFIG_DVB_MT352 is not set
# CONFIG_DVB_NXT6000 is not set
CONFIG_DVB_RTL2830=y
CONFIG_DVB_RTL2832=y
CONFIG_DVB_RTL2832_SDR=y
# CONFIG_DVB_S5H1432 is not set
# CONFIG_DVB_SI2168 is not set
# CONFIG_DVB_SP887X is not set
# CONFIG_DVB_STV0367 is not set
# CONFIG_DVB_TDA10048 is not set
# CONFIG_DVB_TDA1004X is not set
# CONFIG_DVB_ZD1301_DEMOD is not set
CONFIG_DVB_ZL10353=y
# CONFIG_DVB_CXD2880 is not set

#
# DVB-C (cable) frontends
#
# CONFIG_DVB_STV0297 is not set
# CONFIG_DVB_TDA10021 is not set
# CONFIG_DVB_TDA10023 is not set
# CONFIG_DVB_VES1820 is not set

#
# ATSC (North American/Korean Terrestrial/Cable DTV) frontends
#
# CONFIG_DVB_AU8522_DTV is not set
# CONFIG_DVB_AU8522_V4L is not set
# CONFIG_DVB_BCM3510 is not set
# CONFIG_DVB_LG2160 is not set
# CONFIG_DVB_LGDT3305 is not set
# CONFIG_DVB_LGDT3306A is not set
# CONFIG_DVB_LGDT330X is not set
# CONFIG_DVB_MXL692 is not set
# CONFIG_DVB_NXT200X is not set
# CONFIG_DVB_OR51132 is not set
# CONFIG_DVB_OR51211 is not set
# CONFIG_DVB_S5H1409 is not set
# CONFIG_DVB_S5H1411 is not set

#
# ISDB-T (terrestrial) frontends
#
# CONFIG_DVB_DIB8000 is not set
# CONFIG_DVB_MB86A20S is not set
# CONFIG_DVB_S921 is not set

#
# ISDB-S (satellite) & ISDB-T (terrestrial) frontends
#
# CONFIG_DVB_MN88443X is not set
# CONFIG_DVB_TC90522 is not set

#
# Digital terrestrial only tuners/PLL
#
# CONFIG_DVB_PLL is not set
# CONFIG_DVB_TUNER_DIB0070 is not set
# CONFIG_DVB_TUNER_DIB0090 is not set

#
# SEC control devices for DVB-S
#
# CONFIG_DVB_A8293 is not set
CONFIG_DVB_AF9033=y
# CONFIG_DVB_ASCOT2E is not set
# CONFIG_DVB_ATBM8830 is not set
# CONFIG_DVB_HELENE is not set
# CONFIG_DVB_HORUS3A is not set
# CONFIG_DVB_ISL6405 is not set
# CONFIG_DVB_ISL6421 is not set
# CONFIG_DVB_ISL6423 is not set
# CONFIG_DVB_IX2505V is not set
# CONFIG_DVB_LGS8GL5 is not set
# CONFIG_DVB_LGS8GXX is not set
# CONFIG_DVB_LNBH25 is not set
# CONFIG_DVB_LNBH29 is not set
# CONFIG_DVB_LNBP21 is not set
# CONFIG_DVB_LNBP22 is not set
# CONFIG_DVB_M88RS2000 is not set
# CONFIG_DVB_TDA665x is not set
# CONFIG_DVB_DRX39XYJ is not set

#
# Common Interface (EN50221) controller drivers
#
# CONFIG_DVB_CXD2099 is not set
# CONFIG_DVB_SP2 is not set
# end of Customise DVB Frontends

#
# Tools to develop new frontends
#
# CONFIG_DVB_DUMMY_FE is not set
# end of Media ancillary drivers

#
# Graphics support
#
CONFIG_APERTURE_HELPERS=y
CONFIG_SCREEN_INFO=y
CONFIG_VIDEO=y
# CONFIG_AUXDISPLAY is not set
# CONFIG_PANEL is not set
CONFIG_AGP=y
CONFIG_AGP_AMD64=y
CONFIG_AGP_INTEL=y
# CONFIG_AGP_SIS is not set
# CONFIG_AGP_VIA is not set
CONFIG_INTEL_GTT=y
# CONFIG_VGA_SWITCHEROO is not set
CONFIG_DRM=y

#
# DRM debugging options
#
# CONFIG_DRM_WERROR is not set
CONFIG_DRM_DEBUG_MM=y
# end of DRM debugging options

CONFIG_DRM_KMS_HELPER=y
# CONFIG_DRM_PANIC is not set
# CONFIG_DRM_RAS is not set
# CONFIG_DRM_DEBUG_DP_MST_TOPOLOGY_REFS is not set
# CONFIG_DRM_DEBUG_MODESET_LOCK is not set
CONFIG_DRM_CLIENT=y
CONFIG_DRM_CLIENT_LIB=y
CONFIG_DRM_CLIENT_SELECTION=y
CONFIG_DRM_CLIENT_SETUP=y

#
# Supported DRM clients
#
CONFIG_DRM_FBDEV_EMULATION=y
CONFIG_DRM_FBDEV_OVERALLOC=100
# CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM is not set
# CONFIG_DRM_CLIENT_LOG is not set
CONFIG_DRM_CLIENT_DEFAULT_FBDEV=y
CONFIG_DRM_CLIENT_DEFAULT="fbdev"
# end of Supported DRM clients

# CONFIG_DRM_LOAD_EDID_FIRMWARE is not set
CONFIG_DRM_DISPLAY_DP_AUX_BUS=y
CONFIG_DRM_DISPLAY_HELPER=y
# CONFIG_DRM_DISPLAY_DP_AUX_CEC is not set
# CONFIG_DRM_DISPLAY_DP_AUX_CHARDEV is not set
CONFIG_DRM_DISPLAY_DP_HELPER=y
CONFIG_DRM_TTM=y
CONFIG_DRM_TTM_HELPER=y
CONFIG_DRM_GEM_SHMEM_HELPER=y
# CONFIG_DRM_AMDGPU is not set

#
# ARM devices
#
# CONFIG_DRM_KOMEDA is not set
# end of ARM devices

# CONFIG_DRM_AST is not set
CONFIG_DRM_BRIDGE=y
CONFIG_DRM_PANEL_BRIDGE=y
CONFIG_DRM_AUX_BRIDGE=y
CONFIG_DRM_AUX_HPD_BRIDGE=y

#
# Display Interface Bridges
#
# CONFIG_DRM_CHIPONE_ICN6211 is not set
# CONFIG_DRM_CHRONTEL_CH7033 is not set
# CONFIG_DRM_DISPLAY_CONNECTOR is not set
# CONFIG_DRM_I2C_NXP_TDA998X is not set
# CONFIG_DRM_ITE_IT6263 is not set
# CONFIG_DRM_ITE_IT6505 is not set
# CONFIG_DRM_LONTIUM_LT8912B is not set
# CONFIG_DRM_LONTIUM_LT9211 is not set
# CONFIG_DRM_LONTIUM_LT9611 is not set
# CONFIG_DRM_LONTIUM_LT9611UXC is not set
# CONFIG_DRM_LONTIUM_LT8713SX is not set
# CONFIG_DRM_ITE_IT66121 is not set
# CONFIG_DRM_LVDS_CODEC is not set
# CONFIG_DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW is not set
# CONFIG_DRM_NWL_MIPI_DSI is not set
# CONFIG_DRM_NXP_PTN3460 is not set
# CONFIG_DRM_PARADE_PS8622 is not set
# CONFIG_DRM_PARADE_PS8640 is not set
# CONFIG_DRM_SAMSUNG_DSIM is not set
# CONFIG_DRM_SIL_SII8620 is not set
# CONFIG_DRM_SII902X is not set
# CONFIG_DRM_SII9234 is not set
# CONFIG_DRM_SIMPLE_BRIDGE is not set
# CONFIG_DRM_SOLOMON_SSD2825 is not set
# CONFIG_DRM_THINE_THC63LVD1024 is not set
# CONFIG_DRM_TOSHIBA_TC358762 is not set
# CONFIG_DRM_TOSHIBA_TC358764 is not set
# CONFIG_DRM_TOSHIBA_TC358767 is not set
# CONFIG_DRM_TOSHIBA_TC358768 is not set
# CONFIG_DRM_TOSHIBA_TC358775 is not set
# CONFIG_DRM_TI_DLPC3433 is not set
# CONFIG_DRM_TI_TDP158 is not set
# CONFIG_DRM_TI_TFP410 is not set
# CONFIG_DRM_TI_SN65DSI83 is not set
# CONFIG_DRM_TI_SN65DSI86 is not set
# CONFIG_DRM_TI_TPD12S015 is not set
# CONFIG_DRM_WAVESHARE_BRIDGE is not set
# CONFIG_DRM_ANALOGIX_ANX6345 is not set
# CONFIG_DRM_ANALOGIX_ANX78XX is not set
# CONFIG_DRM_ANALOGIX_ANX7625 is not set
# CONFIG_DRM_I2C_ADV7511 is not set
# CONFIG_DRM_CDNS_DSI is not set
# CONFIG_DRM_CDNS_MHDP8546 is not set
# end of Display Interface Bridges

# CONFIG_DRM_ETNAVIV is not set
# CONFIG_DRM_GMA500 is not set
CONFIG_DRM_GUD=y
# CONFIG_DRM_HISI_HIBMC is not set
# CONFIG_DRM_LOGICVC is not set
# CONFIG_DRM_MGAG200 is not set
# CONFIG_DRM_NOUVEAU is not set
CONFIG_DRM_PANEL=y

#
# Display Panels
#
# CONFIG_DRM_PANEL_ABT_Y030XX067A is not set
# CONFIG_DRM_PANEL_ARM_VERSATILE is not set
# CONFIG_DRM_PANEL_AUO_A030JTN01 is not set
# CONFIG_DRM_PANEL_LVDS is not set
# CONFIG_DRM_PANEL_ILITEK_IL9322 is not set
# CONFIG_DRM_PANEL_ILITEK_ILI9341 is not set
# CONFIG_DRM_PANEL_ILITEK_ILI9806E_SPI is not set
# CONFIG_DRM_PANEL_INNOLUX_EJ030NA is not set
# CONFIG_DRM_PANEL_LG_LB035Q02 is not set
# CONFIG_DRM_PANEL_LG_LG4573 is not set
# CONFIG_DRM_PANEL_NEC_NL8048HL11 is not set
# CONFIG_DRM_PANEL_NEWVISION_NV3052C is not set
# CONFIG_DRM_PANEL_NOVATEK_NT39016 is not set
# CONFIG_DRM_PANEL_OLIMEX_LCD_OLINUXINO is not set
# CONFIG_DRM_PANEL_ORISETECH_OTA5601A is not set
# CONFIG_DRM_PANEL_SAMSUNG_S6E88A0_AMS452EF01 is not set
# CONFIG_DRM_PANEL_SAMSUNG_ATNA33XC20 is not set
# CONFIG_DRM_PANEL_SAMSUNG_DB7430 is not set
# CONFIG_DRM_PANEL_SAMSUNG_LD9040 is not set
# CONFIG_DRM_PANEL_SAMSUNG_S6D27A1 is not set
# CONFIG_DRM_PANEL_SAMSUNG_S6D7AA0 is not set
# CONFIG_DRM_PANEL_SAMSUNG_S6E63M0 is not set
# CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0 is not set
# CONFIG_DRM_PANEL_SAMSUNG_S6E8FC0 is not set
# CONFIG_DRM_PANEL_SEIKO_43WVF1G is not set
# CONFIG_DRM_PANEL_SHARP_LS037V7DW01 is not set
# CONFIG_DRM_PANEL_SITRONIX_ST7701 is not set
# CONFIG_DRM_PANEL_SITRONIX_ST7789V is not set
# CONFIG_DRM_PANEL_SONY_ACX565AKM is not set
CONFIG_DRM_PANEL_EDP=y
# CONFIG_DRM_PANEL_SIMPLE is not set
# CONFIG_DRM_PANEL_TPO_TD028TTEC1 is not set
# CONFIG_DRM_PANEL_TPO_TD043MTEA1 is not set
# CONFIG_DRM_PANEL_TPO_TPG110 is not set
# CONFIG_DRM_PANEL_WIDECHIPS_WS2401 is not set
# end of Display Panels

# CONFIG_DRM_QXL is not set
# CONFIG_DRM_RADEON is not set
# CONFIG_DRM_ST7571 is not set
# CONFIG_DRM_ST7586 is not set
# CONFIG_DRM_ST7735R is not set
# CONFIG_DRM_ST7920 is not set
# CONFIG_DRM_SSD130X is not set

#
# Drivers for system framebuffers
#
CONFIG_DRM_SYSFB_HELPER=y
CONFIG_DRM_SIMPLEDRM=y
# CONFIG_DRM_VESADRM is not set
# end of Drivers for system framebuffers

# CONFIG_DRM_APPLETBDRM is not set
# CONFIG_DRM_ARCPGU is not set
CONFIG_DRM_BOCHS=y
CONFIG_DRM_CIRRUS_QEMU=y
CONFIG_DRM_GM12U320=y
# CONFIG_DRM_PANEL_MIPI_DBI is not set
# CONFIG_DRM_PIXPAPER is not set
# CONFIG_TINYDRM_HX8357D is not set
# CONFIG_TINYDRM_ILI9163 is not set
# CONFIG_TINYDRM_ILI9225 is not set
# CONFIG_TINYDRM_ILI9341 is not set
# CONFIG_TINYDRM_ILI9486 is not set
# CONFIG_TINYDRM_MI0283QT is not set
# CONFIG_TINYDRM_REPAPER is not set
# CONFIG_TINYDRM_SHARP_MEMORY is not set
CONFIG_DRM_UDL=y
# CONFIG_DRM_VBOXVIDEO is not set
CONFIG_DRM_VGEM=y
CONFIG_DRM_VIRTIO_GPU=y
CONFIG_DRM_VIRTIO_GPU_KMS=y
CONFIG_DRM_VKMS=y
CONFIG_DRM_VMWGFX=y
# CONFIG_DRM_VMWGFX_MKSSTATS is not set
# CONFIG_DRM_XE is not set
CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y

#
# Frame buffer Devices
#
CONFIG_FB=y
# CONFIG_FB_CIRRUS is not set
# CONFIG_FB_PM2 is not set
# CONFIG_FB_CYBER2000 is not set
# CONFIG_FB_ARC is not set
# CONFIG_FB_ASILIANT is not set
# CONFIG_FB_IMSTT is not set
CONFIG_FB_VGA16=y
# CONFIG_FB_UVESA is not set
CONFIG_FB_VESA=y
# CONFIG_FB_N411 is not set
# CONFIG_FB_OPENCORES is not set
# CONFIG_FB_S1D13XXX is not set
# CONFIG_FB_NVIDIA is not set
# CONFIG_FB_RIVA is not set
# CONFIG_FB_I740 is not set
# CONFIG_FB_MATROX is not set
# CONFIG_FB_RADEON is not set
# CONFIG_FB_ATY128 is not set
# CONFIG_FB_ATY is not set
# CONFIG_FB_S3 is not set
# CONFIG_FB_SAVAGE is not set
# CONFIG_FB_SIS is not set
# CONFIG_FB_VIA is not set
# CONFIG_FB_NEOMAGIC is not set
# CONFIG_FB_KYRO is not set
# CONFIG_FB_3DFX is not set
# CONFIG_FB_VOODOO1 is not set
# CONFIG_FB_VT8623 is not set
# CONFIG_FB_TRIDENT is not set
# CONFIG_FB_ARK is not set
# CONFIG_FB_PM3 is not set
# CONFIG_FB_CARMINE is not set
# CONFIG_FB_SMSCUFX is not set
# CONFIG_FB_UDL is not set
# CONFIG_FB_IBM_GXT4500 is not set
CONFIG_FB_VIRTUAL=y
# CONFIG_FB_METRONOME is not set
# CONFIG_FB_MB862XX is not set
# CONFIG_FB_SSD1307 is not set
# CONFIG_FB_SM712 is not set
CONFIG_FB_CORE=y
CONFIG_FB_NOTIFY=y
CONFIG_FB_DEVICE=y
CONFIG_FB_CFB_FILLRECT=y
CONFIG_FB_CFB_COPYAREA=y
CONFIG_FB_CFB_IMAGEBLIT=y
CONFIG_FB_SYS_FILLRECT=y
CONFIG_FB_SYS_COPYAREA=y
CONFIG_FB_SYS_IMAGEBLIT=y
# CONFIG_FB_FOREIGN_ENDIAN is not set
CONFIG_FB_SYSMEM_FOPS=y
CONFIG_FB_DEFERRED_IO=y
CONFIG_FB_IOMEM_FOPS=y
CONFIG_FB_IOMEM_HELPERS=y
CONFIG_FB_SYSMEM_HELPERS=y
CONFIG_FB_SYSMEM_HELPERS_DEFERRED=y
CONFIG_FB_TILEBLITTING=y
# end of Frame buffer Devices

#
# Backlight & LCD device support
#
CONFIG_LCD_CLASS_DEVICE=y
# CONFIG_LCD_L4F00242T03 is not set
# CONFIG_LCD_LMS283GF05 is not set
# CONFIG_LCD_LTV350QV is not set
# CONFIG_LCD_ILI922X is not set
# CONFIG_LCD_ILI9320 is not set
# CONFIG_LCD_TDO24M is not set
# CONFIG_LCD_VGG2432A4 is not set
# CONFIG_LCD_PLATFORM is not set
# CONFIG_LCD_AMS369FG06 is not set
# CONFIG_LCD_LMS501KF03 is not set
# CONFIG_LCD_HX8357 is not set
# CONFIG_LCD_OTM3225A is not set
CONFIG_BACKLIGHT_CLASS_DEVICE=y
# CONFIG_BACKLIGHT_AW99706 is not set
# CONFIG_BACKLIGHT_KTD253 is not set
# CONFIG_BACKLIGHT_KTD2801 is not set
# CONFIG_BACKLIGHT_KTZ8866 is not set
# CONFIG_BACKLIGHT_MAX25014 is not set
# CONFIG_BACKLIGHT_MT6370 is not set
# CONFIG_BACKLIGHT_APPLE is not set
# CONFIG_BACKLIGHT_QCOM_WLED is not set
# CONFIG_BACKLIGHT_SAHARA is not set
# CONFIG_BACKLIGHT_ADP8860 is not set
# CONFIG_BACKLIGHT_ADP8870 is not set
# CONFIG_BACKLIGHT_LM3509 is not set
# CONFIG_BACKLIGHT_LM3639 is not set
# CONFIG_BACKLIGHT_PANDORA is not set
# CONFIG_BACKLIGHT_GPIO is not set
# CONFIG_BACKLIGHT_LV5207LP is not set
# CONFIG_BACKLIGHT_BD6107 is not set
# CONFIG_BACKLIGHT_ARCXCNN is not set
# CONFIG_BACKLIGHT_LED is not set
# end of Backlight & LCD device support

CONFIG_VGASTATE=y
CONFIG_VIDEOMODE_HELPERS=y
CONFIG_HDMI=y
# CONFIG_FIRMWARE_EDID is not set

#
# Console display driver support
#
CONFIG_VGA_CONSOLE=y
CONFIG_DUMMY_CONSOLE=y
CONFIG_DUMMY_CONSOLE_COLUMNS=80
CONFIG_DUMMY_CONSOLE_ROWS=25
CONFIG_FRAMEBUFFER_CONSOLE=y
# CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION is not set
CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
# CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER is not set
# end of Console display driver support

CONFIG_LOGO=y
CONFIG_LOGO_LINUX_MONO=y
CONFIG_LOGO_LINUX_MONO_FILE="drivers/video/logo/logo_linux_mono.pbm"
CONFIG_LOGO_LINUX_VGA16=y
CONFIG_LOGO_LINUX_VGA16_FILE="drivers/video/logo/logo_linux_vga16.ppm"
# CONFIG_LOGO_LINUX_CLUT224 is not set
# CONFIG_TRACE_GPU_MEM is not set
# end of Graphics support

# CONFIG_DRM_ACCEL is not set
CONFIG_SOUND=y
CONFIG_SOUND_OSS_CORE=y
CONFIG_SOUND_OSS_CORE_PRECLAIM=y
CONFIG_SND=y
CONFIG_SND_TIMER=y
CONFIG_SND_PCM=y
CONFIG_SND_HWDEP=y
CONFIG_SND_SEQ_DEVICE=y
CONFIG_SND_RAWMIDI=y
CONFIG_SND_UMP=y
CONFIG_SND_UMP_LEGACY_RAWMIDI=y
CONFIG_SND_JACK=y
CONFIG_SND_JACK_INPUT_DEV=y
CONFIG_SND_OSSEMUL=y
CONFIG_SND_MIXER_OSS=y
CONFIG_SND_PCM_OSS=y
CONFIG_SND_PCM_OSS_PLUGINS=y
CONFIG_SND_PCM_TIMER=y
CONFIG_SND_HRTIMER=y
# CONFIG_SND_DYNAMIC_MINORS is not set
# CONFIG_SND_SUPPORT_OLD_API is not set
CONFIG_SND_PROC_FS=y
CONFIG_SND_VERBOSE_PROCFS=y
CONFIG_SND_CTL_FAST_LOOKUP=y
CONFIG_SND_DEBUG=y
# CONFIG_SND_DEBUG_VERBOSE is not set
CONFIG_SND_PCM_XRUN_DEBUG=y
# CONFIG_SND_CTL_INPUT_VALIDATION is not set
# CONFIG_SND_CTL_DEBUG is not set
# CONFIG_SND_JACK_INJECTION_DEBUG is not set
# CONFIG_SND_UTIMER is not set
CONFIG_SND_VMASTER=y
CONFIG_SND_DMA_SGBUF=y
CONFIG_SND_CTL_LED=y
CONFIG_SND_SEQUENCER=y
CONFIG_SND_SEQ_DUMMY=y
CONFIG_SND_SEQUENCER_OSS=y
CONFIG_SND_SEQ_HRTIMER_DEFAULT=y
CONFIG_SND_SEQ_MIDI_EVENT=y
CONFIG_SND_SEQ_MIDI=y
CONFIG_SND_SEQ_VIRMIDI=y
# CONFIG_SND_SEQ_UMP is not set
CONFIG_SND_DRIVERS=y
# CONFIG_SND_PCSP is not set
CONFIG_SND_DUMMY=y
CONFIG_SND_ALOOP=y
# CONFIG_SND_PCMTEST is not set
CONFIG_SND_VIRMIDI=y
# CONFIG_SND_MTPAV is not set
# CONFIG_SND_MTS64 is not set
# CONFIG_SND_SERIAL_U16550 is not set
# CONFIG_SND_SERIAL_GENERIC is not set
# CONFIG_SND_MPU401 is not set
# CONFIG_SND_PORTMAN2X4 is not set
CONFIG_SND_PCI=y
# CONFIG_SND_AD1889 is not set
# CONFIG_SND_ALS300 is not set
# CONFIG_SND_ALS4000 is not set
# CONFIG_SND_ALI5451 is not set
# CONFIG_SND_ASIHPI is not set
# CONFIG_SND_ATIIXP is not set
# CONFIG_SND_ATIIXP_MODEM is not set
# CONFIG_SND_AU8810 is not set
# CONFIG_SND_AU8820 is not set
# CONFIG_SND_AU8830 is not set
# CONFIG_SND_AW2 is not set
# CONFIG_SND_AZT3328 is not set
# CONFIG_SND_BT87X is not set
# CONFIG_SND_CA0106 is not set
# CONFIG_SND_CMIPCI is not set
# CONFIG_SND_OXYGEN is not set
# CONFIG_SND_CS4281 is not set
# CONFIG_SND_CS46XX is not set
# CONFIG_SND_CTXFI is not set
# CONFIG_SND_DARLA20 is not set
# CONFIG_SND_GINA20 is not set
# CONFIG_SND_LAYLA20 is not set
# CONFIG_SND_DARLA24 is not set
# CONFIG_SND_GINA24 is not set
# CONFIG_SND_LAYLA24 is not set
# CONFIG_SND_MONA is not set
# CONFIG_SND_MIA is not set
# CONFIG_SND_ECHO3G is not set
# CONFIG_SND_INDIGO is not set
# CONFIG_SND_INDIGOIO is not set
# CONFIG_SND_INDIGODJ is not set
# CONFIG_SND_INDIGOIOX is not set
# CONFIG_SND_INDIGODJX is not set
# CONFIG_SND_EMU10K1 is not set
# CONFIG_SND_EMU10K1X is not set
# CONFIG_SND_ENS1370 is not set
# CONFIG_SND_ENS1371 is not set
# CONFIG_SND_ES1938 is not set
# CONFIG_SND_ES1968 is not set
# CONFIG_SND_FM801 is not set
# CONFIG_SND_HDSP is not set
# CONFIG_SND_HDSPM is not set
# CONFIG_SND_ICE1712 is not set
# CONFIG_SND_ICE1724 is not set
# CONFIG_SND_INTEL8X0 is not set
# CONFIG_SND_INTEL8X0M is not set
# CONFIG_SND_KORG1212 is not set
# CONFIG_SND_LOLA is not set
# CONFIG_SND_LX6464ES is not set
# CONFIG_SND_MAESTRO3 is not set
# CONFIG_SND_MIXART is not set
# CONFIG_SND_NM256 is not set
# CONFIG_SND_PCXHR is not set
# CONFIG_SND_RIPTIDE is not set
# CONFIG_SND_RME32 is not set
# CONFIG_SND_RME96 is not set
# CONFIG_SND_RME9652 is not set
# CONFIG_SND_SE6X is not set
# CONFIG_SND_SONICVIBES is not set
# CONFIG_SND_TRIDENT is not set
# CONFIG_SND_VIA82XX is not set
# CONFIG_SND_VIA82XX_MODEM is not set
# CONFIG_SND_VIRTUOSO is not set
# CONFIG_SND_VX222 is not set
# CONFIG_SND_YMFPCI is not set

#
# HD-Audio
#
CONFIG_SND_HDA=y
CONFIG_SND_HDA_HWDEP=y
CONFIG_SND_HDA_RECONFIG=y
CONFIG_SND_HDA_INPUT_BEEP=y
CONFIG_SND_HDA_INPUT_BEEP_MODE=1
CONFIG_SND_HDA_PATCH_LOADER=y
CONFIG_SND_HDA_POWER_SAVE_DEFAULT=0
# CONFIG_SND_HDA_CTL_DEV_ID is not set
CONFIG_SND_HDA_PREALLOC_SIZE=0
CONFIG_SND_HDA_INTEL=y
# CONFIG_SND_HDA_ACPI is not set
CONFIG_SND_HDA_GENERIC_LEDS=y
CONFIG_SND_HDA_CODEC_ANALOG=y
CONFIG_SND_HDA_CODEC_SIGMATEL=y
CONFIG_SND_HDA_CODEC_VIA=y
CONFIG_SND_HDA_CODEC_CONEXANT=y
# CONFIG_SND_HDA_CODEC_SENARYTECH is not set
CONFIG_SND_HDA_CODEC_CA0110=y
CONFIG_SND_HDA_CODEC_CA0132=y
# CONFIG_SND_HDA_CODEC_CA0132_DSP is not set
CONFIG_SND_HDA_CODEC_CMEDIA=y
# CONFIG_SND_HDA_CODEC_CM9825 is not set
CONFIG_SND_HDA_CODEC_SI3054=y
CONFIG_SND_HDA_GENERIC=y
CONFIG_SND_HDA_CODEC_REALTEK=y
# CONFIG_SND_HDA_CODEC_ALC260 is not set
# CONFIG_SND_HDA_CODEC_ALC262 is not set
# CONFIG_SND_HDA_CODEC_ALC268 is not set
# CONFIG_SND_HDA_CODEC_ALC269 is not set
# CONFIG_SND_HDA_CODEC_ALC662 is not set
# CONFIG_SND_HDA_CODEC_ALC680 is not set
# CONFIG_SND_HDA_CODEC_ALC861 is not set
# CONFIG_SND_HDA_CODEC_ALC861VD is not set
# CONFIG_SND_HDA_CODEC_ALC880 is not set
# CONFIG_SND_HDA_CODEC_ALC882 is not set
CONFIG_SND_HDA_CODEC_CIRRUS=y
# CONFIG_SND_HDA_CODEC_CS420X is not set
# CONFIG_SND_HDA_CODEC_CS421X is not set
# CONFIG_SND_HDA_CODEC_CS8409 is not set
CONFIG_SND_HDA_CODEC_HDMI=y
# CONFIG_SND_HDA_CODEC_HDMI_GENERIC is not set
# CONFIG_SND_HDA_CODEC_HDMI_SIMPLE is not set
# CONFIG_SND_HDA_CODEC_HDMI_INTEL is not set
# CONFIG_SND_HDA_CODEC_HDMI_ATI is not set
# CONFIG_SND_HDA_CODEC_HDMI_NVIDIA is not set
# CONFIG_SND_HDA_CODEC_HDMI_NVIDIA_MCP is not set
# CONFIG_SND_HDA_CODEC_HDMI_TEGRA is not set
# CONFIG_SND_HDA_SCODEC_CS35L56_I2C is not set
# CONFIG_SND_HDA_SCODEC_CS35L56_SPI is not set
CONFIG_SND_HDA_CORE=y
CONFIG_SND_INTEL_NHLT=y
CONFIG_SND_INTEL_DSP_CONFIG=y
CONFIG_SND_INTEL_SOUNDWIRE_ACPI=y
# end of HD-Audio

# CONFIG_SND_SPI is not set
CONFIG_SND_USB=y
CONFIG_SND_USB_AUDIO=y
CONFIG_SND_USB_AUDIO_MIDI_V2=y
CONFIG_SND_USB_AUDIO_USE_MEDIA_CONTROLLER=y
CONFIG_SND_USB_UA101=y
CONFIG_SND_USB_USX2Y=y
CONFIG_SND_USB_CAIAQ=y
CONFIG_SND_USB_CAIAQ_INPUT=y
CONFIG_SND_USB_US122L=y
# CONFIG_SND_USB_US144MKII is not set
CONFIG_SND_USB_6FIRE=y
CONFIG_SND_USB_HIFACE=y
CONFIG_SND_BCD2000=y
CONFIG_SND_USB_LINE6=y
CONFIG_SND_USB_POD=y
CONFIG_SND_USB_PODHD=y
CONFIG_SND_USB_TONEPORT=y
CONFIG_SND_USB_VARIAX=y
# CONFIG_SND_FIREWIRE is not set
CONFIG_SND_PCMCIA=y
# CONFIG_SND_VXPOCKET is not set
# CONFIG_SND_PDAUDIOCF is not set
CONFIG_SND_SOC=y
# CONFIG_SND_SOC_USB is not set

#
# Analog Devices
#
# CONFIG_SND_SOC_ADI_AXI_I2S is not set
# CONFIG_SND_SOC_ADI_AXI_SPDIF is not set
# end of Analog Devices

#
# AMD
#
# CONFIG_SND_SOC_AMD_ACP is not set
# CONFIG_SND_SOC_AMD_ACP3x is not set
# CONFIG_SND_SOC_AMD_RENOIR is not set
# CONFIG_SND_SOC_AMD_ACP5x is not set
# CONFIG_SND_SOC_AMD_ACP6x is not set
# CONFIG_SND_AMD_ACP_CONFIG is not set
# CONFIG_SND_SOC_AMD_ACP_COMMON is not set
# end of AMD

#
# Apple
#
# end of Apple

#
# Atmel
#
# CONFIG_SND_SOC_MIKROE_PROTO is not set
# end of Atmel

#
# Au1x
#
# end of Au1x

#
# Broadcom
#
# CONFIG_SND_BCM63XX_I2S_WHISTLER is not set
# end of Broadcom

#
# Cirrus Logic
#
# end of Cirrus Logic

#
# DesignWare
#
# CONFIG_SND_DESIGNWARE_I2S is not set
# end of DesignWare

#
# Freescale
#

#
# Common SoC Audio options for Freescale CPUs:
#
# CONFIG_SND_SOC_FSL_ASRC is not set
# CONFIG_SND_SOC_FSL_SAI is not set
# CONFIG_SND_SOC_FSL_AUDMIX is not set
# CONFIG_SND_SOC_FSL_SSI is not set
# CONFIG_SND_SOC_FSL_SPDIF is not set
# CONFIG_SND_SOC_FSL_ESAI is not set
# CONFIG_SND_SOC_FSL_MICFIL is not set
# CONFIG_SND_SOC_FSL_XCVR is not set
# CONFIG_SND_SOC_IMX_AUDMUX is not set
# end of Freescale

#
# Google
#
# CONFIG_SND_SOC_CHV3_I2S is not set
# end of Google

#
# Hisilicon
#
# CONFIG_SND_I2S_HI6210_I2S is not set
# end of Hisilicon

#
# JZ4740
#
# end of JZ4740

#
# Kirkwood
#
# end of Kirkwood

#
# Loongson
#
# end of Loongson

#
# Intel
#
# CONFIG_SND_SOC_INTEL_SST_TOPLEVEL is not set
# CONFIG_SND_SOC_INTEL_AVS is not set
# end of Intel

#
# Mediatek
#
# CONFIG_SND_SOC_MTK_BTCVSD is not set
# end of Mediatek

#
# PXA
#
# end of PXA

#
# SoundWire (SDCA)
#
# CONFIG_SND_SOC_SDCA is not set
CONFIG_SND_SOC_SDCA_OPTIONAL=y
# end of SoundWire (SDCA)

#
# ST SPEAr
#
# end of ST SPEAr

#
# Spreadtrum
#
# end of Spreadtrum

#
# STMicroelectronics STM32
#
# end of STMicroelectronics STM32

#
# Tegra
#
# end of Tegra

#
# Xilinx
#
# CONFIG_SND_SOC_XILINX_I2S is not set
# CONFIG_SND_SOC_XILINX_AUDIO_FORMATTER is not set
# CONFIG_SND_SOC_XILINX_SPDIF is not set
# end of Xilinx

#
# Xtensa
#
# CONFIG_SND_SOC_XTFPGA_I2S is not set
# end of Xtensa

# CONFIG_SND_SOC_SOF_TOPLEVEL is not set
CONFIG_SND_SOC_I2C_AND_SPI=y

#
# CODEC drivers
#
# CONFIG_SND_SOC_AC97_CODEC is not set
# CONFIG_SND_SOC_ADAU1372_I2C is not set
# CONFIG_SND_SOC_ADAU1372_SPI is not set
# CONFIG_SND_SOC_ADAU1373 is not set
# CONFIG_SND_SOC_ADAU1701 is not set
# CONFIG_SND_SOC_ADAU1761_I2C is not set
# CONFIG_SND_SOC_ADAU1761_SPI is not set
# CONFIG_SND_SOC_ADAU7002 is not set
# CONFIG_SND_SOC_ADAU7118_HW is not set
# CONFIG_SND_SOC_ADAU7118_I2C is not set
# CONFIG_SND_SOC_AK4104 is not set
# CONFIG_SND_SOC_AK4118 is not set
# CONFIG_SND_SOC_AK4375 is not set
# CONFIG_SND_SOC_AK4458 is not set
# CONFIG_SND_SOC_AK4554 is not set
# CONFIG_SND_SOC_AK4613 is not set
# CONFIG_SND_SOC_AK4619 is not set
# CONFIG_SND_SOC_AK4642 is not set
# CONFIG_SND_SOC_AK5386 is not set
# CONFIG_SND_SOC_AK5558 is not set
# CONFIG_SND_SOC_ALC5623 is not set
# CONFIG_SND_SOC_AUDIO_IIO_AUX is not set
# CONFIG_SND_SOC_AW8738 is not set
# CONFIG_SND_SOC_AW88395 is not set
# CONFIG_SND_SOC_AW88166 is not set
# CONFIG_SND_SOC_AW88261 is not set
# CONFIG_SND_SOC_AW88081 is not set
# CONFIG_SND_SOC_AW87390 is not set
# CONFIG_SND_SOC_AW88399 is not set
# CONFIG_SND_SOC_BD28623 is not set
# CONFIG_SND_SOC_BT_SCO is not set
# CONFIG_SND_SOC_CHV3_CODEC is not set
# CONFIG_SND_SOC_CS35L32 is not set
# CONFIG_SND_SOC_CS35L33 is not set
# CONFIG_SND_SOC_CS35L34 is not set
# CONFIG_SND_SOC_CS35L35 is not set
# CONFIG_SND_SOC_CS35L36 is not set
# CONFIG_SND_SOC_CS35L41_SPI is not set
# CONFIG_SND_SOC_CS35L41_I2C is not set
# CONFIG_SND_SOC_CS35L45_SPI is not set
# CONFIG_SND_SOC_CS35L45_I2C is not set
# CONFIG_SND_SOC_CS35L56_I2C is not set
# CONFIG_SND_SOC_CS35L56_SPI is not set
# CONFIG_SND_SOC_CS35L56_SDW is not set
# CONFIG_SND_SOC_CS42L42 is not set
# CONFIG_SND_SOC_CS42L42_SDW is not set
# CONFIG_SND_SOC_CS42L51_I2C is not set
# CONFIG_SND_SOC_CS42L52 is not set
# CONFIG_SND_SOC_CS42L56 is not set
# CONFIG_SND_SOC_CS42L73 is not set
# CONFIG_SND_SOC_CS42L83 is not set
# CONFIG_SND_SOC_CS42L84 is not set
# CONFIG_SND_SOC_CS4234 is not set
# CONFIG_SND_SOC_CS4265 is not set
# CONFIG_SND_SOC_CS4270 is not set
# CONFIG_SND_SOC_CS4271_I2C is not set
# CONFIG_SND_SOC_CS4271_SPI is not set
# CONFIG_SND_SOC_CS42XX8_SPI is not set
# CONFIG_SND_SOC_CS42XX8_I2C is not set
# CONFIG_SND_SOC_CS43130 is not set
# CONFIG_SND_SOC_CS4341 is not set
# CONFIG_SND_SOC_CS4349 is not set
# CONFIG_SND_SOC_CS48L32 is not set
# CONFIG_SND_SOC_CS53L30 is not set
# CONFIG_SND_SOC_CS530X_I2C is not set
# CONFIG_SND_SOC_CS530X_SPI is not set
# CONFIG_SND_SOC_CX2072X is not set
# CONFIG_SND_SOC_DA7213 is not set
# CONFIG_SND_SOC_DMIC is not set
# CONFIG_SND_SOC_ES7134 is not set
# CONFIG_SND_SOC_ES7241 is not set
# CONFIG_SND_SOC_ES8311 is not set
# CONFIG_SND_SOC_ES8316 is not set
# CONFIG_SND_SOC_ES8323 is not set
# CONFIG_SND_SOC_ES8326 is not set
# CONFIG_SND_SOC_ES8328_I2C is not set
# CONFIG_SND_SOC_ES8328_SPI is not set
# CONFIG_SND_SOC_ES8375 is not set
# CONFIG_SND_SOC_ES8389 is not set
# CONFIG_SND_SOC_FS210X is not set
# CONFIG_SND_SOC_GTM601 is not set
# CONFIG_SND_SOC_HDA is not set
# CONFIG_SND_SOC_ICS43432 is not set
# CONFIG_SND_SOC_IDT821034 is not set
# CONFIG_SND_SOC_MAX98088 is not set
# CONFIG_SND_SOC_MAX98090 is not set
# CONFIG_SND_SOC_MAX98357A is not set
# CONFIG_SND_SOC_MAX98504 is not set
# CONFIG_SND_SOC_MAX9867 is not set
# CONFIG_SND_SOC_MAX98927 is not set
# CONFIG_SND_SOC_MAX98520 is not set
# CONFIG_SND_SOC_MAX98363 is not set
# CONFIG_SND_SOC_MAX98373_I2C is not set
# CONFIG_SND_SOC_MAX98373_SDW is not set
# CONFIG_SND_SOC_MAX98388 is not set
# CONFIG_SND_SOC_MAX98390 is not set
# CONFIG_SND_SOC_MAX98396 is not set
# CONFIG_SND_SOC_MAX9860 is not set
# CONFIG_SND_SOC_MSM8916_WCD_DIGITAL is not set
# CONFIG_SND_SOC_PCM1681 is not set
# CONFIG_SND_SOC_PCM1754 is not set
# CONFIG_SND_SOC_PCM1789_I2C is not set
# CONFIG_SND_SOC_PCM179X_I2C is not set
# CONFIG_SND_SOC_PCM179X_SPI is not set
# CONFIG_SND_SOC_PCM186X_I2C is not set
# CONFIG_SND_SOC_PCM186X_SPI is not set
# CONFIG_SND_SOC_PCM3060_I2C is not set
# CONFIG_SND_SOC_PCM3060_SPI is not set
# CONFIG_SND_SOC_PCM3168A_I2C is not set
# CONFIG_SND_SOC_PCM3168A_SPI is not set
# CONFIG_SND_SOC_PCM5102A is not set
# CONFIG_SND_SOC_PCM512x_I2C is not set
# CONFIG_SND_SOC_PCM512x_SPI is not set
# CONFIG_SND_SOC_PCM6240 is not set
# CONFIG_SND_SOC_PEB2466 is not set
# CONFIG_SND_SOC_PM4125_SDW is not set
# CONFIG_SND_SOC_RT1017_SDCA_SDW is not set
# CONFIG_SND_SOC_RT1308_SDW is not set
# CONFIG_SND_SOC_RT1316_SDW is not set
# CONFIG_SND_SOC_RT1318_SDW is not set
# CONFIG_SND_SOC_RT1320_SDW is not set
# CONFIG_SND_SOC_RT5575 is not set
# CONFIG_SND_SOC_RT5616 is not set
# CONFIG_SND_SOC_RT5631 is not set
# CONFIG_SND_SOC_RT5640 is not set
# CONFIG_SND_SOC_RT5659 is not set
# CONFIG_SND_SOC_RT5682_SDW is not set
# CONFIG_SND_SOC_RT700_SDW is not set
# CONFIG_SND_SOC_RT711_SDW is not set
# CONFIG_SND_SOC_RT711_SDCA_SDW is not set
# CONFIG_SND_SOC_RT712_SDCA_SDW is not set
# CONFIG_SND_SOC_RT712_SDCA_DMIC_SDW is not set
# CONFIG_SND_SOC_RT721_SDCA_SDW is not set
# CONFIG_SND_SOC_RT722_SDCA_SDW is not set
# CONFIG_SND_SOC_RT715_SDW is not set
# CONFIG_SND_SOC_RT715_SDCA_SDW is not set
# CONFIG_SND_SOC_RT9120 is not set
# CONFIG_SND_SOC_RT9123 is not set
# CONFIG_SND_SOC_RT9123P is not set
# CONFIG_SND_SOC_RTQ9124 is not set
# CONFIG_SND_SOC_RTQ9128 is not set
# CONFIG_SND_SOC_SDW_MOCKUP is not set
# CONFIG_SND_SOC_SGTL5000 is not set
# CONFIG_SND_SOC_SIMPLE_AMPLIFIER is not set
# CONFIG_SND_SOC_SIMPLE_MUX is not set
# CONFIG_SND_SOC_SMA1303 is not set
# CONFIG_SND_SOC_SMA1307 is not set
# CONFIG_SND_SOC_SPDIF is not set
# CONFIG_SND_SOC_SRC4XXX_I2C is not set
# CONFIG_SND_SOC_SSM2305 is not set
# CONFIG_SND_SOC_SSM2518 is not set
# CONFIG_SND_SOC_SSM2602_SPI is not set
# CONFIG_SND_SOC_SSM2602_I2C is not set
# CONFIG_SND_SOC_SSM3515 is not set
# CONFIG_SND_SOC_SSM4567 is not set
# CONFIG_SND_SOC_STA32X is not set
# CONFIG_SND_SOC_STA350 is not set
# CONFIG_SND_SOC_STI_SAS is not set
# CONFIG_SND_SOC_TAS2552 is not set
# CONFIG_SND_SOC_TAS2562 is not set
# CONFIG_SND_SOC_TAS2764 is not set
# CONFIG_SND_SOC_TAS2770 is not set
# CONFIG_SND_SOC_TAS2780 is not set
# CONFIG_SND_SOC_TAS2781_I2C is not set
# CONFIG_SND_SOC_TAS5086 is not set
# CONFIG_SND_SOC_TAS571X is not set
# CONFIG_SND_SOC_TAS5720 is not set
# CONFIG_SND_SOC_TAS5805M is not set
# CONFIG_SND_SOC_TAS6424 is not set
# CONFIG_SND_SOC_TAS675X is not set
# CONFIG_SND_SOC_TDA7419 is not set
# CONFIG_SND_SOC_TFA9879 is not set
# CONFIG_SND_SOC_TFA989X is not set
# CONFIG_SND_SOC_TLV320ADC3XXX is not set
# CONFIG_SND_SOC_TLV320AIC23_I2C is not set
# CONFIG_SND_SOC_TLV320AIC23_SPI is not set
# CONFIG_SND_SOC_TLV320AIC31XX is not set
# CONFIG_SND_SOC_TLV320AIC32X4_I2C is not set
# CONFIG_SND_SOC_TLV320AIC32X4_SPI is not set
# CONFIG_SND_SOC_TLV320AIC3X_I2C is not set
# CONFIG_SND_SOC_TLV320AIC3X_SPI is not set
# CONFIG_SND_SOC_TLV320ADCX140 is not set
# CONFIG_SND_SOC_TS3A227E is not set
# CONFIG_SND_SOC_TSCS42XX is not set
# CONFIG_SND_SOC_TSCS454 is not set
# CONFIG_SND_SOC_UDA1334 is not set
# CONFIG_SND_SOC_UDA1342 is not set
# CONFIG_SND_SOC_UDA1380 is not set
# CONFIG_SND_SOC_WCD937X_SDW is not set
# CONFIG_SND_SOC_WCD938X_SDW is not set
# CONFIG_SND_SOC_WCD939X_SDW is not set
# CONFIG_SND_SOC_WM8510 is not set
# CONFIG_SND_SOC_WM8523 is not set
# CONFIG_SND_SOC_WM8524 is not set
# CONFIG_SND_SOC_WM8580 is not set
# CONFIG_SND_SOC_WM8711 is not set
# CONFIG_SND_SOC_WM8728 is not set
# CONFIG_SND_SOC_WM8731_I2C is not set
# CONFIG_SND_SOC_WM8731_SPI is not set
# CONFIG_SND_SOC_WM8737 is not set
# CONFIG_SND_SOC_WM8741 is not set
# CONFIG_SND_SOC_WM8750 is not set
# CONFIG_SND_SOC_WM8753 is not set
# CONFIG_SND_SOC_WM8770 is not set
# CONFIG_SND_SOC_WM8776 is not set
# CONFIG_SND_SOC_WM8782 is not set
# CONFIG_SND_SOC_WM8804_I2C is not set
# CONFIG_SND_SOC_WM8804_SPI is not set
# CONFIG_SND_SOC_WM8903 is not set
# CONFIG_SND_SOC_WM8904 is not set
# CONFIG_SND_SOC_WM8940 is not set
# CONFIG_SND_SOC_WM8960 is not set
# CONFIG_SND_SOC_WM8961 is not set
# CONFIG_SND_SOC_WM8962 is not set
# CONFIG_SND_SOC_WM8974 is not set
# CONFIG_SND_SOC_WM8978 is not set
# CONFIG_SND_SOC_WM8985 is not set
# CONFIG_SND_SOC_WSA881X is not set
# CONFIG_SND_SOC_WSA883X is not set
# CONFIG_SND_SOC_WSA884X is not set
# CONFIG_SND_SOC_ZL38060 is not set
# CONFIG_SND_SOC_MAX9759 is not set
# CONFIG_SND_SOC_MT6351 is not set
# CONFIG_SND_SOC_MT6357 is not set
# CONFIG_SND_SOC_MT6358 is not set
# CONFIG_SND_SOC_MT6660 is not set
# CONFIG_SND_SOC_NAU8315 is not set
# CONFIG_SND_SOC_NAU8325 is not set
# CONFIG_SND_SOC_NAU8540 is not set
# CONFIG_SND_SOC_NAU8810 is not set
# CONFIG_SND_SOC_NAU8821 is not set
# CONFIG_SND_SOC_NAU8822 is not set
# CONFIG_SND_SOC_NAU8824 is not set
# CONFIG_SND_SOC_NTP8918 is not set
# CONFIG_SND_SOC_NTP8835 is not set
# CONFIG_SND_SOC_TPA6130A2 is not set
# CONFIG_SND_SOC_LPASS_WSA_MACRO is not set
# CONFIG_SND_SOC_LPASS_VA_MACRO is not set
# CONFIG_SND_SOC_LPASS_RX_MACRO is not set
# CONFIG_SND_SOC_LPASS_TX_MACRO is not set
# end of CODEC drivers

#
# Generic drivers
#
# CONFIG_SND_SIMPLE_CARD is not set
# CONFIG_SND_AUDIO_GRAPH_CARD is not set
# CONFIG_SND_AUDIO_GRAPH_CARD2 is not set
# CONFIG_SND_TEST_COMPONENT is not set
# end of Generic drivers

CONFIG_SND_X86=y
CONFIG_SND_VIRTIO=y
CONFIG_HID_SUPPORT=y
CONFIG_HID=y
CONFIG_HID_BATTERY_STRENGTH=y
CONFIG_HIDRAW=y
CONFIG_UHID=y
CONFIG_HID_GENERIC=y
CONFIG_HID_HAPTIC=y

#
# Special HID drivers
#
CONFIG_HID_A4TECH=y
CONFIG_HID_ACCUTOUCH=y
CONFIG_HID_ACRUX=y
CONFIG_HID_ACRUX_FF=y
CONFIG_HID_APPLE=y
CONFIG_HID_APPLEIR=y
# CONFIG_HID_APPLETB_BL is not set
# CONFIG_HID_APPLETB_KBD is not set
CONFIG_HID_ASUS=y
CONFIG_HID_AUREAL=y
CONFIG_HID_BELKIN=y
CONFIG_HID_BETOP_FF=y
CONFIG_HID_BIGBEN_FF=y
CONFIG_HID_CHERRY=y
CONFIG_HID_CHICONY=y
CONFIG_HID_CORSAIR=y
CONFIG_HID_COUGAR=y
CONFIG_HID_MACALLY=y
CONFIG_HID_PRODIKEYS=y
CONFIG_HID_CMEDIA=y
CONFIG_HID_CP2112=y
CONFIG_HID_CREATIVE_SB0540=y
CONFIG_HID_CYPRESS=y
CONFIG_HID_DRAGONRISE=y
CONFIG_DRAGONRISE_FF=y
CONFIG_HID_EMS_FF=y
CONFIG_HID_ELAN=y
CONFIG_HID_ELECOM=y
CONFIG_HID_ELO=y
CONFIG_HID_EVISION=y
CONFIG_HID_EZKEY=y
CONFIG_HID_FT260=y
CONFIG_HID_GEMBIRD=y
CONFIG_HID_GFRM=y
CONFIG_HID_GLORIOUS=y
CONFIG_HID_HOLTEK=y
CONFIG_HOLTEK_FF=y
CONFIG_HID_VIVALDI_COMMON=y
# CONFIG_HID_GOODIX_SPI is not set
CONFIG_HID_GOOGLE_STADIA_FF=y
CONFIG_HID_VIVALDI=y
CONFIG_HID_GT683R=y
CONFIG_HID_KEYTOUCH=y
CONFIG_HID_KYE=y
# CONFIG_HID_KYSONA is not set
CONFIG_HID_UCLOGIC=y
CONFIG_HID_WALTOP=y
CONFIG_HID_VIEWSONIC=y
CONFIG_HID_VRC2=y
CONFIG_HID_XIAOMI=y
CONFIG_HID_GYRATION=y
CONFIG_HID_ICADE=y
CONFIG_HID_ITE=y
CONFIG_HID_JABRA=y
CONFIG_HID_TWINHAN=y
CONFIG_HID_KENSINGTON=y
CONFIG_HID_LCPOWER=y
CONFIG_HID_LED=y
CONFIG_HID_LENOVO=y
# CONFIG_HID_LENOVO_GO is not set
# CONFIG_HID_LENOVO_GO_S is not set
CONFIG_HID_LETSKETCH=y
CONFIG_HID_LOGITECH=y
CONFIG_HID_LOGITECH_DJ=y
CONFIG_HID_LOGITECH_HIDPP=y
CONFIG_LOGITECH_FF=y
CONFIG_LOGIRUMBLEPAD2_FF=y
CONFIG_LOGIG940_FF=y
CONFIG_LOGIWHEELS_FF=y
CONFIG_HID_MAGICMOUSE=y
CONFIG_HID_MALTRON=y
CONFIG_HID_MAYFLASH=y
CONFIG_HID_MEGAWORLD_FF=y
# CONFIG_HID_RAKK is not set
CONFIG_HID_REDRAGON=y
CONFIG_HID_MICROSOFT=y
CONFIG_HID_MONTEREY=y
CONFIG_HID_MULTITOUCH=y
CONFIG_HID_NINTENDO=y
CONFIG_NINTENDO_FF=y
CONFIG_HID_NTI=y
CONFIG_HID_NTRIG=y
CONFIG_HID_NVIDIA_SHIELD=y
CONFIG_NVIDIA_SHIELD_FF=y
CONFIG_HID_ORTEK=y
# CONFIG_HID_OXP is not set
CONFIG_HID_PANTHERLORD=y
CONFIG_PANTHERLORD_FF=y
CONFIG_HID_PENMOUNT=y
CONFIG_HID_PETALYNX=y
CONFIG_HID_PICOLCD=y
CONFIG_HID_PICOLCD_FB=y
CONFIG_HID_PICOLCD_BACKLIGHT=y
CONFIG_HID_PICOLCD_LCD=y
CONFIG_HID_PICOLCD_LEDS=y
CONFIG_HID_PICOLCD_CIR=y
CONFIG_HID_PLANTRONICS=y
CONFIG_HID_PLAYSTATION=y
CONFIG_PLAYSTATION_FF=y
CONFIG_HID_PXRC=y
# CONFIG_HID_RAPOO is not set
CONFIG_HID_RAZER=y
CONFIG_HID_PRIMAX=y
CONFIG_HID_RETRODE=y
CONFIG_HID_ROCCAT=y
CONFIG_HID_SAITEK=y
CONFIG_HID_SAMSUNG=y
CONFIG_HID_SEMITEK=y
CONFIG_HID_SIGMAMICRO=y
CONFIG_HID_SONY=y
CONFIG_SONY_FF=y
CONFIG_HID_SPEEDLINK=y
CONFIG_HID_STEAM=y
CONFIG_STEAM_FF=y
CONFIG_HID_STEELSERIES=y
CONFIG_HID_SUNPLUS=y
CONFIG_HID_RMI=y
CONFIG_HID_GREENASIA=y
CONFIG_GREENASIA_FF=y
CONFIG_HID_SMARTJOYPLUS=y
CONFIG_SMARTJOYPLUS_FF=y
CONFIG_HID_TIVO=y
CONFIG_HID_TOPSEED=y
CONFIG_HID_TOPRE=y
CONFIG_HID_THINGM=y
CONFIG_HID_THRUSTMASTER=y
CONFIG_THRUSTMASTER_FF=y
CONFIG_HID_UDRAW_PS3=y
CONFIG_HID_U2FZERO=y
# CONFIG_HID_UNIVERSAL_PIDFF is not set
CONFIG_HID_WACOM=y
CONFIG_HID_WIIMOTE=y
# CONFIG_HID_WINWING is not set
CONFIG_HID_XINMO=y
CONFIG_HID_ZEROPLUS=y
CONFIG_ZEROPLUS_FF=y
CONFIG_HID_ZYDACRON=y
CONFIG_HID_SENSOR_HUB=y
CONFIG_HID_SENSOR_CUSTOM_SENSOR=y
CONFIG_HID_ALPS=y
CONFIG_HID_MCP2200=y
CONFIG_HID_MCP2221=y
CONFIG_HID_HUAWEI=y
# end of Special HID drivers

#
# HID-BPF support
#
# end of HID-BPF support

CONFIG_I2C_HID=y
CONFIG_I2C_HID_ACPI=y
CONFIG_I2C_HID_OF=y
# CONFIG_I2C_HID_OF_ELAN is not set
# CONFIG_I2C_HID_OF_GOODIX is not set
CONFIG_I2C_HID_CORE=y

#
# Intel ISH HID support
#
CONFIG_INTEL_ISH_HID=y
CONFIG_INTEL_ISH_FIRMWARE_DOWNLOADER=y
# end of Intel ISH HID support

#
# AMD SFH HID Support
#
CONFIG_AMD_SFH_HID=y
# end of AMD SFH HID Support

#
# Surface System Aggregator Module HID support
#
CONFIG_SURFACE_HID=y
CONFIG_SURFACE_KBD=y
# end of Surface System Aggregator Module HID support

CONFIG_SURFACE_HID_CORE=y

#
# Intel THC HID Support
#
# CONFIG_INTEL_THC_HID is not set
# end of Intel THC HID Support

#
# USB HID support
#
CONFIG_USB_HID=y
CONFIG_HID_PID=y
CONFIG_USB_HIDDEV=y
# end of USB HID support

CONFIG_USB_OHCI_LITTLE_ENDIAN=y
CONFIG_USB_SUPPORT=y
CONFIG_USB_COMMON=y
CONFIG_USB_LED_TRIG=y
CONFIG_USB_ULPI_BUS=y
CONFIG_USB_CONN_GPIO=y
CONFIG_USB_ARCH_HAS_HCD=y
CONFIG_USB=y
CONFIG_USB_PCI=y
CONFIG_USB_PCI_AMD=y
CONFIG_USB_ANNOUNCE_NEW_DEVICES=y

#
# Miscellaneous USB options
#
CONFIG_USB_DEFAULT_PERSIST=y
CONFIG_USB_FEW_INIT_RETRIES=y
CONFIG_USB_DYNAMIC_MINORS=y
CONFIG_USB_OTG=y
# CONFIG_USB_OTG_PRODUCTLIST is not set
# CONFIG_USB_OTG_DISABLE_EXTERNAL_HUB is not set
CONFIG_USB_OTG_FSM=y
CONFIG_USB_LEDS_TRIGGER_USBPORT=y
CONFIG_USB_AUTOSUSPEND_DELAY=2
CONFIG_USB_DEFAULT_AUTHORIZATION_MODE=1
CONFIG_USB_MON=y

#
# USB Host Controller Drivers
#
CONFIG_USB_C67X00_HCD=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_DBGCAP=y
CONFIG_USB_XHCI_PCI=y
CONFIG_USB_XHCI_PCI_RENESAS=y
CONFIG_USB_XHCI_PLATFORM=y
# CONFIG_USB_XHCI_SIDEBAND is not set
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_ROOT_HUB_TT=y
CONFIG_USB_EHCI_TT_NEWSCHED=y
CONFIG_USB_EHCI_PCI=y
CONFIG_USB_EHCI_FSL=y
CONFIG_USB_EHCI_HCD_PLATFORM=y
CONFIG_USB_OXU210HP_HCD=y
CONFIG_USB_ISP116X_HCD=y
CONFIG_USB_MAX3421_HCD=y
CONFIG_USB_OHCI_HCD=y
CONFIG_USB_OHCI_HCD_PCI=y
# CONFIG_USB_OHCI_HCD_SSB is not set
CONFIG_USB_OHCI_HCD_PLATFORM=y
CONFIG_USB_UHCI_HCD=y
CONFIG_USB_SL811_HCD=y
CONFIG_USB_SL811_HCD_ISO=y
CONFIG_USB_SL811_CS=y
CONFIG_USB_R8A66597_HCD=y
CONFIG_USB_HCD_BCMA=y
CONFIG_USB_HCD_SSB=y
# CONFIG_USB_HCD_TEST_MODE is not set

#
# USB Device Class drivers
#
CONFIG_USB_ACM=y
CONFIG_USB_PRINTER=y
CONFIG_USB_WDM=y
CONFIG_USB_TMC=y

#
# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed; see USB_STORAGE Help for more info
#
CONFIG_USB_STORAGE=y
# CONFIG_USB_STORAGE_DEBUG is not set
CONFIG_USB_STORAGE_REALTEK=y
CONFIG_REALTEK_AUTOPM=y
CONFIG_USB_STORAGE_DATAFAB=y
CONFIG_USB_STORAGE_FREECOM=y
CONFIG_USB_STORAGE_ISD200=y
CONFIG_USB_STORAGE_USBAT=y
CONFIG_USB_STORAGE_SDDR09=y
CONFIG_USB_STORAGE_SDDR55=y
CONFIG_USB_STORAGE_JUMPSHOT=y
CONFIG_USB_STORAGE_ALAUDA=y
CONFIG_USB_STORAGE_ONETOUCH=y
CONFIG_USB_STORAGE_KARMA=y
CONFIG_USB_STORAGE_CYPRESS_ATACB=y
CONFIG_USB_STORAGE_ENE_UB6250=y
CONFIG_USB_UAS=y

#
# USB Imaging devices
#
CONFIG_USB_MDC800=y
CONFIG_USB_MICROTEK=y
CONFIG_USBIP_CORE=y
CONFIG_USBIP_VHCI_HCD=y
CONFIG_USBIP_VHCI_HC_PORTS=8
CONFIG_USBIP_VHCI_NR_HCS=16
CONFIG_USBIP_HOST=y
CONFIG_USBIP_VUDC=y
# CONFIG_USBIP_DEBUG is not set

#
# USB dual-mode controller drivers
#
CONFIG_USB_CDNS_SUPPORT=y
CONFIG_USB_CDNS3=y
CONFIG_USB_CDNS3_HOST=y
CONFIG_USB_CDNS3_GADGET=y

#
# Platform glue driver support
#
CONFIG_USB_CDNS3_PCI_WRAP=y
CONFIG_USB_CDNSP_PCI=y
CONFIG_USB_MUSB_HDRC=y
# CONFIG_USB_MUSB_HOST is not set
# CONFIG_USB_MUSB_GADGET is not set
CONFIG_USB_MUSB_DUAL_ROLE=y

#
# Platform Glue Layer
#

#
# MUSB DMA mode
#
CONFIG_MUSB_PIO_ONLY=y
CONFIG_USB_DWC3=y
CONFIG_USB_DWC3_ULPI=y
# CONFIG_USB_DWC3_HOST is not set
CONFIG_USB_DWC3_GADGET=y
# CONFIG_USB_DWC3_DUAL_ROLE is not set

#
# Platform Glue Driver Support
#
CONFIG_USB_DWC3_PCI=y
CONFIG_USB_DWC3_HAPS=y
CONFIG_USB_DWC3_OF_SIMPLE=y
CONFIG_USB_DWC3_GENERIC_PLAT=y
# CONFIG_USB_DWC3_GOOGLE is not set
CONFIG_USB_DWC2=y
CONFIG_USB_DWC2_HOST=y

#
# Gadget/Dual-role mode requires USB Gadget support to be enabled
#
# CONFIG_USB_DWC2_PERIPHERAL is not set
# CONFIG_USB_DWC2_DUAL_ROLE is not set
CONFIG_USB_DWC2_PCI=y
# CONFIG_USB_DWC2_DEBUG is not set
# CONFIG_USB_DWC2_TRACK_MISSED_SOFS is not set
CONFIG_USB_CHIPIDEA=y
CONFIG_USB_CHIPIDEA_UDC=y
CONFIG_USB_CHIPIDEA_HOST=y
CONFIG_USB_CHIPIDEA_PCI=y
CONFIG_USB_CHIPIDEA_MSM=y
CONFIG_USB_CHIPIDEA_NPCM=y
# CONFIG_USB_CHIPIDEA_IMX is not set
CONFIG_USB_CHIPIDEA_GENERIC=y
# CONFIG_USB_CHIPIDEA_TEGRA is not set
CONFIG_USB_ISP1760=y
CONFIG_USB_ISP1760_HCD=y
CONFIG_USB_ISP1761_UDC=y
# CONFIG_USB_ISP1760_HOST_ROLE is not set
# CONFIG_USB_ISP1760_GADGET_ROLE is not set
CONFIG_USB_ISP1760_DUAL_ROLE=y

#
# USB port drivers
#
CONFIG_USB_SERIAL=y
CONFIG_USB_SERIAL_CONSOLE=y
CONFIG_USB_SERIAL_GENERIC=y
CONFIG_USB_SERIAL_SIMPLE=y
CONFIG_USB_SERIAL_AIRCABLE=y
CONFIG_USB_SERIAL_ARK3116=y
CONFIG_USB_SERIAL_BELKIN=y
CONFIG_USB_SERIAL_CH341=y
CONFIG_USB_SERIAL_WHITEHEAT=y
CONFIG_USB_SERIAL_DIGI_ACCELEPORT=y
CONFIG_USB_SERIAL_CP210X=y
CONFIG_USB_SERIAL_CYPRESS_M8=y
CONFIG_USB_SERIAL_EMPEG=y
CONFIG_USB_SERIAL_FTDI_SIO=y
CONFIG_USB_SERIAL_VISOR=y
CONFIG_USB_SERIAL_IPAQ=y
CONFIG_USB_SERIAL_IR=y
CONFIG_USB_SERIAL_EDGEPORT=y
CONFIG_USB_SERIAL_EDGEPORT_TI=y
CONFIG_USB_SERIAL_F81232=y
CONFIG_USB_SERIAL_F8153X=y
CONFIG_USB_SERIAL_GARMIN=y
CONFIG_USB_SERIAL_IPW=y
CONFIG_USB_SERIAL_IUU=y
CONFIG_USB_SERIAL_KEYSPAN_PDA=y
CONFIG_USB_SERIAL_KEYSPAN=y
CONFIG_USB_SERIAL_KLSI=y
CONFIG_USB_SERIAL_KOBIL_SCT=y
CONFIG_USB_SERIAL_MCT_U232=y
CONFIG_USB_SERIAL_METRO=y
CONFIG_USB_SERIAL_MOS7720=y
CONFIG_USB_SERIAL_MOS7715_PARPORT=y
CONFIG_USB_SERIAL_MOS7840=y
CONFIG_USB_SERIAL_MXUPORT=y
CONFIG_USB_SERIAL_NAVMAN=y
CONFIG_USB_SERIAL_PL2303=y
CONFIG_USB_SERIAL_OTI6858=y
CONFIG_USB_SERIAL_QCAUX=y
CONFIG_USB_SERIAL_QUALCOMM=y
CONFIG_USB_SERIAL_SPCP8X5=y
CONFIG_USB_SERIAL_SAFE=y
# CONFIG_USB_SERIAL_SAFE_PADDED is not set
CONFIG_USB_SERIAL_SIERRAWIRELESS=y
CONFIG_USB_SERIAL_SYMBOL=y
CONFIG_USB_SERIAL_TI=y
CONFIG_USB_SERIAL_CYBERJACK=y
CONFIG_USB_SERIAL_WWAN=y
CONFIG_USB_SERIAL_OPTION=y
CONFIG_USB_SERIAL_OMNINET=y
CONFIG_USB_SERIAL_OPTICON=y
CONFIG_USB_SERIAL_XSENS_MT=y
CONFIG_USB_SERIAL_WISHBONE=y
CONFIG_USB_SERIAL_SSU100=y
CONFIG_USB_SERIAL_QT2=y
CONFIG_USB_SERIAL_UPD78F0730=y
CONFIG_USB_SERIAL_XR=y
CONFIG_USB_SERIAL_DEBUG=y

#
# USB Miscellaneous drivers
#
CONFIG_USB_USS720=y
CONFIG_USB_EMI62=y
CONFIG_USB_EMI26=y
CONFIG_USB_ADUTUX=y
CONFIG_USB_SEVSEG=y
CONFIG_USB_LEGOTOWER=y
CONFIG_USB_LCD=y
CONFIG_USB_CYPRESS_CY7C63=y
CONFIG_USB_CYTHERM=y
CONFIG_USB_IDMOUSE=y
CONFIG_USB_APPLEDISPLAY=y
CONFIG_APPLE_MFI_FASTCHARGE=y
CONFIG_USB_LJCA=y
# CONFIG_USB_USBIO is not set
CONFIG_USB_SISUSBVGA=y
CONFIG_USB_LD=y
CONFIG_USB_TRANCEVIBRATOR=y
CONFIG_USB_IOWARRIOR=y
CONFIG_USB_TEST=y
CONFIG_USB_EHSET_TEST_FIXTURE=y
CONFIG_USB_ISIGHTFW=y
CONFIG_USB_YUREX=y
CONFIG_USB_EZUSB_FX2=y
CONFIG_USB_HUB_USB251XB=y
CONFIG_USB_HSIC_USB3503=y
CONFIG_USB_HSIC_USB4604=y
CONFIG_USB_LINK_LAYER_TEST=y
CONFIG_USB_CHAOSKEY=y
# CONFIG_USB_ONBOARD_DEV is not set
CONFIG_USB_ATM=y
CONFIG_USB_SPEEDTOUCH=y
CONFIG_USB_CXACRU=y
CONFIG_USB_UEAGLEATM=y
CONFIG_USB_XUSBATM=y

#
# USB Physical Layer drivers
#
CONFIG_USB_PHY=y
CONFIG_NOP_USB_XCEIV=y
CONFIG_TAHVO_USB=y
CONFIG_TAHVO_USB_HOST_BY_DEFAULT=y
CONFIG_USB_ISP1301=y
# end of USB Physical Layer drivers

CONFIG_USB_GADGET=y
# CONFIG_USB_GADGET_DEBUG is not set
CONFIG_USB_GADGET_DEBUG_FILES=y
CONFIG_USB_GADGET_DEBUG_FS=y
CONFIG_USB_GADGET_VBUS_DRAW=2
CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2
CONFIG_U_SERIAL_CONSOLE=y

#
# USB Peripheral Controller
#
CONFIG_USB_GR_UDC=y
CONFIG_USB_R8A66597=y
CONFIG_USB_PXA27X=y
CONFIG_USB_SNP_CORE=y
# CONFIG_USB_SNP_UDC_PLAT is not set
# CONFIG_USB_M66592 is not set
CONFIG_USB_BDC_UDC=y
CONFIG_USB_AMD5536UDC=y
CONFIG_USB_NET2280=y
CONFIG_USB_GOKU=y
CONFIG_USB_EG20T=y
# CONFIG_USB_GADGET_XILINX is not set
CONFIG_USB_MAX3420_UDC=y
CONFIG_USB_CDNS2_UDC=y
CONFIG_USB_DUMMY_HCD=y
# end of USB Peripheral Controller

CONFIG_USB_LIBCOMPOSITE=y
CONFIG_USB_F_ACM=y
CONFIG_USB_F_SS_LB=y
CONFIG_USB_U_SERIAL=y
CONFIG_USB_U_ETHER=y
CONFIG_USB_U_AUDIO=y
CONFIG_USB_F_SERIAL=y
CONFIG_USB_F_OBEX=y
CONFIG_USB_F_NCM=y
CONFIG_USB_F_ECM=y
CONFIG_USB_F_PHONET=y
CONFIG_USB_F_EEM=y
CONFIG_USB_F_SUBSET=y
CONFIG_USB_F_RNDIS=y
CONFIG_USB_F_MASS_STORAGE=y
CONFIG_USB_F_FS=y
CONFIG_USB_F_UAC1=y
CONFIG_USB_F_UAC1_LEGACY=y
CONFIG_USB_F_UAC2=y
CONFIG_USB_F_UVC=y
CONFIG_USB_F_MIDI=y
CONFIG_USB_F_MIDI2=y
CONFIG_USB_F_HID=y
CONFIG_USB_F_PRINTER=y
CONFIG_USB_F_TCM=y
CONFIG_USB_CONFIGFS=y
CONFIG_USB_CONFIGFS_SERIAL=y
CONFIG_USB_CONFIGFS_ACM=y
CONFIG_USB_CONFIGFS_OBEX=y
CONFIG_USB_CONFIGFS_NCM=y
CONFIG_USB_CONFIGFS_ECM=y
CONFIG_USB_CONFIGFS_ECM_SUBSET=y
CONFIG_USB_CONFIGFS_RNDIS=y
CONFIG_USB_CONFIGFS_EEM=y
CONFIG_USB_CONFIGFS_PHONET=y
CONFIG_USB_CONFIGFS_MASS_STORAGE=y
CONFIG_USB_CONFIGFS_F_LB_SS=y
CONFIG_USB_CONFIGFS_F_FS=y
CONFIG_USB_CONFIGFS_F_UAC1=y
CONFIG_USB_CONFIGFS_F_UAC1_LEGACY=y
CONFIG_USB_CONFIGFS_F_UAC2=y
CONFIG_USB_CONFIGFS_F_MIDI=y
CONFIG_USB_CONFIGFS_F_MIDI2=y
CONFIG_USB_CONFIGFS_F_HID=y
CONFIG_USB_CONFIGFS_F_UVC=y
CONFIG_USB_CONFIGFS_F_PRINTER=y
CONFIG_USB_CONFIGFS_F_TCM=y

#
# USB Gadget precomposed configurations
#
# CONFIG_USB_ZERO is not set
# CONFIG_USB_AUDIO is not set
# CONFIG_USB_ETH is not set
# CONFIG_USB_G_NCM is not set
CONFIG_USB_GADGETFS=y
# CONFIG_USB_FUNCTIONFS is not set
# CONFIG_USB_MASS_STORAGE is not set
# CONFIG_USB_GADGET_TARGET is not set
# CONFIG_USB_G_SERIAL is not set
# CONFIG_USB_MIDI_GADGET is not set
# CONFIG_USB_G_PRINTER is not set
# CONFIG_USB_CDC_COMPOSITE is not set
# CONFIG_USB_G_NOKIA is not set
# CONFIG_USB_G_ACM_MS is not set
# CONFIG_USB_G_MULTI is not set
# CONFIG_USB_G_HID is not set
# CONFIG_USB_G_DBGP is not set
# CONFIG_USB_G_WEBCAM is not set
CONFIG_USB_RAW_GADGET=y
# end of USB Gadget precomposed configurations

CONFIG_TYPEC=y
CONFIG_TYPEC_TCPM=y
CONFIG_TYPEC_TCPCI=y
CONFIG_TYPEC_RT1711H=y
CONFIG_TYPEC_MT6360=y
CONFIG_TYPEC_TCPCI_MT6370=y
CONFIG_TYPEC_TCPCI_MAXIM=y
CONFIG_TYPEC_FUSB302=y
CONFIG_TYPEC_WCOVE=y
CONFIG_TYPEC_UCSI=y
CONFIG_UCSI_CCG=y
CONFIG_UCSI_ACPI=y
CONFIG_UCSI_STM32G0=y
CONFIG_TYPEC_TPS6598X=y
CONFIG_TYPEC_ANX7411=y
CONFIG_TYPEC_RT1719=y
CONFIG_TYPEC_HD3SS3220=y
CONFIG_TYPEC_STUSB160X=y
CONFIG_TYPEC_WUSB3801=y

#
# USB Type-C Multiplexer/DeMultiplexer Switch support
#
CONFIG_TYPEC_MUX_FSA4480=y
CONFIG_TYPEC_MUX_GPIO_SBU=y
CONFIG_TYPEC_MUX_PI3USB30532=y
CONFIG_TYPEC_MUX_INTEL_PMC=y
# CONFIG_TYPEC_MUX_IT5205 is not set
CONFIG_TYPEC_MUX_NB7VPQ904M=y
# CONFIG_TYPEC_MUX_PS883X is not set
CONFIG_TYPEC_MUX_PTN36502=y
# CONFIG_TYPEC_MUX_TUSB1046 is not set
CONFIG_TYPEC_MUX_WCD939X_USBSS=y
# end of USB Type-C Multiplexer/DeMultiplexer Switch support

#
# USB Type-C Alternate Mode drivers
#
CONFIG_TYPEC_DP_ALTMODE=y
CONFIG_TYPEC_NVIDIA_ALTMODE=y
# CONFIG_TYPEC_TBT_ALTMODE is not set
# end of USB Type-C Alternate Mode drivers

CONFIG_USB_ROLE_SWITCH=y
CONFIG_USB_ROLES_INTEL_XHCI=y
CONFIG_MMC=y
# CONFIG_PWRSEQ_EMMC is not set
# CONFIG_PWRSEQ_SD8787 is not set
# CONFIG_PWRSEQ_SIMPLE is not set
# CONFIG_MMC_BLOCK is not set
# CONFIG_SDIO_UART is not set
# CONFIG_MMC_TEST is not set
# CONFIG_MMC_CRYPTO is not set

#
# MMC/SD/SDIO Host Controller Drivers
#
# CONFIG_MMC_DEBUG is not set
# CONFIG_MMC_SDHCI is not set
# CONFIG_MMC_WBSD is not set
# CONFIG_MMC_TIFM_SD is not set
# CONFIG_MMC_SPI is not set
# CONFIG_MMC_SDRICOH_CS is not set
# CONFIG_MMC_CB710 is not set
# CONFIG_MMC_VIA_SDMMC is not set
CONFIG_MMC_VUB300=y
CONFIG_MMC_USHC=y
# CONFIG_MMC_USDHI6ROL0 is not set
CONFIG_MMC_REALTEK_USB=y
# CONFIG_MMC_CQHCI is not set
# CONFIG_MMC_HSQ is not set
# CONFIG_MMC_TOSHIBA_PCI is not set
# CONFIG_MMC_MTK is not set
# CONFIG_SCSI_UFSHCD is not set
CONFIG_MEMSTICK=y
# CONFIG_MEMSTICK_DEBUG is not set

#
# MemoryStick drivers
#
# CONFIG_MEMSTICK_UNSAFE_RESUME is not set
# CONFIG_MSPRO_BLOCK is not set
# CONFIG_MS_BLOCK is not set

#
# MemoryStick Host Controller Drivers
#
# CONFIG_MEMSTICK_TIFM_MS is not set
# CONFIG_MEMSTICK_JMICRON_38X is not set
# CONFIG_MEMSTICK_R592 is not set
CONFIG_MEMSTICK_REALTEK_USB=y
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
# CONFIG_LEDS_CLASS_FLASH is not set
CONFIG_LEDS_CLASS_MULTICOLOR=y
# CONFIG_LEDS_BRIGHTNESS_HW_CHANGED is not set

#
# LED drivers
#
# CONFIG_LEDS_AN30259A is not set
# CONFIG_LEDS_APU is not set
# CONFIG_LEDS_OSRAM_AMS_AS3668 is not set
# CONFIG_LEDS_AW200XX is not set
# CONFIG_LEDS_AW2013 is not set
# CONFIG_LEDS_BCM6328 is not set
# CONFIG_LEDS_BCM6358 is not set
# CONFIG_LEDS_CHT_WCOVE is not set
# CONFIG_LEDS_CR0014114 is not set
# CONFIG_LEDS_EL15203000 is not set
# CONFIG_LEDS_LM3530 is not set
# CONFIG_LEDS_LM3532 is not set
# CONFIG_LEDS_LM3642 is not set
# CONFIG_LEDS_LM3692X is not set
# CONFIG_LEDS_PCA9532 is not set
# CONFIG_LEDS_GPIO is not set
# CONFIG_LEDS_LP3944 is not set
# CONFIG_LEDS_LP3952 is not set
# CONFIG_LEDS_LP50XX is not set
# CONFIG_LEDS_LP55XX_COMMON is not set
# CONFIG_LEDS_LP8860 is not set
# CONFIG_LEDS_LP8864 is not set
# CONFIG_LEDS_PCA955X is not set
# CONFIG_LEDS_PCA963X is not set
# CONFIG_LEDS_PCA995X is not set
# CONFIG_LEDS_DAC124S085 is not set
# CONFIG_LEDS_REGULATOR is not set
# CONFIG_LEDS_BD2606MVV is not set
# CONFIG_LEDS_BD2802 is not set
# CONFIG_LEDS_INTEL_SS4200 is not set
# CONFIG_LEDS_LT3593 is not set
# CONFIG_LEDS_TCA6507 is not set
# CONFIG_LEDS_TLC591XX is not set
# CONFIG_LEDS_LM355x is not set
# CONFIG_LEDS_IS31FL319X is not set
# CONFIG_LEDS_IS31FL32XX is not set

#
# LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM)
#
# CONFIG_LEDS_BLINKM is not set
# CONFIG_LEDS_SYSCON is not set
# CONFIG_LEDS_MLXCPLD is not set
# CONFIG_LEDS_MLXREG is not set
# CONFIG_LEDS_USER is not set
# CONFIG_LEDS_NIC78BX is not set
# CONFIG_LEDS_SPI_BYTE is not set
# CONFIG_LEDS_LM3697 is not set
# CONFIG_LEDS_ST1202 is not set
# CONFIG_LEDS_LGM is not set

#
# Flash and Torch LED drivers
#

#
# RGB LED drivers
#
# CONFIG_LEDS_GROUP_MULTICOLOR is not set
# CONFIG_LEDS_KTD202X is not set
# CONFIG_LEDS_LP5812 is not set
# CONFIG_LEDS_LP5860_CORE is not set
# CONFIG_LEDS_LP5860_SPI is not set
# CONFIG_LEDS_NCP5623 is not set
# CONFIG_LEDS_MT6370_RGB is not set

#
# LED Triggers
#
CONFIG_LEDS_TRIGGERS=y
# CONFIG_LEDS_TRIGGER_TIMER is not set
# CONFIG_LEDS_TRIGGER_ONESHOT is not set
# CONFIG_LEDS_TRIGGER_DISK is not set
# CONFIG_LEDS_TRIGGER_MTD is not set
# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
# CONFIG_LEDS_TRIGGER_ACTIVITY is not set
# CONFIG_LEDS_TRIGGER_GPIO is not set
# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set

#
# iptables trigger is under Netfilter config (LED target)
#
# CONFIG_LEDS_TRIGGER_TRANSIENT is not set
# CONFIG_LEDS_TRIGGER_CAMERA is not set
# CONFIG_LEDS_TRIGGER_PANIC is not set
# CONFIG_LEDS_TRIGGER_NETDEV is not set
# CONFIG_LEDS_TRIGGER_PATTERN is not set
# CONFIG_LEDS_TRIGGER_TTY is not set
# CONFIG_LEDS_TRIGGER_INPUT_EVENTS is not set

#
# Simatic LED drivers
#
# CONFIG_ACCESSIBILITY is not set
CONFIG_INFINIBAND=y
CONFIG_INFINIBAND_USER_MAD=y
CONFIG_INFINIBAND_USER_ACCESS=y
CONFIG_INFINIBAND_USER_ACCESS_CORE=y
CONFIG_INFINIBAND_USER_MEM=y
CONFIG_INFINIBAND_ON_DEMAND_PAGING=y
CONFIG_INFINIBAND_ADDR_TRANS=y
CONFIG_INFINIBAND_ADDR_TRANS_CONFIGFS=y
CONFIG_INFINIBAND_VIRT_DMA=y
# CONFIG_INFINIBAND_EFA is not set
# CONFIG_INFINIBAND_ERDMA is not set
CONFIG_MLX4_INFINIBAND=y
# CONFIG_INFINIBAND_MTHCA is not set
# CONFIG_INFINIBAND_OCRDMA is not set
# CONFIG_INFINIBAND_USNIC is not set
# CONFIG_INFINIBAND_VMWARE_PVRDMA is not set
# CONFIG_INFINIBAND_RDMAVT is not set
CONFIG_RDMA_RXE=y
CONFIG_RDMA_SIW=y
CONFIG_INFINIBAND_IPOIB=y
CONFIG_INFINIBAND_IPOIB_CM=y
CONFIG_INFINIBAND_IPOIB_DEBUG=y
# CONFIG_INFINIBAND_IPOIB_DEBUG_DATA is not set
CONFIG_INFINIBAND_SRP=y
# CONFIG_INFINIBAND_SRPT is not set
CONFIG_INFINIBAND_ISER=y
CONFIG_INFINIBAND_RTRS=y
CONFIG_INFINIBAND_RTRS_CLIENT=y
# CONFIG_INFINIBAND_RTRS_SERVER is not set
CONFIG_EDAC_ATOMIC_SCRUB=y
CONFIG_EDAC_SUPPORT=y
CONFIG_EDAC=y
# CONFIG_EDAC_DEBUG is not set
# CONFIG_EDAC_DECODE_MCE is not set
# CONFIG_EDAC_SCRUB is not set
# CONFIG_EDAC_ECS is not set
# CONFIG_EDAC_MEM_REPAIR is not set
# CONFIG_EDAC_E752X is not set
# CONFIG_EDAC_I82975X is not set
# CONFIG_EDAC_I3000 is not set
# CONFIG_EDAC_I3200 is not set
# CONFIG_EDAC_IE31200 is not set
# CONFIG_EDAC_X38 is not set
# CONFIG_EDAC_I5400 is not set
# CONFIG_EDAC_I7CORE is not set
# CONFIG_EDAC_I5100 is not set
# CONFIG_EDAC_I7300 is not set
# CONFIG_EDAC_SBRIDGE is not set
# CONFIG_EDAC_SKX is not set
# CONFIG_EDAC_I10NM is not set
# CONFIG_EDAC_IMH is not set
# CONFIG_EDAC_PND2 is not set
# CONFIG_EDAC_IGEN6 is not set
CONFIG_RTC_LIB=y
CONFIG_RTC_MC146818_LIB=y
CONFIG_RTC_CLASS=y
# CONFIG_RTC_HCTOSYS is not set
CONFIG_RTC_SYSTOHC=y
CONFIG_RTC_SYSTOHC_DEVICE="rtc0"
# CONFIG_RTC_DEBUG is not set
# CONFIG_RTC_NVMEM is not set

#
# RTC interfaces
#
CONFIG_RTC_INTF_SYSFS=y
CONFIG_RTC_INTF_PROC=y
CONFIG_RTC_INTF_DEV=y
# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
# CONFIG_RTC_DRV_TEST is not set

#
# I2C RTC drivers
#
# CONFIG_RTC_DRV_ABB5ZES3 is not set
# CONFIG_RTC_DRV_ABEOZ9 is not set
# CONFIG_RTC_DRV_ABX80X is not set
# CONFIG_RTC_DRV_DS1307 is not set
# CONFIG_RTC_DRV_DS1374 is not set
# CONFIG_RTC_DRV_DS1672 is not set
# CONFIG_RTC_DRV_HYM8563 is not set
# CONFIG_RTC_DRV_MAX6900 is not set
# CONFIG_RTC_DRV_MAX31335 is not set
# CONFIG_RTC_DRV_NCT3018Y is not set
# CONFIG_RTC_DRV_RS5C372 is not set
# CONFIG_RTC_DRV_ISL1208 is not set
# CONFIG_RTC_DRV_ISL12022 is not set
# CONFIG_RTC_DRV_ISL12026 is not set
# CONFIG_RTC_DRV_X1205 is not set
# CONFIG_RTC_DRV_PCF8523 is not set
# CONFIG_RTC_DRV_PCF85363 is not set
# CONFIG_RTC_DRV_PCF8563 is not set
# CONFIG_RTC_DRV_PCF8583 is not set
# CONFIG_RTC_DRV_M41T80 is not set
# CONFIG_RTC_DRV_BQ32K is not set
# CONFIG_RTC_DRV_TWL4030 is not set
# CONFIG_RTC_DRV_S35390A is not set
# CONFIG_RTC_DRV_FM3130 is not set
# CONFIG_RTC_DRV_RX8010 is not set
# CONFIG_RTC_DRV_RX8111 is not set
# CONFIG_RTC_DRV_RX8581 is not set
# CONFIG_RTC_DRV_RX8025 is not set
# CONFIG_RTC_DRV_EM3027 is not set
# CONFIG_RTC_DRV_RV3028 is not set
# CONFIG_RTC_DRV_RV3032 is not set
# CONFIG_RTC_DRV_RV8803 is not set
# CONFIG_RTC_DRV_SD2405AL is not set
# CONFIG_RTC_DRV_SD3078 is not set

#
# SPI RTC drivers
#
# CONFIG_RTC_DRV_M41T93 is not set
# CONFIG_RTC_DRV_M41T94 is not set
# CONFIG_RTC_DRV_DS1302 is not set
# CONFIG_RTC_DRV_DS1305 is not set
# CONFIG_RTC_DRV_DS1343 is not set
# CONFIG_RTC_DRV_DS1347 is not set
# CONFIG_RTC_DRV_DS1390 is not set
# CONFIG_RTC_DRV_MAX6916 is not set
# CONFIG_RTC_DRV_R9701 is not set
# CONFIG_RTC_DRV_RX4581 is not set
# CONFIG_RTC_DRV_RS5C348 is not set
# CONFIG_RTC_DRV_MAX6902 is not set
# CONFIG_RTC_DRV_PCF2123 is not set
# CONFIG_RTC_DRV_MCP795 is not set
CONFIG_RTC_I2C_AND_SPI=y

#
# SPI and I2C RTC drivers
#
# CONFIG_RTC_DRV_DS3232 is not set
# CONFIG_RTC_DRV_PCF2127 is not set
# CONFIG_RTC_DRV_PCF85063 is not set
# CONFIG_RTC_DRV_RV3029C2 is not set
# CONFIG_RTC_DRV_RX6110 is not set

#
# Platform RTC drivers
#
CONFIG_RTC_DRV_CMOS=y
# CONFIG_RTC_DRV_DS1286 is not set
# CONFIG_RTC_DRV_DS1511 is not set
# CONFIG_RTC_DRV_DS1553 is not set
# CONFIG_RTC_DRV_DS1685_FAMILY is not set
# CONFIG_RTC_DRV_DS1742 is not set
# CONFIG_RTC_DRV_DS2404 is not set
# CONFIG_RTC_DRV_STK17TA8 is not set
# CONFIG_RTC_DRV_M48T86 is not set
# CONFIG_RTC_DRV_M48T35 is not set
# CONFIG_RTC_DRV_M48T59 is not set
# CONFIG_RTC_DRV_MSM6242 is not set
# CONFIG_RTC_DRV_RP5C01 is not set
# CONFIG_RTC_DRV_ZYNQMP is not set

#
# on-CPU RTC drivers
#
# CONFIG_RTC_DRV_CADENCE is not set
# CONFIG_RTC_DRV_FTRTC010 is not set
# CONFIG_RTC_DRV_R7301 is not set
# CONFIG_RTC_DRV_GOLDFISH is not set

#
# HID Sensor RTC drivers
#
CONFIG_RTC_DRV_HID_SENSOR_TIME=y
CONFIG_DMADEVICES=y
# CONFIG_DMADEVICES_DEBUG is not set

#
# DMA Devices
#
CONFIG_DMA_ENGINE=y
CONFIG_DMA_VIRTUAL_CHANNELS=y
CONFIG_DMA_ACPI=y
CONFIG_DMA_OF=y
# CONFIG_ALTERA_MSGDMA is not set
# CONFIG_DW_AXI_DMAC is not set
# CONFIG_FSL_EDMA is not set
CONFIG_INTEL_IDMA64=y
# CONFIG_INTEL_IDXD is not set
# CONFIG_INTEL_IDXD_COMPAT is not set
CONFIG_INTEL_IOATDMA=y
# CONFIG_PLX_DMA is not set
# CONFIG_SWITCHTEC_DMA is not set
# CONFIG_XILINX_DMA is not set
# CONFIG_XILINX_XDMA is not set
# CONFIG_XILINX_ZYNQMP_DPDMA is not set
# CONFIG_AMD_PTDMA is not set
# CONFIG_AMD_QDMA is not set
# CONFIG_QCOM_HIDMA_MGMT is not set
# CONFIG_QCOM_HIDMA is not set
CONFIG_DW_DMAC_CORE=y
# CONFIG_DW_DMAC is not set
# CONFIG_DW_DMAC_PCI is not set
# CONFIG_DW_EDMA is not set
CONFIG_HSU_DMA=y
# CONFIG_SF_PDMA is not set
# CONFIG_INTEL_LDMA is not set

#
# DMA Clients
#
CONFIG_ASYNC_TX_DMA=y
# CONFIG_DMATEST is not set
CONFIG_DMA_ENGINE_RAID=y

#
# DMABUF options
#
CONFIG_SYNC_FILE=y
CONFIG_SW_SYNC=y
CONFIG_UDMABUF=y
# CONFIG_DMABUF_DEBUG is not set
CONFIG_DMABUF_HEAPS=y
CONFIG_DMABUF_HEAPS_SYSTEM=y
# CONFIG_DMABUF_HEAPS_SYSTEM_CC_SHARED is not set
CONFIG_DMABUF_HEAPS_CMA=y
# end of DMABUF options

CONFIG_DCA=y
# CONFIG_UIO is not set
CONFIG_VFIO=y
CONFIG_VFIO_DEVICE_CDEV=y
# CONFIG_VFIO_GROUP is not set
CONFIG_VFIO_VIRQFD=y
# CONFIG_VFIO_DEBUGFS is not set

#
# VFIO support for PCI devices
#
CONFIG_VFIO_PCI_CORE=y
CONFIG_VFIO_PCI_INTX=y
CONFIG_VFIO_PCI=y
# CONFIG_VFIO_PCI_VGA is not set
# CONFIG_VFIO_PCI_IGD is not set
# CONFIG_VIRTIO_VFIO_PCI is not set
# end of VFIO support for PCI devices

CONFIG_IRQ_BYPASS_MANAGER=y
# CONFIG_VIRT_DRIVERS is not set
CONFIG_VIRTIO_ANCHOR=y
CONFIG_VIRTIO=y
CONFIG_VIRTIO_PCI_LIB=y
CONFIG_VIRTIO_PCI_LIB_LEGACY=y
CONFIG_VIRTIO_MENU=y
CONFIG_VIRTIO_PCI=y
CONFIG_VIRTIO_PCI_ADMIN_LEGACY=y
CONFIG_VIRTIO_PCI_LEGACY=y
CONFIG_VIRTIO_VDPA=y
CONFIG_VIRTIO_PMEM=y
CONFIG_VIRTIO_BALLOON=y
CONFIG_VIRTIO_MEM=y
CONFIG_VIRTIO_INPUT=y
CONFIG_VIRTIO_MMIO=y
CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y
CONFIG_VIRTIO_DMA_SHARED_BUFFER=y
# CONFIG_VIRTIO_DEBUG is not set
# CONFIG_VIRTIO_RTC is not set
CONFIG_VDPA=y
CONFIG_VDPA_SIM=y
CONFIG_VDPA_SIM_NET=y
CONFIG_VDPA_SIM_BLOCK=y
# CONFIG_VDPA_USER is not set
# CONFIG_IFCVF is not set
# CONFIG_MLX5_VDPA_STEERING_DEBUG is not set
CONFIG_VP_VDPA=y
# CONFIG_ALIBABA_ENI_VDPA is not set
# CONFIG_SNET_VDPA is not set
# CONFIG_OCTEONEP_VDPA is not set
CONFIG_VHOST_IOTLB=y
CONFIG_VHOST_RING=y
CONFIG_VHOST_TASK=y
CONFIG_VHOST=y
CONFIG_VHOST_MENU=y
CONFIG_VHOST_NET=y
# CONFIG_VHOST_SCSI is not set
CONFIG_VHOST_VSOCK=y
CONFIG_VHOST_VDPA=y
CONFIG_VHOST_CROSS_ENDIAN_LEGACY=y
CONFIG_VHOST_ENABLE_FORK_OWNER_CONTROL=y

#
# Microsoft Hyper-V guest support
#
# CONFIG_HYPERV is not set
# end of Microsoft Hyper-V guest support

CONFIG_GREYBUS=y
# CONFIG_GREYBUS_BEAGLEPLAY is not set
CONFIG_GREYBUS_ES2=y
CONFIG_COMEDI=y
# CONFIG_COMEDI_DEBUG is not set
CONFIG_COMEDI_DEFAULT_BUF_SIZE_KB=2048
CONFIG_COMEDI_DEFAULT_BUF_MAXSIZE_KB=20480
CONFIG_COMEDI_MISC_DRIVERS=y
CONFIG_COMEDI_BOND=y
CONFIG_COMEDI_TEST=y
CONFIG_COMEDI_PARPORT=y
CONFIG_COMEDI_ISA_DRIVERS=y
CONFIG_COMEDI_PCL711=y
CONFIG_COMEDI_PCL724=y
CONFIG_COMEDI_PCL726=y
CONFIG_COMEDI_PCL730=y
CONFIG_COMEDI_PCL812=y
CONFIG_COMEDI_PCL816=y
CONFIG_COMEDI_PCL818=y
CONFIG_COMEDI_PCM3724=y
CONFIG_COMEDI_AMPLC_DIO200_ISA=y
CONFIG_COMEDI_AMPLC_PC236_ISA=y
CONFIG_COMEDI_AMPLC_PC263_ISA=y
CONFIG_COMEDI_RTI800=y
CONFIG_COMEDI_RTI802=y
CONFIG_COMEDI_DAC02=y
CONFIG_COMEDI_DAS16M1=y
CONFIG_COMEDI_DAS08_ISA=y
# CONFIG_COMEDI_DAS16 is not set
CONFIG_COMEDI_DAS800=y
CONFIG_COMEDI_DAS1800=y
CONFIG_COMEDI_DAS6402=y
CONFIG_COMEDI_DT2801=y
CONFIG_COMEDI_DT2811=y
CONFIG_COMEDI_DT2814=y
CONFIG_COMEDI_DT2815=y
CONFIG_COMEDI_DT2817=y
CONFIG_COMEDI_DT282X=y
CONFIG_COMEDI_DMM32AT=y
CONFIG_COMEDI_FL512=y
CONFIG_COMEDI_AIO_AIO12_8=y
CONFIG_COMEDI_AIO_IIRO_16=y
# CONFIG_COMEDI_II_PCI20KC is not set
CONFIG_COMEDI_C6XDIGIO=y
CONFIG_COMEDI_MPC624=y
CONFIG_COMEDI_ADQ12B=y
CONFIG_COMEDI_NI_AT_A2150=y
CONFIG_COMEDI_NI_AT_AO=y
# CONFIG_COMEDI_NI_ATMIO is not set
CONFIG_COMEDI_NI_ATMIO16D=y
CONFIG_COMEDI_NI_LABPC_ISA=y
CONFIG_COMEDI_PCMAD=y
CONFIG_COMEDI_PCMDA12=y
CONFIG_COMEDI_PCMMIO=y
CONFIG_COMEDI_PCMUIO=y
CONFIG_COMEDI_MULTIQ3=y
CONFIG_COMEDI_S526=y
CONFIG_COMEDI_PCI_DRIVERS=y
CONFIG_COMEDI_8255_PCI=y
# CONFIG_COMEDI_ADDI_APCI_1032 is not set
# CONFIG_COMEDI_ADDI_APCI_1500 is not set
# CONFIG_COMEDI_ADDI_APCI_1516 is not set
# CONFIG_COMEDI_ADDI_APCI_1564 is not set
# CONFIG_COMEDI_ADDI_APCI_16XX is not set
# CONFIG_COMEDI_ADDI_APCI_2032 is not set
# CONFIG_COMEDI_ADDI_APCI_2200 is not set
# CONFIG_COMEDI_ADDI_APCI_3120 is not set
# CONFIG_COMEDI_ADDI_APCI_3501 is not set
# CONFIG_COMEDI_ADDI_APCI_3XXX is not set
# CONFIG_COMEDI_ADL_PCI6208 is not set
# CONFIG_COMEDI_ADL_PCI7250 is not set
# CONFIG_COMEDI_ADL_PCI7X3X is not set
# CONFIG_COMEDI_ADL_PCI8164 is not set
# CONFIG_COMEDI_ADL_PCI9111 is not set
CONFIG_COMEDI_ADL_PCI9118=y
# CONFIG_COMEDI_ADV_PCI1710 is not set
# CONFIG_COMEDI_ADV_PCI1720 is not set
# CONFIG_COMEDI_ADV_PCI1723 is not set
# CONFIG_COMEDI_ADV_PCI1724 is not set
# CONFIG_COMEDI_ADV_PCI1760 is not set
# CONFIG_COMEDI_ADV_PCI_DIO is not set
# CONFIG_COMEDI_AMPLC_DIO200_PCI is not set
# CONFIG_COMEDI_AMPLC_PC236_PCI is not set
# CONFIG_COMEDI_AMPLC_PC263_PCI is not set
# CONFIG_COMEDI_AMPLC_PCI224 is not set
# CONFIG_COMEDI_AMPLC_PCI230 is not set
# CONFIG_COMEDI_CONTEC_PCI_DIO is not set
# CONFIG_COMEDI_DAS08_PCI is not set
# CONFIG_COMEDI_DT3000 is not set
# CONFIG_COMEDI_DYNA_PCI10XX is not set
# CONFIG_COMEDI_GSC_HPDI is not set
# CONFIG_COMEDI_MF6X4 is not set
# CONFIG_COMEDI_ICP_MULTI is not set
# CONFIG_COMEDI_DAQBOARD2000 is not set
# CONFIG_COMEDI_JR3_PCI is not set
# CONFIG_COMEDI_KE_COUNTER is not set
# CONFIG_COMEDI_CB_PCIDAS64 is not set
# CONFIG_COMEDI_CB_PCIDAS is not set
# CONFIG_COMEDI_CB_PCIDDA is not set
# CONFIG_COMEDI_CB_PCIMDAS is not set
# CONFIG_COMEDI_CB_PCIMDDA is not set
# CONFIG_COMEDI_ME4000 is not set
# CONFIG_COMEDI_ME_DAQ is not set
# CONFIG_COMEDI_NI_6527 is not set
# CONFIG_COMEDI_NI_65XX is not set
# CONFIG_COMEDI_NI_660X is not set
# CONFIG_COMEDI_NI_670X is not set
CONFIG_COMEDI_NI_LABPC_PCI=y
# CONFIG_COMEDI_NI_PCIDIO is not set
# CONFIG_COMEDI_NI_PCIMIO is not set
# CONFIG_COMEDI_RTD520 is not set
# CONFIG_COMEDI_S626 is not set
CONFIG_COMEDI_PCMCIA_DRIVERS=y
# CONFIG_COMEDI_CB_DAS16_CS is not set
# CONFIG_COMEDI_DAS08_CS is not set
CONFIG_COMEDI_NI_DAQ_700_CS=y
# CONFIG_COMEDI_NI_DAQ_DIO24_CS is not set
CONFIG_COMEDI_NI_LABPC_CS=y
# CONFIG_COMEDI_NI_MIO_CS is not set
# CONFIG_COMEDI_QUATECH_DAQP_CS is not set
CONFIG_COMEDI_USB_DRIVERS=y
CONFIG_COMEDI_DT9812=y
CONFIG_COMEDI_NI_USB6501=y
CONFIG_COMEDI_USBDUX=y
CONFIG_COMEDI_USBDUXFAST=y
CONFIG_COMEDI_USBDUXSIGMA=y
CONFIG_COMEDI_VMK80XX=y
CONFIG_COMEDI_8254=y
CONFIG_COMEDI_8255=y
CONFIG_COMEDI_8255_SA=y
CONFIG_COMEDI_KCOMEDILIB=y
CONFIG_COMEDI_AMPLC_DIO200=y
CONFIG_COMEDI_AMPLC_PC236=y
CONFIG_COMEDI_DAS08=y
CONFIG_COMEDI_ISADMA=y
CONFIG_COMEDI_NI_LABPC=y
CONFIG_COMEDI_NI_LABPC_ISADMA=y
# CONFIG_COMEDI_TESTS is not set
# CONFIG_GPIB is not set
CONFIG_STAGING=y
# CONFIG_RTL8723BS is not set

#
# IIO staging drivers
#

#
# Accelerometers
#
# CONFIG_ADIS16203 is not set
# end of Accelerometers

#
# Analog to digital converters
#
# CONFIG_AD7816 is not set
# end of Analog to digital converters

#
# Analog digital bi-direction converters
#
# CONFIG_ADT7316 is not set
# end of Analog digital bi-direction converters

#
# Direct Digital Synthesis
#
# CONFIG_AD9832 is not set
# CONFIG_AD9834 is not set
# end of Direct Digital Synthesis

#
# Network Analyzer, Impedance Converters
#
# CONFIG_AD5933 is not set
# end of Network Analyzer, Impedance Converters
# end of IIO staging drivers

# CONFIG_FB_SM750 is not set
# CONFIG_STAGING_MEDIA is not set
# CONFIG_FB_TFT is not set
# CONFIG_MOST_COMPONENTS is not set
# CONFIG_GREYBUS_AUDIO is not set
# CONFIG_GREYBUS_BOOTROM is not set
# CONFIG_GREYBUS_FIRMWARE is not set
CONFIG_GREYBUS_HID=y
# CONFIG_GREYBUS_LOG is not set
# CONFIG_GREYBUS_LOOPBACK is not set
# CONFIG_GREYBUS_POWER is not set
# CONFIG_GREYBUS_RAW is not set
# CONFIG_GREYBUS_VIBRATOR is not set
CONFIG_GREYBUS_BRIDGED_PHY=y
# CONFIG_GREYBUS_GPIO is not set
# CONFIG_GREYBUS_I2C is not set
# CONFIG_GREYBUS_SDIO is not set
# CONFIG_GREYBUS_SPI is not set
# CONFIG_GREYBUS_UART is not set
CONFIG_GREYBUS_USB=y
# CONFIG_XIL_AXIS_FIFO is not set
# CONFIG_VME_BUS is not set
# CONFIG_GOLDFISH is not set
# CONFIG_CHROME_PLATFORMS is not set
# CONFIG_MELLANOX_PLATFORM is not set
CONFIG_SURFACE_PLATFORMS=y
# CONFIG_SURFACE3_WMI is not set
# CONFIG_SURFACE_3_POWER_OPREGION is not set
# CONFIG_SURFACE_ACPI_NOTIFY is not set
# CONFIG_SURFACE_AGGREGATOR_CDEV is not set
# CONFIG_SURFACE_AGGREGATOR_HUB is not set
CONFIG_SURFACE_AGGREGATOR_REGISTRY=y
# CONFIG_SURFACE_AGGREGATOR_TABLET_SWITCH is not set
# CONFIG_SURFACE_DTX is not set
# CONFIG_SURFACE_GPE is not set
# CONFIG_SURFACE_HOTPLUG is not set
# CONFIG_SURFACE_PLATFORM_PROFILE is not set
# CONFIG_SURFACE_PRO3_BUTTON is not set
CONFIG_SURFACE_AGGREGATOR=y
CONFIG_SURFACE_AGGREGATOR_BUS=y
CONFIG_X86_PLATFORM_DEVICES=y
CONFIG_WMI_BMOF=y
# CONFIG_HUAWEI_WMI is not set
# CONFIG_X86_PLATFORM_DRIVERS_UNIWILL is not set
# CONFIG_MXM_WMI is not set
# CONFIG_NVIDIA_WMI_EC_BACKLIGHT is not set
# CONFIG_XIAOMI_WMI is not set
# CONFIG_REDMI_WMI is not set
# CONFIG_GIGABYTE_WMI is not set
# CONFIG_BITLAND_MIFS_WMI is not set
# CONFIG_ACERHDF is not set
# CONFIG_ACER_WIRELESS is not set
# CONFIG_ACER_WMI is not set

#
# AMD HSMP Driver
#
# CONFIG_AMD_HSMP_ACPI is not set
# CONFIG_AMD_HSMP_PLAT is not set
# end of AMD HSMP Driver

# CONFIG_AMD_PMC is not set
# CONFIG_AMD_HFI is not set
# CONFIG_AMD_3D_VCACHE is not set
# CONFIG_AMD_WBRF is not set
# CONFIG_AMD_ISP_PLATFORM is not set
# CONFIG_ADV_SWBUTTON is not set
# CONFIG_APPLE_GMUX is not set
# CONFIG_ASUS_LAPTOP is not set
# CONFIG_ASUS_WIRELESS is not set
# CONFIG_ASUS_ARMOURY is not set
CONFIG_ASUS_WMI=y
# CONFIG_ASUS_WMI_DEPRECATED_ATTRS is not set
# CONFIG_ASUS_NB_WMI is not set
CONFIG_ASUS_TF103C_DOCK=y
# CONFIG_AYANEO_EC is not set
CONFIG_EEEPC_LAPTOP=y
# CONFIG_EEEPC_WMI is not set
# CONFIG_X86_PLATFORM_DRIVERS_DELL is not set
# CONFIG_AMILO_RFKILL is not set
# CONFIG_FUJITSU_LAPTOP is not set
# CONFIG_FUJITSU_TABLET is not set
# CONFIG_GPD_POCKET_FAN is not set
# CONFIG_X86_PLATFORM_DRIVERS_HP is not set
# CONFIG_WIRELESS_HOTKEY is not set
# CONFIG_IBM_RTL is not set
# CONFIG_SENSORS_HDAPS is not set
# CONFIG_INTEL_ATOMISP2_PM is not set
# CONFIG_INTEL_IFS is not set
# CONFIG_INTEL_SAR_INT1092 is not set
# CONFIG_INTEL_SKL_INT3472 is not set

#
# Intel Speed Select Technology interface support
#
# CONFIG_INTEL_SPEED_SELECT_INTERFACE is not set
# end of Intel Speed Select Technology interface support

# CONFIG_INTEL_WMI_SBL_FW_UPDATE is not set
# CONFIG_INTEL_WMI_THUNDERBOLT is not set

#
# Intel Uncore Frequency Control
#
# CONFIG_INTEL_UNCORE_FREQ_CONTROL is not set
# end of Intel Uncore Frequency Control

# CONFIG_INTEL_HID_EVENT is not set
# CONFIG_INTEL_VBTN is not set
# CONFIG_INTEL_EHL_PSE_IO is not set
# CONFIG_INTEL_INT0002_VGPIO is not set
# CONFIG_INTEL_OAKTRAIL is not set
# CONFIG_INTEL_BXTWC_PMIC_TMU is not set
CONFIG_INTEL_CHTWC_INT33FE=y
CONFIG_INTEL_ISHTP_ECLITE=y
# CONFIG_INTEL_PUNIT_IPC is not set
# CONFIG_INTEL_RST is not set
# CONFIG_INTEL_SMARTCONNECT is not set
# CONFIG_INTEL_TURBO_MAX_3 is not set
# CONFIG_INTEL_VSEC is not set
# CONFIG_IDEAPAD_LAPTOP is not set
# CONFIG_LENOVO_WMI_HOTKEY_UTILITIES is not set
# CONFIG_LENOVO_WMI_CAMERA is not set
# CONFIG_THINKPAD_ACPI is not set
# CONFIG_THINKPAD_LMI is not set
# CONFIG_YOGABOOK is not set
# CONFIG_YT2_1380 is not set
# CONFIG_LENOVO_WMI_GAMEZONE is not set
# CONFIG_LENOVO_WMI_TUNING is not set
# CONFIG_ACPI_QUICKSTART is not set
# CONFIG_MEEGOPAD_ANX7428 is not set
# CONFIG_MSI_EC is not set
# CONFIG_MSI_LAPTOP is not set
# CONFIG_MSI_WMI is not set
# CONFIG_MSI_WMI_PLATFORM is not set
# CONFIG_PCENGINES_APU2 is not set
# CONFIG_PORTWELL_EC is not set
# CONFIG_BARCO_P50_GPIO is not set
# CONFIG_SAMSUNG_GALAXYBOOK is not set
# CONFIG_SAMSUNG_LAPTOP is not set
# CONFIG_SAMSUNG_Q10 is not set
# CONFIG_ACPI_TOSHIBA is not set
# CONFIG_TOSHIBA_BT_RFKILL is not set
# CONFIG_TOSHIBA_HAPS is not set
# CONFIG_TOSHIBA_WMI is not set
# CONFIG_ACPI_CMPC is not set
# CONFIG_COMPAL_LAPTOP is not set
# CONFIG_LG_LAPTOP is not set
# CONFIG_PANASONIC_LAPTOP is not set
# CONFIG_SONY_LAPTOP is not set
# CONFIG_SYSTEM76_ACPI is not set
# CONFIG_TOPSTAR_LAPTOP is not set
# CONFIG_SERIAL_MULTI_INSTANTIATE is not set
# CONFIG_INSPUR_PLATFORM_PROFILE is not set
# CONFIG_DASHARO_ACPI is not set
# CONFIG_INTEL_IPS is not set
CONFIG_INTEL_SCU_IPC=y
# CONFIG_INTEL_SCU_PCI is not set
# CONFIG_INTEL_SCU_PLATFORM is not set
# CONFIG_SIEMENS_SIMATIC_IPC is not set
# CONFIG_SILICOM_PLATFORM is not set
# CONFIG_WINMATE_FM07_KEYS is not set
# CONFIG_OXP_EC is not set
# CONFIG_TUXEDO_NB04_WMI_AB is not set
CONFIG_P2SB=y
CONFIG_ACPI_WMI=y
# CONFIG_ACPI_WMI_LEGACY_DEVICE_NAMES is not set
CONFIG_HAVE_CLK=y
CONFIG_HAVE_CLK_PREPARE=y
CONFIG_COMMON_CLK=y
# CONFIG_LMK04832 is not set
# CONFIG_COMMON_CLK_MAX9485 is not set
# CONFIG_COMMON_CLK_SI5341 is not set
# CONFIG_COMMON_CLK_SI5351 is not set
# CONFIG_COMMON_CLK_SI514 is not set
# CONFIG_COMMON_CLK_SI544 is not set
# CONFIG_COMMON_CLK_SI570 is not set
# CONFIG_COMMON_CLK_CDCE706 is not set
# CONFIG_COMMON_CLK_CDCE925 is not set
# CONFIG_COMMON_CLK_CS2000_CP is not set
# CONFIG_CLK_TWL is not set
# CONFIG_COMMON_CLK_AXI_CLKGEN is not set
# CONFIG_COMMON_CLK_RS9_PCIE is not set
# CONFIG_COMMON_CLK_SI521XX is not set
# CONFIG_COMMON_CLK_VC3 is not set
# CONFIG_COMMON_CLK_VC5 is not set
# CONFIG_COMMON_CLK_VC7 is not set
# CONFIG_COMMON_CLK_FIXED_MMIO is not set
# CONFIG_CLK_LGM_CGU is not set
# CONFIG_XILINX_VCU is not set
# CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set
# CONFIG_HWSPINLOCK is not set

#
# Clock Source drivers
#
CONFIG_CLKEVT_I8253=y
CONFIG_I8253_LOCK=y
CONFIG_CLKBLD_I8253=y
# end of Clock Source drivers

CONFIG_MAILBOX=y
# CONFIG_PLATFORM_MHU is not set
CONFIG_PCC=y
# CONFIG_ALTERA_MBOX is not set
# CONFIG_MAILBOX_TEST is not set
CONFIG_IOMMU_IOVA=y
CONFIG_IOMMU_API=y
CONFIG_IOMMUFD_DRIVER=y
CONFIG_IOMMU_SUPPORT=y

#
# Generic IOMMU Pagetable Support
#
# end of Generic IOMMU Pagetable Support

# CONFIG_IOMMU_DEBUGFS is not set
# CONFIG_IOMMU_DEFAULT_DMA_STRICT is not set
CONFIG_IOMMU_DEFAULT_DMA_LAZY=y
# CONFIG_IOMMU_DEFAULT_PASSTHROUGH is not set
CONFIG_OF_IOMMU=y
CONFIG_IOMMU_DMA=y
CONFIG_IOMMU_SVA=y
CONFIG_IOMMU_IOPF=y
CONFIG_AMD_IOMMU=y
# CONFIG_AMD_IOMMU_IOMMUFD is not set
CONFIG_DMAR_TABLE=y
CONFIG_INTEL_IOMMU=y
CONFIG_INTEL_IOMMU_SVM=y
CONFIG_INTEL_IOMMU_DEFAULT_ON=y
CONFIG_INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON=y
CONFIG_INTEL_IOMMU_PERF_EVENTS=y
CONFIG_IOMMUFD_DRIVER_CORE=y
CONFIG_IOMMUFD=y
CONFIG_IOMMUFD_TEST=y
CONFIG_IRQ_REMAP=y
# CONFIG_VIRTIO_IOMMU is not set
CONFIG_GENERIC_PT=y
CONFIG_DEBUG_GENERIC_PT=y
CONFIG_IOMMU_PT=y
CONFIG_IOMMU_PT_AMDV1=y
CONFIG_IOMMU_PT_VTDSS=y
# CONFIG_IOMMU_PT_RISCV64 is not set
CONFIG_IOMMU_PT_X86_64=y

#
# Remoteproc drivers
#
# CONFIG_REMOTEPROC is not set
# end of Remoteproc drivers

#
# Rpmsg drivers
#
# CONFIG_RPMSG_QCOM_GLINK_RPM is not set
# CONFIG_RPMSG_VIRTIO is not set
# end of Rpmsg drivers

CONFIG_SOUNDWIRE=y

#
# SoundWire Devices
#
# CONFIG_SOUNDWIRE_AMD is not set
# CONFIG_SOUNDWIRE_INTEL is not set
# CONFIG_SOUNDWIRE_QCOM is not set

#
# SOC (System On Chip) specific Drivers
#

#
# Amlogic SoC drivers
#
# end of Amlogic SoC drivers

#
# Broadcom SoC drivers
#
# end of Broadcom SoC drivers

#
# NXP/Freescale QorIQ SoC drivers
#
# end of NXP/Freescale QorIQ SoC drivers

#
# fujitsu SoC drivers
#
# end of fujitsu SoC drivers

#
# i.MX SoC drivers
#
# end of i.MX SoC drivers

#
# Enable LiteX SoC Builder specific drivers
#
# CONFIG_LITEX_SOC_CONTROLLER is not set
# end of Enable LiteX SoC Builder specific drivers

# CONFIG_WPCM450_SOC is not set

#
# Qualcomm SoC drivers
#
CONFIG_QCOM_QMI_HELPERS=y
# end of Qualcomm SoC drivers

# CONFIG_SOC_TI is not set

#
# Xilinx SoC drivers
#
# end of Xilinx SoC drivers
# end of SOC (System On Chip) specific Drivers

#
# PM Domains
#

#
# Amlogic PM Domains
#
# end of Amlogic PM Domains

#
# Broadcom PM Domains
#
# end of Broadcom PM Domains

#
# i.MX PM Domains
#
# end of i.MX PM Domains

#
# Qualcomm PM Domains
#
# end of Qualcomm PM Domains
# end of PM Domains

# CONFIG_PM_DEVFREQ is not set
CONFIG_EXTCON=y

#
# Extcon Device Drivers
#
# CONFIG_EXTCON_ADC_JACK is not set
# CONFIG_EXTCON_FSA9480 is not set
# CONFIG_EXTCON_GPIO is not set
# CONFIG_EXTCON_INTEL_INT3496 is not set
CONFIG_EXTCON_INTEL_CHT_WC=y
# CONFIG_EXTCON_LC824206XA is not set
# CONFIG_EXTCON_MAX3355 is not set
# CONFIG_EXTCON_MAX14526 is not set
CONFIG_EXTCON_PTN5150=y
# CONFIG_EXTCON_RT8973A is not set
# CONFIG_EXTCON_SM5502 is not set
# CONFIG_EXTCON_USB_GPIO is not set
CONFIG_EXTCON_USBC_TUSB320=y
# CONFIG_MEMORY is not set
CONFIG_IIO=y
CONFIG_IIO_BUFFER=y
# CONFIG_IIO_BUFFER_CB is not set
# CONFIG_IIO_BUFFER_DMA is not set
# CONFIG_IIO_BUFFER_DMAENGINE is not set
# CONFIG_IIO_BUFFER_HW_CONSUMER is not set
CONFIG_IIO_KFIFO_BUF=y
CONFIG_IIO_TRIGGERED_BUFFER=y
# CONFIG_IIO_CONFIGFS is not set
CONFIG_IIO_TRIGGER=y
CONFIG_IIO_CONSUMERS_PER_TRIGGER=2
# CONFIG_IIO_SW_DEVICE is not set
# CONFIG_IIO_SW_TRIGGER is not set
# CONFIG_IIO_TRIGGERED_EVENT is not set

#
# Accelerometers
#
# CONFIG_ADIS16201 is not set
# CONFIG_ADIS16209 is not set
# CONFIG_ADXL313_I2C is not set
# CONFIG_ADXL313_SPI is not set
# CONFIG_ADXL345_I2C is not set
# CONFIG_ADXL345_SPI is not set
# CONFIG_ADXL355_I2C is not set
# CONFIG_ADXL355_SPI is not set
# CONFIG_ADXL367_SPI is not set
# CONFIG_ADXL367_I2C is not set
# CONFIG_ADXL372_SPI is not set
# CONFIG_ADXL372_I2C is not set
# CONFIG_ADXL380_SPI is not set
# CONFIG_ADXL380_I2C is not set
# CONFIG_BMA180 is not set
# CONFIG_BMA220 is not set
# CONFIG_BMA400 is not set
# CONFIG_BMC150_ACCEL is not set
# CONFIG_BMI088_ACCEL is not set
# CONFIG_DA280 is not set
# CONFIG_DA311 is not set
# CONFIG_DMARD06 is not set
# CONFIG_DMARD09 is not set
# CONFIG_DMARD10 is not set
# CONFIG_FXLS8962AF_I2C is not set
# CONFIG_FXLS8962AF_SPI is not set
CONFIG_HID_SENSOR_ACCEL_3D=y
# CONFIG_IIO_ST_ACCEL_3AXIS is not set
# CONFIG_IIO_KX022A_SPI is not set
# CONFIG_IIO_KX022A_I2C is not set
# CONFIG_KXSD9 is not set
# CONFIG_KXCJK1013 is not set
# CONFIG_MC3230 is not set
# CONFIG_MMA7455_I2C is not set
# CONFIG_MMA7455_SPI is not set
# CONFIG_MMA7660 is not set
# CONFIG_MMA8452 is not set
# CONFIG_MMA9551 is not set
# CONFIG_MMA9553 is not set
# CONFIG_MSA311 is not set
# CONFIG_MXC4005 is not set
# CONFIG_MXC6255 is not set
# CONFIG_SCA3000 is not set
# CONFIG_SCA3300 is not set
# CONFIG_STK8312 is not set
# CONFIG_STK8BA50 is not set
# end of Accelerometers

#
# Analog to digital converters
#
# CONFIG_AD4000 is not set
# CONFIG_AD4080 is not set
# CONFIG_AD4130 is not set
# CONFIG_AD4134 is not set
# CONFIG_AD4170_4 is not set
# CONFIG_AD4691 is not set
# CONFIG_AD4695 is not set
# CONFIG_AD7091R5 is not set
# CONFIG_AD7091R8 is not set
# CONFIG_AD7124 is not set
# CONFIG_AD7173 is not set
# CONFIG_AD7191 is not set
# CONFIG_AD7192 is not set
# CONFIG_AD7266 is not set
# CONFIG_AD7280 is not set
# CONFIG_AD7291 is not set
# CONFIG_AD7292 is not set
# CONFIG_AD7298 is not set
# CONFIG_AD7380 is not set
# CONFIG_AD7476 is not set
# CONFIG_AD7606_IFACE_PARALLEL is not set
# CONFIG_AD7606_IFACE_SPI is not set
# CONFIG_AD7766 is not set
# CONFIG_AD7768_1 is not set
# CONFIG_AD7779 is not set
# CONFIG_AD7780 is not set
# CONFIG_AD7791 is not set
# CONFIG_AD7793 is not set
# CONFIG_AD7887 is not set
# CONFIG_AD7923 is not set
# CONFIG_AD7944 is not set
# CONFIG_AD7949 is not set
# CONFIG_AD799X is not set
# CONFIG_AD9467 is not set
# CONFIG_ADE9000 is not set
# CONFIG_CC10001_ADC is not set
CONFIG_DLN2_ADC=y
# CONFIG_ENVELOPE_DETECTOR is not set
# CONFIG_GEHC_PMC_ADC is not set
# CONFIG_HI8435 is not set
# CONFIG_HX711 is not set
# CONFIG_INA2XX_ADC is not set
# CONFIG_LTC2309 is not set
# CONFIG_LTC2471 is not set
# CONFIG_LTC2485 is not set
# CONFIG_LTC2496 is not set
# CONFIG_LTC2497 is not set
# CONFIG_MAX1027 is not set
# CONFIG_MAX11100 is not set
# CONFIG_MAX1118 is not set
# CONFIG_MAX11205 is not set
# CONFIG_MAX11410 is not set
# CONFIG_MAX1241 is not set
# CONFIG_MAX1363 is not set
# CONFIG_MAX14001 is not set
# CONFIG_MAX34408 is not set
# CONFIG_MAX9611 is not set
# CONFIG_MCP320X is not set
# CONFIG_MCP3422 is not set
# CONFIG_MCP3564 is not set
# CONFIG_MCP3911 is not set
# CONFIG_MEDIATEK_MT6360_ADC is not set
# CONFIG_MEDIATEK_MT6370_ADC is not set
# CONFIG_NAU7802 is not set
# CONFIG_NCT7201 is not set
# CONFIG_PAC1921 is not set
# CONFIG_PAC1934 is not set
# CONFIG_ROHM_BD79112 is not set
# CONFIG_ROHM_BD79124 is not set
# CONFIG_RICHTEK_RTQ6056 is not set
# CONFIG_SD_ADC_MODULATOR is not set
# CONFIG_TI_ADC081C is not set
# CONFIG_TI_ADC0832 is not set
# CONFIG_TI_ADC084S021 is not set
# CONFIG_TI_ADC108S102 is not set
# CONFIG_TI_ADC12138 is not set
# CONFIG_TI_ADC128S052 is not set
# CONFIG_TI_ADC161S626 is not set
# CONFIG_TI_ADS1015 is not set
# CONFIG_TI_ADS1018 is not set
# CONFIG_TI_ADS1100 is not set
# CONFIG_TI_ADS1119 is not set
# CONFIG_TI_ADS124S08 is not set
# CONFIG_TI_ADS1298 is not set
# CONFIG_TI_ADS131E08 is not set
# CONFIG_TI_ADS131M02 is not set
# CONFIG_TI_ADS7138 is not set
# CONFIG_TI_ADS7924 is not set
# CONFIG_TI_ADS7950 is not set
# CONFIG_TI_ADS8344 is not set
# CONFIG_TI_ADS8688 is not set
# CONFIG_TI_LMP92064 is not set
# CONFIG_TI_TLC4541 is not set
# CONFIG_TI_TSC2046 is not set
# CONFIG_TWL4030_MADC is not set
# CONFIG_TWL6030_GPADC is not set
# CONFIG_VF610_ADC is not set
CONFIG_VIPERBOARD_ADC=y
# CONFIG_XILINX_XADC is not set
# end of Analog to digital converters

#
# Analog to digital and digital to analog converters
#
# CONFIG_AD74115 is not set
# CONFIG_AD74413R is not set
# end of Analog to digital and digital to analog converters

#
# Analog Front Ends
#
# CONFIG_IIO_RESCALE is not set
# end of Analog Front Ends

#
# Amplifiers
#
# CONFIG_AD8366 is not set
# CONFIG_ADA4250 is not set
# CONFIG_ADL8113 is not set
# CONFIG_HMC425 is not set
# end of Amplifiers

#
# Capacitance to digital converters
#
# CONFIG_AD7150 is not set
# CONFIG_AD7746 is not set
# end of Capacitance to digital converters

#
# Chemical Sensors
#
# CONFIG_AOSONG_AGS02MA is not set
# CONFIG_ATLAS_PH_SENSOR is not set
# CONFIG_ATLAS_EZO_SENSOR is not set
# CONFIG_BME680 is not set
# CONFIG_CCS811 is not set
# CONFIG_ENS160 is not set
# CONFIG_IAQCORE is not set
# CONFIG_MHZ19B is not set
# CONFIG_PMS7003 is not set
# CONFIG_SCD30_CORE is not set
# CONFIG_SCD4X is not set
# CONFIG_SEN0322 is not set
# CONFIG_SENSIRION_SGP30 is not set
# CONFIG_SENSIRION_SGP40 is not set
# CONFIG_SPS30_I2C is not set
# CONFIG_SPS30_SERIAL is not set
# CONFIG_SENSEAIR_SUNRISE_CO2 is not set
# CONFIG_VZ89X is not set
# end of Chemical Sensors

#
# Hid Sensor IIO Common
#
CONFIG_HID_SENSOR_IIO_COMMON=y
CONFIG_HID_SENSOR_IIO_TRIGGER=y
# end of Hid Sensor IIO Common

#
# IIO SCMI Sensors
#
# end of IIO SCMI Sensors

#
# SSP Sensor Common
#
# CONFIG_IIO_SSP_SENSORHUB is not set
# end of SSP Sensor Common

#
# Digital to analog converters
#
# CONFIG_AD3530R is not set
# CONFIG_AD3552R_HS is not set
# CONFIG_AD3552R is not set
# CONFIG_AD5064 is not set
# CONFIG_AD5360 is not set
# CONFIG_AD5380 is not set
# CONFIG_AD5421 is not set
# CONFIG_AD5446_SPI is not set
# CONFIG_AD5446_I2C is not set
# CONFIG_AD5449 is not set
# CONFIG_AD5592R is not set
# CONFIG_AD5593R is not set
# CONFIG_AD5504 is not set
# CONFIG_AD5624R_SPI is not set
# CONFIG_AD5706R is not set
# CONFIG_AD9739A is not set
# CONFIG_LTC2688 is not set
# CONFIG_AD5686_SPI is not set
# CONFIG_AD5696_I2C is not set
# CONFIG_AD5755 is not set
# CONFIG_AD5758 is not set
# CONFIG_AD5761 is not set
# CONFIG_AD5764 is not set
# CONFIG_AD5766 is not set
# CONFIG_AD5770R is not set
# CONFIG_AD5791 is not set
# CONFIG_AD7293 is not set
# CONFIG_AD7303 is not set
# CONFIG_AD8460 is not set
# CONFIG_AD8801 is not set
# CONFIG_BD79703 is not set
# CONFIG_CIO_DAC is not set
# CONFIG_DPOT_DAC is not set
# CONFIG_DS4424 is not set
# CONFIG_LTC1660 is not set
# CONFIG_LTC2632 is not set
# CONFIG_LTC2664 is not set
# CONFIG_M62332 is not set
# CONFIG_MAX517 is not set
# CONFIG_MAX22007 is not set
# CONFIG_MAX5522 is not set
# CONFIG_MAX5821 is not set
# CONFIG_MCP4725 is not set
# CONFIG_MCP4728 is not set
# CONFIG_MCP47FEB02 is not set
# CONFIG_MCP4821 is not set
# CONFIG_MCP4922 is not set
# CONFIG_TI_DAC082S085 is not set
# CONFIG_TI_DAC5571 is not set
# CONFIG_TI_DAC7311 is not set
# CONFIG_TI_DAC7612 is not set
# CONFIG_VF610_DAC is not set
# end of Digital to analog converters

#
# IIO dummy driver
#
# end of IIO dummy driver

#
# Filters
#
# CONFIG_ADMV8818 is not set
# end of Filters

#
# Frequency Synthesizers DDS/PLL
#

#
# Clock Generator/Distribution
#
# CONFIG_AD9523 is not set
# end of Clock Generator/Distribution

#
# Phase-Locked Loop (PLL) frequency synthesizers
#
# CONFIG_ADF4350 is not set
# CONFIG_ADF4371 is not set
# CONFIG_ADF4377 is not set
# CONFIG_ADMFM2000 is not set
# CONFIG_ADMV1013 is not set
# CONFIG_ADMV1014 is not set
# CONFIG_ADMV4420 is not set
# CONFIG_ADRF6780 is not set
# end of Phase-Locked Loop (PLL) frequency synthesizers
# end of Frequency Synthesizers DDS/PLL

#
# Digital gyroscope sensors
#
# CONFIG_ADIS16080 is not set
# CONFIG_ADIS16130 is not set
# CONFIG_ADIS16136 is not set
# CONFIG_ADIS16260 is not set
# CONFIG_ADXRS290 is not set
# CONFIG_ADXRS450 is not set
# CONFIG_BMG160 is not set
# CONFIG_FXAS21002C is not set
CONFIG_HID_SENSOR_GYRO_3D=y
# CONFIG_MPU3050_I2C is not set
# CONFIG_IIO_ST_GYRO_3AXIS is not set
# CONFIG_ITG3200 is not set
# end of Digital gyroscope sensors

#
# Health Sensors
#

#
# Heart Rate Monitors
#
# CONFIG_AFE4403 is not set
# CONFIG_AFE4404 is not set
# CONFIG_MAX30100 is not set
# CONFIG_MAX30102 is not set
# end of Heart Rate Monitors
# end of Health Sensors

#
# Humidity sensors
#
# CONFIG_AM2315 is not set
# CONFIG_DHT11 is not set
# CONFIG_ENS210 is not set
# CONFIG_HDC100X is not set
# CONFIG_HDC2010 is not set
# CONFIG_HDC3020 is not set
CONFIG_HID_SENSOR_HUMIDITY=y
# CONFIG_HTS221 is not set
# CONFIG_HTU21 is not set
# CONFIG_SI7005 is not set
# CONFIG_SI7020 is not set
# end of Humidity sensors

#
# Inertial measurement units
#
# CONFIG_ADIS16400 is not set
# CONFIG_ADIS16460 is not set
# CONFIG_ADIS16475 is not set
# CONFIG_ADIS16480 is not set
# CONFIG_ADIS16550 is not set
# CONFIG_BMI160_I2C is not set
# CONFIG_BMI160_SPI is not set
# CONFIG_BMI270_I2C is not set
# CONFIG_BMI270_SPI is not set
# CONFIG_BMI323_I2C is not set
# CONFIG_BMI323_SPI is not set
# CONFIG_BOSCH_BNO055_SERIAL is not set
# CONFIG_BOSCH_BNO055_I2C is not set
# CONFIG_FXOS8700_I2C is not set
# CONFIG_FXOS8700_SPI is not set
# CONFIG_KMX61 is not set
# CONFIG_INV_ICM42600_I2C is not set
# CONFIG_INV_ICM42600_SPI is not set
# CONFIG_INV_ICM45600_I2C is not set
# CONFIG_INV_ICM45600_SPI is not set
# CONFIG_INV_MPU6050_I2C is not set
# CONFIG_INV_MPU6050_SPI is not set
# CONFIG_SMI240 is not set
# CONFIG_SMI330_I2C is not set
# CONFIG_SMI330_SPI is not set
# CONFIG_IIO_ST_LSM6DSX is not set
# CONFIG_IIO_ST_LSM9DS0 is not set
# end of Inertial measurement units

#
# Light sensors
#
# CONFIG_ACPI_ALS is not set
# CONFIG_ADJD_S311 is not set
# CONFIG_ADUX1020 is not set
# CONFIG_AL3000A is not set
# CONFIG_AL3010 is not set
# CONFIG_AL3320A is not set
# CONFIG_APDS9160 is not set
# CONFIG_APDS9300 is not set
# CONFIG_APDS9306 is not set
# CONFIG_APDS9960 is not set
# CONFIG_APDS9999 is not set
# CONFIG_AS73211 is not set
# CONFIG_BH1745 is not set
# CONFIG_BH1750 is not set
# CONFIG_BH1780 is not set
# CONFIG_CM32181 is not set
# CONFIG_CM3232 is not set
# CONFIG_CM3323 is not set
# CONFIG_CM3605 is not set
# CONFIG_CM36651 is not set
# CONFIG_GP2AP002 is not set
# CONFIG_GP2AP020A00F is not set
# CONFIG_SENSORS_ISL29018 is not set
# CONFIG_SENSORS_ISL29028 is not set
# CONFIG_ISL29125 is not set
# CONFIG_ISL76682 is not set
CONFIG_HID_SENSOR_ALS=y
CONFIG_HID_SENSOR_PROX=y
# CONFIG_JSA1212 is not set
# CONFIG_ROHM_BU27034 is not set
# CONFIG_RPR0521 is not set
# CONFIG_LTR390 is not set
# CONFIG_LTR501 is not set
# CONFIG_LTRF216A is not set
# CONFIG_LV0104CS is not set
# CONFIG_MAX44000 is not set
# CONFIG_MAX44009 is not set
# CONFIG_NOA1305 is not set
# CONFIG_OPT3001 is not set
# CONFIG_OPT4001 is not set
# CONFIG_OPT4060 is not set
# CONFIG_PA12203001 is not set
# CONFIG_SI1133 is not set
# CONFIG_SI1145 is not set
# CONFIG_STK3310 is not set
# CONFIG_ST_UVIS25 is not set
# CONFIG_TCS3414 is not set
# CONFIG_TCS3472 is not set
# CONFIG_SENSORS_TSL2563 is not set
# CONFIG_TSL2583 is not set
# CONFIG_TSL2591 is not set
# CONFIG_TSL2772 is not set
# CONFIG_TSL4531 is not set
# CONFIG_US5182D is not set
# CONFIG_VCNL4000 is not set
# CONFIG_VCNL4035 is not set
# CONFIG_VEML3235 is not set
# CONFIG_VEML3328 is not set
# CONFIG_VEML6030 is not set
# CONFIG_VEML6040 is not set
# CONFIG_VEML6046X00 is not set
# CONFIG_VEML6070 is not set
# CONFIG_VEML6075 is not set
# CONFIG_VL6180 is not set
# CONFIG_ZOPT2201 is not set
# end of Light sensors

#
# Magnetometer sensors
#
# CONFIG_AF8133J is not set
# CONFIG_AK8974 is not set
# CONFIG_AK8975 is not set
# CONFIG_AK09911 is not set
# CONFIG_ALS31300 is not set
# CONFIG_BMC150_MAGN_I2C is not set
# CONFIG_BMC150_MAGN_SPI is not set
# CONFIG_MAG3110 is not set
CONFIG_HID_SENSOR_MAGNETOMETER_3D=y
# CONFIG_MMC35240 is not set
# CONFIG_MMC5633 is not set
# CONFIG_MMC5983 is not set
# CONFIG_IIO_ST_MAGN_3AXIS is not set
# CONFIG_INFINEON_TLV493D is not set
# CONFIG_SENSORS_HMC5843_I2C is not set
# CONFIG_SENSORS_HMC5843_SPI is not set
# CONFIG_SENSORS_RM3100_I2C is not set
# CONFIG_SENSORS_RM3100_SPI is not set
# CONFIG_SI7210 is not set
# CONFIG_TI_TMAG5273 is not set
# CONFIG_YAMAHA_YAS530 is not set
# end of Magnetometer sensors

#
# Multiplexers
#
# CONFIG_IIO_MUX is not set
# end of Multiplexers

#
# Inclinometer sensors
#
CONFIG_HID_SENSOR_INCLINOMETER_3D=y
CONFIG_HID_SENSOR_DEVICE_ROTATION=y
# end of Inclinometer sensors

#
# Triggers - standalone
#
# CONFIG_IIO_SYSFS_TRIGGER is not set
# end of Triggers - standalone

#
# Linear and angular position sensors
#
CONFIG_HID_SENSOR_CUSTOM_INTEL_HINGE=y
# end of Linear and angular position sensors

#
# Digital potentiometers
#
# CONFIG_AD5110 is not set
# CONFIG_AD5272 is not set
# CONFIG_DS1803 is not set
# CONFIG_MAX5432 is not set
# CONFIG_MAX5481 is not set
# CONFIG_MAX5487 is not set
# CONFIG_MCP4018 is not set
# CONFIG_MCP4131 is not set
# CONFIG_MCP4531 is not set
# CONFIG_MCP41010 is not set
# CONFIG_TPL0102 is not set
# CONFIG_X9250 is not set
# end of Digital potentiometers

#
# Digital potentiostats
#
# CONFIG_LMP91000 is not set
# end of Digital potentiostats

#
# Pressure sensors
#
# CONFIG_ABP060MG is not set
# CONFIG_ABP2030PA_I2C is not set
# CONFIG_ABP2030PA_SPI is not set
# CONFIG_ROHM_BM1390 is not set
# CONFIG_BMP280 is not set
# CONFIG_DLHL60D is not set
# CONFIG_DPS310 is not set
CONFIG_HID_SENSOR_PRESS=y
# CONFIG_HP03 is not set
# CONFIG_HSC030PA is not set
# CONFIG_ICP10100 is not set
# CONFIG_MPL115_I2C is not set
# CONFIG_MPL115_SPI is not set
# CONFIG_MPL3115 is not set
# CONFIG_MPRLS0025PA_I2C is not set
# CONFIG_MPRLS0025PA_SPI is not set
# CONFIG_MS5611 is not set
# CONFIG_MS5637 is not set
# CONFIG_SDP500 is not set
# CONFIG_IIO_ST_PRESS is not set
# CONFIG_T5403 is not set
# CONFIG_HP206C is not set
# CONFIG_ZPA2326 is not set
# CONFIG_ADP810 is not set
# end of Pressure sensors

#
# Lightning sensors
#
# CONFIG_AS3935 is not set
# end of Lightning sensors

#
# Proximity and distance sensors
#
# CONFIG_D3323AA is not set
# CONFIG_HX9023S is not set
# CONFIG_IRSD200 is not set
# CONFIG_ISL29501 is not set
# CONFIG_LIDAR_LITE_V2 is not set
# CONFIG_MB1232 is not set
# CONFIG_PING is not set
# CONFIG_RFD77402 is not set
# CONFIG_SRF04 is not set
# CONFIG_SX9310 is not set
# CONFIG_SX9324 is not set
# CONFIG_SX9360 is not set
# CONFIG_SX9500 is not set
# CONFIG_SRF08 is not set
# CONFIG_VCNL3020 is not set
# CONFIG_VL53L0X_I2C is not set
# CONFIG_VL53L1X_I2C is not set
# CONFIG_AW96103 is not set
# end of Proximity and distance sensors

#
# Resolver to digital converters
#
# CONFIG_AD2S90 is not set
# CONFIG_AD2S1200 is not set
# CONFIG_AD2S1210 is not set
# end of Resolver to digital converters

#
# Temperature sensors
#
# CONFIG_LTC2983 is not set
# CONFIG_MAXIM_THERMOCOUPLE is not set
CONFIG_HID_SENSOR_TEMP=y
# CONFIG_MLX90614 is not set
# CONFIG_MLX90632 is not set
# CONFIG_MLX90635 is not set
# CONFIG_TMP006 is not set
# CONFIG_TMP007 is not set
# CONFIG_TMP117 is not set
# CONFIG_TSYS01 is not set
# CONFIG_TSYS02D is not set
# CONFIG_MAX30208 is not set
# CONFIG_MAX31856 is not set
# CONFIG_MAX31865 is not set
# CONFIG_MCP9600 is not set
# end of Temperature sensors

# CONFIG_NTB is not set
# CONFIG_PWM is not set

#
# IRQ chip support
#
CONFIG_IRQCHIP=y
CONFIG_IRQ_MSI_LIB=y
# CONFIG_AL_FIC is not set
# CONFIG_XILINX_INTC is not set
# end of IRQ chip support

# CONFIG_IPACK_BUS is not set
CONFIG_RESET_CONTROLLER=y
# CONFIG_RESET_GPIO is not set
# CONFIG_RESET_INTEL_GW is not set
# CONFIG_RESET_SIMPLE is not set
# CONFIG_RESET_TI_SYSCON is not set
# CONFIG_RESET_TI_TPS380X is not set

#
# PHY Subsystem
#
CONFIG_GENERIC_PHY=y
# CONFIG_PHY_CAN_TRANSCEIVER is not set
CONFIG_PHY_GOOGLE_USB=y
CONFIG_USB_LGM_PHY=y
# CONFIG_PHY_NXP_PTN3222 is not set
# CONFIG_PHY_NXP_TJA1145 is not set

#
# PHY drivers for Broadcom platforms
#
# CONFIG_BCM_KONA_USB2_PHY is not set
# end of PHY drivers for Broadcom platforms

# CONFIG_PHY_CADENCE_TORRENT is not set
# CONFIG_PHY_CADENCE_DPHY is not set
# CONFIG_PHY_CADENCE_DPHY_RX is not set
# CONFIG_PHY_CADENCE_SIERRA is not set
# CONFIG_PHY_CADENCE_SALVO is not set
# CONFIG_PHY_INTEL_LGM_COMBO is not set
# CONFIG_PHY_INTEL_LGM_EMMC is not set
# CONFIG_PHY_PXA_28NM_HSIC is not set
# CONFIG_PHY_PXA_28NM_USB2 is not set
CONFIG_PHY_CPCAP_USB=y
# CONFIG_PHY_MAPPHONE_MDM6600 is not set
# CONFIG_PHY_OCELOT_SERDES is not set
CONFIG_PHY_QCOM_USB_HS=y
CONFIG_PHY_QCOM_USB_HSIC=y
CONFIG_PHY_SAMSUNG_USB2=y
# CONFIG_PHY_TI_DS125DF111 is not set
CONFIG_PHY_TUSB1210=y
# end of PHY Subsystem

# CONFIG_POWERCAP is not set
# CONFIG_MCB is not set

#
# Performance monitor support
#
# CONFIG_DWC_PCIE_PMU is not set
# end of Performance monitor support

CONFIG_RAS=y
CONFIG_USB4=y
CONFIG_USB4_CONFIGFS=y
# CONFIG_USB4_DEBUGFS_WRITE is not set
# CONFIG_USB4_DMA_TEST is not set
# CONFIG_USB4_STREAM is not set

#
# Android
#
CONFIG_ANDROID_BINDER_IPC=y
CONFIG_ANDROID_BINDERFS=y
CONFIG_ANDROID_BINDER_DEVICES="binder0,binder1"
# end of Android

CONFIG_LIBNVDIMM=y
CONFIG_BLK_DEV_PMEM=y
CONFIG_ND_CLAIM=y
CONFIG_ND_BTT=y
CONFIG_BTT=y
CONFIG_ND_PFN=y
CONFIG_NVDIMM_PFN=y
CONFIG_NVDIMM_DAX=y
CONFIG_OF_PMEM=y
# CONFIG_RAMDAX is not set
CONFIG_NVDIMM_KEYS=y
# CONFIG_NVDIMM_SECURITY_TEST is not set
CONFIG_DAX=y
CONFIG_NVMEM=y
CONFIG_NVMEM_SYSFS=y
CONFIG_NVMEM_LAYOUTS=y

#
# Layout Types
#
# CONFIG_NVMEM_LAYOUT_SL28_VPD is not set
# CONFIG_NVMEM_LAYOUT_ONIE_TLV is not set
# CONFIG_NVMEM_LAYOUT_U_BOOT_ENV is not set
# end of Layout Types

# CONFIG_NVMEM_RMEM is not set
# CONFIG_NVMEM_U_BOOT_ENV is not set

#
# HW tracing support
#
# CONFIG_STM is not set
# CONFIG_INTEL_TH is not set
# end of HW tracing support

# CONFIG_FPGA is not set
# CONFIG_FSI is not set
CONFIG_TEE=y
CONFIG_TEE_DMABUF_HEAPS=y
CONFIG_OPTEE_STATIC_PROTMEM_POOL=y
# CONFIG_MUX_CORE is not set
# CONFIG_SIOX is not set
# CONFIG_SLIMBUS is not set
# CONFIG_INTERCONNECT is not set
CONFIG_COUNTER=y
# CONFIG_INTEL_QEP is not set
# CONFIG_INTERRUPT_CNT is not set
CONFIG_MOST=y
CONFIG_MOST_USB_HDM=y
# CONFIG_MOST_CDEV is not set
# CONFIG_MOST_SND is not set
# CONFIG_PECI is not set
# CONFIG_HTE is not set
# end of Device Drivers

#
# File systems
#
CONFIG_DCACHE_WORD_ACCESS=y
CONFIG_VALIDATE_FS_PARSER=y
CONFIG_FS_IOMAP=y
CONFIG_FS_STACK=y
CONFIG_BUFFER_HEAD=y
CONFIG_LEGACY_DIRECT_IO=y
# CONFIG_EXT2_FS is not set
CONFIG_EXT4_FS=y
CONFIG_EXT4_USE_FOR_EXT2=y
CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_EXT4_FS_SECURITY=y
# CONFIG_EXT4_DEBUG is not set
CONFIG_JBD2=y
# CONFIG_JBD2_DEBUG is not set
CONFIG_FS_MBCACHE=y
CONFIG_JFS_FS=y
CONFIG_JFS_POSIX_ACL=y
CONFIG_JFS_SECURITY=y
CONFIG_JFS_DEBUG=y
# CONFIG_JFS_STATISTICS is not set
CONFIG_XFS_FS=y
# CONFIG_XFS_SUPPORT_V4 is not set
# CONFIG_XFS_SUPPORT_ASCII_CI is not set
CONFIG_XFS_QUOTA=y
CONFIG_XFS_POSIX_ACL=y
CONFIG_XFS_RT=y
CONFIG_XFS_DRAIN_INTENTS=y
CONFIG_XFS_LIVE_HOOKS=y
CONFIG_XFS_MEMORY_BUFS=y
CONFIG_XFS_BTREE_IN_MEM=y
CONFIG_XFS_ONLINE_SCRUB=y
# CONFIG_XFS_ONLINE_SCRUB_STATS is not set
CONFIG_XFS_ONLINE_REPAIR=y
# CONFIG_XFS_WARN is not set
# CONFIG_XFS_DEBUG is not set
CONFIG_GFS2_FS=y
CONFIG_GFS2_FS_LOCKING_DLM=y
CONFIG_OCFS2_FS=y
CONFIG_OCFS2_FS_O2CB=y
CONFIG_OCFS2_FS_USERSPACE_CLUSTER=y
CONFIG_OCFS2_FS_STATS=y
# CONFIG_OCFS2_DEBUG_MASKLOG is not set
CONFIG_OCFS2_DEBUG_FS=y
CONFIG_BTRFS_FS=y
CONFIG_BTRFS_FS_POSIX_ACL=y
# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set
# CONFIG_BTRFS_DEBUG is not set
CONFIG_BTRFS_ASSERT=y
# CONFIG_BTRFS_EXPERIMENTAL is not set
CONFIG_NILFS2_FS=y
CONFIG_F2FS_FS=y
CONFIG_F2FS_STAT_FS=y
CONFIG_F2FS_FS_XATTR=y
CONFIG_F2FS_FS_POSIX_ACL=y
CONFIG_F2FS_FS_SECURITY=y
CONFIG_F2FS_CHECK_FS=y
CONFIG_F2FS_FAULT_INJECTION=y
CONFIG_F2FS_FS_COMPRESSION=y
CONFIG_F2FS_FS_LZO=y
CONFIG_F2FS_FS_LZORLE=y
CONFIG_F2FS_FS_LZ4=y
CONFIG_F2FS_FS_LZ4HC=y
CONFIG_F2FS_FS_ZSTD=y
# CONFIG_F2FS_IOSTAT is not set
# CONFIG_F2FS_UNFAIR_RWSEM is not set
CONFIG_ZONEFS_FS=y
CONFIG_FS_DAX=y
CONFIG_FS_POSIX_ACL=y
CONFIG_EXPORTFS=y
CONFIG_EXPORTFS_BLOCK_OPS=y
CONFIG_FILE_LOCKING=y
CONFIG_FS_ENCRYPTION=y
CONFIG_FS_ENCRYPTION_ALGS=y
# CONFIG_FS_ENCRYPTION_INLINE_CRYPT is not set
CONFIG_FS_VERITY=y
CONFIG_FS_VERITY_BUILTIN_SIGNATURES=y
CONFIG_FSNOTIFY=y
CONFIG_DNOTIFY=y
CONFIG_INOTIFY_USER=y
CONFIG_FANOTIFY=y
CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y
CONFIG_QUOTA=y
CONFIG_QUOTA_NETLINK_INTERFACE=y
# CONFIG_QUOTA_DEBUG is not set
CONFIG_QUOTA_TREE=y
# CONFIG_QFMT_V1 is not set
CONFIG_QFMT_V2=y
CONFIG_QUOTACTL=y
CONFIG_AUTOFS_FS=y
CONFIG_FUSE_FS=y
CONFIG_CUSE=y
CONFIG_VIRTIO_FS=y
CONFIG_FUSE_DAX=y
# CONFIG_FUSE_PASSTHROUGH is not set
CONFIG_FUSE_IO_URING=y
CONFIG_OVERLAY_FS=y
CONFIG_OVERLAY_FS_REDIRECT_DIR=y
CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW=y
CONFIG_OVERLAY_FS_INDEX=y
# CONFIG_OVERLAY_FS_NFS_EXPORT is not set
# CONFIG_OVERLAY_FS_XINO_AUTO is not set
# CONFIG_OVERLAY_FS_METACOPY is not set
CONFIG_OVERLAY_FS_DEBUG=y

#
# Caches
#
CONFIG_NETFS_SUPPORT=y
# CONFIG_NETFS_STATS is not set
# CONFIG_NETFS_DEBUG is not set
CONFIG_FSCACHE=y
# CONFIG_FSCACHE_STATS is not set
CONFIG_CACHEFILES=y
# CONFIG_CACHEFILES_DEBUG is not set
# CONFIG_CACHEFILES_ERROR_INJECTION is not set
# CONFIG_CACHEFILES_ONDEMAND is not set
# end of Caches

#
# CD-ROM/DVD Filesystems
#
CONFIG_ISO9660_FS=y
CONFIG_JOLIET=y
CONFIG_ZISOFS=y
CONFIG_UDF_FS=y
# end of CD-ROM/DVD Filesystems

#
# DOS/FAT/EXFAT/NT Filesystems
#
CONFIG_FAT_FS=y
CONFIG_MSDOS_FS=y
CONFIG_VFAT_FS=y
CONFIG_FAT_DEFAULT_CODEPAGE=437
CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
# CONFIG_FAT_DEFAULT_UTF8 is not set
CONFIG_EXFAT_FS=y
CONFIG_EXFAT_DEFAULT_IOCHARSET="utf8"
# CONFIG_NTFS_FS is not set
CONFIG_NTFS3_FS=y
# CONFIG_NTFS3_64BIT_CLUSTER is not set
CONFIG_NTFS3_LZX_XPRESS=y
CONFIG_NTFS3_FS_POSIX_ACL=y
# end of DOS/FAT/EXFAT/NT Filesystems

#
# Pseudo filesystems
#
CONFIG_PROC_FS=y
CONFIG_PROC_KCORE=y
CONFIG_PROC_VMCORE=y
# CONFIG_PROC_VMCORE_DEVICE_DUMP is not set
CONFIG_PROC_SYSCTL=y
CONFIG_PROC_PAGE_MONITOR=y
CONFIG_PROC_CHILDREN=y
CONFIG_PROC_PID_ARCH_STATUS=y
CONFIG_KERNFS=y
CONFIG_SYSFS=y
CONFIG_TMPFS=y
CONFIG_TMPFS_POSIX_ACL=y
CONFIG_TMPFS_XATTR=y
# CONFIG_TMPFS_INODE64 is not set
CONFIG_TMPFS_QUOTA=y
CONFIG_ARCH_SUPPORTS_HUGETLBFS=y
CONFIG_HUGETLBFS=y
# CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP_DEFAULT_ON is not set
CONFIG_HUGETLB_PAGE=y
CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP=y
CONFIG_HUGETLB_PMD_PAGE_TABLE_SHARING=y
CONFIG_ARCH_HAS_GIGANTIC_PAGE=y
CONFIG_CONFIGFS_FS=y
# end of Pseudo filesystems

CONFIG_MISC_FILESYSTEMS=y
CONFIG_ORANGEFS_FS=y
CONFIG_ADFS_FS=y
# CONFIG_ADFS_FS_RW is not set
CONFIG_AFFS_FS=y
CONFIG_ECRYPT_FS=y
CONFIG_ECRYPT_FS_MESSAGING=y
CONFIG_HFS_FS=y
CONFIG_HFSPLUS_FS=y
CONFIG_BEFS_FS=y
# CONFIG_BEFS_DEBUG is not set
CONFIG_BFS_FS=y
CONFIG_EFS_FS=y
CONFIG_JFFS2_FS=y
CONFIG_JFFS2_FS_DEBUG=0
CONFIG_JFFS2_FS_WRITEBUFFER=y
# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
CONFIG_JFFS2_SUMMARY=y
CONFIG_JFFS2_FS_XATTR=y
CONFIG_JFFS2_FS_POSIX_ACL=y
CONFIG_JFFS2_FS_SECURITY=y
CONFIG_JFFS2_COMPRESSION_OPTIONS=y
CONFIG_JFFS2_ZLIB=y
CONFIG_JFFS2_LZO=y
CONFIG_JFFS2_RTIME=y
CONFIG_JFFS2_RUBIN=y
# CONFIG_JFFS2_CMODE_NONE is not set
CONFIG_JFFS2_CMODE_PRIORITY=y
# CONFIG_JFFS2_CMODE_SIZE is not set
# CONFIG_JFFS2_CMODE_FAVOURLZO is not set
CONFIG_UBIFS_FS=y
CONFIG_UBIFS_FS_ADVANCED_COMPR=y
CONFIG_UBIFS_FS_LZO=y
CONFIG_UBIFS_FS_ZLIB=y
CONFIG_UBIFS_FS_ZSTD=y
CONFIG_UBIFS_ATIME_SUPPORT=y
CONFIG_UBIFS_FS_XATTR=y
CONFIG_UBIFS_FS_SECURITY=y
# CONFIG_UBIFS_FS_AUTHENTICATION is not set
CONFIG_CRAMFS=y
CONFIG_CRAMFS_BLOCKDEV=y
CONFIG_CRAMFS_MTD=y
CONFIG_SQUASHFS=y
# CONFIG_SQUASHFS_FILE_CACHE is not set
CONFIG_SQUASHFS_FILE_DIRECT=y
CONFIG_SQUASHFS_DECOMP_MULTI=y
# CONFIG_SQUASHFS_CHOICE_DECOMP_BY_MOUNT is not set
# CONFIG_SQUASHFS_COMPILE_DECOMP_SINGLE is not set
CONFIG_SQUASHFS_COMPILE_DECOMP_MULTI=y
# CONFIG_SQUASHFS_COMPILE_DECOMP_MULTI_PERCPU is not set
# CONFIG_SQUASHFS_MOUNT_DECOMP_THREADS is not set
CONFIG_SQUASHFS_XATTR=y
# CONFIG_SQUASHFS_COMP_CACHE_FULL is not set
CONFIG_SQUASHFS_ZLIB=y
CONFIG_SQUASHFS_LZ4=y
CONFIG_SQUASHFS_LZO=y
CONFIG_SQUASHFS_XZ=y
CONFIG_SQUASHFS_ZSTD=y
CONFIG_SQUASHFS_4K_DEVBLK_SIZE=y
# CONFIG_SQUASHFS_EMBEDDED is not set
CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3
CONFIG_VXFS_FS=y
CONFIG_MINIX_FS=y
CONFIG_OMFS_FS=y
CONFIG_HPFS_FS=y
CONFIG_QNX4FS_FS=y
CONFIG_QNX6FS_FS=y
# CONFIG_QNX6FS_DEBUG is not set
CONFIG_ROMFS_FS=y
# CONFIG_ROMFS_BACKED_BY_BLOCK is not set
# CONFIG_ROMFS_BACKED_BY_MTD is not set
CONFIG_ROMFS_BACKED_BY_BOTH=y
CONFIG_ROMFS_ON_BLOCK=y
CONFIG_ROMFS_ON_MTD=y
CONFIG_PSTORE=y
CONFIG_PSTORE_DEFAULT_KMSG_BYTES=10240
CONFIG_PSTORE_COMPRESS=y
# CONFIG_PSTORE_CONSOLE is not set
# CONFIG_PSTORE_PMSG is not set
# CONFIG_PSTORE_RAM is not set
# CONFIG_PSTORE_BLK is not set
CONFIG_UFS_FS=y
CONFIG_UFS_FS_WRITE=y
# CONFIG_UFS_DEBUG is not set
CONFIG_EROFS_FS=y
# CONFIG_EROFS_FS_DEBUG is not set
CONFIG_EROFS_FS_XATTR=y
CONFIG_EROFS_FS_POSIX_ACL=y
CONFIG_EROFS_FS_SECURITY=y
# CONFIG_EROFS_FS_BACKED_BY_FILE is not set
CONFIG_EROFS_FS_ZIP=y
# CONFIG_EROFS_FS_ZIP_LZMA is not set
# CONFIG_EROFS_FS_ZIP_DEFLATE is not set
# CONFIG_EROFS_FS_ZIP_ZSTD is not set
# CONFIG_EROFS_FS_ZIP_ACCEL is not set
# CONFIG_EROFS_FS_PCPU_KTHREAD is not set
# CONFIG_EROFS_FS_PAGE_CACHE_SHARE is not set
CONFIG_NETWORK_FILESYSTEMS=y
CONFIG_NFS_FS=y
# CONFIG_NFS_V2 is not set
CONFIG_NFS_V3=y
CONFIG_NFS_V3_ACL=y
CONFIG_NFS_V4=y
# CONFIG_NFS_SWAP is not set
CONFIG_NFS_V4_0=y
CONFIG_NFS_V4_2=y
CONFIG_PNFS_FILE_LAYOUT=y
CONFIG_PNFS_BLOCK=y
CONFIG_PNFS_FLEXFILE_LAYOUT=y
CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org"
# CONFIG_NFS_V4_1_MIGRATION is not set
CONFIG_NFS_V4_SECURITY_LABEL=y
CONFIG_ROOT_NFS=y
CONFIG_NFS_FSCACHE=y
# CONFIG_NFS_USE_LEGACY_DNS is not set
CONFIG_NFS_USE_KERNEL_DNS=y
# CONFIG_NFS_DISABLE_UDP_SUPPORT is not set
CONFIG_NFS_V4_2_READ_PLUS=y
CONFIG_NFSD=y
# CONFIG_NFSD_V2 is not set
CONFIG_NFSD_V3_ACL=y
CONFIG_NFSD_V4=y
CONFIG_NFSD_PNFS=y
CONFIG_NFSD_BLOCKLAYOUT=y
CONFIG_NFSD_SCSILAYOUT=y
CONFIG_NFSD_FLEXFILELAYOUT=y
CONFIG_NFSD_V4_2_INTER_SSC=y
CONFIG_NFSD_V4_SECURITY_LABEL=y
# CONFIG_NFSD_LEGACY_CLIENT_TRACKING is not set
# CONFIG_NFSD_V4_POSIX_ACLS is not set
CONFIG_GRACE_PERIOD=y
CONFIG_LOCKD=y
CONFIG_LOCKD_V4=y
CONFIG_NFS_ACL_SUPPORT=y
CONFIG_NFS_COMMON=y
# CONFIG_NFS_LOCALIO is not set
CONFIG_NFS_V4_2_SSC_HELPER=y
CONFIG_SUNRPC=y
CONFIG_SUNRPC_GSS=y
CONFIG_SUNRPC_BACKCHANNEL=y
CONFIG_RPCSEC_GSS_KRB5=y
# CONFIG_SUNRPC_DEBUG is not set
# CONFIG_SUNRPC_XPRT_RDMA is not set
CONFIG_CEPH_FS=y
CONFIG_CEPH_FSCACHE=y
CONFIG_CEPH_FS_POSIX_ACL=y
# CONFIG_CEPH_FS_SECURITY_LABEL is not set
CONFIG_CIFS=y
# CONFIG_CIFS_STATS2 is not set
CONFIG_CIFS_ALLOW_INSECURE_LEGACY=y
CONFIG_CIFS_UPCALL=y
CONFIG_CIFS_XATTR=y
CONFIG_CIFS_POSIX=y
CONFIG_CIFS_DEBUG=y
# CONFIG_CIFS_DEBUG2 is not set
# CONFIG_CIFS_DEBUG_DUMP_KEYS is not set
CONFIG_CIFS_DFS_UPCALL=y
CONFIG_CIFS_SWN_UPCALL=y
CONFIG_CIFS_SMB_DIRECT=y
CONFIG_CIFS_FSCACHE=y
# CONFIG_CIFS_ROOT is not set
# CONFIG_CIFS_COMPRESSION is not set
CONFIG_SMB_SERVER=y
# CONFIG_SMB_SERVER_SMBDIRECT is not set
# CONFIG_SMB_SERVER_CHECK_CAP_NET_ADMIN is not set
# CONFIG_SMB_SERVER_KERBEROS5 is not set
CONFIG_SMBDIRECT=y
CONFIG_SMBFS=y
# CONFIG_CODA_FS is not set
CONFIG_AFS_FS=y
# CONFIG_AFS_DEBUG is not set
CONFIG_AFS_FSCACHE=y
# CONFIG_AFS_DEBUG_CURSOR is not set
CONFIG_9P_FS=y
CONFIG_9P_FSCACHE=y
CONFIG_9P_FS_POSIX_ACL=y
CONFIG_9P_FS_SECURITY=y
CONFIG_NLS=y
CONFIG_NLS_DEFAULT="utf8"
CONFIG_NLS_CODEPAGE_437=y
CONFIG_NLS_CODEPAGE_737=y
CONFIG_NLS_CODEPAGE_775=y
CONFIG_NLS_CODEPAGE_850=y
CONFIG_NLS_CODEPAGE_852=y
CONFIG_NLS_CODEPAGE_855=y
CONFIG_NLS_CODEPAGE_857=y
CONFIG_NLS_CODEPAGE_860=y
CONFIG_NLS_CODEPAGE_861=y
CONFIG_NLS_CODEPAGE_862=y
CONFIG_NLS_CODEPAGE_863=y
CONFIG_NLS_CODEPAGE_864=y
CONFIG_NLS_CODEPAGE_865=y
CONFIG_NLS_CODEPAGE_866=y
CONFIG_NLS_CODEPAGE_869=y
CONFIG_NLS_CODEPAGE_936=y
CONFIG_NLS_CODEPAGE_950=y
CONFIG_NLS_CODEPAGE_932=y
CONFIG_NLS_CODEPAGE_949=y
CONFIG_NLS_CODEPAGE_874=y
CONFIG_NLS_ISO8859_8=y
CONFIG_NLS_CODEPAGE_1250=y
CONFIG_NLS_CODEPAGE_1251=y
CONFIG_NLS_ASCII=y
CONFIG_NLS_ISO8859_1=y
CONFIG_NLS_ISO8859_2=y
CONFIG_NLS_ISO8859_3=y
CONFIG_NLS_ISO8859_4=y
CONFIG_NLS_ISO8859_5=y
CONFIG_NLS_ISO8859_6=y
CONFIG_NLS_ISO8859_7=y
CONFIG_NLS_ISO8859_9=y
CONFIG_NLS_ISO8859_13=y
CONFIG_NLS_ISO8859_14=y
CONFIG_NLS_ISO8859_15=y
CONFIG_NLS_KOI8_R=y
CONFIG_NLS_KOI8_U=y
CONFIG_NLS_MAC_ROMAN=y
CONFIG_NLS_MAC_CELTIC=y
CONFIG_NLS_MAC_CENTEURO=y
CONFIG_NLS_MAC_CROATIAN=y
CONFIG_NLS_MAC_CYRILLIC=y
CONFIG_NLS_MAC_GAELIC=y
CONFIG_NLS_MAC_GREEK=y
CONFIG_NLS_MAC_ICELAND=y
CONFIG_NLS_MAC_INUIT=y
CONFIG_NLS_MAC_ROMANIAN=y
CONFIG_NLS_MAC_TURKISH=y
CONFIG_NLS_UTF8=y
CONFIG_NLS_UCS2_UTILS=y
CONFIG_DLM=y
# CONFIG_DLM_DEBUG is not set
CONFIG_UNICODE=y
CONFIG_IO_WQ=y
# end of File systems

#
# Security options
#
CONFIG_KEYS=y
CONFIG_KEYS_REQUEST_CACHE=y
CONFIG_PERSISTENT_KEYRINGS=y
CONFIG_BIG_KEYS=y
CONFIG_TRUSTED_KEYS=y
# CONFIG_TRUSTED_KEYS_TPM is not set
# CONFIG_TRUSTED_KEYS_TEE is not set

#
# No trust source selected!
#
CONFIG_ENCRYPTED_KEYS=y
# CONFIG_USER_DECRYPTED_DATA is not set
CONFIG_KEY_DH_OPERATIONS=y
CONFIG_KEY_NOTIFICATIONS=y
# CONFIG_SECURITY_DMESG_RESTRICT is not set
# CONFIG_PROC_MEM_ALWAYS_FORCE is not set
CONFIG_PROC_MEM_FORCE_PTRACE=y
# CONFIG_PROC_MEM_NO_FORCE is not set
CONFIG_SECURITY=y
CONFIG_HAS_SECURITY_AUDIT=y
CONFIG_SECURITYFS=y
CONFIG_SECURITY_NETWORK=y
CONFIG_SECURITY_INFINIBAND=y
CONFIG_SECURITY_NETWORK_XFRM=y
CONFIG_SECURITY_PATH=y
# CONFIG_INTEL_TXT is not set
# CONFIG_STATIC_USERMODEHELPER is not set
# CONFIG_SECURITY_SELINUX is not set
CONFIG_SECURITY_SMACK=y
# CONFIG_SECURITY_SMACK_BRINGUP is not set
CONFIG_SECURITY_SMACK_NETFILTER=y
# CONFIG_SECURITY_SMACK_APPEND_SIGNALS is not set
CONFIG_SECURITY_TOMOYO=y
CONFIG_SECURITY_TOMOYO_MAX_ACCEPT_ENTRY=64
CONFIG_SECURITY_TOMOYO_MAX_AUDIT_LOG=32
CONFIG_SECURITY_TOMOYO_OMIT_USERSPACE_LOADER=y
CONFIG_SECURITY_TOMOYO_INSECURE_BUILTIN_SETTING=y
# CONFIG_SECURITY_APPARMOR is not set
# CONFIG_SECURITY_LOADPIN is not set
CONFIG_SECURITY_YAMA=y
CONFIG_SECURITY_SAFESETID=y
CONFIG_SECURITY_LOCKDOWN_LSM=y
CONFIG_SECURITY_LOCKDOWN_LSM_EARLY=y
CONFIG_LOCK_DOWN_KERNEL_FORCE_NONE=y
# CONFIG_LOCK_DOWN_KERNEL_FORCE_INTEGRITY is not set
# CONFIG_LOCK_DOWN_KERNEL_FORCE_CONFIDENTIALITY is not set
CONFIG_SECURITY_LANDLOCK=y
# CONFIG_SECURITY_IPE is not set
CONFIG_INTEGRITY=y
CONFIG_INTEGRITY_SIGNATURE=y
CONFIG_INTEGRITY_ASYMMETRIC_KEYS=y
CONFIG_INTEGRITY_TRUSTED_KEYRING=y
CONFIG_INTEGRITY_AUDIT=y
CONFIG_IMA=y
CONFIG_IMA_MEASURE_PCR_IDX=10
CONFIG_IMA_LSM_RULES=y
CONFIG_IMA_NG_TEMPLATE=y
# CONFIG_IMA_SIG_TEMPLATE is not set
CONFIG_IMA_DEFAULT_TEMPLATE="ima-ng"
# CONFIG_IMA_DEFAULT_HASH_SHA1 is not set
CONFIG_IMA_DEFAULT_HASH_SHA256=y
# CONFIG_IMA_DEFAULT_HASH_SHA512 is not set
# CONFIG_IMA_DEFAULT_HASH_WP512 is not set
CONFIG_IMA_DEFAULT_HASH="sha256"
CONFIG_IMA_WRITE_POLICY=y
CONFIG_IMA_READ_POLICY=y
CONFIG_IMA_APPRAISE=y
# CONFIG_IMA_ARCH_POLICY is not set
# CONFIG_IMA_APPRAISE_BUILD_POLICY is not set
# CONFIG_IMA_APPRAISE_BOOTPARAM is not set
CONFIG_IMA_APPRAISE_MODSIG=y
# CONFIG_IMA_KEYRINGS_PERMIT_SIGNED_BY_BUILTIN_OR_SECONDARY is not set
# CONFIG_IMA_BLACKLIST_KEYRING is not set
# CONFIG_IMA_LOAD_X509 is not set
CONFIG_IMA_MEASURE_ASYMMETRIC_KEYS=y
CONFIG_IMA_QUEUE_EARLY_BOOT_KEYS=y
# CONFIG_IMA_DISABLE_HTABLE is not set
# CONFIG_IMA_STAGING is not set
CONFIG_EVM=y
CONFIG_EVM_ATTR_FSUUID=y
CONFIG_EVM_EXTRA_SMACK_XATTRS=y
CONFIG_EVM_ADD_XATTRS=y
# CONFIG_EVM_LOAD_X509 is not set
CONFIG_DEFAULT_SECURITY_SMACK=y
# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
# CONFIG_DEFAULT_SECURITY_DAC is not set
CONFIG_LSM="landlock,lockdown,yama,safesetid,integrity,tomoyo,smack,bpf"

#
# Kernel hardening options
#

#
# Memory initialization
#
CONFIG_CC_HAS_AUTO_VAR_INIT_PATTERN=y
CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO_BARE=y
CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO=y
# CONFIG_INIT_STACK_NONE is not set
# CONFIG_INIT_STACK_ALL_PATTERN is not set
CONFIG_INIT_STACK_ALL_ZERO=y
CONFIG_CC_HAS_SANCOV_STACK_DEPTH_CALLBACK=y
# CONFIG_KSTACK_ERASE is not set
CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y
# CONFIG_INIT_ON_FREE_DEFAULT_ON is not set
CONFIG_CC_HAS_ZERO_CALL_USED_REGS=y
# CONFIG_ZERO_CALL_USED_REGS is not set
# end of Memory initialization

#
# Bounds checking
#
CONFIG_FORTIFY_SOURCE=y
CONFIG_HARDENED_USERCOPY=y
# CONFIG_HARDENED_USERCOPY_DEFAULT_ON is not set
# end of Bounds checking

#
# Hardening of kernel data structures
#
CONFIG_LIST_HARDENED=y
CONFIG_BUG_ON_DATA_CORRUPTION=y
# end of Hardening of kernel data structures

CONFIG_CC_HAS_RANDSTRUCT=y
CONFIG_RANDSTRUCT_NONE=y
# CONFIG_RANDSTRUCT_FULL is not set
# end of Kernel hardening options
# end of Security options

CONFIG_ASYNC_CORE=y
CONFIG_ASYNC_MEMCPY=y
CONFIG_ASYNC_XOR=y
CONFIG_ASYNC_PQ=y
CONFIG_ASYNC_RAID6_RECOV=y
CONFIG_CRYPTO=y

#
# Crypto core or helper
#
CONFIG_CRYPTO_ALGAPI=y
CONFIG_CRYPTO_ALGAPI2=y
CONFIG_CRYPTO_AEAD=y
CONFIG_CRYPTO_AEAD2=y
CONFIG_CRYPTO_SIG=y
CONFIG_CRYPTO_SIG2=y
CONFIG_CRYPTO_SKCIPHER=y
CONFIG_CRYPTO_SKCIPHER2=y
CONFIG_CRYPTO_HASH=y
CONFIG_CRYPTO_HASH2=y
CONFIG_CRYPTO_RNG=y
CONFIG_CRYPTO_RNG2=y
CONFIG_CRYPTO_AKCIPHER2=y
CONFIG_CRYPTO_AKCIPHER=y
CONFIG_CRYPTO_KPP2=y
CONFIG_CRYPTO_KPP=y
CONFIG_CRYPTO_ACOMP2=y
CONFIG_CRYPTO_ACOMP=y
CONFIG_CRYPTO_MANAGER=y
CONFIG_CRYPTO_MANAGER2=y
CONFIG_CRYPTO_USER=y
# CONFIG_CRYPTO_SELFTESTS is not set
# CONFIG_CRYPTO_NULL is not set
CONFIG_CRYPTO_PCRYPT=y
# CONFIG_CRYPTO_CRYPTD is not set
CONFIG_CRYPTO_AUTHENC=y
CONFIG_CRYPTO_KRB5ENC=y
# CONFIG_CRYPTO_BENCHMARK is not set
CONFIG_CRYPTO_ENGINE=y
# end of Crypto core or helper

#
# Public-key cryptography
#
CONFIG_CRYPTO_RSA=y
CONFIG_CRYPTO_DH=y
# CONFIG_CRYPTO_DH_RFC7919_GROUPS is not set
CONFIG_CRYPTO_ECC=y
CONFIG_CRYPTO_ECDH=y
# CONFIG_CRYPTO_ECDSA is not set
CONFIG_CRYPTO_ECRDSA=y
CONFIG_CRYPTO_MLDSA=y
# end of Public-key cryptography

#
# Block ciphers
#
CONFIG_CRYPTO_AES=y
CONFIG_CRYPTO_ANUBIS=y
CONFIG_CRYPTO_ARIA=y
CONFIG_CRYPTO_BLOWFISH=y
CONFIG_CRYPTO_BLOWFISH_COMMON=y
CONFIG_CRYPTO_CAMELLIA=y
CONFIG_CRYPTO_CAST_COMMON=y
CONFIG_CRYPTO_CAST5=y
CONFIG_CRYPTO_CAST6=y
CONFIG_CRYPTO_DES=y
CONFIG_CRYPTO_KHAZAD=y
CONFIG_CRYPTO_SEED=y
CONFIG_CRYPTO_SERPENT=y
CONFIG_CRYPTO_SM4=y
CONFIG_CRYPTO_SM4_GENERIC=y
CONFIG_CRYPTO_TEA=y
CONFIG_CRYPTO_TWOFISH=y
CONFIG_CRYPTO_TWOFISH_COMMON=y
# end of Block ciphers

#
# Length-preserving ciphers and modes
#
CONFIG_CRYPTO_ADIANTUM=y
CONFIG_CRYPTO_ARC4=y
CONFIG_CRYPTO_CHACHA20=y
CONFIG_CRYPTO_CBC=y
CONFIG_CRYPTO_CTR=y
CONFIG_CRYPTO_CTS=y
CONFIG_CRYPTO_ECB=y
CONFIG_CRYPTO_HCTR2=y
CONFIG_CRYPTO_LRW=y
CONFIG_CRYPTO_XCTR=y
CONFIG_CRYPTO_XTS=y
# end of Length-preserving ciphers and modes

#
# AEAD (authenticated encryption with associated data) ciphers
#
CONFIG_CRYPTO_AEGIS128=y
CONFIG_CRYPTO_CHACHA20POLY1305=y
CONFIG_CRYPTO_CCM=y
CONFIG_CRYPTO_GCM=y
CONFIG_CRYPTO_GENIV=y
CONFIG_CRYPTO_SEQIV=y
CONFIG_CRYPTO_ECHAINIV=y
CONFIG_CRYPTO_ESSIV=y
# end of AEAD (authenticated encryption with associated data) ciphers

#
# Hashes, digests, and MACs
#
# CONFIG_CRYPTO_BLAKE2B is not set
CONFIG_CRYPTO_CMAC=y
CONFIG_CRYPTO_HMAC=y
# CONFIG_CRYPTO_MD4 is not set
# CONFIG_CRYPTO_MD5 is not set
CONFIG_CRYPTO_RMD160=y
CONFIG_CRYPTO_SHA1=y
CONFIG_CRYPTO_SHA256=y
CONFIG_CRYPTO_SHA512=y
CONFIG_CRYPTO_SHA3=y
# CONFIG_CRYPTO_SM3 is not set
CONFIG_CRYPTO_STREEBOG=y
CONFIG_CRYPTO_WP512=y
CONFIG_CRYPTO_XCBC=y
# CONFIG_CRYPTO_XXHASH is not set
# end of Hashes, digests, and MACs

#
# CRCs (cyclic redundancy checks)
#
# CONFIG_CRYPTO_CRC32C is not set
# CONFIG_CRYPTO_CRC32 is not set
# end of CRCs (cyclic redundancy checks)

#
# Compression
#
CONFIG_CRYPTO_DEFLATE=y
CONFIG_CRYPTO_LZO=y
CONFIG_CRYPTO_842=y
CONFIG_CRYPTO_LZ4=y
CONFIG_CRYPTO_LZ4HC=y
CONFIG_CRYPTO_ZSTD=y
# end of Compression

#
# Random number generation
#
# CONFIG_CRYPTO_DRBG is not set
# CONFIG_CRYPTO_JITTERENTROPY is not set
CONFIG_CRYPTO_KDF800108_CTR=y
# end of Random number generation

#
# Userspace interface (deprecated)
#
CONFIG_CRYPTO_USER_API=y
CONFIG_CRYPTO_USER_API_HASH=y
CONFIG_CRYPTO_USER_API_SKCIPHER=y
CONFIG_CRYPTO_USER_API_RNG=y
CONFIG_CRYPTO_USER_API_AEAD=y
CONFIG_CRYPTO_USER_API_ENABLE_OBSOLETE=y
# end of Userspace interface (deprecated)

#
# Accelerated Cryptographic Algorithms for CPU (x86)
#
CONFIG_CRYPTO_AES_NI_INTEL=y
CONFIG_CRYPTO_BLOWFISH_X86_64=y
CONFIG_CRYPTO_CAMELLIA_X86_64=y
CONFIG_CRYPTO_CAMELLIA_AESNI_AVX_X86_64=y
CONFIG_CRYPTO_CAMELLIA_AESNI_AVX2_X86_64=y
CONFIG_CRYPTO_CAST5_AVX_X86_64=y
CONFIG_CRYPTO_CAST6_AVX_X86_64=y
CONFIG_CRYPTO_SERPENT_SSE2_X86_64=y
CONFIG_CRYPTO_SERPENT_AVX_X86_64=y
CONFIG_CRYPTO_SERPENT_AVX2_X86_64=y
CONFIG_CRYPTO_SM4_AESNI_AVX_X86_64=y
CONFIG_CRYPTO_SM4_AESNI_AVX2_X86_64=y
CONFIG_CRYPTO_TWOFISH_X86_64=y
CONFIG_CRYPTO_TWOFISH_X86_64_3WAY=y
CONFIG_CRYPTO_TWOFISH_AVX_X86_64=y
CONFIG_CRYPTO_ARIA_AESNI_AVX_X86_64=y
# CONFIG_CRYPTO_ARIA_AESNI_AVX2_X86_64 is not set
# CONFIG_CRYPTO_ARIA_GFNI_AVX512_X86_64 is not set
CONFIG_CRYPTO_AEGIS128_AESNI_SSE2=y
# end of Accelerated Cryptographic Algorithms for CPU (x86)

CONFIG_CRYPTO_HW=y
CONFIG_CRYPTO_DEV_PADLOCK=y
CONFIG_CRYPTO_DEV_PADLOCK_AES=y
CONFIG_CRYPTO_DEV_PADLOCK_SHA=y
# CONFIG_CRYPTO_DEV_ATMEL_ECC is not set
# CONFIG_CRYPTO_DEV_ATMEL_SHA204A is not set
CONFIG_CRYPTO_DEV_CCP=y
CONFIG_CRYPTO_DEV_CCP_DD=y
# CONFIG_CRYPTO_DEV_SP_CCP is not set
# CONFIG_CRYPTO_DEV_SP_PSP is not set
# CONFIG_CRYPTO_DEV_NITROX_CNN55XX is not set
CONFIG_CRYPTO_DEV_QAT=y
CONFIG_CRYPTO_DEV_QAT_DH895xCC=y
CONFIG_CRYPTO_DEV_QAT_C3XXX=y
CONFIG_CRYPTO_DEV_QAT_C62X=y
# CONFIG_CRYPTO_DEV_QAT_4XXX is not set
# CONFIG_CRYPTO_DEV_QAT_420XX is not set
# CONFIG_CRYPTO_DEV_QAT_6XXX is not set
CONFIG_CRYPTO_DEV_QAT_DH895xCCVF=y
CONFIG_CRYPTO_DEV_QAT_C3XXXVF=y
CONFIG_CRYPTO_DEV_QAT_C62XVF=y
# CONFIG_CRYPTO_DEV_QAT_ERROR_INJECTION is not set
CONFIG_CRYPTO_DEV_VIRTIO=y
# CONFIG_CRYPTO_DEV_SAFEXCEL is not set
# CONFIG_CRYPTO_DEV_CCREE is not set
# CONFIG_CRYPTO_DEV_AMLOGIC_GXL is not set
CONFIG_ASYMMETRIC_KEY_TYPE=y
CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=y
CONFIG_X509_CERTIFICATE_PARSER=y
CONFIG_PKCS8_PRIVATE_KEY_PARSER=y
CONFIG_PKCS7_MESSAGE_PARSER=y
# CONFIG_PKCS7_WAIVE_AUTHATTRS_REJECTION_FOR_MLDSA is not set
CONFIG_PKCS7_TEST_KEY=y
CONFIG_SIGNED_PE_FILE_VERIFICATION=y
# CONFIG_FIPS_SIGNATURE_SELFTEST is not set

#
# Certificates for signature checking
#
CONFIG_MODULE_SIG_KEY="certs/signing_key.pem"
# CONFIG_MODULE_SIG_KEY_TYPE_RSA is not set
CONFIG_MODULE_SIG_KEY_TYPE_MLDSA_44=y
# CONFIG_MODULE_SIG_KEY_TYPE_MLDSA_65 is not set
# CONFIG_MODULE_SIG_KEY_TYPE_MLDSA_87 is not set
CONFIG_SYSTEM_TRUSTED_KEYRING=y
CONFIG_SYSTEM_TRUSTED_KEYS=""
# CONFIG_SYSTEM_EXTRA_CERTIFICATE is not set
CONFIG_SECONDARY_TRUSTED_KEYRING=y
# CONFIG_SECONDARY_TRUSTED_KEYRING_SIGNED_BY_BUILTIN is not set
# CONFIG_SYSTEM_BLACKLIST_KEYRING is not set
CONFIG_OPENSSL_SUPPORTS_ML_DSA=y
# end of Certificates for signature checking

CONFIG_CRYPTO_KRB5=y
# CONFIG_CRYPTO_KRB5_SELFTESTS is not set
CONFIG_BINARY_PRINTF=y

#
# Library routines
#
CONFIG_LINEAR_RANGES=y
# CONFIG_PACKING is not set
CONFIG_BITREVERSE=y
CONFIG_GENERIC_BITREVERSE=y
CONFIG_GENERIC_STRNCPY_FROM_USER=y
CONFIG_GENERIC_STRNLEN_USER=y
CONFIG_GENERIC_NET_UTILS=y
# CONFIG_CORDIC is not set
# CONFIG_PRIME_NUMBERS is not set
CONFIG_RATIONAL=y
CONFIG_GENERIC_IOMAP=y
CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y
CONFIG_ARCH_HAS_FAST_MULTIPLIER=y
CONFIG_ARCH_USE_SYM_ANNOTATIONS=y
CONFIG_CRC8=y
CONFIG_CRC16=y
CONFIG_CRC_CCITT=y
CONFIG_CRC_ITU_T=y
CONFIG_CRC_T10DIF=y
CONFIG_CRC_T10DIF_ARCH=y
CONFIG_CRC32=y
CONFIG_CRC32_ARCH=y
CONFIG_CRC64=y
CONFIG_CRC64_ARCH=y
CONFIG_CRC_OPTIMIZATIONS=y
CONFIG_CRYPTO_HASH_INFO=y
CONFIG_CRYPTO_LIB_UTILS=y
CONFIG_CRYPTO_LIB_AES=y
CONFIG_CRYPTO_LIB_AES_ARCH=y
CONFIG_CRYPTO_LIB_AES_CBC_MACS=y
CONFIG_CRYPTO_LIB_ARC4=y
CONFIG_CRYPTO_LIB_GF128MUL=y
CONFIG_CRYPTO_LIB_BLAKE2B=y
CONFIG_CRYPTO_LIB_BLAKE2S_ARCH=y
CONFIG_CRYPTO_LIB_CHACHA=y
CONFIG_CRYPTO_LIB_CHACHA_ARCH=y
CONFIG_CRYPTO_LIB_CURVE25519=y
CONFIG_CRYPTO_LIB_CURVE25519_ARCH=y
CONFIG_CRYPTO_LIB_CURVE25519_GENERIC=y
CONFIG_CRYPTO_LIB_DES=y
CONFIG_CRYPTO_LIB_GF128HASH=y
CONFIG_CRYPTO_LIB_GF128HASH_ARCH=y
CONFIG_CRYPTO_LIB_MD5=y
CONFIG_CRYPTO_LIB_MLDSA=y
CONFIG_CRYPTO_LIB_NH=y
CONFIG_CRYPTO_LIB_NH_ARCH=y
CONFIG_CRYPTO_LIB_POLY1305=y
CONFIG_CRYPTO_LIB_POLY1305_ARCH=y
CONFIG_CRYPTO_LIB_POLY1305_GENERIC=y
CONFIG_CRYPTO_LIB_POLY1305_RSIZE=11
CONFIG_CRYPTO_LIB_CHACHA20POLY1305=y
CONFIG_CRYPTO_LIB_SHA1=y
CONFIG_CRYPTO_LIB_SHA1_ARCH=y
CONFIG_CRYPTO_LIB_SHA256=y
CONFIG_CRYPTO_LIB_SHA256_ARCH=y
CONFIG_CRYPTO_LIB_SHA512=y
CONFIG_CRYPTO_LIB_SHA512_ARCH=y
CONFIG_CRYPTO_LIB_SHA3=y
CONFIG_XOR_BLOCKS=y
CONFIG_XOR_BLOCKS_ARCH=y
CONFIG_RAID6_PQ=y
CONFIG_RAID6_PQ_ARCH=y
# CONFIG_RAID6_PQ_BENCHMARK is not set
CONFIG_XXHASH=y
# CONFIG_RANDOM32_SELFTEST is not set
CONFIG_842_COMPRESS=y
CONFIG_842_DECOMPRESS=y
CONFIG_ZLIB_INFLATE=y
CONFIG_ZLIB_DEFLATE=y
CONFIG_LZO_COMPRESS=y
CONFIG_LZO_DECOMPRESS=y
CONFIG_LZ4_COMPRESS=y
CONFIG_LZ4HC_COMPRESS=y
CONFIG_LZ4_DECOMPRESS=y
CONFIG_ZSTD_COMMON=y
CONFIG_ZSTD_COMPRESS=y
CONFIG_ZSTD_DECOMPRESS=y
CONFIG_XZ_DEC=y
CONFIG_XZ_DEC_X86=y
CONFIG_XZ_DEC_POWERPC=y
CONFIG_XZ_DEC_ARM=y
CONFIG_XZ_DEC_ARMTHUMB=y
CONFIG_XZ_DEC_ARM64=y
CONFIG_XZ_DEC_SPARC=y
CONFIG_XZ_DEC_RISCV=y
# CONFIG_XZ_DEC_MICROLZMA is not set
CONFIG_XZ_DEC_BCJ=y
# CONFIG_XZ_DEC_TEST is not set
CONFIG_DECOMPRESS_GZIP=y
CONFIG_DECOMPRESS_BZIP2=y
CONFIG_DECOMPRESS_LZMA=y
CONFIG_DECOMPRESS_XZ=y
CONFIG_DECOMPRESS_LZO=y
CONFIG_DECOMPRESS_LZ4=y
CONFIG_DECOMPRESS_ZSTD=y
CONFIG_GENERIC_ALLOCATOR=y
CONFIG_REED_SOLOMON=y
CONFIG_REED_SOLOMON_DEC8=y
CONFIG_TEXTSEARCH=y
CONFIG_TEXTSEARCH_KMP=y
CONFIG_TEXTSEARCH_BM=y
CONFIG_TEXTSEARCH_FSM=y
CONFIG_INTERVAL_TREE=y
CONFIG_INTERVAL_TREE_SPAN_ITER=y
CONFIG_XARRAY_MULTI=y
CONFIG_ASSOCIATIVE_ARRAY=y
CONFIG_CLOSURES=y
CONFIG_HAS_IOMEM=y
CONFIG_HAS_IOPORT=y
CONFIG_HAS_IOPORT_MAP=y
CONFIG_HAS_DMA=y
CONFIG_DMA_OPS_HELPERS=y
CONFIG_NEED_SG_DMA_FLAGS=y
CONFIG_NEED_SG_DMA_LENGTH=y
CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_ARCH_DMA_ADDR_T_64BIT=y
CONFIG_DMA_DECLARE_COHERENT=y
CONFIG_SWIOTLB=y
# CONFIG_SWIOTLB_DYNAMIC is not set
CONFIG_DMA_NEED_SYNC=y
# CONFIG_DMA_RESTRICTED_POOL is not set
CONFIG_DMA_CMA=y
# CONFIG_DMA_NUMA_CMA is not set

#
# Default contiguous memory area size:
#
CONFIG_CMA_SIZE_MBYTES=0
CONFIG_CMA_SIZE_PERCENTAGE=0
# CONFIG_CMA_SIZE_SEL_MBYTES is not set
# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set
# CONFIG_CMA_SIZE_SEL_MIN is not set
CONFIG_CMA_SIZE_SEL_MAX=y
CONFIG_CMA_ALIGNMENT=8
# CONFIG_DMA_API_DEBUG is not set
# CONFIG_DMA_MAP_BENCHMARK is not set
CONFIG_SGL_ALLOC=y
CONFIG_CHECK_SIGNATURE=y
# CONFIG_CPUMASK_OFFSTACK is not set
CONFIG_CPU_RMAP=y
CONFIG_DQL=y
CONFIG_GLOB=y
CONFIG_NLATTR=y
CONFIG_CLZ_TAB=y
CONFIG_IRQ_POLL=y
CONFIG_MPILIB=y
CONFIG_SIGNATURE=y
CONFIG_DIMLIB=y
CONFIG_LIBFDT=y
CONFIG_OID_REGISTRY=y
CONFIG_HAVE_GENERIC_VDSO=y
CONFIG_GENERIC_GETTIMEOFDAY=y
CONFIG_GENERIC_VDSO_OVERFLOW_PROTECT=y
CONFIG_VDSO_GETRANDOM=y
CONFIG_FONT_SUPPORT=y
# CONFIG_FONTS is not set
CONFIG_FONT_8x8=y
CONFIG_FONT_8x16=y
CONFIG_SG_POOL=y
CONFIG_ARCH_HAS_PMEM_API=y
CONFIG_MEMREGION=y
CONFIG_ARCH_HAS_CPU_CACHE_INVALIDATE_MEMREGION=y
CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE=y
CONFIG_ARCH_HAS_COPY_MC=y
CONFIG_ARCH_STACKWALK=y
CONFIG_STACKDEPOT=y
CONFIG_STACKDEPOT_ALWAYS_INIT=y
CONFIG_STACKDEPOT_MAX_FRAMES=64
CONFIG_REF_TRACKER=y
CONFIG_SBITMAP=y
# CONFIG_LWQ_TEST is not set
# end of Library routines

CONFIG_FIRMWARE_TABLE=y
CONFIG_UNION_FIND=y

#
# Kernel hacking
#

#
# printk and dmesg options
#
CONFIG_PRINTK_TIME=y
CONFIG_PRINTK_CALLER=y
# CONFIG_STACKTRACE_BUILD_ID is not set
CONFIG_CONSOLE_LOGLEVEL_DEFAULT=7
CONFIG_CONSOLE_LOGLEVEL_QUIET=4
CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4
# CONFIG_BOOT_PRINTK_DELAY is not set
CONFIG_DYNAMIC_DEBUG=y
CONFIG_DYNAMIC_DEBUG_CORE=y
CONFIG_SYMBOLIC_ERRNAME=y
CONFIG_DEBUG_BUGVERBOSE=y
CONFIG_DEBUG_BUGVERBOSE_DETAILED=y
# end of printk and dmesg options

CONFIG_DEBUG_KERNEL=y
CONFIG_DEBUG_MISC=y

#
# Compile-time checks and compiler options
#
CONFIG_DEBUG_INFO=y
CONFIG_AS_HAS_NON_CONST_ULEB128=y
# CONFIG_DEBUG_INFO_NONE is not set
# CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT is not set
CONFIG_DEBUG_INFO_DWARF4=y
# CONFIG_DEBUG_INFO_DWARF5 is not set
# CONFIG_DEBUG_INFO_REDUCED is not set
CONFIG_DEBUG_INFO_COMPRESSED_NONE=y
# CONFIG_DEBUG_INFO_COMPRESSED_ZLIB is not set
# CONFIG_DEBUG_INFO_COMPRESSED_ZSTD is not set
# CONFIG_DEBUG_INFO_SPLIT is not set
# CONFIG_DEBUG_INFO_BTF is not set
CONFIG_PAHOLE_HAS_BTF_TAG=y
CONFIG_PAHOLE_HAS_LANG_EXCLUDE=y
# CONFIG_GDB_SCRIPTS is not set
CONFIG_FRAME_WARN=2048
# CONFIG_STRIP_ASM_SYMS is not set
# CONFIG_HEADERS_INSTALL is not set
CONFIG_SECTION_MISMATCH_WARN_ONLY=y
# CONFIG_DEBUG_FORCE_FUNCTION_ALIGN_64B is not set
CONFIG_OBJTOOL=y
# CONFIG_OBJTOOL_WERROR is not set
CONFIG_NOINSTR_VALIDATION=y
# CONFIG_VMLINUX_MAP is not set
# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
# end of Compile-time checks and compiler options

#
# Generic Kernel Debugging Instruments
#
# CONFIG_MAGIC_SYSRQ is not set
CONFIG_DEBUG_FS=y
CONFIG_DEBUG_FS_ALLOW_ALL=y
# CONFIG_DEBUG_FS_ALLOW_NONE is not set
CONFIG_HAVE_ARCH_KGDB=y
# CONFIG_KGDB is not set
CONFIG_ARCH_HAS_UBSAN=y
CONFIG_UBSAN=y
# CONFIG_UBSAN_TRAP is not set
CONFIG_CC_HAS_UBSAN_ARRAY_BOUNDS=y
CONFIG_UBSAN_BOUNDS=y
CONFIG_UBSAN_ARRAY_BOUNDS=y
CONFIG_UBSAN_SHIFT=y
# CONFIG_UBSAN_BOOL is not set
# CONFIG_UBSAN_ENUM is not set
# CONFIG_UBSAN_ALIGNMENT is not set
# CONFIG_TEST_UBSAN is not set
CONFIG_HAVE_ARCH_KCSAN=y
CONFIG_HAVE_KCSAN_COMPILER=y
# end of Generic Kernel Debugging Instruments

#
# Networking Debugging
#
CONFIG_NET_DEV_REFCNT_TRACKER=y
CONFIG_NET_NS_REFCNT_TRACKER=y
CONFIG_DEBUG_NET=y
# CONFIG_DEBUG_NET_SMALL_RTNL is not set
# end of Networking Debugging

#
# Memory Debugging
#
CONFIG_PAGE_EXTENSION=y
# CONFIG_DEBUG_PAGEALLOC is not set
CONFIG_SLUB_DEBUG=y
# CONFIG_SLUB_DEBUG_ON is not set
CONFIG_SLUB_RCU_DEBUG=y
CONFIG_PAGE_OWNER=y
CONFIG_PAGE_TABLE_CHECK=y
CONFIG_PAGE_TABLE_CHECK_ENFORCED=y
CONFIG_PAGE_POISONING=y
# CONFIG_DEBUG_PAGE_REF is not set
# CONFIG_DEBUG_RODATA_TEST is not set
CONFIG_ARCH_HAS_DEBUG_WX=y
CONFIG_DEBUG_WX=y
CONFIG_ARCH_HAS_PTDUMP=y
CONFIG_PTDUMP=y
CONFIG_PTDUMP_DEBUGFS=y
CONFIG_HAVE_DEBUG_KMEMLEAK=y
# CONFIG_DEBUG_KMEMLEAK is not set
# CONFIG_PER_VMA_LOCK_STATS is not set
CONFIG_DEBUG_OBJECTS=y
# CONFIG_DEBUG_OBJECTS_SELFTEST is not set
CONFIG_DEBUG_OBJECTS_FREE=y
CONFIG_DEBUG_OBJECTS_TIMERS=y
CONFIG_DEBUG_OBJECTS_WORK=y
CONFIG_DEBUG_OBJECTS_RCU_HEAD=y
CONFIG_DEBUG_OBJECTS_PERCPU_COUNTER=y
CONFIG_DEBUG_OBJECTS_ENABLE_DEFAULT=1
# CONFIG_SHRINKER_DEBUG is not set
CONFIG_DEBUG_STACK_USAGE=y
CONFIG_SCHED_STACK_END_CHECK=y
CONFIG_ARCH_HAS_DEBUG_VM_PGTABLE=y
CONFIG_DEBUG_VFS=y
CONFIG_DEBUG_VM=y
CONFIG_DEBUG_VM_MAPLE_TREE=y
CONFIG_DEBUG_VM_RB=y
CONFIG_DEBUG_VM_PGFLAGS=y
CONFIG_DEBUG_VM_PGTABLE=y
CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y
CONFIG_DEBUG_VIRTUAL=y
CONFIG_DEBUG_MEMORY_INIT=y
CONFIG_DEBUG_PER_CPU_MAPS=y
CONFIG_DEBUG_KMAP_LOCAL=y
CONFIG_ARCH_SUPPORTS_KMAP_LOCAL_FORCE_MAP=y
CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAP=y
# CONFIG_MEM_ALLOC_PROFILING is not set
CONFIG_HAVE_ARCH_KASAN=y
CONFIG_HAVE_ARCH_KASAN_VMALLOC=y
CONFIG_CC_HAS_KASAN_GENERIC=y
CONFIG_CC_HAS_KASAN_SW_TAGS=y
CONFIG_CC_HAS_WORKING_NOSANITIZE_ADDRESS=y
CONFIG_KASAN=y
CONFIG_CC_HAS_KASAN_MEMINTRINSIC_PREFIX=y
CONFIG_KASAN_GENERIC=y
# CONFIG_KASAN_OUTLINE is not set
CONFIG_KASAN_INLINE=y
CONFIG_KASAN_STACK=y
CONFIG_KASAN_VMALLOC=y
# CONFIG_KASAN_EXTRA_INFO is not set
CONFIG_HAVE_ARCH_KFENCE=y
CONFIG_KFENCE=y
CONFIG_KFENCE_SAMPLE_INTERVAL=100
CONFIG_KFENCE_NUM_OBJECTS=255
# CONFIG_KFENCE_DEFERRABLE is not set
CONFIG_KFENCE_STATIC_KEYS=y
CONFIG_KFENCE_STRESS_TEST_FAULTS=0
CONFIG_HAVE_ARCH_KMSAN=y
CONFIG_HAVE_KMSAN_COMPILER=y
# end of Memory Debugging

# CONFIG_DEBUG_SHIRQ is not set

#
# Debug Oops, Lockups and Hangs
#
CONFIG_PANIC_ON_OOPS=y
CONFIG_PANIC_TIMEOUT=86400
CONFIG_LOCKUP_DETECTOR=y
CONFIG_SOFTLOCKUP_DETECTOR=y
# CONFIG_SOFTLOCKUP_DETECTOR_INTR_STORM is not set
CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=1
CONFIG_HAVE_HARDLOCKUP_DETECTOR_BUDDY=y
CONFIG_HARDLOCKUP_DETECTOR=y
# CONFIG_HARDLOCKUP_DETECTOR_PREFER_BUDDY is not set
CONFIG_HARDLOCKUP_DETECTOR_PERF=y
# CONFIG_HARDLOCKUP_DETECTOR_BUDDY is not set
# CONFIG_HARDLOCKUP_DETECTOR_ARCH is not set
CONFIG_HARDLOCKUP_DETECTOR_COUNTS_HRTIMER=y
CONFIG_HARDLOCKUP_CHECK_TIMESTAMP=y
CONFIG_BOOTPARAM_HARDLOCKUP_PANIC=y
CONFIG_DETECT_HUNG_TASK=y
CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=140
CONFIG_BOOTPARAM_HUNG_TASK_PANIC=1
CONFIG_WQ_WATCHDOG=y
CONFIG_BOOTPARAM_WQ_STALL_PANIC=0
# CONFIG_WQ_CPU_INTENSIVE_REPORT is not set
# CONFIG_TEST_LOCKUP is not set
# end of Debug Oops, Lockups and Hangs

#
# Scheduler Debugging
#
CONFIG_SCHED_INFO=y
CONFIG_SCHEDSTATS=y
# end of Scheduler Debugging

CONFIG_DEBUG_PREEMPT=y
# CONFIG_DEBUG_ATOMIC is not set

#
# Lock Debugging (spinlocks, mutexes, etc...)
#
CONFIG_LOCK_DEBUGGING_SUPPORT=y
CONFIG_PROVE_LOCKING=y
CONFIG_PROVE_RAW_LOCK_NESTING=y
# CONFIG_LOCK_STAT is not set
CONFIG_DEBUG_RT_MUTEXES=y
CONFIG_DEBUG_SPINLOCK=y
CONFIG_DEBUG_WW_MUTEX_SLOWPATH=y
CONFIG_DEBUG_LOCK_ALLOC=y
CONFIG_LOCKDEP=y
CONFIG_LOCKDEP_BITS=20
CONFIG_LOCKDEP_CHAINS_BITS=20
CONFIG_LOCKDEP_STACK_TRACE_BITS=20
CONFIG_LOCKDEP_STACK_TRACE_HASH_BITS=14
CONFIG_LOCKDEP_CIRCULAR_QUEUE_BITS=12
# CONFIG_DEBUG_LOCKDEP is not set
CONFIG_DEBUG_ATOMIC_SLEEP=y
# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
# CONFIG_LOCK_TORTURE_TEST is not set
# CONFIG_WW_MUTEX_SELFTEST is not set
# CONFIG_SCF_TORTURE_TEST is not set
CONFIG_CSD_LOCK_WAIT_DEBUG=y
# CONFIG_CSD_LOCK_WAIT_DEBUG_DEFAULT is not set
# end of Lock Debugging (spinlocks, mutexes, etc...)

CONFIG_TRACE_IRQFLAGS=y
CONFIG_TRACE_IRQFLAGS_NMI=y
CONFIG_NMI_CHECK_CPU=y
CONFIG_DEBUG_IRQFLAGS=y
CONFIG_STACKTRACE=y
# CONFIG_DEBUG_KOBJECT is not set
# CONFIG_DEBUG_KOBJECT_RELEASE is not set

#
# Debug kernel data structures
#
CONFIG_DEBUG_LIST=y
CONFIG_DEBUG_PLIST=y
CONFIG_DEBUG_SG=y
CONFIG_DEBUG_NOTIFIERS=y
# CONFIG_DEBUG_CLOSURES is not set
CONFIG_DEBUG_MAPLE_TREE=y
# end of Debug kernel data structures

#
# RCU Debugging
#
CONFIG_PROVE_RCU=y
# CONFIG_RCU_SCALE_TEST is not set
# CONFIG_RCU_TORTURE_TEST is not set
# CONFIG_RCU_REF_SCALE_TEST is not set
CONFIG_RCU_CPU_STALL_TIMEOUT=100
CONFIG_RCU_EXP_CPU_STALL_TIMEOUT=0
# CONFIG_RCU_CPU_STALL_CPUTIME is not set
# CONFIG_RCU_TRACE is not set
CONFIG_RCU_EQS_DEBUG=y
# end of RCU Debugging

# CONFIG_DEBUG_WQ_FORCE_RR_CPU is not set
# CONFIG_CPU_HOTPLUG_STATE_CONTROL is not set
# CONFIG_LATENCYTOP is not set
CONFIG_USER_STACKTRACE_SUPPORT=y
CONFIG_NOP_TRACER=y
CONFIG_HAVE_RETHOOK=y
CONFIG_HAVE_FUNCTION_TRACER=y
CONFIG_HAVE_DYNAMIC_FTRACE=y
CONFIG_HAVE_DYNAMIC_FTRACE_WITH_REGS=y
CONFIG_HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS=y
CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS=y
CONFIG_HAVE_FTRACE_REGS_HAVING_PT_REGS=y
CONFIG_HAVE_DYNAMIC_FTRACE_NO_PATCHABLE=y
CONFIG_HAVE_DYNAMIC_FTRACE_WITH_JMP=y
CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
CONFIG_HAVE_FENTRY=y
CONFIG_HAVE_OBJTOOL_MCOUNT=y
CONFIG_HAVE_OBJTOOL_NOP_MCOUNT=y
CONFIG_HAVE_C_RECORDMCOUNT=y
CONFIG_HAVE_BUILDTIME_MCOUNT_SORT=y
CONFIG_TRACE_CLOCK=y
CONFIG_RING_BUFFER=y
CONFIG_EVENT_TRACING=y
CONFIG_CONTEXT_SWITCH_TRACER=y
CONFIG_PREEMPTIRQ_TRACEPOINTS=y
CONFIG_TRACING=y
CONFIG_GENERIC_TRACER=y
CONFIG_TRACING_SUPPORT=y
CONFIG_FTRACE=y
CONFIG_TRACEFS_AUTOMOUNT_DEPRECATED=y
# CONFIG_BOOTTIME_TRACING is not set
# CONFIG_FUNCTION_TRACER is not set
# CONFIG_STACK_TRACER is not set
# CONFIG_IRQSOFF_TRACER is not set
# CONFIG_PREEMPT_TRACER is not set
# CONFIG_SCHED_TRACER is not set
# CONFIG_HWLAT_TRACER is not set
# CONFIG_OSNOISE_TRACER is not set
# CONFIG_TIMERLAT_TRACER is not set
# CONFIG_MMIOTRACE is not set
# CONFIG_FTRACE_SYSCALLS is not set
# CONFIG_TRACER_SNAPSHOT is not set
CONFIG_BRANCH_PROFILE_NONE=y
# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
CONFIG_BLK_DEV_IO_TRACE=y
CONFIG_UPROBE_EVENTS=y
CONFIG_EPROBE_EVENTS=y
CONFIG_BPF_EVENTS=y
CONFIG_DYNAMIC_EVENTS=y
CONFIG_PROBE_EVENTS=y
# CONFIG_SYNTH_EVENTS is not set
# CONFIG_USER_EVENTS is not set
# CONFIG_HIST_TRIGGERS is not set
CONFIG_TRACE_EVENT_INJECT=y
# CONFIG_TRACEPOINT_BENCHMARK is not set
# CONFIG_RING_BUFFER_BENCHMARK is not set
# CONFIG_TRACE_EVAL_MAP_FILE is not set
# CONFIG_FTRACE_STARTUP_TEST is not set
# CONFIG_RING_BUFFER_STARTUP_TEST is not set
CONFIG_RING_BUFFER_VALIDATE_TIME_DELTAS=y
# CONFIG_RING_BUFFER_PERSISTENT_INJECT is not set
# CONFIG_PREEMPTIRQ_DELAY_TEST is not set
# CONFIG_RV is not set
# CONFIG_TRACE_REMOTE_TEST is not set
CONFIG_PROVIDE_OHCI1394_DMA_INIT=y
# CONFIG_SAMPLES is not set
CONFIG_HAVE_SAMPLE_FTRACE_DIRECT=y
CONFIG_HAVE_SAMPLE_FTRACE_DIRECT_MULTI=y
CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y
# CONFIG_STRICT_DEVMEM is not set

#
# x86 Debugging
#
CONFIG_EARLY_PRINTK_USB=y
CONFIG_X86_VERBOSE_BOOTUP=y
CONFIG_EARLY_PRINTK=y
CONFIG_EARLY_PRINTK_DBGP=y
# CONFIG_EARLY_PRINTK_USB_XDBC is not set
# CONFIG_DEBUG_TLBFLUSH is not set
CONFIG_HAVE_MMIOTRACE_SUPPORT=y
# CONFIG_X86_DECODER_SELFTEST is not set
CONFIG_IO_DELAY_0X80=y
# CONFIG_IO_DELAY_0XED is not set
# CONFIG_IO_DELAY_UDELAY is not set
# CONFIG_IO_DELAY_NONE is not set
CONFIG_DEBUG_BOOT_PARAMS=y
# CONFIG_CPA_DEBUG is not set
CONFIG_DEBUG_ENTRY=y
# CONFIG_DEBUG_NMI_SELFTEST is not set
CONFIG_X86_DEBUG_FPU=y
# CONFIG_PUNIT_ATOM_DEBUG is not set
CONFIG_UNWINDER_ORC=y
# CONFIG_UNWINDER_FRAME_POINTER is not set
# end of x86 Debugging

#
# Kernel Testing and Coverage
#
# CONFIG_KUNIT is not set
# CONFIG_NOTIFIER_ERROR_INJECTION is not set
CONFIG_FAULT_INJECTION=y
CONFIG_FAILSLAB=y
CONFIG_FAIL_PAGE_ALLOC=y
CONFIG_FAULT_INJECTION_USERCOPY=y
CONFIG_FAIL_MAKE_REQUEST=y
CONFIG_FAIL_IO_TIMEOUT=y
CONFIG_FAIL_FUTEX=y
CONFIG_FAULT_INJECTION_DEBUG_FS=y
# CONFIG_FAIL_MMC_REQUEST is not set
# CONFIG_FAIL_SKB_REALLOC is not set
CONFIG_FAULT_INJECTION_CONFIGFS=y
# CONFIG_FAULT_INJECTION_STACKTRACE_FILTER is not set
CONFIG_ARCH_HAS_KCOV=y
CONFIG_KCOV=y
CONFIG_KCOV_ENABLE_COMPARISONS=y
CONFIG_KCOV_INSTRUMENT_ALL=y
CONFIG_KCOV_IRQ_AREA_SIZE=0x40000
# CONFIG_KCOV_SELFTEST is not set
CONFIG_RUNTIME_TESTING_MENU=y
# CONFIG_TEST_DHRY is not set
# CONFIG_LKDTM is not set
# CONFIG_TEST_DIV64 is not set
# CONFIG_TEST_MULDIV64 is not set
# CONFIG_BACKTRACE_SELF_TEST is not set
# CONFIG_TEST_REF_TRACKER is not set
# CONFIG_RBTREE_TEST is not set
# CONFIG_REED_SOLOMON_TEST is not set
# CONFIG_INTERVAL_TREE_TEST is not set
# CONFIG_PERCPU_TEST is not set
# CONFIG_ATOMIC64_SELFTEST is not set
# CONFIG_ASYNC_RAID6_TEST is not set
# CONFIG_TEST_HEXDUMP is not set
# CONFIG_TEST_KSTRTOX is not set
# CONFIG_TEST_BITMAP is not set
# CONFIG_TEST_XARRAY is not set
# CONFIG_TEST_MAPLE_TREE is not set
# CONFIG_TEST_RHASHTABLE is not set
# CONFIG_TEST_IDA is not set
# CONFIG_TEST_LKM is not set
# CONFIG_TEST_BITOPS is not set
# CONFIG_TEST_VMALLOC is not set
# CONFIG_TEST_WORKQUEUE is not set
# CONFIG_TEST_BPF is not set
# CONFIG_FIND_BIT_BENCHMARK is not set
# CONFIG_TEST_FIRMWARE is not set
# CONFIG_TEST_SYSCTL is not set
# CONFIG_CONTEXT_ANALYSIS_TEST is not set
# CONFIG_TEST_UDELAY is not set
# CONFIG_TEST_STATIC_KEYS is not set
# CONFIG_TEST_DYNAMIC_DEBUG is not set
# CONFIG_TEST_KMOD is not set
# CONFIG_TEST_KALLSYMS is not set
# CONFIG_TEST_DEBUG_VIRTUAL is not set
# CONFIG_TEST_MEMCAT_P is not set
# CONFIG_TEST_MEMINIT is not set
# CONFIG_TEST_FREE_PAGES is not set
# CONFIG_TEST_CLOCKSOURCE_WATCHDOG is not set
# CONFIG_TEST_OBJPOOL is not set
CONFIG_ARCH_USE_MEMTEST=y
# CONFIG_MEMTEST is not set
# end of Kernel Testing and Coverage

#
# Rust hacking
#
# end of Rust hacking
# end of Kernel hacking

CONFIG_IO_URING_BPF=y
KernelRepo git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
ReproCID 5869198208663552
ReproOpts
ReproSyzID 0
SyzkallerCommit 2377cd3dcd3c2e96dc5bd3c92c152122cdd05d7a
TargetArch amd64
TargetOS linux

Current Stage: moderation
Next Stage: upstream

Reporting Stages and Comments:
Stage Source Reported At Ext ID Comments
moderation lore 2026/08/07 06:25 <f4fb3f3c-7a51-44ed-bbd3-4ea5fa486d2e@mail.kernel.org>
1 Comments
  • syzbot@kernel.org (2026/08/07 06:29):
    A KASAN slab-use-after-free bug was found in gadgetfs_kill_sb():
    
    BUG: KASAN: slab-use-after-free in put_dev
    drivers/usb/gadget/legacy/inode.c:165 [inline]
    BUG: KASAN: slab-use-after-free in gadgetfs_kill_sb+0x46/0x110
    drivers/usb/gadget/legacy/inode.c:2104
    Write of size 4 at addr ffff88811638c080 by task syz-executor169/5848
    
    CPU: 0 UID: 0 PID: 5848 Comm: syz-executor169 Not tainted
    Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS
    1.16.3-debian-1.16.3-2 04/01/2014
    Call Trace:
     <TASK>
     dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
     print_address_description+0x55/0x1e0 mm/kasan/report.c:378
     print_report+0x58/0x70 mm/kasan/report.c:482
     kasan_report+0x117/0x150 mm/kasan/report.c:595
     check_region_inline mm/kasan/generic.c:-1 [inline]
     kasan_check_range+0x264/0x2c0 mm/kasan/generic.c:200
     instrument_atomic_read_write include/linux/instrumented.h:112 [inline]
     atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:400
     [inline]
     __refcount_sub_and_test include/linux/refcount.h:389 [inline]
     __refcount_dec_and_test include/linux/refcount.h:432 [inline]
     refcount_dec_and_test include/linux/refcount.h:450 [inline]
     put_dev drivers/usb/gadget/legacy/inode.c:165 [inline]
     gadgetfs_kill_sb+0x46/0x110 drivers/usb/gadget/legacy/inode.c:2104
     deactivate_locked_super+0xbc/0x130 fs/super.c:477
     cleanup_mnt+0x3d3/0x460 fs/namespace.c:1317
     task_work_run+0x1d9/0x270 kernel/task_work.c:233
    
    The root cause is a reference count underflow in the error handling path of
    gadgetfs_bind(). When gadgetfs_bind() encounters an error (e.g., memory
    allocation failure), it jumps to the enomem label and calls
    gadgetfs_unbind(). However, gadgetfs_unbind() is designed to tear down a
    fully initialized and bound gadget, and unconditionally drops a device
    reference by calling put_dev(dev). Since gadgetfs_bind() only acquires this
    reference (get_dev(dev)) at the very end of the function upon complete
    success, calling gadgetfs_unbind() in the error path drops a reference that
    was never taken.
    
    This leads to a premature free of the dev structure when the ep0 file is
    closed, and subsequently a use-after-free when the filesystem is unmounted
    and gadgetfs_kill_sb() tries to drop the initial reference.
    
    To fix this, stop calling the full teardown function gadgetfs_unbind() from
    the gadgetfs_bind() error path. Instead, manually and locally clean up only
    the specific state that was successfully altered before the failure
    occurred.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Assisted-by: Gemini:gemini-3.5-flash Gemini:gemini-3.1-pro-preview syzbot
    Reported-by: syzbot+4a5c87a01894ca37f25c@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=4a5c87a01894ca37f25c
    Link: https://syzkaller.appspot.com/ai_job?id=d40043f8-d813-4477-b6e2-0f071c04be7c
    To: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
    To: <linux-usb@vger.kernel.org>
    To: "Linus Torvalds" <torvalds@ppc970.osdl.org>
    Cc: "Christian Brauner" <brauner@kernel.org>
    Cc: "Jan Kara" <jack@suse.cz>
    Cc: "Kees Cook" <kees@kernel.org>
    Cc: <linux-kernel@vger.kernel.org>
    Cc: "Mateusz Guzik" <mjguzik@gmail.com>
    Cc: "Al Viro" <viro@zeniv.linux.org.uk>
    
    ---
    diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c
    index d87a8ab51..365f9ab4d 100644
    --- a/drivers/usb/gadget/legacy/inode.c
    +++ b/drivers/usb/gadget/legacy/inode.c
    @@ -1700,7 +1700,13 @@ static int gadgetfs_bind(struct usb_gadget *gadget,
     	return 0;
     
     enomem:
    -	gadgetfs_unbind (gadget);
    +	if (dev->req) {
    +		usb_ep_free_request(gadget->ep0, dev->req);
    +		dev->req = NULL;
    +	}
    +	gadget->ep0->driver_data = NULL;
    +	dev->gadget = NULL;
    +	set_gadget_data(gadget, NULL);
     	return -ENOMEM;
     }
     
    
    
    base-commit: 075b74841bd0065a3bda3440873c747938e69b68
    -- 
    This is an AI-generated patch subject to moderation.
    Reply with '#syz upstream' to Sign-off the patch as a human author
    and send it to the upstream kernel mailing lists.
    Reply with '#syz reject' to reject it ('#syz unreject' to undo).
    
    See https://goo.gle/syzbot-ai-patches for information about AI-generated patches.
    The person who has signed off on the patch is responsible for
    addressing comments.
    syzbot engineers can be reached at syzkaller@googlegroups.com.
    

Outputs:
AckedBy
[]
Fixes
map[AuthorEmail:torvalds@ppc970.osdl.org AuthorName:Linus Torvalds Hash:1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Title:Linux-2.6.12-rc2]
KernelBranch
master
KernelCommit
075b74841bd0065a3bda3440873c747938e69b68
KernelRepo
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
PatchDescription
usb: gadgetfs: fix reference count underflow in gadgetfs_bind()

A KASAN slab-use-after-free bug was found in gadgetfs_kill_sb():

BUG: KASAN: slab-use-after-free in put_dev
drivers/usb/gadget/legacy/inode.c:165 [inline]
BUG: KASAN: slab-use-after-free in gadgetfs_kill_sb+0x46/0x110
drivers/usb/gadget/legacy/inode.c:2104
Write of size 4 at addr ffff88811638c080 by task syz-executor169/5848

CPU: 0 UID: 0 PID: 5848 Comm: syz-executor169 Not tainted
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS
1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 print_address_description+0x55/0x1e0 mm/kasan/report.c:378
 print_report+0x58/0x70 mm/kasan/report.c:482
 kasan_report+0x117/0x150 mm/kasan/report.c:595
 check_region_inline mm/kasan/generic.c:-1 [inline]
 kasan_check_range+0x264/0x2c0 mm/kasan/generic.c:200
 instrument_atomic_read_write include/linux/instrumented.h:112 [inline]
 atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:400
 [inline]
 __refcount_sub_and_test include/linux/refcount.h:389 [inline]
 __refcount_dec_and_test include/linux/refcount.h:432 [inline]
 refcount_dec_and_test include/linux/refcount.h:450 [inline]
 put_dev drivers/usb/gadget/legacy/inode.c:165 [inline]
 gadgetfs_kill_sb+0x46/0x110 drivers/usb/gadget/legacy/inode.c:2104
 deactivate_locked_super+0xbc/0x130 fs/super.c:477
 cleanup_mnt+0x3d3/0x460 fs/namespace.c:1317
 task_work_run+0x1d9/0x270 kernel/task_work.c:233

The root cause is a reference count underflow in the error handling path of
gadgetfs_bind(). When gadgetfs_bind() encounters an error (e.g., memory
allocation failure), it jumps to the enomem label and calls
gadgetfs_unbind(). However, gadgetfs_unbind() is designed to tear down a
fully initialized and bound gadget, and unconditionally drops a device
reference by calling put_dev(dev). Since gadgetfs_bind() only acquires this
reference (get_dev(dev)) at the very end of the function upon complete
success, calling gadgetfs_unbind() in the error path drops a reference that
was never taken.

This leads to a premature free of the dev structure when the ep0 file is
closed, and subsequently a use-after-free when the filesystem is unmounted
and gadgetfs_kill_sb() tries to drop the initial reference.

To fix this, stop calling the full teardown function gadgetfs_unbind() from
the gadgetfs_bind() error path. Instead, manually and locally clean up only
the specific state that was successfully altered before the failure
occurred.
PatchDiff
diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c
index d87a8ab51..365f9ab4d 100644
--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -1700,7 +1700,13 @@ static int gadgetfs_bind(struct usb_gadget *gadget,
 	return 0;
 
 enomem:
-	gadgetfs_unbind (gadget);
+	if (dev->req) {
+		usb_ep_free_request(gadget->ep0, dev->req);
+		dev->req = NULL;
+	}
+	gadget->ep0->driver_data = NULL;
+	dev->gadget = NULL;
+	set_gadget_data(gadget, NULL);
 	return -ENOMEM;
 }
 
Recipients
[map[Email:brauner@kernel.org Name:Christian Brauner To:false] map[Email:gregkh@linuxfoundation.org Name:Greg Kroah-Hartman To:true] map[Email:jack@suse.cz Name:Jan Kara To:false] map[Email:kees@kernel.org Name:Kees Cook To:false] map[Email:linux-kernel@vger.kernel.org Name: To:false] map[Email:linux-usb@vger.kernel.org Name: To:true] map[Email:mjguzik@gmail.com Name:Mateusz Guzik To:false] map[Email:viro@zeniv.linux.org.uk Name:Al Viro To:false] map[Email:torvalds@ppc970.osdl.org Name:Linus Torvalds To:true]]
ReportedBy
[]
ReviewedBy
[]
SuggestedBy
[]
TestedBy
[]

Crash report:
 </TASK>
udc dummy_udc.0: failed to start USB Gadget filesystem: -12
gadgetfs gadget.0: probe with driver gadgetfs failed with error -12
gadgetfs: bound to dummy_udc driver
==================================================================
BUG: KASAN: slab-use-after-free in instrument_atomic_read_write include/linux/instrumented.h:112 [inline]
BUG: KASAN: slab-use-after-free in atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:400 [inline]
BUG: KASAN: slab-use-after-free in __refcount_sub_and_test include/linux/refcount.h:389 [inline]
BUG: KASAN: slab-use-after-free in __refcount_dec_and_test include/linux/refcount.h:432 [inline]
BUG: KASAN: slab-use-after-free in refcount_dec_and_test include/linux/refcount.h:450 [inline]
BUG: KASAN: slab-use-after-free in put_dev drivers/usb/gadget/legacy/inode.c:165 [inline]
BUG: KASAN: slab-use-after-free in gadgetfs_kill_sb+0x46/0x110 drivers/usb/gadget/legacy/inode.c:2104
Write of size 4 at addr ffff888034069080 by task syz-executor187/5951

CPU: 0 UID: 0 PID: 5951 Comm: syz-executor187 Not tainted syzkaller #0 PREEMPT_{RT,(full)} 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 print_address_description+0x55/0x1e0 mm/kasan/report.c:378
 print_report+0x58/0x70 mm/kasan/report.c:482
 kasan_report+0x117/0x150 mm/kasan/report.c:595
 check_region_inline mm/kasan/generic.c:-1 [inline]
 kasan_check_range+0x264/0x2c0 mm/kasan/generic.c:200
 instrument_atomic_read_write include/linux/instrumented.h:112 [inline]
 atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:400 [inline]
 __refcount_sub_and_test include/linux/refcount.h:389 [inline]
 __refcount_dec_and_test include/linux/refcount.h:432 [inline]
 refcount_dec_and_test include/linux/refcount.h:450 [inline]
 put_dev drivers/usb/gadget/legacy/inode.c:165 [inline]
 gadgetfs_kill_sb+0x46/0x110 drivers/usb/gadget/legacy/inode.c:2104
 deactivate_locked_super+0xbc/0x130 fs/super.c:477
 cleanup_mnt+0x3d3/0x460 fs/namespace.c:1317
 task_work_run+0x1d9/0x270 kernel/task_work.c:233
 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
 __exit_to_user_mode_loop kernel/entry/common.c:70 [inline]
 exit_to_user_mode_loop+0x1fa/0x730 kernel/entry/common.c:101
 __exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline]
 syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:230 [inline]
 syscall_exit_to_user_mode include/linux/entry-common.h:318 [inline]
 do_syscall_64+0x353/0x580 arch/x86/entry/syscall_64.c:100
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f9c403c3027
Code: a2 c7 05 54 b0 08 00 00 00 00 00 eb 96 e8 a1 08 00 00 90 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 c7 c2 d8 ff ff ff f7 d8 64 89 02 b8
RSP: 002b:00007ffc402c5578 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6
RAX: 0000000000000000 RBX: 0000000000000003 RCX: 00007f9c403c3027
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00007f9c4041d05e
RBP: 00007f9c4041d05e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f9c4041d623
R13: 00007ffc402c56d0 R14: 00007f9c4041f510 R15: 00007f9c4041f4e8
 </TASK>

Allocated by task 5951:
 kasan_save_stack mm/kasan/common.c:57 [inline]
 kasan_save_track+0x3e/0x80 mm/kasan/common.c:78
 poison_kmalloc_redzone mm/kasan/common.c:398 [inline]
 __kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:415
 kasan_kmalloc include/linux/kasan.h:263 [inline]
 __kmalloc_cache_noprof+0x3d2/0x6b0 mm/slub.c:5489
 _kmalloc_noprof include/linux/slab.h:988 [inline]
 _kzalloc_noprof include/linux/slab.h:1309 [inline]
 dev_new drivers/usb/gadget/legacy/inode.c:176 [inline]
 gadgetfs_fill_super+0x27b/0x7a0 drivers/usb/gadget/legacy/inode.c:2054
 vfs_get_super fs/super.c:1273 [inline]
 get_tree_single+0xc0/0x150 fs/super.c:1300
 vfs_get_tree+0x92/0x2a0 fs/super.c:1700
 fc_mount fs/namespace.c:1198 [inline]
 do_new_mount_fc fs/namespace.c:3765 [inline]
 do_new_mount+0x319/0xdc0 fs/namespace.c:3841
 do_mount fs/namespace.c:4174 [inline]
 __do_sys_mount fs/namespace.c:4390 [inline]
 __se_sys_mount+0x31d/0x420 fs/namespace.c:4367
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Freed by task 5951:
 kasan_save_stack mm/kasan/common.c:57 [inline]
 kasan_save_track+0x3e/0x80 mm/kasan/common.c:78
 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:584
 poison_slab_object mm/kasan/common.c:253 [inline]
 __kasan_slab_free+0x5c/0x80 mm/kasan/common.c:285
 kasan_slab_free include/linux/kasan.h:235 [inline]
 slab_free_hook mm/slub.c:2677 [inline]
 slab_free mm/slub.c:6377 [inline]
 kfree+0x1c5/0x6c0 mm/slub.c:6692
 put_dev drivers/usb/gadget/legacy/inode.c:169 [inline]
 dev_release+0x173/0x210 drivers/usb/gadget/legacy/inode.c:1215
 __fput+0x42a/0xa80 fs/file_table.c:512
 fput_close_sync+0x11f/0x240 fs/file_table.c:617
 __do_sys_close fs/open.c:1511 [inline]
 __se_sys_close fs/open.c:1496 [inline]
 __x64_sys_close+0x7e/0x110 fs/open.c:1496
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

The buggy address belongs to the object at ffff888034069000
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 128 bytes inside of
 freed 1024-byte region [ffff888034069000, ffff888034069400)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff888034069800 pfn:0x34068
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0x80000000000240(workingset|head|node=0|zone=1)
page_type: f5(slab)
raw: 0080000000000240 ffff88813ffb2dc0 ffffea0000d33e10 ffffea0000a85210
raw: ffff888034069800 0000000800100007 00000000f5000000 0000000000000000
head: 0080000000000240 ffff88813ffb2dc0 ffffea0000d33e10 ffffea0000a85210
head: ffff888034069800 0000000800100007 00000000f5000000 0000000000000000
head: 0080000000000003 fffffffffffffe01 00000000ffffffff 00000000ffffffff
head: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000008
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5659, tgid 5659 (syz-executor), ts 91566899744, free_ts 90984522889
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x1f9/0x250 mm/page_alloc.c:1859
 prep_new_page mm/page_alloc.c:1867 [inline]
 get_page_from_freelist+0x262a/0x26a0 mm/page_alloc.c:3946
 __alloc_frozen_pages_noprof+0x18d/0x380 mm/page_alloc.c:5304
 alloc_slab_page mm/slub.c:3266 [inline]
 allocate_slab+0x79/0x5e0 mm/slub.c:3380
 new_slab mm/slub.c:3426 [inline]
 refill_objects+0x2d8/0x350 mm/slub.c:7310
 refill_sheaf mm/slub.c:2804 [inline]
 __pcs_replace_empty_main+0x330/0x690 mm/slub.c:4675
 alloc_from_pcs mm/slub.c:4773 [inline]
 slab_alloc_node mm/slub.c:4905 [inline]
 __kmalloc_cache_noprof+0x468/0x6b0 mm/slub.c:5485
 _kmalloc_noprof include/linux/slab.h:988 [inline]
 _kzalloc_noprof include/linux/slab.h:1309 [inline]
 afs_alloc_call+0x79/0x580 fs/afs/rxrpc.c:171
 afs_charge_preallocation+0x273/0x570 fs/afs/rxrpc.c:755
 afs_open_socket+0x33c/0x3f0 fs/afs/rxrpc.c:112
 afs_net_init+0x6ce/0x8f0 fs/afs/main.c:116
 ops_init+0x35d/0x5d0 net/core/net_namespace.c:137
 setup_net+0x118/0x350 net/core/net_namespace.c:446
 copy_net_ns+0x4f9/0x720 net/core/net_namespace.c:579
 create_new_namespaces+0x3f0/0x6b0 kernel/nsproxy.c:132
 unshare_nsproxy_namespaces+0x149/0x190 kernel/nsproxy.c:234
page last free pid 10 tgid 10 stack trace:
 reset_page_owner include/linux/page_owner.h:25 [inline]
 __free_pages_prepare mm/page_alloc.c:1406 [inline]
 __free_frozen_pages+0x10e7/0x11c0 mm/page_alloc.c:2950
 kasan_depopulate_vmalloc_pte+0x6d/0x90 mm/kasan/shadow.c:484
 apply_to_pte_range mm/memory.c:3338 [inline]
 apply_to_pmd_range mm/memory.c:3382 [inline]
 apply_to_pud_range mm/memory.c:3418 [inline]
 apply_to_p4d_range mm/memory.c:3454 [inline]
 __apply_to_page_range+0xbd8/0x1420 mm/memory.c:3490
 __kasan_release_vmalloc+0xa2/0xd0 mm/kasan/shadow.c:602
 kasan_release_vmalloc include/linux/kasan.h:593 [inline]
 kasan_release_vmalloc_node mm/vmalloc.c:2284 [inline]
 purge_vmap_node+0x220/0x960 mm/vmalloc.c:2306
 __purge_vmap_area_lazy+0x783/0xb40 mm/vmalloc.c:2396
 drain_vmap_area_work+0x27/0x40 mm/vmalloc.c:2430
 process_one_work kernel/workqueue.c:3322 [inline]
 process_scheduled_works+0xa8e/0x14e0 kernel/workqueue.c:3405
 worker_thread+0xa47/0xfb0 kernel/workqueue.c:3486
 kthread+0x388/0x470 kernel/kthread.c:436
 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

Memory state around the buggy address:
 ffff888034068f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888034069000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888034069080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff888034069100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888034069180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Trajectory: (Expand/Collapse All)
Seq Timestamp Type Name Duration
0/0 2026/08/07 05:35 flow patching
50m Results:
map[AckedBy:[] Fixes:map[AuthorEmail:torvalds@ppc970.osdl.org AuthorName:Linus Torvalds Hash:1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Title:Linux-2.6.12-rc2] KernelBranch:master KernelCommit:075b74841bd0065a3bda3440873c747938e69b68 KernelRepo:git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git PatchDescription:usb: gadgetfs: fix reference count underflow in gadgetfs_bind()

A KASAN slab-use-after-free bug was found in gadgetfs_kill_sb():

BUG: KASAN: slab-use-after-free in put_dev
drivers/usb/gadget/legacy/inode.c:165 [inline]
BUG: KASAN: slab-use-after-free in gadgetfs_kill_sb+0x46/0x110
drivers/usb/gadget/legacy/inode.c:2104
Write of size 4 at addr ffff88811638c080 by task syz-executor169/5848

CPU: 0 UID: 0 PID: 5848 Comm: syz-executor169 Not tainted
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS
1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 print_address_description+0x55/0x1e0 mm/kasan/report.c:378
 print_report+0x58/0x70 mm/kasan/report.c:482
 kasan_report+0x117/0x150 mm/kasan/report.c:595
 check_region_inline mm/kasan/generic.c:-1 [inline]
 kasan_check_range+0x264/0x2c0 mm/kasan/generic.c:200
 instrument_atomic_read_write include/linux/instrumented.h:112 [inline]
 atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:400
 [inline]
 __refcount_sub_and_test include/linux/refcount.h:389 [inline]
 __refcount_dec_and_test include/linux/refcount.h:432 [inline]
 refcount_dec_and_test include/linux/refcount.h:450 [inline]
 put_dev drivers/usb/gadget/legacy/inode.c:165 [inline]
 gadgetfs_kill_sb+0x46/0x110 drivers/usb/gadget/legacy/inode.c:2104
 deactivate_locked_super+0xbc/0x130 fs/super.c:477
 cleanup_mnt+0x3d3/0x460 fs/namespace.c:1317
 task_work_run+0x1d9/0x270 kernel/task_work.c:233

The root cause is a reference count underflow in the error handling path of
gadgetfs_bind(). When gadgetfs_bind() encounters an error (e.g., memory
allocation failure), it jumps to the enomem label and calls
gadgetfs_unbind(). However, gadgetfs_unbind() is designed to tear down a
fully initialized and bound gadget, and unconditionally drops a device
reference by calling put_dev(dev). Since gadgetfs_bind() only acquires this
reference (get_dev(dev)) at the very end of the function upon complete
success, calling gadgetfs_unbind() in the error path drops a reference that
was never taken.

This leads to a premature free of the dev structure when the ep0 file is
closed, and subsequently a use-after-free when the filesystem is unmounted
and gadgetfs_kill_sb() tries to drop the initial reference.

To fix this, stop calling the full teardown function gadgetfs_unbind() from
the gadgetfs_bind() error path. Instead, manually and locally clean up only
the specific state that was successfully altered before the failure
occurred. PatchDiff:diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c
index d87a8ab51..365f9ab4d 100644
--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -1700,7 +1700,13 @@ static int gadgetfs_bind(struct usb_gadget *gadget,
 	return 0;
 
 enomem:
-	gadgetfs_unbind (gadget);
+	if (dev->req) {
+		usb_ep_free_request(gadget->ep0, dev->req);
+		dev->req = NULL;
+	}
+	gadget->ep0->driver_data = NULL;
+	dev->gadget = NULL;
+	set_gadget_data(gadget, NULL);
 	return -ENOMEM;
 }
 
 Recipients:[map[Email:brauner@kernel.org Name:Christian Brauner To:false] map[Email:gregkh@linuxfoundation.org Name:Greg Kroah-Hartman To:true] map[Email:jack@suse.cz Name:Jan Kara To:false] map[Email:kees@kernel.org Name:Kees Cook To:false] map[Email:linux-kernel@vger.kernel.org Name: To:false] map[Email:linux-usb@vger.kernel.org Name: To:true] map[Email:mjguzik@gmail.com Name:Mateusz Guzik To:false] map[Email:viro@zeniv.linux.org.uk Name:Al Viro To:false] map[Email:torvalds@ppc970.osdl.org Name:Linus Torvalds To:true]] ReportedBy:[] ReviewedBy:[] SuggestedBy:[] TestedBy:[]]

1/1 2026/08/07 05:35 action base-commit-picker
0m Results:
map[KernelBranch:master KernelCommit:075b74841bd0065a3bda3440873c747938e69b68 KernelRepo:git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git]

2/1 2026/08/07 05:35 action syz-repro-to-c-repro
0m Results:
map[SimplifiedCRepro:#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/syscall.h>
#include <stdint.h>
#include <stdbool.h>
#include <dirent.h>
#include <errno.h>
#include <sched.h>

void write_file(const char *path, const char *val) {
    int fd = open(path, O_WRONLY);
    if (fd < 0) {
        // We don't exit here because failslab might not be available in all kernels,
        // but we print the error.
        printf("[-] Failed to open %s: %s\n", path, strerror(errno));
        return;
    }
    if (write(fd, val, strlen(val)) < 0) {
        printf("[-] Failed to write to %s: %s\n", path, strerror(errno));
    }
    close(fd);
}

struct usb_config_descriptor {
    uint8_t  bLength;
    uint8_t  bDescriptorType;
    uint16_t wTotalLength;
    uint8_t  bNumInterfaces;
    uint8_t  bConfigurationValue;
    uint8_t  iConfiguration;
    uint8_t  bmAttributes;
    uint8_t  bMaxPower;
} __attribute__ ((packed));

struct usb_device_descriptor {
    uint8_t  bLength;
    uint8_t  bDescriptorType;
    uint16_t bcdUSB;
    uint8_t  bDeviceClass;
    uint8_t  bDeviceSubClass;
    uint8_t  bDeviceProtocol;
    uint8_t  bMaxPacketSize0;
    uint16_t idVendor;
    uint16_t idProduct;
    uint16_t bcdDevice;
    uint8_t  iManufacturer;
    uint8_t  iProduct;
    uint8_t  iSerialNumber;
    uint8_t  bNumConfigurations;
} __attribute__ ((packed));

struct config_data {
    uint32_t tag;
    struct usb_config_descriptor config;
    struct usb_device_descriptor device;
} __attribute__ ((packed));

void trigger_bug(int nth) {
    int res;

    res = unshare(CLONE_NEWNS);
    if (res < 0) {
        printf("[-] Failed to unshare: %s\n", strerror(errno));
        exit(1);
    }
    printf("[+] unshare successful.\n");

    res = mount(NULL, "/", NULL, MS_PRIVATE | MS_REC, NULL);
    if (res < 0) {
        printf("[-] Failed to mount / private: %s\n", strerror(errno));
        exit(1);
    }
    printf("[+] mount / private successful.\n");

    res = mkdir("/tmp/gadgetfs", 0777);
    if (res < 0 && errno != EEXIST) {
        printf("[-] Failed to mkdir /tmp/gadgetfs: %s\n", strerror(errno));
        exit(1);
    }
    printf("[+] mkdir /tmp/gadgetfs successful.\n");

    res = mount("gadgetfs", "/tmp/gadgetfs", "gadgetfs", 0, NULL);
    if (res < 0) {
        printf("[-] Failed to mount gadgetfs: %s\n", strerror(errno));
        exit(1);
    }
    printf("[+] mount gadgetfs successful.\n");

    char ep0_name[256] = {0};
    DIR *dir = opendir("/tmp/gadgetfs");
    if (!dir) {
        printf("[-] Failed to opendir /tmp/gadgetfs: %s\n", strerror(errno));
        exit(1);
    }
    printf("[+] opendir /tmp/gadgetfs successful.\n");

    struct dirent *ent;
    while ((ent = readdir(dir)) != NULL) {
        if (ent->d_name[0] != '.') {
            strncpy(ep0_name, ent->d_name, sizeof(ep0_name) - 1);
            break;
        }
    }
    closedir(dir);

    if (ep0_name[0] == '\0') {
        printf("[-] Failed to find ep0 file\n");
        umount("/tmp/gadgetfs");
        exit(1);
    }
    printf("[+] Found ep0 file: %s\n", ep0_name);

    char ep0_path[512];
    snprintf(ep0_path, sizeof(ep0_path), "/tmp/gadgetfs/%s", ep0_name);

    int fd = open(ep0_path, O_RDWR);
    if (fd < 0) {
        printf("[-] Failed to open %s: %s\n", ep0_path, strerror(errno));
        umount("/tmp/gadgetfs");
        exit(1);
    }
    printf("[+] open %s successful.\n", ep0_path);

    struct config_data data;
    memset(&data, 0, sizeof(data));
    data.tag = 0;

    data.config.bLength = 9;
    data.config.bDescriptorType = 2; // USB_DT_CONFIG
    data.config.wTotalLength = 9;
    data.config.bConfigurationValue = 1;
    data.config.bmAttributes = 0x80; // USB_CONFIG_ATT_ONE

    data.device.bLength = 18;
    data.device.bDescriptorType = 1; // USB_DT_DEVICE
    data.device.bNumConfigurations = 1;

    write_file("/sys/kernel/debug/failslab/ignore-gfp-wait", "N");
    write_file("/sys/kernel/debug/failslab/task-filter", "Y");
    write_file("/sys/kernel/debug/failslab/probability", "100");
    write_file("/sys/kernel/debug/failslab/times", "1");
    write_file("/proc/self/make-it-fail", "1");
    
    char nth_str[32];
    snprintf(nth_str, sizeof(nth_str), "%d", nth);
    char path[256];
    snprintf(path, sizeof(path), "/proc/self/task/%ld/fail-nth", syscall(SYS_gettid));
    write_file(path, nth_str);

    printf("[*] Triggering bug with fail-nth=%d...\n", nth);
    // Expected to fail due to fault injection
    if (write(fd, &data, sizeof(data)) < 0) {
        printf("[+] write to ep0 failed as expected (fault injection).\n");
    } else {
        printf("[-] write to ep0 succeeded (fault injection missed).\n");
    }

    write_file("/sys/kernel/debug/failslab/probability", "0");
    write_file("/sys/kernel/debug/failslab/times", "0");
    write_file("/proc/self/make-it-fail", "0");
    write_file(path, "0");

    res = close(fd);
    if (res < 0) {
        printf("[-] Failed to close fd: %s\n", strerror(errno));
    } else {
        printf("[+] close fd successful.\n");
    }
    
    res = umount("/tmp/gadgetfs");
    if (res < 0) {
        printf("[-] Failed to umount gadgetfs: %s\n", strerror(errno));
    } else {
        printf("[+] umount gadgetfs successful.\n");
    }
}

int main() {
    printf("[*] Starting bug reproduction...\n");
    
    int res = mount("debugfs", "/sys/kernel/debug", "debugfs", 0, NULL);
    if (res < 0 && errno != EBUSY) {
        printf("[-] Failed to mount debugfs: %s\n", strerror(errno));
    } else {
        printf("[+] debugfs mounted or already present.\n");
    }

    for (int i = 1; i <= 50; i++) {
        pid_t pid = fork();
        if (pid < 0) {
            printf("[-] Failed to fork: %s\n", strerror(errno));
            exit(1);
        }
        if (pid == 0) {
            trigger_bug(i);
            exit(0);
        }
        wait(NULL);
    }
    
    printf("[+] Bug reproduction finished.\n");
    return 0;
}
]

3/1 2026/08/07 05:35 action kernel-checkouter
0m Results:
map[KernelSrc:/app/workdir/cache/src/fda57abbaa89268f1be2087d652398a1a507dfa0]

4/1 2026/08/07 05:35 action kernel-builder
0m Results:
map[KernelObj:/app/workdir/cache/build/9514ae972f608b949e6f94b00f42cd8b515fc5bf]

5/1 2026/08/07 05:35 action crash-reproducer
1m Results:
map[OtherCrashReports:<nil> ReproducedBugTitle:KASAN: slab-use-after-free Write in gadgetfs_kill_sb ReproducedCrashReport:udc dummy_udc.0: failed to start USB Gadget filesystem: -12
gadgetfs gadget.0: probe with driver gadgetfs failed with error -12
gadgetfs: bound to dummy_udc driver
==================================================================
BUG: KASAN: slab-use-after-free in instrument_atomic_read_write include/linux/instrumented.h:112 [inline]
BUG: KASAN: slab-use-after-free in atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:400 [inline]
BUG: KASAN: slab-use-after-free in __refcount_sub_and_test include/linux/refcount.h:389 [inline]
BUG: KASAN: slab-use-after-free in __refcount_dec_and_test include/linux/refcount.h:432 [inline]
BUG: KASAN: slab-use-after-free in refcount_dec_and_test include/linux/refcount.h:450 [inline]
BUG: KASAN: slab-use-after-free in put_dev drivers/usb/gadget/legacy/inode.c:165 [inline]
BUG: KASAN: slab-use-after-free in gadgetfs_kill_sb+0x46/0x110 drivers/usb/gadget/legacy/inode.c:2104
Write of size 4 at addr ffff88811638c080 by task syz-executor169/5848

CPU: 0 UID: 0 PID: 5848 Comm: syz-executor169 Not tainted syzkaller #1 PREEMPT_{RT,(full)} 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 print_address_description+0x55/0x1e0 mm/kasan/report.c:378
 print_report+0x58/0x70 mm/kasan/report.c:482
 kasan_report+0x117/0x150 mm/kasan/report.c:595
 check_region_inline mm/kasan/generic.c:-1 [inline]
 kasan_check_range+0x264/0x2c0 mm/kasan/generic.c:200
 instrument_atomic_read_write include/linux/instrumented.h:112 [inline]
 atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:400 [inline]
 __refcount_sub_and_test include/linux/refcount.h:389 [inline]
 __refcount_dec_and_test include/linux/refcount.h:432 [inline]
 refcount_dec_and_test include/linux/refcount.h:450 [inline]
 put_dev drivers/usb/gadget/legacy/inode.c:165 [inline]
 gadgetfs_kill_sb+0x46/0x110 drivers/usb/gadget/legacy/inode.c:2104
 deactivate_locked_super+0xbc/0x130 fs/super.c:477
 cleanup_mnt+0x3d3/0x460 fs/namespace.c:1317
 task_work_run+0x1d9/0x270 kernel/task_work.c:233
 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
 __exit_to_user_mode_loop kernel/entry/common.c:70 [inline]
 exit_to_user_mode_loop+0x1fa/0x730 kernel/entry/common.c:101
 __exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline]
 syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:230 [inline]
 syscall_exit_to_user_mode include/linux/entry-common.h:318 [inline]
 do_syscall_64+0x353/0x580 arch/x86/entry/syscall_64.c:100
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f5f0e505027
Code: a2 c7 05 54 b0 08 00 00 00 00 00 eb 96 e8 a1 08 00 00 90 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 c7 c2 d8 ff ff ff f7 d8 64 89 02 b8
RSP: 002b:00007ffcdf2b0288 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6
RAX: 0000000000000000 RBX: 0000000000000003 RCX: 00007f5f0e505027
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00007f5f0e55f05e
RBP: 00007f5f0e55f05e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f5f0e55f623
R13: 00007ffcdf2b03e0 R14: 00007f5f0e561510 R15: 00007f5f0e5614e8
 </TASK>

Allocated by task 5848:
 kasan_save_stack mm/kasan/common.c:57 [inline]
 kasan_save_track+0x3e/0x80 mm/kasan/common.c:78
 poison_kmalloc_redzone mm/kasan/common.c:398 [inline]
 __kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:415
 kasan_kmalloc include/linux/kasan.h:263 [inline]
 __kmalloc_cache_noprof+0x3d2/0x6b0 mm/slub.c:5489
 _kmalloc_noprof include/linux/slab.h:988 [inline]
 _kzalloc_noprof include/linux/slab.h:1309 [inline]
 dev_new drivers/usb/gadget/legacy/inode.c:176 [inline]
 gadgetfs_fill_super+0x27b/0x7a0 drivers/usb/gadget/legacy/inode.c:2054
 vfs_get_super fs/super.c:1273 [inline]
 get_tree_single+0xc0/0x150 fs/super.c:1300
 vfs_get_tree+0x92/0x2a0 fs/super.c:1700
 fc_mount fs/namespace.c:1198 [inline]
 do_new_mount_fc fs/namespace.c:3765 [inline]
 do_new_mount+0x319/0xdc0 fs/namespace.c:3841
 do_mount fs/namespace.c:4174 [inline]
 __do_sys_mount fs/namespace.c:4390 [inline]
 __se_sys_mount+0x31d/0x420 fs/namespace.c:4367
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Freed by task 5848:
 kasan_save_stack mm/kasan/common.c:57 [inline]
 kasan_save_track+0x3e/0x80 mm/kasan/common.c:78
 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:584
 poison_slab_object mm/kasan/common.c:253 [inline]
 __kasan_slab_free+0x5c/0x80 mm/kasan/common.c:285
 kasan_slab_free include/linux/kasan.h:235 [inline]
 slab_free_hook mm/slub.c:2677 [inline]
 slab_free mm/slub.c:6377 [inline]
 kfree+0x1c5/0x6c0 mm/slub.c:6692
 put_dev drivers/usb/gadget/legacy/inode.c:169 [inline]
 dev_release+0x173/0x210 drivers/usb/gadget/legacy/inode.c:1215
 __fput+0x42a/0xa80 fs/file_table.c:512
 fput_close_sync+0x11f/0x240 fs/file_table.c:617
 __do_sys_close fs/open.c:1511 [inline]
 __se_sys_close fs/open.c:1496 [inline]
 __x64_sys_close+0x7e/0x110 fs/open.c:1496
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

The buggy address belongs to the object at ffff88811638c000
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 128 bytes inside of
 freed 1024-byte region [ffff88811638c000, ffff88811638c400)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff88811638d000 pfn:0x116388
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0x100000000000240(workingset|head|node=0|zone=2)
page_type: f5(slab)
raw: 0100000000000240 ffff888100041dc0 ffffea00044a8a10 ffffea00043da810
raw: ffff88811638d000 000000080010000f 00000000f5000000 0000000000000000
head: 0100000000000240 ffff888100041dc0 ffffea00044a8a10 ffffea00043da810
head: ffff88811638d000 000000080010000f 00000000f5000000 0000000000000000
head: 0100000000000003 fffffffffffffe01 00000000ffffffff 00000000ffffffff
head: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000008
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5581, tgid 5581 (syz-executor), ts 49160475111, free_ts 0
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x1f9/0x250 mm/page_alloc.c:1859
 prep_new_page mm/page_alloc.c:1867 [inline]
 get_page_from_freelist+0x262a/0x26a0 mm/page_alloc.c:3946
 __alloc_frozen_pages_noprof+0x18d/0x380 mm/page_alloc.c:5304
 alloc_slab_page mm/slub.c:3266 [inline]
 allocate_slab+0x79/0x5e0 mm/slub.c:3380
 new_slab mm/slub.c:3426 [inline]
 refill_objects+0x2d8/0x350 mm/slub.c:7310
 refill_sheaf mm/slub.c:2804 [inline]
 __pcs_replace_empty_main+0x330/0x690 mm/slub.c:4675
 alloc_from_pcs mm/slub.c:4773 [inline]
 slab_alloc_node mm/slub.c:4905 [inline]
 __kmalloc_cache_noprof+0x468/0x6b0 mm/slub.c:5485
 _kmalloc_noprof include/linux/slab.h:988 [inline]
 _kzalloc_noprof include/linux/slab.h:1309 [inline]
 rxrpc_service_prealloc+0x9f/0x130 net/rxrpc/call_accept.c:167
 rxrpc_listen+0x1b7/0x360 net/rxrpc/af_rxrpc.c:237
 afs_open_socket+0x2fa/0x3f0 fs/afs/rxrpc.c:107
 afs_net_init+0x6ce/0x8f0 fs/afs/main.c:116
 ops_init+0x35d/0x5d0 net/core/net_namespace.c:137
 setup_net+0x118/0x350 net/core/net_namespace.c:446
 copy_net_ns+0x4f9/0x720 net/core/net_namespace.c:579
 create_new_namespaces+0x3f0/0x6b0 kernel/nsproxy.c:132
 unshare_nsproxy_namespaces+0x149/0x190 kernel/nsproxy.c:234
page_owner free stack trace missing

Memory state around the buggy address:
 ffff88811638bf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88811638c000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88811638c080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff88811638c100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88811638c180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
 ReproducedFaultInjection:FAULT_INJECTION: forcing a failure.
name fail_usercopy, interval 1, probability 0, space 0, times 1
Call Trace:
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 fail_dump lib/fault-inject.c:73 [inline]
 should_fail_ex+0x467/0x600 lib/fault-inject.c:174
 _inline_copy_from_user include/linux/uaccess.h:170 [inline]
 _copy_from_user+0x2d/0xb0 lib/usercopy.c:18
 copy_from_user include/linux/uaccess.h:222 [inline]
 dev_config+0x2ab/0x12c0 drivers/usb/gadget/legacy/inode.c:1822
 vfs_write+0x29f/0xbb0 fs/read_write.c:685
 ksys_write+0x156/0x270 fs/read_write.c:739
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

FAULT_INJECTION: forcing a failure.
name fail_usercopy, interval 1, probability 0, space 0, times 0
Call Trace:
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 fail_dump lib/fault-inject.c:73 [inline]
 should_fail_ex+0x467/0x600 lib/fault-inject.c:174
 _inline_copy_from_user include/linux/uaccess.h:170 [inline]
 _copy_from_user+0x2d/0xb0 lib/usercopy.c:18
 copy_from_user include/linux/uaccess.h:222 [inline]
 memdup_user+0x5e/0xd0 mm/util.c:225
 dev_config+0x4d8/0x12c0 drivers/usb/gadget/legacy/inode.c:1829
 vfs_write+0x29f/0xbb0 fs/read_write.c:685
 ksys_write+0x156/0x270 fs/read_write.c:739
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

FAULT_INJECTION: forcing a failure.
name failslab, interval 1, probability 100, space 0, times 0
Call Trace:
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 fail_dump lib/fault-inject.c:73 [inline]
 should_fail_ex+0x467/0x600 lib/fault-inject.c:174
 should_failslab+0xa8/0x100 mm/failslab.c:46
 slab_pre_alloc_hook mm/slub.c:4539 [inline]
 slab_alloc_node mm/slub.c:4897 [inline]
 __kmalloc_cache_noprof+0xa0/0x6b0 mm/slub.c:5485
 _kmalloc_noprof include/linux/slab.h:988 [inline]
 _kzalloc_noprof include/linux/slab.h:1309 [inline]
 bus_add_driver+0x165/0x670 drivers/base/bus.c:747
 driver_register+0x23a/0x320 drivers/base/driver.c:174
 usb_gadget_register_driver_owner+0xf9/0x270 drivers/usb/gadget/udc/core.c:1752
 dev_config+0xe4e/0x12c0 drivers/usb/gadget/legacy/inode.c:1883
 vfs_write+0x29f/0xbb0 fs/read_write.c:685
 ksys_write+0x156/0x270 fs/read_write.c:739
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

FAULT_INJECTION: forcing a failure.
name failslab, interval 1, probability 100, space 0, times 0
Call Trace:
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 fail_dump lib/fault-inject.c:73 [inline]
 should_fail_ex+0x467/0x600 lib/fault-inject.c:174
 should_failslab+0xa8/0x100 mm/failslab.c:46
 slab_pre_alloc_hook mm/slub.c:4539 [inline]
 slab_alloc_node mm/slub.c:4897 [inline]
 kmem_cache_alloc_noprof+0xa4/0x650 mm/slub.c:4931
 __kernfs_new_node+0xe7/0xa70 fs/kernfs/dir.c:665
 kernfs_new_node fs/kernfs/dir.c:751 [inline]
 kernfs_create_dir_ns+0xfe/0x230 fs/kernfs/dir.c:1120
 sysfs_create_dir_ns+0x12f/0x2a0 fs/sysfs/dir.c:59
 create_dir lib/kobject.c:73 [inline]
 kobject_add_internal+0x62c/0xce0 lib/kobject.c:240
 kobject_add_varg lib/kobject.c:374 [inline]
 kobject_init_and_add+0x12b/0x1a0 lib/kobject.c:457
 bus_add_driver+0x258/0x670 drivers/base/bus.c:756
 driver_register+0x23a/0x320 drivers/base/driver.c:174
 usb_gadget_register_driver_owner+0xf9/0x270 drivers/usb/gadget/udc/core.c:1752
 dev_config+0xe4e/0x12c0 drivers/usb/gadget/legacy/inode.c:1883
 vfs_write+0x29f/0xbb0 fs/read_write.c:685
 ksys_write+0x156/0x270 fs/read_write.c:739
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

FAULT_INJECTION: forcing a failure.
name failslab, interval 1, probability 100, space 0, times 0
Call Trace:
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 fail_dump lib/fault-inject.c:73 [inline]
 should_fail_ex+0x467/0x600 lib/fault-inject.c:174
 should_failslab+0xa8/0x100 mm/failslab.c:46
 slab_pre_alloc_hook mm/slub.c:4539 [inline]
 slab_alloc_node mm/slub.c:4897 [inline]
 __do_kmalloc_node mm/slub.c:5333 [inline]
 __kmalloc_node_track_caller_noprof+0x102/0x7c0 mm/slub.c:5471
 __kmemdup_nul mm/util.c:64 [inline]
 kstrdup+0x42/0x100 mm/util.c:84
 __kernfs_new_node+0xac/0xa70 fs/kernfs/dir.c:661
 kernfs_new_node+0xea/0x140 fs/kernfs/dir.c:751
 kernfs_create_link+0xa7/0x200 fs/kernfs/symlink.c:39
 sysfs_do_create_link_sd+0x83/0x110 fs/sysfs/symlink.c:44
 driver_sysfs_add+0x89/0x210 drivers/base/dd.c:489
 really_probe+0x142/0xae0 drivers/base/dd.c:694
 __driver_probe_device+0x1e8/0x360 drivers/base/dd.c:868
 driver_probe_device+0x4f/0x240 drivers/base/dd.c:898
 __driver_attach+0x339/0x600 drivers/base/dd.c:1292
 bus_for_each_dev+0x23e/0x2c0 drivers/base/bus.c:383
 bus_add_driver+0x348/0x670 drivers/base/bus.c:763
 driver_register+0x23a/0x320 drivers/base/driver.c:174
 usb_gadget_register_driver_owner+0xf9/0x270 drivers/usb/gadget/udc/core.c:1752
 dev_config+0xe4e/0x12c0 drivers/usb/gadget/legacy/inode.c:1883
 vfs_write+0x29f/0xbb0 fs/read_write.c:685
 ksys_write+0x156/0x270 fs/read_write.c:739
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f]

6/1 2026/08/07 05:36 action codesearch-prepare
0m Results:
map[Index:codesearch-index]

7/1 2026/08/07 05:37 agent debugger
6m Model:
best-expensive

Instruction:
You are an experienced Linux kernel developer tasked with debugging a kernel crash root cause.
You need to provide a detailed explanation of the root cause for another developer to be
able to write a fix for the bug based on your explanation. Include all relevant details
into the response: function/struct/field/etc names, code snippets, line numbers,
macro/enum values, etc.



Don't make assumptions about the kernel source code (it may be different from what you assume it is).
Extensively use the provided code access tools (codesearch-*, git-*, grepper, etc)
to examine the actual source code, and confirm any assumptions.

Prefer calling several tools at the same time to save round-trips.

Prompt:
The crash is:

udc dummy_udc.0: failed to start USB Gadget filesystem: -12
gadgetfs gadget.0: probe with driver gadgetfs failed with error -12
gadgetfs: bound to dummy_udc driver
==================================================================
BUG: KASAN: slab-use-after-free in instrument_atomic_read_write include/linux/instrumented.h:112 [inline]
BUG: KASAN: slab-use-after-free in atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:400 [inline]
BUG: KASAN: slab-use-after-free in __refcount_sub_and_test include/linux/refcount.h:389 [inline]
BUG: KASAN: slab-use-after-free in __refcount_dec_and_test include/linux/refcount.h:432 [inline]
BUG: KASAN: slab-use-after-free in refcount_dec_and_test include/linux/refcount.h:450 [inline]
BUG: KASAN: slab-use-after-free in put_dev drivers/usb/gadget/legacy/inode.c:165 [inline]
BUG: KASAN: slab-use-after-free in gadgetfs_kill_sb+0x46/0x110 drivers/usb/gadget/legacy/inode.c:2104
Write of size 4 at addr ffff88811638c080 by task syz-executor169/5848

CPU: 0 UID: 0 PID: 5848 Comm: syz-executor169 Not tainted syzkaller #1 PREEMPT_{RT,(full)} 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 print_address_description+0x55/0x1e0 mm/kasan/report.c:378
 print_report+0x58/0x70 mm/kasan/report.c:482
 kasan_report+0x117/0x150 mm/kasan/report.c:595
 check_region_inline mm/kasan/generic.c:-1 [inline]
 kasan_check_range+0x264/0x2c0 mm/kasan/generic.c:200
 instrument_atomic_read_write include/linux/instrumented.h:112 [inline]
 atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:400 [inline]
 __refcount_sub_and_test include/linux/refcount.h:389 [inline]
 __refcount_dec_and_test include/linux/refcount.h:432 [inline]
 refcount_dec_and_test include/linux/refcount.h:450 [inline]
 put_dev drivers/usb/gadget/legacy/inode.c:165 [inline]
 gadgetfs_kill_sb+0x46/0x110 drivers/usb/gadget/legacy/inode.c:2104
 deactivate_locked_super+0xbc/0x130 fs/super.c:477
 cleanup_mnt+0x3d3/0x460 fs/namespace.c:1317
 task_work_run+0x1d9/0x270 kernel/task_work.c:233
 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
 __exit_to_user_mode_loop kernel/entry/common.c:70 [inline]
 exit_to_user_mode_loop+0x1fa/0x730 kernel/entry/common.c:101
 __exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline]
 syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:230 [inline]
 syscall_exit_to_user_mode include/linux/entry-common.h:318 [inline]
 do_syscall_64+0x353/0x580 arch/x86/entry/syscall_64.c:100
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f5f0e505027
Code: a2 c7 05 54 b0 08 00 00 00 00 00 eb 96 e8 a1 08 00 00 90 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 c7 c2 d8 ff ff ff f7 d8 64 89 02 b8
RSP: 002b:00007ffcdf2b0288 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6
RAX: 0000000000000000 RBX: 0000000000000003 RCX: 00007f5f0e505027
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00007f5f0e55f05e
RBP: 00007f5f0e55f05e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f5f0e55f623
R13: 00007ffcdf2b03e0 R14: 00007f5f0e561510 R15: 00007f5f0e5614e8
 </TASK>

Allocated by task 5848:
 kasan_save_stack mm/kasan/common.c:57 [inline]
 kasan_save_track+0x3e/0x80 mm/kasan/common.c:78
 poison_kmalloc_redzone mm/kasan/common.c:398 [inline]
 __kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:415
 kasan_kmalloc include/linux/kasan.h:263 [inline]
 __kmalloc_cache_noprof+0x3d2/0x6b0 mm/slub.c:5489
 _kmalloc_noprof include/linux/slab.h:988 [inline]
 _kzalloc_noprof include/linux/slab.h:1309 [inline]
 dev_new drivers/usb/gadget/legacy/inode.c:176 [inline]
 gadgetfs_fill_super+0x27b/0x7a0 drivers/usb/gadget/legacy/inode.c:2054
 vfs_get_super fs/super.c:1273 [inline]
 get_tree_single+0xc0/0x150 fs/super.c:1300
 vfs_get_tree+0x92/0x2a0 fs/super.c:1700
 fc_mount fs/namespace.c:1198 [inline]
 do_new_mount_fc fs/namespace.c:3765 [inline]
 do_new_mount+0x319/0xdc0 fs/namespace.c:3841
 do_mount fs/namespace.c:4174 [inline]
 __do_sys_mount fs/namespace.c:4390 [inline]
 __se_sys_mount+0x31d/0x420 fs/namespace.c:4367
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Freed by task 5848:
 kasan_save_stack mm/kasan/common.c:57 [inline]
 kasan_save_track+0x3e/0x80 mm/kasan/common.c:78
 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:584
 poison_slab_object mm/kasan/common.c:253 [inline]
 __kasan_slab_free+0x5c/0x80 mm/kasan/common.c:285
 kasan_slab_free include/linux/kasan.h:235 [inline]
 slab_free_hook mm/slub.c:2677 [inline]
 slab_free mm/slub.c:6377 [inline]
 kfree+0x1c5/0x6c0 mm/slub.c:6692
 put_dev drivers/usb/gadget/legacy/inode.c:169 [inline]
 dev_release+0x173/0x210 drivers/usb/gadget/legacy/inode.c:1215
 __fput+0x42a/0xa80 fs/file_table.c:512
 fput_close_sync+0x11f/0x240 fs/file_table.c:617
 __do_sys_close fs/open.c:1511 [inline]
 __se_sys_close fs/open.c:1496 [inline]
 __x64_sys_close+0x7e/0x110 fs/open.c:1496
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

The buggy address belongs to the object at ffff88811638c000
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 128 bytes inside of
 freed 1024-byte region [ffff88811638c000, ffff88811638c400)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff88811638d000 pfn:0x116388
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0x100000000000240(workingset|head|node=0|zone=2)
page_type: f5(slab)
raw: 0100000000000240 ffff888100041dc0 ffffea00044a8a10 ffffea00043da810
raw: ffff88811638d000 000000080010000f 00000000f5000000 0000000000000000
head: 0100000000000240 ffff888100041dc0 ffffea00044a8a10 ffffea00043da810
head: ffff88811638d000 000000080010000f 00000000f5000000 0000000000000000
head: 0100000000000003 fffffffffffffe01 00000000ffffffff 00000000ffffffff
head: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000008
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5581, tgid 5581 (syz-executor), ts 49160475111, free_ts 0
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x1f9/0x250 mm/page_alloc.c:1859
 prep_new_page mm/page_alloc.c:1867 [inline]
 get_page_from_freelist+0x262a/0x26a0 mm/page_alloc.c:3946
 __alloc_frozen_pages_noprof+0x18d/0x380 mm/page_alloc.c:5304
 alloc_slab_page mm/slub.c:3266 [inline]
 allocate_slab+0x79/0x5e0 mm/slub.c:3380
 new_slab mm/slub.c:3426 [inline]
 refill_objects+0x2d8/0x350 mm/slub.c:7310
 refill_sheaf mm/slub.c:2804 [inline]
 __pcs_replace_empty_main+0x330/0x690 mm/slub.c:4675
 alloc_from_pcs mm/slub.c:4773 [inline]
 slab_alloc_node mm/slub.c:4905 [inline]
 __kmalloc_cache_noprof+0x468/0x6b0 mm/slub.c:5485
 _kmalloc_noprof include/linux/slab.h:988 [inline]
 _kzalloc_noprof include/linux/slab.h:1309 [inline]
 rxrpc_service_prealloc+0x9f/0x130 net/rxrpc/call_accept.c:167
 rxrpc_listen+0x1b7/0x360 net/rxrpc/af_rxrpc.c:237
 afs_open_socket+0x2fa/0x3f0 fs/afs/rxrpc.c:107
 afs_net_init+0x6ce/0x8f0 fs/afs/main.c:116
 ops_init+0x35d/0x5d0 net/core/net_namespace.c:137
 setup_net+0x118/0x350 net/core/net_namespace.c:446
 copy_net_ns+0x4f9/0x720 net/core/net_namespace.c:579
 create_new_namespaces+0x3f0/0x6b0 kernel/nsproxy.c:132
 unshare_nsproxy_namespaces+0x149/0x190 kernel/nsproxy.c:234
page_owner free stack trace missing

Memory state around the buggy address:
 ffff88811638bf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88811638c000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88811638c080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff88811638c100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88811638c180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


The following C code is a draft of the vulnerable syscall sequence. Keep in mind that
it may lack the precise threading, sandboxing, and some arguments of a working reproducer:

#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/syscall.h>
#include <stdint.h>
#include <stdbool.h>
#include <dirent.h>
#include <errno.h>
#include <sched.h>

void write_file(const char *path, const char *val) {
    int fd = open(path, O_WRONLY);
    if (fd < 0) {
        // We don't exit here because failslab might not be available in all kernels,
        // but we print the error.
        printf("[-] Failed to open %s: %s\n", path, strerror(errno));
        return;
    }
    if (write(fd, val, strlen(val)) < 0) {
        printf("[-] Failed to write to %s: %s\n", path, strerror(errno));
    }
    close(fd);
}

struct usb_config_descriptor {
    uint8_t  bLength;
    uint8_t  bDescriptorType;
    uint16_t wTotalLength;
    uint8_t  bNumInterfaces;
    uint8_t  bConfigurationValue;
    uint8_t  iConfiguration;
    uint8_t  bmAttributes;
    uint8_t  bMaxPower;
} __attribute__ ((packed));

struct usb_device_descriptor {
    uint8_t  bLength;
    uint8_t  bDescriptorType;
    uint16_t bcdUSB;
    uint8_t  bDeviceClass;
    uint8_t  bDeviceSubClass;
    uint8_t  bDeviceProtocol;
    uint8_t  bMaxPacketSize0;
    uint16_t idVendor;
    uint16_t idProduct;
    uint16_t bcdDevice;
    uint8_t  iManufacturer;
    uint8_t  iProduct;
    uint8_t  iSerialNumber;
    uint8_t  bNumConfigurations;
} __attribute__ ((packed));

struct config_data {
    uint32_t tag;
    struct usb_config_descriptor config;
    struct usb_device_descriptor device;
} __attribute__ ((packed));

void trigger_bug(int nth) {
    int res;

    res = unshare(CLONE_NEWNS);
    if (res < 0) {
        printf("[-] Failed to unshare: %s\n", strerror(errno));
        exit(1);
    }
    printf("[+] unshare successful.\n");

    res = mount(NULL, "/", NULL, MS_PRIVATE | MS_REC, NULL);
    if (res < 0) {
        printf("[-] Failed to mount / private: %s\n", strerror(errno));
        exit(1);
    }
    printf("[+] mount / private successful.\n");

    res = mkdir("/tmp/gadgetfs", 0777);
    if (res < 0 && errno != EEXIST) {
        printf("[-] Failed to mkdir /tmp/gadgetfs: %s\n", strerror(errno));
        exit(1);
    }
    printf("[+] mkdir /tmp/gadgetfs successful.\n");

    res = mount("gadgetfs", "/tmp/gadgetfs", "gadgetfs", 0, NULL);
    if (res < 0) {
        printf("[-] Failed to mount gadgetfs: %s\n", strerror(errno));
        exit(1);
    }
    printf("[+] mount gadgetfs successful.\n");

    char ep0_name[256] = {0};
    DIR *dir = opendir("/tmp/gadgetfs");
    if (!dir) {
        printf("[-] Failed to opendir /tmp/gadgetfs: %s\n", strerror(errno));
        exit(1);
    }
    printf("[+] opendir /tmp/gadgetfs successful.\n");

    struct dirent *ent;
    while ((ent = readdir(dir)) != NULL) {
        if (ent->d_name[0] != '.') {
            strncpy(ep0_name, ent->d_name, sizeof(ep0_name) - 1);
            break;
        }
    }
    closedir(dir);

    if (ep0_name[0] == '\0') {
        printf("[-] Failed to find ep0 file\n");
        umount("/tmp/gadgetfs");
        exit(1);
    }
    printf("[+] Found ep0 file: %s\n", ep0_name);

    char ep0_path[512];
    snprintf(ep0_path, sizeof(ep0_path), "/tmp/gadgetfs/%s", ep0_name);

    int fd = open(ep0_path, O_RDWR);
    if (fd < 0) {
        printf("[-] Failed to open %s: %s\n", ep0_path, strerror(errno));
        umount("/tmp/gadgetfs");
        exit(1);
    }
    printf("[+] open %s successful.\n", ep0_path);

    struct config_data data;
    memset(&data, 0, sizeof(data));
    data.tag = 0;

    data.config.bLength = 9;
    data.config.bDescriptorType = 2; // USB_DT_CONFIG
    data.config.wTotalLength = 9;
    data.config.bConfigurationValue = 1;
    data.config.bmAttributes = 0x80; // USB_CONFIG_ATT_ONE

    data.device.bLength = 18;
    data.device.bDescriptorType = 1; // USB_DT_DEVICE
    data.device.bNumConfigurations = 1;

    write_file("/sys/kernel/debug/failslab/ignore-gfp-wait", "N");
    write_file("/sys/kernel/debug/failslab/task-filter", "Y");
    write_file("/sys/kernel/debug/failslab/probability", "100");
    write_file("/sys/kernel/debug/failslab/times", "1");
    write_file("/proc/self/make-it-fail", "1");
    
    char nth_str[32];
    snprintf(nth_str, sizeof(nth_str), "%d", nth);
    char path[256];
    snprintf(path, sizeof(path), "/proc/self/task/%ld/fail-nth", syscall(SYS_gettid));
    write_file(path, nth_str);

    printf("[*] Triggering bug with fail-nth=%d...\n", nth);
    // Expected to fail due to fault injection
    if (write(fd, &data, sizeof(data)) < 0) {
        printf("[+] write to ep0 failed as expected (fault injection).\n");
    } else {
        printf("[-] write to ep0 succeeded (fault injection missed).\n");
    }

    write_file("/sys/kernel/debug/failslab/probability", "0");
    write_file("/sys/kernel/debug/failslab/times", "0");
    write_file("/proc/self/make-it-fail", "0");
    write_file(path, "0");

    res = close(fd);
    if (res < 0) {
        printf("[-] Failed to close fd: %s\n", strerror(errno));
    } else {
        printf("[+] close fd successful.\n");
    }
    
    res = umount("/tmp/gadgetfs");
    if (res < 0) {
        printf("[-] Failed to umount gadgetfs: %s\n", strerror(errno));
    } else {
        printf("[+] umount gadgetfs successful.\n");
    }
}

int main() {
    printf("[*] Starting bug reproduction...\n");
    
    int res = mount("debugfs", "/sys/kernel/debug", "debugfs", 0, NULL);
    if (res < 0 && errno != EBUSY) {
        printf("[-] Failed to mount debugfs: %s\n", strerror(errno));
    } else {
        printf("[+] debugfs mounted or already present.\n");
    }

    for (int i = 1; i <= 50; i++) {
        pid_t pid = fork();
        if (pid < 0) {
            printf("[-] Failed to fork: %s\n", strerror(errno));
            exit(1);
        }
        if (pid == 0) {
            trigger_bug(i);
            exit(0);
        }
        wait(NULL);
    }
    
    printf("[+] Bug reproduction finished.\n");
    return 0;
}




The reproducer uses fault injection to force allocation failure at a specific point.
These injected failures often exercise rarely used error-handling paths,
so the bug is frequently in that error handling.
The following fault injection report(s) show what was injected:

FAULT_INJECTION: forcing a failure.
name fail_usercopy, interval 1, probability 0, space 0, times 1
Call Trace:
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 fail_dump lib/fault-inject.c:73 [inline]
 should_fail_ex+0x467/0x600 lib/fault-inject.c:174
 _inline_copy_from_user include/linux/uaccess.h:170 [inline]
 _copy_from_user+0x2d/0xb0 lib/usercopy.c:18
 copy_from_user include/linux/uaccess.h:222 [inline]
 dev_config+0x2ab/0x12c0 drivers/usb/gadget/legacy/inode.c:1822
 vfs_write+0x29f/0xbb0 fs/read_write.c:685
 ksys_write+0x156/0x270 fs/read_write.c:739
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

FAULT_INJECTION: forcing a failure.
name fail_usercopy, interval 1, probability 0, space 0, times 0
Call Trace:
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 fail_dump lib/fault-inject.c:73 [inline]
 should_fail_ex+0x467/0x600 lib/fault-inject.c:174
 _inline_copy_from_user include/linux/uaccess.h:170 [inline]
 _copy_from_user+0x2d/0xb0 lib/usercopy.c:18
 copy_from_user include/linux/uaccess.h:222 [inline]
 memdup_user+0x5e/0xd0 mm/util.c:225
 dev_config+0x4d8/0x12c0 drivers/usb/gadget/legacy/inode.c:1829
 vfs_write+0x29f/0xbb0 fs/read_write.c:685
 ksys_write+0x156/0x270 fs/read_write.c:739
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

FAULT_INJECTION: forcing a failure.
name failslab, interval 1, probability 100, space 0, times 0
Call Trace:
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 fail_dump lib/fault-inject.c:73 [inline]
 should_fail_ex+0x467/0x600 lib/fault-inject.c:174
 should_failslab+0xa8/0x100 mm/failslab.c:46
 slab_pre_alloc_hook mm/slub.c:4539 [inline]
 slab_alloc_node mm/slub.c:4897 [inline]
 __kmalloc_cache_noprof+0xa0/0x6b0 mm/slub.c:5485
 _kmalloc_noprof include/linux/slab.h:988 [inline]
 _kzalloc_noprof include/linux/slab.h:1309 [inline]
 bus_add_driver+0x165/0x670 drivers/base/bus.c:747
 driver_register+0x23a/0x320 drivers/base/driver.c:174
 usb_gadget_register_driver_owner+0xf9/0x270 drivers/usb/gadget/udc/core.c:1752
 dev_config+0xe4e/0x12c0 drivers/usb/gadget/legacy/inode.c:1883
 vfs_write+0x29f/0xbb0 fs/read_write.c:685
 ksys_write+0x156/0x270 fs/read_write.c:739
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

FAULT_INJECTION: forcing a failure.
name failslab, interval 1, probability 100, space 0, times 0
Call Trace:
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 fail_dump lib/fault-inject.c:73 [inline]
 should_fail_ex+0x467/0x600 lib/fault-inject.c:174
 should_failslab+0xa8/0x100 mm/failslab.c:46
 slab_pre_alloc_hook mm/slub.c:4539 [inline]
 slab_alloc_node mm/slub.c:4897 [inline]
 kmem_cache_alloc_noprof+0xa4/0x650 mm/slub.c:4931
 __kernfs_new_node+0xe7/0xa70 fs/kernfs/dir.c:665
 kernfs_new_node fs/kernfs/dir.c:751 [inline]
 kernfs_create_dir_ns+0xfe/0x230 fs/kernfs/dir.c:1120
 sysfs_create_dir_ns+0x12f/0x2a0 fs/sysfs/dir.c:59
 create_dir lib/kobject.c:73 [inline]
 kobject_add_internal+0x62c/0xce0 lib/kobject.c:240
 kobject_add_varg lib/kobject.c:374 [inline]
 kobject_init_and_add+0x12b/0x1a0 lib/kobject.c:457
 bus_add_driver+0x258/0x670 drivers/base/bus.c:756
 driver_register+0x23a/0x320 drivers/base/driver.c:174
 usb_gadget_register_driver_owner+0xf9/0x270 drivers/usb/gadget/udc/core.c:1752
 dev_config+0xe4e/0x12c0 drivers/usb/gadget/legacy/inode.c:1883
 vfs_write+0x29f/0xbb0 fs/read_write.c:685
 ksys_write+0x156/0x270 fs/read_write.c:739
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

FAULT_INJECTION: forcing a failure.
name failslab, interval 1, probability 100, space 0, times 0
Call Trace:
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 fail_dump lib/fault-inject.c:73 [inline]
 should_fail_ex+0x467/0x600 lib/fault-inject.c:174
 should_failslab+0xa8/0x100 mm/failslab.c:46
 slab_pre_alloc_hook mm/slub.c:4539 [inline]
 slab_alloc_node mm/slub.c:4897 [inline]
 __do_kmalloc_node mm/slub.c:5333 [inline]
 __kmalloc_node_track_caller_noprof+0x102/0x7c0 mm/slub.c:5471
 __kmemdup_nul mm/util.c:64 [inline]
 kstrdup+0x42/0x100 mm/util.c:84
 __kernfs_new_node+0xac/0xa70 fs/kernfs/dir.c:661
 kernfs_new_node+0xea/0x140 fs/kernfs/dir.c:751
 kernfs_create_link+0xa7/0x200 fs/kernfs/symlink.c:39
 sysfs_do_create_link_sd+0x83/0x110 fs/sysfs/symlink.c:44
 driver_sysfs_add+0x89/0x210 drivers/base/dd.c:489
 really_probe+0x142/0xae0 drivers/base/dd.c:694
 __driver_probe_device+0x1e8/0x360 drivers/base/dd.c:868
 driver_probe_device+0x4f/0x240 drivers/base/dd.c:898
 __driver_attach+0x339/0x600 drivers/base/dd.c:1292
 bus_for_each_dev+0x23e/0x2c0 drivers/base/bus.c:383
 bus_add_driver+0x348/0x670 drivers/base/bus.c:763
 driver_register+0x23a/0x320 drivers/base/driver.c:174
 usb_gadget_register_driver_owner+0xf9/0x270 drivers/usb/gadget/udc/core.c:1752
 dev_config+0xe4e/0x12c0 drivers/usb/gadget/legacy/inode.c:1883
 vfs_write+0x29f/0xbb0 fs/read_write.c:685
 ksys_write+0x156/0x270 fs/read_write.c:739
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f


Reply:
The root cause of this KASAN slab-use-after-free is a reference count underflow in the error handling path of `gadgetfs_bind()`. 

When fault injection forces a memory allocation failure during the binding process, `gadgetfs_bind()` incorrectly calls `gadgetfs_unbind()`, which drops a reference to the device (`dev`) that was never actually taken.

### Detailed Sequence of Events

1. **Initialization and Open:**
   When the gadgetfs superblock is created, `dev_new()` allocates the `dev_data` structure (`dev`) and initializes its refcount to 1. When the user opens the `/tmp/gadgetfs/ep0` file, `gadget_dev_open()` is called, which increments the refcount to 2 via `get_dev(dev)`.

2. **Driver Registration and Binding:**
   The user writes configuration data to `ep0`, invoking `dev_config()`. This function calls `usb_gadget_register_driver(&gadgetfs_driver)`, which registers the driver and attempts to bind it to the UDC, eventually calling `gadgetfs_bind()`.

3. **Fault Injection and Refcount Underflow:**
   In `gadgetfs_bind()`, memory allocations are performed (e.g., `usb_ep_alloc_request()` or inside `activate_ep_files()`). If fault injection causes one of these to fail, the code jumps to the `enomem` label:
   ```c
   // drivers/usb/gadget/legacy/inode.c : gadgetfs_bind()
   
   	dev->req = usb_ep_alloc_request (gadget->ep0, GFP_KERNEL);
   	if (!dev->req)
   		goto enomem;
   ...
   	if (activate_ep_files (dev) < 0)
   		goto enomem;
   ...
   	get_dev (dev); // <--- Reference is only taken on SUCCESS
   	return 0;
   
   enomem:
   	gadgetfs_unbind (gadget);
   	return -ENOMEM;
   ```
   The `enomem` path calls `gadgetfs_unbind()`, which performs cleanup and unconditionally calls `put_dev(dev)`. Because `get_dev(dev)` is only called at the very end of `gadgetfs_bind()` on success, `gadgetfs_unbind()` drops a reference that was never acquired. The refcount incorrectly drops from 2 to 1.

4. **Probe Failure Ignored:**
   The `-ENOMEM` error propagates up to the driver core. However, `__driver_attach()` intentionally ignores probe failures and returns `0`. Because `gadgetfs_driver` does not set `match_existing_only = true`, `usb_gadget_register_driver_owner()` also returns `0` (success).

5. **Closing ep0 and Freeing:**
   Seeing a success return value, `dev_config()` sets `dev->gadget_registered = true`. 
   Later, the reproducer closes the `ep0` file descriptor, triggering `dev_release()`. `dev_release()` cleans up and calls `put_dev(dev)`. The refcount drops from 1 to 0, and `dev` is prematurely freed.

6. **The Use-After-Free:**
   Finally, the reproducer unmounts the filesystem, which invokes `gadgetfs_kill_sb()`. 
   ```c
   // drivers/usb/gadget/legacy/inode.c : gadgetfs_kill_sb()
   
   	if (the_device) {
   		put_dev (the_device); // <--- UAF here
   		the_device = NULL;
   	}
   ```
   `gadgetfs_kill_sb()` attempts to drop the initial reference by calling `put_dev(the_device)`. Since `the_device` points to the `dev` structure that was already freed in step 5, this triggers the KASAN slab-use-after-free.

### Suggested Fix

`gadgetfs_bind()` should not call `gadgetfs_unbind()` in its error path, as `gadgetfs_unbind()` is designed to tear down a fully bound gadget (and thus expects the extra reference to exist). Instead, `gadgetfs_bind()` should manually clean up the specific state it altered before the failure occurred.

```c
 enomem:
-	gadgetfs_unbind (gadget);
+	if (dev->req) {
+		usb_ep_free_request (gadget->ep0, dev->req);
+		dev->req = NULL;
+	}
+	gadget->ep0->driver_data = NULL;
+	set_gadget_data (gadget, NULL);
+	dev->gadget = NULL;
 	return -ENOMEM;
```
*(Note: `activate_ep_files()` already perfectly cleans up after itself on failure, so no additional teardown is needed for it in `gadgetfs_bind()`'s error path).*

8/2 2026/08/07 05:37 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 13029
							output: 39
							thoughts: 147
						

Thoughts:
**Analyzing a KASAN Slab-Use-After-Free in Gadgetfs**

Okay, so I'm looking at this KASAN slab-use-after-free bug that's popping up, specifically in the `gadgetfs_kill_sb` function.  It looks like the chain is: `gadgetfs_kill_sb` -> `put_dev` -> `refcount_dec_and_test`.  The crash itself occurs during a write operation to the `ep0` file within gadgetfs – interesting, I wonder what the context of that write is.

Digging a bit deeper, this write to the `ep0` file is handled by the `dev_config` function located in `drivers/usb/gadget/legacy/inode.c`. That's a key piece of information. Now, the freed object, the culprit of this whole use-after-free issue, was originally allocated in `dev_new` within `gadgetfs_fill_super`.  And then, the object is freed in `dev_release` which, if I recall correctly, is triggered when the associated file is closed.

Alright, so the freed object is being used after the file handle is closed, and that's the vulnerability. The crash happens when we write to the ep0 file, which is handled by dev_config.

Let's start by carefully examining that `drivers/usb/gadget/legacy/inode.c` file; that's where the heart of the issue is likely hiding. I need to trace the object's lifecycle and figure out where the refcount is going wrong and which paths are accessing the memory after `dev_release` has been called.



9/2 2026/08/07 05:37 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c Name:put_dev]

Results:
map[SourceCode: 163:	static void put_dev (struct dev_data *data)
 164:	{
 165:		if (likely (!refcount_dec_and_test (&data->count)))
 166:			return;
 167:		/* needs no more cleanup */
 168:		BUG_ON (waitqueue_active (&data->wait));
 169:		kfree (data);
 170:	}
 SourceFile:drivers/usb/gadget/legacy/inode.c]

10/2 2026/08/07 05:37 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 13726
							output: 43
							thoughts: 13
						

Thoughts:
Okay, let's dive into this. Here's my thought process on this:

**Analyzing `gadgetfs_kill_sb`**

Alright, the next thing on my plate is checking out `gadgetfs_kill_sb`. Let me mentally walk through what's likely happening here. Knowing the usual structure of filesystems, a `_kill_sb` function is probably responsible for unmounting a gadgetfs filesystem. I'm thinking about the standard shutdown sequence: freeing superblocks, detaching the filesystem from the mount point, and making sure everything is cleaned up properly so there aren't any lingering resources that could cause problems. I'll need to look at how this specifically handles the gadgetfs context. Are there specific gadget-related data structures that need special handling? Are there any device-specific considerations that impact this function? I'll be looking for potential race conditions or resource leaks. Let's see how well it's implemented. Time to delve into the code.



11/2 2026/08/07 05:37 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c Name:gadgetfs_kill_sb]

Results:
map[SourceCode:2098:	static void
2099:	gadgetfs_kill_sb (struct super_block *sb)
2100:	{
2101:		mutex_lock(&sb_mutex);
2102:		kill_anon_super (sb);
2103:		if (the_device) {
2104:			put_dev (the_device);
2105:			the_device = NULL;
2106:		}
2107:		kfree(CHIP);
2108:		CHIP = NULL;
2109:		mutex_unlock(&sb_mutex);
2110:	}
 SourceFile:drivers/usb/gadget/legacy/inode.c]

12/2 2026/08/07 05:37 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 14192
							output: 39
							thoughts: 9
						

Thoughts:
Okay, here's my attempt at summarizing that thought process, keeping in mind I'm speaking to a fellow expert:

**Checking the Release Pipeline**

Alright, let's just get straight to it. First things first, I need to take a look at `dev_release`. No need to beat around the bush; I've got a specific purpose. I need to take a quick peek at the pipeline to assess its current state. I need to make sure everything looks as expected before I move on.



13/2 2026/08/07 05:37 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c Name:dev_release]

Results:
map[SourceCode:1190:	static int
1191:	dev_release (struct inode *inode, struct file *fd)
1192:	{
1193:		struct dev_data		*dev = fd->private_data;
1194:	
1195:		/* closing ep0 === shutdown all */
1196:	
1197:		if (dev->gadget_registered) {
1198:			usb_gadget_unregister_driver (&gadgetfs_driver);
1199:			dev->gadget_registered = false;
1200:		}
1201:	
1202:		/* at this point "good" hardware has disconnected the
1203:		 * device from USB; the host won't see it any more.
1204:		 * alternatively, all host requests will time out.
1205:		 */
1206:	
1207:		kfree (dev->buf);
1208:		dev->buf = NULL;
1209:	
1210:		/* other endpoints were all decoupled from this device */
1211:		spin_lock_irq(&dev->lock);
1212:		dev->state = STATE_DEV_DISABLED;
1213:		spin_unlock_irq(&dev->lock);
1214:	
1215:		put_dev (dev);
1216:		return 0;
1217:	}
 SourceFile:drivers/usb/gadget/legacy/inode.c]

14/2 2026/08/07 05:37 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 14755
							output: 39
							thoughts: 9
						

Thoughts:
Okay, here's my interpretation of that thought process, tailored for an expert audience, and written in the first person:

**Initial Assessment: A Focused Examination**

Alright, the directive is clear. My immediate instinct, given the context, is to zero in on `dev_new`. It's likely a branch, directory, or perhaps even a specific configuration file related to a development environment. Based on the naming convention it is also likely that this is new and so needs special consideration. The fact that this is the first thing referenced suggests a critical task is about to occur.

My primary concern now is to determine the scope and nature of the evaluation required in this case and to determine the current state of `dev_new`.



15/2 2026/08/07 05:37 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c Name:dev_new]

Results:
map[SourceCode: 172:	static struct dev_data *dev_new (void)
 173:	{
 174:		struct dev_data		*dev;
 175:	
 176:		dev = kzalloc_obj(*dev);
 177:		if (!dev)
 178:			return NULL;
 179:		dev->state = STATE_DEV_DISABLED;
 180:		refcount_set (&dev->count, 1);
 181:		spin_lock_init (&dev->lock);
 182:		INIT_LIST_HEAD (&dev->epfiles);
 183:		init_waitqueue_head (&dev->wait);
 184:		return dev;
 185:	}
 SourceFile:drivers/usb/gadget/legacy/inode.c]

16/2 2026/08/07 05:37 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 15182
							output: 43
							thoughts: 13
						

Thoughts:
Okay, let's dive into this. Here's my thought process on this:

**Analyzing `gadgetfs_fill_super`**

Alright, the objective is pretty clear. I need to take a look at the function `gadgetfs_fill_super`. It's a standard practice whenever I'm dealing with file system internals. My experience tells me that this function is going to be the heart of initializing the gadgetfs file system. It's the point where the kernel sets up the superblock, root inode, and generally gets the file system ready to handle I/O requests.

I'm expecting to see calls to `sget` or similar functions to get the `super_block` structure, initializing the file system type, setting up filesystem-specific data, creating the root inode with `new_inode` or its equivalent, and linking it to the `super_block`. Depending on the design, I might find checks for options passed during mount, perhaps some locking mechanisms, and probably error handling throughout. Understanding the sequence of operations here is crucial for comprehending how the file system's structure is built. I'll need to pay close attention to the data structures involved, the allocations being done, and how the kernel is setting up the overall framework. Essentially, it's about making sure everything is in place to provide a usable file system interface to the userspace.



17/2 2026/08/07 05:37 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c Name:gadgetfs_fill_super]

Results:
map[SourceCode:2014:	static int
2015:	gadgetfs_fill_super (struct super_block *sb, struct fs_context *fc)
2016:	{
2017:		struct inode	*inode;
2018:		struct dev_data	*dev;
2019:		int		rc;
2020:	
2021:		mutex_lock(&sb_mutex);
2022:	
2023:		if (the_device) {
2024:			rc = -ESRCH;
2025:			goto Done;
2026:		}
2027:	
2028:		CHIP = usb_get_gadget_udc_name();
2029:		if (!CHIP) {
2030:			rc = -ENODEV;
2031:			goto Done;
2032:		}
2033:	
2034:		/* superblock */
2035:		sb->s_blocksize = PAGE_SIZE;
2036:		sb->s_blocksize_bits = PAGE_SHIFT;
2037:		sb->s_magic = GADGETFS_MAGIC;
2038:		sb->s_op = &gadget_fs_operations;
2039:		sb->s_time_gran = 1;
2040:	
2041:		/* root inode */
2042:		inode = gadgetfs_make_inode (sb,
2043:				NULL, &simple_dir_operations,
2044:				S_IFDIR | S_IRUGO | S_IXUGO);
2045:		if (!inode)
2046:			goto Enomem;
2047:		inode->i_op = &simple_dir_inode_operations;
2048:		if (!(sb->s_root = d_make_root (inode)))
2049:			goto Enomem;
2050:	
2051:		/* the ep0 file is named after the controller we expect;
2052:		 * user mode code can use it for sanity checks, like we do.
2053:		 */
2054:		dev = dev_new ();
2055:		if (!dev)
2056:			goto Enomem;
2057:	
2058:		dev->sb = sb;
2059:		rc = gadgetfs_create_file(sb, CHIP, dev, &ep0_operations);
2060:		if (rc) {
2061:			put_dev(dev);
2062:			goto Enomem;
2063:		}
2064:	
2065:		/* other endpoint files are available after hardware setup,
2066:		 * from binding to a controller.
2067:		 */
2068:		the_device = dev;
2069:		rc = 0;
2070:		goto Done;
2071:	
2072:	 Enomem:
2073:		kfree(CHIP);
2074:		CHIP = NULL;
2075:		rc = -ENOMEM;
2076:	
2077:	 Done:
2078:		mutex_unlock(&sb_mutex);
2079:		return rc;
2080:	}
 SourceFile:drivers/usb/gadget/legacy/inode.c]

18/2 2026/08/07 05:37 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 16441
							output: 43
							thoughts: 111
						

Thoughts:
**Analyzing the Device Structure and Inode Creation**

Okay, so I'm looking at this code, and the first thing that jumps out is that `the_device` is a global variable. Interesting. It's a `static struct dev_data *`, so it's only visible within this compilation unit. Good, keeps things somewhat localized. Let me trace how it's used.

Right, `gadgetfs_fill_super` is where it gets initialized. It calls `dev_new()`, which presumably allocates and sets up the device data, and then *crucially* assigns `the_device = dev`. So, the newly created device data is accessible globally through `the_device`. I assume the refcount is set to 1 after the call to `dev_new()`. Seems standard so far.

Now, the concern. `gadgetfs_create_file`. This function's purpose is clear: to create the inode and dentry for `CHIP`, which I assume is a pre-defined device. But... does it take a reference? I need to know *if* and *how* `gadgetfs_create_file` handles the reference counting for `the_device` or the newly created device. Does it increment the refcount of `the_device`? If not, we're in trouble – we'll have a race. If it *does* take a reference, we need to understand the corresponding release path. Understanding the refcounting is key here. That's the crux of the issue; I need to verify that the device's lifecycle is correctly managed.



19/2 2026/08/07 05:37 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c Name:gadgetfs_create_file]

Results:
map[SourceCode:1983:	/* creates in fs root directory, so non-renamable and non-linkable.
1984:	 * so inode and dentry are paired, until device reconfig.
1985:	 */
1986:	static int gadgetfs_create_file (struct super_block *sb, char const *name,
1987:			void *data, const struct file_operations *fops)
1988:	{
1989:		struct dentry	*dentry;
1990:		struct inode	*inode;
1991:	
1992:		inode = gadgetfs_make_inode (sb, data, fops,
1993:				S_IFREG | (default_perm & S_IRWXUGO));
1994:		if (!inode)
1995:			return -ENOMEM;
1996:	
1997:		dentry = simple_start_creating(sb->s_root, name);
1998:		if (IS_ERR(dentry)) {
1999:			iput(inode);
2000:			return PTR_ERR(dentry);
2001:		}
2002:	
2003:		d_make_persistent(dentry, inode);
2004:	
2005:		simple_done_creating(dentry);
2006:		return 0;
2007:	}
 SourceFile:drivers/usb/gadget/legacy/inode.c]

20/2 2026/08/07 05:37 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 17338
							output: 43
							thoughts: 29
						

Thoughts:
Here's my understanding of the situation, tailored for an expert like yourself:

**Analyzing the `gadgetfs_create_file` Process**

Okay, so I'm looking at `gadgetfs_create_file`. The key thing here is that it’s passing the `data` pointer – which I recognize as `dev` in this context, right? – straight into `gadgetfs_make_inode`. This immediately flags a couple of thoughts. Firstly, I have to consider the implications of passing `dev` (likely device-specific information, or perhaps some sort of context related to the gadget itself) directly into the inode creation function. Is `gadgetfs_make_inode` designed to handle this directly, or is it a bit of a shortcut?

Is this the typical pattern, or is it an instance of implicit state management? Does it have implications for concurrency?

I need to confirm if that direct transfer is intentional or if there is something specific about `dev`, perhaps an internal representation used in the inode, that `gadgetfs_make_inode` needs to correctly initialize the inode. I'll need to dig into the source of `gadgetfs_make_inode` and see how it's actually using the `data` pointer to fully understand the design and any potential risks, especially in a concurrent environment where multiple devices might be interacting. Is `dev` properly protected? Are there mutexes or other synchronization primitives in place?



21/2 2026/08/07 05:37 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c Name:gadgetfs_make_inode]

Results:
map[SourceCode:1964:	static struct inode *
1965:	gadgetfs_make_inode (struct super_block *sb,
1966:			void *data, const struct file_operations *fops,
1967:			int mode)
1968:	{
1969:		struct inode *inode = new_inode (sb);
1970:	
1971:		if (inode) {
1972:			inode->i_ino = get_next_ino();
1973:			inode->i_mode = mode;
1974:			inode->i_uid = make_kuid(&init_user_ns, default_uid);
1975:			inode->i_gid = make_kgid(&init_user_ns, default_gid);
1976:			simple_inode_init_ts(inode);
1977:			inode->i_private = data;
1978:			inode->i_fop = fops;
1979:		}
1980:		return inode;
1981:	}
 SourceFile:drivers/usb/gadget/legacy/inode.c]

22/2 2026/08/07 05:37 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 18024
							output: 40
							thoughts: 50
						

Thoughts:
Okay, here's my interpretation of those thoughts, tailored for an expert audience, as if they were my own mental process:

**Diving Deep into `gadgetfs_make_inode`**

Alright, hold on a second. I'm focusing on `gadgetfs_make_inode` here, and something's just pinging my radar. It doesn't appear that this function takes a reference to the `dev` struct, right? That's immediately crucial. If that's the case, and I'm pretty sure it's the case, then at that point, `dev` would have a reference count of 1. Okay, that's important to bear in mind. Later, when we start talking about the `ep0` file being opened, and the associated operations, we'll see that `ep0_operations` are used. This all is related to how the endpoints and the device itself are managed.



23/2 2026/08/07 05:37 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c Name:ep0_operations]

Results:
map[SourceCode:1931:	static const struct file_operations ep0_operations = {
1932:	
1933:		.open =		gadget_dev_open,
1934:		.read =		ep0_read,
1935:		.write =	dev_config,
1936:		.fasync =	ep0_fasync,
1937:		.poll =		ep0_poll,
1938:		.unlocked_ioctl = gadget_dev_ioctl,
1939:		.release =	dev_release,
1940:	};
 SourceFile:drivers/usb/gadget/legacy/inode.c]

24/2 2026/08/07 05:37 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 18500
							output: 42
							thoughts: 12
						

Thoughts:
Okay, let's dive into this. Here's my take on those thoughts, as if they're my own:

**Analyzing `gadget_dev_open`**

Alright, `gadget_dev_open`... that immediately suggests we're dealing with device driver code, specifically within a "gadget" framework. My initial thought process involves a few key areas:

*   **Context:** What kind of "gadget" are we talking about? USB? Something else? The specific context drastically changes my interpretation. I need to figure out the environment.
*   **Purpose:** The name itself strongly indicates the opening of a device file. But why is this relevant? Is it for configuration? Data transfer? Debugging? Knowing the use-case is vital to understanding the implications.
*   **Abstraction Layer:** The term "gadget" makes me think it's likely a relatively high-level abstraction. I want to look into how far removed from the hardware this function is, and consider how to interface it.
*   **Error Handling:** "Open" functions are notorious for error handling. I'll need to immediately think about what errors can occur and what the function is expected to do in each case. Bad arguments, resource exhaustion, hardware failures... I want to see if this function handles them well. I'm looking for robustness.
*   **Concurrency:** Is this function thread-safe? Does it need synchronization? If multiple users can call this concurrently, that opens up a whole can of worms.
*   **Resource Management:** What resources does this function allocate? File descriptors, memory, locks? Proper cleanup is crucial, so I want to understand how the resources are managed, particularly on close or when errors occur.
*   **Security:** Device drivers are a common attack surface. So, I need to look for any potential security vulnerabilities, such as privilege escalation or data exposure. Input validation, proper access control, and preventing race conditions are all things I'll be looking out for.

Ultimately, I need to quickly get a sense of its place within the broader system. I will start by seeing how it's called and by what, and what it does internally.



25/2 2026/08/07 05:37 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c Name:gadget_dev_open]

Results:
map[SourceCode:1913:	static int
1914:	gadget_dev_open (struct inode *inode, struct file *fd)
1915:	{
1916:		struct dev_data		*dev = inode->i_private;
1917:		int			value = -EBUSY;
1918:	
1919:		spin_lock_irq(&dev->lock);
1920:		if (dev->state == STATE_DEV_DISABLED) {
1921:			dev->ev_next = 0;
1922:			dev->state = STATE_DEV_OPENED;
1923:			fd->private_data = dev;
1924:			get_dev (dev);
1925:			value = 0;
1926:		}
1927:		spin_unlock_irq(&dev->lock);
1928:		return value;
1929:	}
 SourceFile:drivers/usb/gadget/legacy/inode.c]

26/2 2026/08/07 05:37 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 19289
							output: 39
							thoughts: 175
						

Thoughts:
**Debugging a UAF in gadgetfs_kill_sb**

Okay, let's break this down. `gadget_dev_open` kicks things off by calling `get_dev(dev)`, which bumps the reference count to 2, as expected. Then, when `ep0` closes, `dev_release` is invoked, and that in turn calls `put_dev(dev)`, which decrements the refcount to 1. So far, so good. Everything seems logical.

Now, here's where things get interesting. The UAF is in `gadgetfs_kill_sb`, specifically when it calls `put_dev(the_device)`. The implication is that `the_device` has *already* been freed before `gadgetfs_kill_sb` even gets around to calling `put_dev`. How is that possible? Something is clearly wrong with the device lifecycle management. We've got a classic use-after-free scenario. The device should still be alive until `gadgetfs_kill_sb` has run. But apparently, something freed it before. We need to identify the code path that might be doing this. Let's delve into the `dev_config` structure and its handling.



27/2 2026/08/07 05:37 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c Name:dev_config]

Results:
map[SourceCode:1800:	static ssize_t
1801:	dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
1802:	{
1803:		struct dev_data		*dev = fd->private_data;
1804:		ssize_t			value, length = len;
1805:		unsigned		total;
1806:		u32			tag;
1807:		char			*kbuf;
1808:	
1809:		spin_lock_irq(&dev->lock);
1810:		if (dev->state > STATE_DEV_OPENED) {
1811:			value = ep0_write(fd, buf, len, ptr);
1812:			spin_unlock_irq(&dev->lock);
1813:			return value;
1814:		}
1815:		spin_unlock_irq(&dev->lock);
1816:	
1817:		if ((len < (USB_DT_CONFIG_SIZE + USB_DT_DEVICE_SIZE + 4)) ||
1818:		    (len > PAGE_SIZE * 4))
1819:			return -EINVAL;
1820:	
1821:		/* we might need to change message format someday */
1822:		if (copy_from_user (&tag, buf, 4))
1823:			return -EFAULT;
1824:		if (tag != 0)
1825:			return -EINVAL;
1826:		buf += 4;
1827:		length -= 4;
1828:	
1829:		kbuf = memdup_user(buf, length);
1830:		if (IS_ERR(kbuf))
1831:			return PTR_ERR(kbuf);
1832:	
1833:		spin_lock_irq (&dev->lock);
1834:		value = -EINVAL;
1835:		if (dev->buf) {
1836:			spin_unlock_irq(&dev->lock);
1837:			kfree(kbuf);
1838:			return value;
1839:		}
1840:		dev->buf = kbuf;
1841:	
1842:		/* full or low speed config */
1843:		dev->config = (void *) kbuf;
1844:		total = le16_to_cpu(dev->config->wTotalLength);
1845:		if (!is_valid_config(dev->config, total) ||
1846:				total > length - USB_DT_DEVICE_SIZE)
1847:			goto fail;
1848:		kbuf += total;
1849:		length -= total;
1850:	
1851:		/* optional high speed config */
1852:		if (kbuf [1] == USB_DT_CONFIG) {
1853:			dev->hs_config = (void *) kbuf;
1854:			total = le16_to_cpu(dev->hs_config->wTotalLength);
1855:			if (!is_valid_config(dev->hs_config, total) ||
1856:					total > length - USB_DT_DEVICE_SIZE)
1857:				goto fail;
1858:			kbuf += total;
1859:			length -= total;
1860:		} else {
1861:			dev->hs_config = NULL;
1862:		}
1863:	
1864:		/* could support multiple configs, using another encoding! */
1865:	
1866:		/* device descriptor (tweaked for paranoia) */
1867:		if (length != USB_DT_DEVICE_SIZE)
1868:			goto fail;
1869:		dev->dev = (void *)kbuf;
1870:		if (dev->dev->bLength != USB_DT_DEVICE_SIZE
1871:				|| dev->dev->bDescriptorType != USB_DT_DEVICE
1872:				|| dev->dev->bNumConfigurations != 1)
1873:			goto fail;
1874:		dev->dev->bcdUSB = cpu_to_le16 (0x0200);
1875:	
1876:		/* triggers gadgetfs_bind(); then we can enumerate. */
1877:		spin_unlock_irq (&dev->lock);
1878:		if (dev->hs_config)
1879:			gadgetfs_driver.max_speed = USB_SPEED_HIGH;
1880:		else
1881:			gadgetfs_driver.max_speed = USB_SPEED_FULL;
1882:	
1883:		value = usb_gadget_register_driver(&gadgetfs_driver);
1884:		if (value != 0) {
1885:			spin_lock_irq(&dev->lock);
1886:			goto fail;
1887:		} else {
1888:			/* at this point "good" hardware has for the first time
1889:			 * let the USB the host see us.  alternatively, if users
1890:			 * unplug/replug that will clear all the error state.
1891:			 *
1892:			 * note:  everything running before here was guaranteed
1893:			 * to choke driver model style diagnostics.  from here
1894:			 * on, they can work ... except in cleanup paths that
1895:			 * kick in after the ep0 descriptor is closed.
1896:			 */
1897:			value = len;
1898:			dev->gadget_registered = true;
1899:		}
1900:		return value;
1901:	
1902:	fail:
1903:		dev->config = NULL;
1904:		dev->hs_config = NULL;
1905:		dev->dev = NULL;
1906:		spin_unlock_irq (&dev->lock);
1907:		pr_debug ("%s: %s fail %zd, %p\n", shortname, __func__, value, dev);
1908:		kfree (dev->buf);
1909:		dev->buf = NULL;
1910:		return value;
1911:	}
 SourceFile:drivers/usb/gadget/legacy/inode.c]

28/2 2026/08/07 05:37 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 21481
							output: 41
							thoughts: 525
						

Thoughts:
**Analyzing a Potential USB Gadget Driver Failure**

Okay, so I'm looking at this `dev_config` function and the way it handles `usb_gadget_register_driver`. My first thought is: "Wait, this *can* fail, can't it?" And if it fails, it branches to `fail` and returns `value`, which represents the error code. The question then becomes, does `usb_gadget_register_driver` actually free `dev` if it fails? No, it doesn't.

Now, I'm reviewing this fault injection report. It indicates that the system is being forced to fail, presumably during memory allocation. The call trace reveals the error is happening within `usb_gadget_register_driver_owner`, and further down the stack, specifically within `__kmalloc_cache_noprof` and eventually in slab allocation. This implies a potential memory allocation issue, specifically within the driver registration process. So, it looks like if `usb_gadget_register_driver` fails, then `dev_config` returns an error, and the failure is linked to a slab allocation issue.

The next question I ask myself is: If `usb_gadget_register_driver` fails, does it unregister `gadgetfs_driver`? Looking at the code, it does not. The `gadgetfs_driver` itself stays registered. And wait, I have to remember that `gadgetfs_driver` is a global variable. This could have some important implications for resource management in an error scenario. This whole thing makes me realize I need to dive deeper into this error path, especially around memory allocation, and the overall reliability of the `dev_config` function. I will need to verify whether the global nature of `gadgetfs_driver` has an impact on the error recovery.



29/2 2026/08/07 05:37 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c Name:gadgetfs_driver]

Results:
map[SourceCode:1746:	static struct usb_gadget_driver gadgetfs_driver = {
1747:		.function	= (char *) driver_desc,
1748:		.bind		= gadgetfs_bind,
1749:		.unbind		= gadgetfs_unbind,
1750:		.setup		= gadgetfs_setup,
1751:		.reset		= gadgetfs_disconnect,
1752:		.disconnect	= gadgetfs_disconnect,
1753:		.suspend	= gadgetfs_suspend,
1754:	
1755:		.driver	= {
1756:			.name		= shortname,
1757:		},
1758:	};
 SourceFile:drivers/usb/gadget/legacy/inode.c]

30/2 2026/08/07 05:37 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 22659
							output: 47
							thoughts: 196
						

Thoughts:
**Analyzing Gadget Driver Registration and Unregistration**

Okay, so I'm tracing the logic around the `gadgetfs_driver` registration and unregistration, and I need to be absolutely sure I'm not overlooking anything. The core assumption here is that if `usb_gadget_register_driver` fails, the `gadgetfs_driver` isn't registered. That's a given. However, the sequence of events is what's critical.

My first thought: what happens if `gadgetfs_driver` registers successfully, *then* we hit a failure when `ep0` is closed? Ah, then `dev_release` gets called, and this block of code is executed:

```c
	if (dev->gadget_registered) {
		usb_gadget_unregister_driver (&gadgetfs_driver);
		dev->gadget_registered = false;
	}
```

Okay, makes sense. But, if `usb_gadget_register_driver` *fails* initially, I need to double-check that `dev->gadget_registered` is *not* set to `true`. And in that case, the `dev_release` function is not going to unregister `gadgetfs_driver` because that conditional isn't met.

Then, the nagging question: if `usb_gadget_register_driver` fails, does it leave something behind, some sort of dangling state? I need to know. Time to dig into the `usb_gadget_register_driver_owner` function to see what it's really doing under the hood. I need to understand all the failure paths and any potential side effects. The goal here is to ensure clean up in all scenarios.



31/2 2026/08/07 05:38 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/udc/core.c Name:usb_gadget_register_driver_owner]

Results:
map[SourceCode:1740:	int usb_gadget_register_driver_owner(struct usb_gadget_driver *driver,
1741:			struct module *owner, const char *mod_name)
1742:	{
1743:		int ret;
1744:	
1745:		if (!driver || !driver->bind || !driver->setup)
1746:			return -EINVAL;
1747:	
1748:		driver->driver.bus = &gadget_bus_type;
1749:		driver->driver.owner = owner;
1750:		driver->driver.mod_name = mod_name;
1751:		driver->driver.probe_type = PROBE_FORCE_SYNCHRONOUS;
1752:		ret = driver_register(&driver->driver);
1753:		if (ret) {
1754:			pr_warn("%s: driver registration failed: %d\n",
1755:					driver->function, ret);
1756:			return ret;
1757:		}
1758:	
1759:		mutex_lock(&udc_lock);
1760:		if (!driver->is_bound) {
1761:			if (driver->match_existing_only) {
1762:				pr_warn("%s: couldn't find an available UDC or it's busy\n",
1763:						driver->function);
1764:				ret = -EBUSY;
1765:			} else {
1766:				pr_info("%s: couldn't find an available UDC\n",
1767:						driver->function);
1768:				ret = 0;
1769:			}
1770:		}
1771:		mutex_unlock(&udc_lock);
1772:	
1773:		if (ret)
1774:			driver_unregister(&driver->driver);
1775:		return ret;
1776:	}
 SourceFile:drivers/usb/gadget/udc/core.c]

32/2 2026/08/07 05:38 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 23837
							output: 41
							thoughts: 213
						

Thoughts:
**Dissecting the USB Gadget Driver Registration Flow**

Okay, let's break this down. It looks like `usb_gadget_register_driver_owner` kicks things off with a call to `driver_register`. Standard stuff so far. But, hang on, after a successful `driver_register`, it checks `driver->is_bound`. That's interesting.

If `driver->is_bound` is *false* and the driver is marked with `driver->match_existing_only` true, it immediately hits the brakes, returning `-EBUSY` and unregistering itself. Makes sense, that's expected behaviour. It doesn't want to bind.

But what if `driver_register` *does* succeed, and `driver->is_bound` is actually *true*? In that case, the function just returns 0. No problems, right? The driver is already bound, or can be.

Now, the important question: how does `driver->is_bound` get flipped to true in the first place? Let's trace it back. We have `driver_register` -> `bus_add_driver` -> `driver_attach` -> `__driver_attach` -> `driver_probe_device` -> `really_probe` -> `udc_bind_to_driver` -> `gadget_bind_driver` -> finally `driver->bind(gadget, driver)`. Aha! The `bind` method is the key. For `gadgetfs`, I remember, that's `gadgetfs_bind`. That's where the magic happens.



33/2 2026/08/07 05:38 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c Name:gadgetfs_bind]

Results:
map[SourceCode:1668:	static int gadgetfs_bind(struct usb_gadget *gadget,
1669:			struct usb_gadget_driver *driver)
1670:	{
1671:		struct dev_data		*dev = the_device;
1672:	
1673:		if (!dev)
1674:			return -ESRCH;
1675:		if (0 != strcmp (CHIP, gadget->name)) {
1676:			pr_err("%s expected %s controller not %s\n",
1677:				shortname, CHIP, gadget->name);
1678:			return -ENODEV;
1679:		}
1680:	
1681:		set_gadget_data (gadget, dev);
1682:		dev->gadget = gadget;
1683:		gadget->ep0->driver_data = dev;
1684:	
1685:		/* preallocate control response and buffer */
1686:		dev->req = usb_ep_alloc_request (gadget->ep0, GFP_KERNEL);
1687:		if (!dev->req)
1688:			goto enomem;
1689:		dev->req->context = NULL;
1690:		dev->req->complete = epio_complete;
1691:	
1692:		if (activate_ep_files (dev) < 0)
1693:			goto enomem;
1694:	
1695:		INFO (dev, "bound to %s driver\n", gadget->name);
1696:		spin_lock_irq(&dev->lock);
1697:		dev->state = STATE_DEV_UNCONNECTED;
1698:		spin_unlock_irq(&dev->lock);
1699:		get_dev (dev);
1700:		return 0;
1701:	
1702:	enomem:
1703:		gadgetfs_unbind (gadget);
1704:		return -ENOMEM;
1705:	}
 SourceFile:drivers/usb/gadget/legacy/inode.c]

34/2 2026/08/07 05:38 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 25023
							output: 34
							thoughts: 114
						

Thoughts:
**Reflecting on `gadgetfs_bind` and `driver_register`**

Okay, so I'm digging into this code and it's hitting me... `gadgetfs_bind` calls `get_dev(dev)`. That means if `gadgetfs_bind` is successful, the reference count of `dev` gets bumped up. Alright, makes sense. But then a thought hits me - what if `gadgetfs_bind` *succeeds* but then, *after* that point, `driver_register` fails? We've got a reference count issue right there! That feels like a subtle race condition that's just waiting to bite us.

Wait a second... I need to remember exactly when things are called... ah, right, `gadgetfs_bind` is actually called DURING `driver_register`! So, if `driver_register` bails out *after* that `gadgetfs_bind` call... It all hinges on what happens when `driver_register` has a problem after a successful `gadgetfs_bind`. This is important, better dig into the implementation of `driver_register` to check how it handles these scenarios.



35/2 2026/08/07 05:38 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/base/driver.c Name:driver_register]

Results:
map[SourceCode: 142:	/**
 143:	 * driver_register - register driver with bus
 144:	 * @drv: driver to register
 145:	 *
 146:	 * We pass off most of the work to the bus_add_driver() call,
 147:	 * since most of the things we have to do deal with the bus
 148:	 * structures.
 149:	 */
 150:	int driver_register(struct device_driver *drv)
 151:	{
 152:		int ret;
 153:		struct device_driver *other;
 154:	
 155:		if (!bus_is_registered(drv->bus)) {
 156:			pr_err("Driver '%s' was unable to register with bus_type '%s' because the bus was not initialized.\n",
 157:				   drv->name, drv->bus->name);
 158:			return -EINVAL;
 159:		}
 160:	
 161:		if ((drv->bus->probe && drv->probe) ||
 162:		    (drv->bus->remove && drv->remove) ||
 163:		    (drv->bus->shutdown && drv->shutdown))
 164:			pr_warn("Driver '%s' needs updating - please use "
 165:				"bus_type methods\n", drv->name);
 166:	
 167:		other = driver_find(drv->name, drv->bus);
 168:		if (other) {
 169:			pr_err("Error: Driver '%s' is already registered, "
 170:				"aborting...\n", drv->name);
 171:			return -EBUSY;
 172:		}
 173:	
 174:		ret = bus_add_driver(drv);
 175:		if (ret)
 176:			return ret;
 177:		ret = driver_add_groups(drv, drv->groups);
 178:		if (ret) {
 179:			bus_remove_driver(drv);
 180:			return ret;
 181:		}
 182:		kobject_uevent(&drv->p->kobj, KOBJ_ADD);
 183:		deferred_probe_extend_timeout();
 184:	
 185:		return ret;
 186:	}
 SourceFile:drivers/base/driver.c]

36/2 2026/08/07 05:38 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 26106
							output: 34
							thoughts: 712
						

Thoughts:
**Analyzing a Fault Injection Scenario**

Okay, so I'm looking at this code and trying to understand a failure scenario. My initial thought process was: if `bus_add_driver` succeeds, it subsequently calls `driver_add_groups`. If, however, *that* call fails, then `bus_remove_driver` gets called to clean up. But the fault injection trace is showing `bus_add_driver` failing directly! That's not the intended path.

Looking closer at the trace, the fault injection is clearly indicated. I see the failure is forced within `failslab`, likely related to memory allocation within the kernel. The stack trace clearly shows where the failure occurs within the `bus_add_driver` flow. I'm seeing it's happening when trying to create a sysfs link inside `driver_sysfs_add`, which is called from `really_probe`. Wait a minute, I see `driver_sysfs_add` is called *after* a successful `probe` call! So, the failure is happening after the driver is supposed to be working, it's occurring on the setup side.

Now, my focus is on `really_probe`. This is where the core interaction with the driver is happening, and it’s where this unexpected failure is occurring after the driver has nominally succeeded in its `probe` function. I need to understand what `really_probe` is doing and *why* it's failing here after an apparent initial success. This is key to pinpointing the root cause.



37/2 2026/08/07 05:38 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/base/dd.c Name:really_probe]

Results:
map[SourceCode: 652:	static int really_probe(struct device *dev, const struct device_driver *drv)
 653:	{
 654:		bool test_remove = IS_ENABLED(CONFIG_DEBUG_TEST_DRIVER_REMOVE) &&
 655:				   !drv->suppress_bind_attrs;
 656:		int ret, link_ret;
 657:	
 658:		if (defer_all_probes) {
 659:			/*
 660:			 * Value of defer_all_probes can be set only by
 661:			 * device_block_probing() which, in turn, will call
 662:			 * wait_for_device_probe() right after that to avoid any races.
 663:			 */
 664:			dev_dbg(dev, "Driver %s force probe deferral\n", drv->name);
 665:			return -EPROBE_DEFER;
 666:		}
 667:	
 668:		link_ret = device_links_check_suppliers(dev);
 669:		if (link_ret == -EPROBE_DEFER)
 670:			return link_ret;
 671:	
 672:		dev_dbg(dev, "bus: '%s': %s: probing driver %s with device\n",
 673:			drv->bus->name, __func__, drv->name);
 674:		if (!list_empty(&dev->devres_head)) {
 675:			dev_crit(dev, "Resources present before probing\n");
 676:			ret = -EBUSY;
 677:			goto done;
 678:		}
 679:	
 680:	re_probe:
 681:		device_set_driver(dev, drv);
 682:	
 683:		/* If using pinctrl, bind pins now before probing */
 684:		ret = pinctrl_bind_pins(dev);
 685:		if (ret)
 686:			goto pinctrl_bind_failed;
 687:	
 688:		if (dev->bus->dma_configure) {
 689:			ret = dev->bus->dma_configure(dev);
 690:			if (ret)
 691:				goto pinctrl_bind_failed;
 692:		}
 693:	
 694:		ret = driver_sysfs_add(dev);
 695:		if (ret) {
 696:			dev_err(dev, "%s: driver_sysfs_add failed\n", __func__);
 697:			goto sysfs_failed;
 698:		}
 699:	
 700:		if (dev->pm_domain && dev->pm_domain->activate) {
 701:			ret = dev->pm_domain->activate(dev);
 702:			if (ret)
 703:				goto probe_failed;
 704:		}
 705:	
 706:		ret = call_driver_probe(dev, drv);
 707:		if (ret) {
 708:			/*
 709:			 * If fw_devlink_best_effort is active (denoted by -EAGAIN), the
 710:			 * device might actually probe properly once some of its missing
 711:			 * suppliers have probed. So, treat this as if the driver
 712:			 * returned -EPROBE_DEFER.
 713:			 */
 714:			if (link_ret == -EAGAIN)
 715:				ret = -EPROBE_DEFER;
 716:	
 717:			/*
 718:			 * Return probe errors as positive values so that the callers
 719:			 * can distinguish them from other errors.
 720:			 */
 721:			ret = -ret;
 722:			goto probe_failed;
 723:		}
 724:	
 725:		ret = device_add_groups(dev, drv->dev_groups);
 726:		if (ret) {
 727:			dev_err(dev, "device_add_groups() failed\n");
 728:			goto dev_groups_failed;
 729:		}
 730:	
 731:		if (dev_has_sync_state(dev)) {
 732:			ret = device_create_file(dev, &dev_attr_state_synced);
 733:			if (ret) {
 734:				dev_err(dev, "state_synced sysfs add failed\n");
 735:				goto dev_sysfs_state_synced_failed;
 736:			}
 737:		}
 738:	
 739:		if (test_remove) {
 740:			test_remove = false;
 741:	
 742:			device_remove(dev);
 743:			driver_sysfs_remove(dev);
 744:			if (dev->bus && dev->bus->dma_cleanup)
 745:				dev->bus->dma_cleanup(dev);
 746:			device_unbind_cleanup(dev);
 747:	
 748:			goto re_probe;
 749:		}
 750:	
 751:		pinctrl_init_done(dev);
 752:	
 753:		if (dev->pm_domain && dev->pm_domain->sync)
 754:			dev->pm_domain->sync(dev);
 755:	
 756:		driver_bound(dev);
 757:		dev_dbg(dev, "bus: '%s': %s: bound device to driver %s\n",
 758:			drv->bus->name, __func__, drv->name);
 759:		goto done;
 760:	
 761:	dev_sysfs_state_synced_failed:
 762:	dev_groups_failed:
 763:		device_remove(dev);
 764:	probe_failed:
 765:		driver_sysfs_remove(dev);
 766:	sysfs_failed:
 767:		bus_notify(dev, BUS_NOTIFY_DRIVER_NOT_BOUND);
 768:		if (dev->bus && dev->bus->dma_cleanup)
 769:			dev->bus->dma_cleanup(dev);
 770:	pinctrl_bind_failed:
 771:		device_links_no_driver(dev);
 772:		device_unbind_cleanup(dev);
 773:	done:
 774:		return ret;
 775:	}
 SourceFile:drivers/base/dd.c]

38/2 2026/08/07 05:38 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 29022
							output: 36
							thoughts: 135
						

Thoughts:
**My Immediate Assessment of the Driver Probe Sequence**

Okay, so I'm tracing the driver probe flow here and I've got a key insight: `driver_sysfs_add` is definitely called *before* `call_driver_probe` – that's crucial. Now, if `driver_sysfs_add` hits a snag and fails, *bam*, `really_probe` returns an error. And if that happens, `call_driver_probe`, which is the function that actually calls `gadgetfs_bind`, is *never* called.

Wait a second... if `gadgetfs_bind` is skipped entirely, the crucial increment of the `dev` refcount in that function never happens! That's a potential leak point if we're not careful. But hang on, the failure of `driver_sysfs_add` *does* mean `really_probe` bails out with an error, so there's probably some cleanup happening higher up. The question is, does `driver_register` itself then also return a failure? I need to check the calling sequence. Let me go look at `bus_add_driver` to see how the failure is handled.



39/2 2026/08/07 05:38 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/base/bus.c Name:bus_add_driver]

Results:
map[SourceCode: 728:	/**
 729:	 * bus_add_driver - Add a driver to the bus.
 730:	 * @drv: driver.
 731:	 */
 732:	int bus_add_driver(struct device_driver *drv)
 733:	{
 734:		struct subsys_private *sp = bus_to_subsys(drv->bus);
 735:		struct driver_private *priv;
 736:		int error = 0;
 737:	
 738:		if (!sp)
 739:			return -EINVAL;
 740:	
 741:		/*
 742:		 * Reference in sp is now incremented and will be dropped when
 743:		 * the driver is removed from the bus
 744:		 */
 745:		pr_debug("bus: '%s': add driver %s\n", sp->bus->name, drv->name);
 746:	
 747:		priv = kzalloc_obj(*priv);
 748:		if (!priv) {
 749:			error = -ENOMEM;
 750:			goto out_put_bus;
 751:		}
 752:		klist_init(&priv->klist_devices, NULL, NULL);
 753:		priv->driver = drv;
 754:		drv->p = priv;
 755:		priv->kobj.kset = sp->drivers_kset;
 756:		error = kobject_init_and_add(&priv->kobj, &driver_ktype, NULL,
 757:					     "%s", drv->name);
 758:		if (error)
 759:			goto out_unregister;
 760:	
 761:		klist_add_tail(&priv->knode_bus, &sp->klist_drivers);
 762:		if (sp->drivers_autoprobe) {
 763:			error = driver_attach(drv);
 764:			if (error)
 765:				goto out_del_list;
 766:		}
 767:		error = module_add_driver(drv->owner, drv);
 768:		if (error) {
 769:			printk(KERN_ERR "%s: failed to create module links for %s\n",
 770:				__func__, drv->name);
 771:			goto out_detach;
 772:		}
 773:	
 774:		error = driver_create_file(drv, &driver_attr_uevent);
 775:		if (error) {
 776:			printk(KERN_ERR "%s: uevent attr (%s) failed\n",
 777:				__func__, drv->name);
 778:		}
 779:		error = driver_add_groups(drv, sp->bus->drv_groups);
 780:		if (error) {
 781:			/* How the hell do we get out of this pickle? Give up */
 782:			printk(KERN_ERR "%s: driver_add_groups(%s) failed\n",
 783:				__func__, drv->name);
 784:		}
 785:	
 786:		if (!drv->suppress_bind_attrs) {
 787:			error = add_bind_files(drv);
 788:			if (error) {
 789:				/* Ditto */
 790:				printk(KERN_ERR "%s: add_bind_files(%s) failed\n",
 791:					__func__, drv->name);
 792:			}
 793:		}
 794:	
 795:		return 0;
 796:	
 797:	out_detach:
 798:		driver_detach(drv);
 799:	out_del_list:
 800:		klist_del(&priv->knode_bus);
 801:	out_unregister:
 802:		kobject_put(&priv->kobj);
 803:		/* drv->p is freed in driver_release()  */
 804:		drv->p = NULL;
 805:	out_put_bus:
 806:		subsys_put(sp);
 807:		return error;
 808:	}
 SourceFile:drivers/base/bus.c]

40/2 2026/08/07 05:38 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 30653
							output: 34
							thoughts: 19
						

Thoughts:
Here's my take on the situation:

**Unexpected `driver_attach` Behavior**

Alright, hang on a second. I was just reviewing the recent logs and I've stumbled upon something that has me rethinking my initial assessment. I thought `driver_attach` was handling the failure of `really_probe` correctly, but now I'm seeing it consistently returning 0 even when `really_probe` fails. That's... not what I expected at all. I was under the impression that the return value of `driver_attach` would provide a clearer indication of a complete failure from probe to attach, but now I need to dive deeper. I need to figure out why this discrepancy exists and how to account for it in my error handling. This could have broader implications for the stability checks I've put in place and will have to revisit those. Looks like I have some debugging ahead of me.



41/2 2026/08/07 05:38 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/base/dd.c Name:driver_attach]

Results:
map[SourceCode:1298:	/**
1299:	 * driver_attach - try to bind driver to devices.
1300:	 * @drv: driver.
1301:	 *
1302:	 * Walk the list of devices that the bus has on it and try to
1303:	 * match the driver with each one.  If driver_probe_device()
1304:	 * returns 0 and the @dev->driver is set, we've found a
1305:	 * compatible pair.
1306:	 */
1307:	int driver_attach(const struct device_driver *drv)
1308:	{
1309:		/* The (void *) will be put back to const * in __driver_attach() */
1310:		return bus_for_each_dev(drv->bus, NULL, (void *)drv, __driver_attach);
1311:	}
 SourceFile:drivers/base/dd.c]

42/2 2026/08/07 05:38 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 31156
							output: 35
							thoughts: 7
						

Thoughts:
Okay, here's my attempt at summarizing the thought process, tailored for an expert audience, and written in the first person:

**Navigating the `__driver_attach` Landscape**

Alright, let's break down this `__driver_attach` concept. We're talking low-level here, kernel land, where a lot of magic happens – or, as we well know, *doesn't* happen without careful planning. My immediate focus is on the *why* of this function. It's the hook, the entry point, the first place where the rubber meets the road between the kernel and the new driver.

My initial mental checklist starts running:

*   **Resource Allocation:** What resources are we dealing with? I'm thinking memory, interrupts, DMA channels – anything the driver needs to operate. The first step is *probably* figuring out how to acquire and manage those resources. That means checking for availability and potentially some kind of negotiation if there's contention. I'm already anticipating potential deadlocks.
*   **Device Probe:** The probe stage is where the driver actually *sees* the device. We're looking for Vendor ID, Device ID, and maybe other identifying information to verify that we're talking to the right piece of hardware. I might need to deal with multiple devices of the same type or, perhaps, even handle multiple devices of different types, if the driver is designed to work with those. This is where I'd start looking at how reliable my probing logic is, and if I need to back out cleanly if a problem is detected.
*   **Driver Initialization:** Once the hardware is identified, the driver has to get set up. This is where I'd be looking at registering interrupt handlers, allocating any private data structures, setting up queues, and configuring the hardware registers. This includes enabling the device, setting up any necessary clocks, and ensuring it can communicate with the rest of the system.
*   **Error Handling:** Okay, this is *critical*. I'm thinking *what can go wrong*? What failure modes can I anticipate? Is it a device missing or not responding? Is the device responding with unexpected data? Bad memory allocation? Bad register configuration? And, how am I going to handle these errors gracefully? Does it return a specific error code? Can it be recovered from? Or does it need to signal a critical failure back up the call chain? This entire stage is my bread and butter. I'm not happy if I'm not thinking about error handling.
*   **Driver Registration:** At some point, once the device is configured and the driver is ready, it needs to register itself with the kernel's device management system. This is often the final step, signaling that the driver is ready to accept I/O requests.

My main focus at this stage is to make sure every single point is covered; every step has a logical continuation. I’ll make sure that error codes and states are clear, with every possible problem, accounted for, and that the code does as much as is possible, while giving up as little as is absolutely necessary.



43/2 2026/08/07 05:38 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/base/dd.c Name:__driver_attach]

Results:
map[SourceCode:1232:	static int __driver_attach(struct device *dev, void *data)
1233:	{
1234:		const struct device_driver *drv = data;
1235:		bool async = false;
1236:		int ret;
1237:	
1238:		/*
1239:		 * Lock device and try to bind to it. We drop the error
1240:		 * here and always return 0, because we need to keep trying
1241:		 * to bind to devices and some drivers will return an error
1242:		 * simply if it didn't support the device.
1243:		 *
1244:		 * driver_probe_device() will spit a warning if there
1245:		 * is an error.
1246:		 */
1247:	
1248:		ret = driver_match_device(drv, dev);
1249:		if (ret == 0) {
1250:			/* no match */
1251:			return 0;
1252:		} else if (ret == -EPROBE_DEFER) {
1253:			dev_dbg(dev, "Device match requests probe deferral\n");
1254:			dev_set_can_match(dev);
1255:			driver_deferred_probe_add(dev);
1256:			/*
1257:			 * Driver could not match with device, but may match with
1258:			 * another device on the bus.
1259:			 */
1260:			return 0;
1261:		} else if (ret < 0) {
1262:			dev_dbg(dev, "Bus failed to match device: %d\n", ret);
1263:			/*
1264:			 * Driver could not match with device, but may match with
1265:			 * another device on the bus.
1266:			 */
1267:			return 0;
1268:		} /* ret > 0 means positive match */
1269:	
1270:		if (driver_allows_async_probing(drv)) {
1271:			/*
1272:			 * Instead of probing the device synchronously we will
1273:			 * probe it asynchronously to allow for more parallelism.
1274:			 *
1275:			 * We only take the device lock here in order to guarantee
1276:			 * that the dev->driver and async_driver fields are protected
1277:			 */
1278:			dev_dbg(dev, "probing driver %s asynchronously\n", drv->name);
1279:			device_lock(dev);
1280:			if (!dev->driver && !dev->p->async_driver) {
1281:				get_device(dev);
1282:				dev->p->async_driver = drv;
1283:				async = true;
1284:			}
1285:			device_unlock(dev);
1286:			if (async)
1287:				async_schedule_dev(__driver_attach_async_helper, dev);
1288:			return 0;
1289:		}
1290:	
1291:		__device_driver_lock(dev, dev->parent);
1292:		driver_probe_device(drv, dev);
1293:		__device_driver_unlock(dev, dev->parent);
1294:	
1295:		return 0;
1296:	}
 SourceFile:drivers/base/dd.c]

44/2 2026/08/07 05:38 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 32806
							output: 41
							thoughts: 124
						

Thoughts:
Okay, let me break this down.

**My Analysis of the Driver Registration Process**

Right, so `__driver_attach` *always* returns 0. That's the baseline, the foundation. Therefore, `driver_attach` also returns 0. That's a success, it means `bus_add_driver` is going to succeed! Following that, `driver_register` also succeeding. But hang on, a successful `driver_register` means `usb_gadget_register_driver_owner` is being called. And within that, it specifically checks the `driver->is_bound` flag.

Now, here's where it gets interesting: If `driver->is_bound` is false, it's going to return `-EBUSY`. That's the key. And *that* only happens if `match_existing_only` is true. But is that `match_existing_only` flag set for the `gadgetfs_driver`? I need to go back and check the definition of `gadgetfs_driver` to confirm whether that's true or not. Otherwise the whole thing is off.



45/2 2026/08/07 05:38 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c Name:gadgetfs_driver]

Results:
map[SourceCode:1746:	static struct usb_gadget_driver gadgetfs_driver = {
1747:		.function	= (char *) driver_desc,
1748:		.bind		= gadgetfs_bind,
1749:		.unbind		= gadgetfs_unbind,
1750:		.setup		= gadgetfs_setup,
1751:		.reset		= gadgetfs_disconnect,
1752:		.disconnect	= gadgetfs_disconnect,
1753:		.suspend	= gadgetfs_suspend,
1754:	
1755:		.driver	= {
1756:			.name		= shortname,
1757:		},
1758:	};
 SourceFile:drivers/usb/gadget/legacy/inode.c]

46/2 2026/08/07 05:38 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 33437
							output: 47
							thoughts: 67
						

Thoughts:
**Analyzing GadgetFS Driver Registration**

Okay, so I'm looking at this `gadgetfs_driver` code, and I see that `match_existing_only` isn't set. That's a key detail. What this means, based on my understanding of how `usb_gadget_register_driver_owner` works, is that the function will happily return a success code (zero) *even* if the driver isn't actually bound yet. That's assuming `driver->is_bound` is false, which is the crux of the problem. This could lead to a situation that looks like a success but isn't. I need to be absolutely certain of this behavior, so let me go back and re-examine the implementation of `usb_gadget_register_driver_owner` and how it handles the driver's binding state. I need to confirm this assumption.



47/2 2026/08/07 05:38 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/udc/core.c Name:usb_gadget_register_driver_owner]

Results:
map[SourceCode:1740:	int usb_gadget_register_driver_owner(struct usb_gadget_driver *driver,
1741:			struct module *owner, const char *mod_name)
1742:	{
1743:		int ret;
1744:	
1745:		if (!driver || !driver->bind || !driver->setup)
1746:			return -EINVAL;
1747:	
1748:		driver->driver.bus = &gadget_bus_type;
1749:		driver->driver.owner = owner;
1750:		driver->driver.mod_name = mod_name;
1751:		driver->driver.probe_type = PROBE_FORCE_SYNCHRONOUS;
1752:		ret = driver_register(&driver->driver);
1753:		if (ret) {
1754:			pr_warn("%s: driver registration failed: %d\n",
1755:					driver->function, ret);
1756:			return ret;
1757:		}
1758:	
1759:		mutex_lock(&udc_lock);
1760:		if (!driver->is_bound) {
1761:			if (driver->match_existing_only) {
1762:				pr_warn("%s: couldn't find an available UDC or it's busy\n",
1763:						driver->function);
1764:				ret = -EBUSY;
1765:			} else {
1766:				pr_info("%s: couldn't find an available UDC\n",
1767:						driver->function);
1768:				ret = 0;
1769:			}
1770:		}
1771:		mutex_unlock(&udc_lock);
1772:	
1773:		if (ret)
1774:			driver_unregister(&driver->driver);
1775:		return ret;
1776:	}
 SourceFile:drivers/usb/gadget/udc/core.c]

48/2 2026/08/07 05:38 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 34304
							output: 45
							thoughts: 125
						

Thoughts:
**Analyzing the USB Gadget Driver Registration Flow**

Okay, yes! I've confirmed it: If the driver isn't bound already (`driver->is_bound` is false) and we're not only trying to match existing devices (`driver->match_existing_only` is also false), the function will return zero! So, that means `usb_gadget_register_driver` is returning 0 in this scenario. Got it.

And then, I see that within the `dev_config` function, we're setting `dev->gadget_registered = true`. Ah-ha! That's the crucial flag. Now, if this flag is set to true, it means that when `ep0` is closed, the `dev_release` function is going to be called, which then in turn, calls `usb_gadget_unregister_driver(&gadgetfs_driver)`. Okay, so it looks like I need to dig into `usb_gadget_unregister_driver` now to see what actually happens there. Let's see...



49/2 2026/08/07 05:38 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/udc/core.c Name:usb_gadget_unregister_driver]

Results:
map[SourceCode:1779:	int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
1780:	{
1781:		if (!driver || !driver->unbind)
1782:			return -EINVAL;
1783:	
1784:		driver_unregister(&driver->driver);
1785:		return 0;
1786:	}
 SourceFile:drivers/usb/gadget/udc/core.c]

50/2 2026/08/07 05:38 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 34841
							output: 36
							thoughts: 832
						

Thoughts:
**Debugging a USB Driver UAF with Fault Injection**

Okay, so I'm staring at this potential use-after-free in a USB driver, and it's got me scratching my head. The core of it seems to be in the device unbinding sequence, specifically after a driver fails to bind. I'm seeing that `driver_unregister` is called, which should remove the driver from the bus.

My initial thought was, if `really_probe` fails, then `gadgetfs_unbind` *should* never be called. And if `gadgetfs_unbind` isn't called, then neither is `gadgetfs_bind`, which means the device's reference count shouldn't have been incremented! If `gadgetfs_bind` wasn't called, the refcount should remain at 2 (1 from the device's allocation in `dev_new`, and 1 from `gadget_dev_open`). The `ep0` is then closed, `dev_release` calls `put_dev(dev)` and the refcount goes to 1, as expected. Following this `gadgetfs_kill_sb` calls `put_dev(the_device)`, dropping the refcount to 0, and the device is freed. It looks perfectly balanced, so why the UAF?

Time to re-examine the fault injection trace. Aha! It looks like there's an injected failure happening. Let's trace that.

Okay, so the fault is injected during the call to `driver_sysfs_add`, which is called within `really_probe`. If `driver_sysfs_add` fails, `really_probe` then goes to `sysfs_failed`. Now let's see what happens during `sysfs_failed`

Ah! So, if `really_probe` fails, `driver_probe_device` returns an error. The key is in `sysfs_failed`: I need to look at how `device_unbind_cleanup` interacts with the reference counts of the device after a failure. This could be where the refcount is mismanaged, leading to the UAF. Now to go check `driver_probe_device` and the surrounding code, and see how the reference counts are handled in the error paths.



51/2 2026/08/07 05:38 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/base/dd.c Name:driver_probe_device]

Results:
map[SourceCode: 878:	/**
 879:	 * driver_probe_device - attempt to bind device & driver together
 880:	 * @drv: driver to bind a device to
 881:	 * @dev: device to try to bind to the driver
 882:	 *
 883:	 * This function returns -ENODEV if the device is not registered, -EBUSY if it
 884:	 * already has a driver, 0 if the device is bound successfully and a positive
 885:	 * (inverted) error code for failures from the ->probe method.
 886:	 *
 887:	 * This function must be called with @dev lock held.  When called for a
 888:	 * USB interface, @dev->parent lock must be held as well.
 889:	 *
 890:	 * If the device has a parent, runtime-resume the parent before driver probing.
 891:	 */
 892:	static int driver_probe_device(const struct device_driver *drv, struct device *dev)
 893:	{
 894:		int trigger_count = atomic_read(&deferred_trigger_count);
 895:		int ret;
 896:	
 897:		atomic_inc(&probe_count);
 898:		ret = __driver_probe_device(drv, dev);
 899:		if (ret == -EPROBE_DEFER || ret == EPROBE_DEFER) {
 900:			driver_deferred_probe_add(dev);
 901:	
 902:			/*
 903:			 * Did a trigger occur while probing? Need to re-trigger if yes
 904:			 */
 905:			if (trigger_count != atomic_read(&deferred_trigger_count) &&
 906:			    !defer_all_probes)
 907:				driver_deferred_probe_trigger();
 908:		}
 909:		atomic_dec(&probe_count);
 910:		wake_up_all(&probe_waitqueue);
 911:		return ret;
 912:	}
 SourceFile:drivers/base/dd.c]

52/2 2026/08/07 05:38 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 36780
							output: 37
							thoughts: 9
						

Thoughts:
Okay, here's my interpretation of that thought process, tailored for an expert audience, and written in the first person:

**Decoding the `__driver_probe_device` Function**

Alright, let's break this down. When I see `__driver_probe_device`, my initial thought is immediately drawn to the core of the device driver lifecycle within the kernel. This isn't just a generic "probe" function; the double underscore signals an internal function, likely the fundamental workhorse responsible for the critical action of *proactively attempting* to bind a driver to a device. It's a low-level operation, dealing with the nitty-gritty details of matching drivers with hardware and, crucially, managing the potential conflicts or errors that can arise during this critical "binding" phase.

I'm thinking about the arguments it likely takes: a pointer to the device structure itself, a pointer to the driver structure, perhaps some hints regarding the bus type or device ID. My mental model conjures the typical sequence: checking device and driver compatibility, calling the driver's specific probe function, and handling potential failures. It's the point where everything hangs in the balance: a successful probe, and the device is ready to go, the driver takes over. A failure, and the system needs to gracefully handle it – potentially looking for alternative drivers, logging an error, or simply leaving the device unmanaged.

I'm also anticipating how it deals with resource allocation: requesting the necessary memory regions, IRQs, DMA channels, and then the critical step of reporting these resources to the system. It would need to consider the order of operations, the locking mechanisms, and the potential race conditions that can occur. I'm wondering if it involves any of the hotplug or ACPI subsystems. I'd need to consider how this core functionality interacts with power management, device-specific quirks and error handling. I'm imagining the conditional compilation, platform-specific code and potential for architecture-dependent variations. The complexity lies in its generality; it needs to be flexible enough to handle a vast array of devices across different hardware architectures.

So, when I see `__driver_probe_device`, I instantly start visualizing the entire driver initialization workflow – the core logic that orchestrates the crucial binding of a driver to a device, and all the inherent challenges that come with making that happen correctly and safely. It's a fundamental piece, and understanding it is key to understanding how devices integrate with the kernel.



53/2 2026/08/07 05:39 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/base/dd.c Name:__driver_probe_device]

Results:
map[SourceCode: 827:	static int __driver_probe_device(const struct device_driver *drv, struct device *dev)
 828:	{
 829:		int ret = 0;
 830:	
 831:		if (dev->p->dead || !device_is_registered(dev))
 832:			return -ENODEV;
 833:		if (dev->driver)
 834:			return -EBUSY;
 835:	
 836:		/*
 837:		 * In device_add(), the "struct device" gets linked into the subsystem's
 838:		 * list of devices and broadcast to userspace (via uevent) before we're
 839:		 * quite ready to probe. Those open pathways to driver probe before
 840:		 * we've finished enough of device_add() to reliably support probe.
 841:		 * Detect this and tell other pathways to try again later. device_add()
 842:		 * itself will also try to probe immediately after setting
 843:		 * "ready_to_probe".
 844:		 */
 845:		if (!dev_ready_to_probe(dev))
 846:			return dev_err_probe(dev, -EPROBE_DEFER, "Device not ready to probe\n");
 847:	
 848:		/*
 849:		 * Call dev_set_can_match() after calling dev_ready_to_probe(), so
 850:		 * driver_deferred_probe_add() won't actually add the device to the
 851:		 * deferred probe list when dev_ready_to_probe() returns false.
 852:		 *
 853:		 * When dev_ready_to_probe() returns false, it means that device_add()
 854:		 * will do another probe() attempt for us.
 855:		 */
 856:		dev_set_can_match(dev);
 857:		dev_dbg(dev, "bus: '%s': %s: matched device with driver %s\n",
 858:			drv->bus->name, __func__, drv->name);
 859:	
 860:		pm_runtime_get_suppliers(dev);
 861:		if (dev->parent)
 862:			pm_runtime_get_sync(dev->parent);
 863:	
 864:		pm_runtime_barrier(dev);
 865:		if (initcall_debug)
 866:			ret = really_probe_debug(dev, drv);
 867:		else
 868:			ret = really_probe(dev, drv);
 869:		pm_request_idle(dev);
 870:	
 871:		if (dev->parent)
 872:			pm_runtime_put(dev->parent);
 873:	
 874:		pm_runtime_put_suppliers(dev);
 875:		return ret;
 876:	}
 SourceFile:drivers/base/dd.c]

54/2 2026/08/07 05:39 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 38166
							output: 39
							thoughts: 573
						

Thoughts:
**Analyzing a USB Gadget Driver Registration Issue**

Okay, let me break this down. So, `__driver_probe_device` just returns the result of `really_probe`, which seems straightforward. But then I see that `__driver_attach` blithely *ignores* whatever `driver_probe_device` returns. That's immediately suspect. It just returns 0 after probing, which makes `driver_attach` return 0, then `bus_add_driver` also returns 0, and so on, all the way up to the registration functions. The return values don't seem to indicate much of a problem. But `dev_config` *does* set `dev->gadget_registered` to true.

Now, here's the kicker. If `really_probe` fails, then `gadgetfs_bind` is *never* called. This means the device reference count (`dev` refcount) isn't incremented beyond the initial counts (one from `dev_new` and another from `gadget_dev_open`). The catch is, `dev->gadget_registered` is *still* set to true, which is a real problem.

When the endpoint 0 (ep0) is closed, `dev_release` is called. It checks `dev->gadget_registered`. If it's true, it unregisters the driver using `usb_gadget_unregister_driver`, which then calls `driver_unregister`. But here's the trap - because `gadgetfs_bind` wasn't called (due to the probe failure), the refcount is 2 at the beginning. `dev_release` calls `put_dev(dev)`, dropping the refcount to 1. Then, `gadgetfs_kill_sb` calls `put_dev(the_device)`, dropping the refcount to 0, and *boom* the device is freed.

Now, if the device is freed inside `gadgetfs_kill_sb`, why is it causing a use-after-free (UAF) later on? That's what's got my attention. Looking at the crash trace again...

The trace indicates a slab-use-after-free in `gadgetfs_kill_sb`, meaning `the_device` was *already* freed when `gadgetfs_kill_sb` was called. That's the real problem! I need to trace this back.

Let's go back and examine `dev_release` again because that's the point where `the_device` and `dev` are handled. I need to figure out exactly why it thinks the device is registered but the bind never happened. Is there an issue with the ref counting? Where else could this device be getting released? I have to trace the state of `the_device` and `dev` throughout the device lifecycle when probe fails and `gadgetfs_bind` is not called!



55/2 2026/08/07 05:39 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c Name:dev_release]

Results:
map[SourceCode:1190:	static int
1191:	dev_release (struct inode *inode, struct file *fd)
1192:	{
1193:		struct dev_data		*dev = fd->private_data;
1194:	
1195:		/* closing ep0 === shutdown all */
1196:	
1197:		if (dev->gadget_registered) {
1198:			usb_gadget_unregister_driver (&gadgetfs_driver);
1199:			dev->gadget_registered = false;
1200:		}
1201:	
1202:		/* at this point "good" hardware has disconnected the
1203:		 * device from USB; the host won't see it any more.
1204:		 * alternatively, all host requests will time out.
1205:		 */
1206:	
1207:		kfree (dev->buf);
1208:		dev->buf = NULL;
1209:	
1210:		/* other endpoints were all decoupled from this device */
1211:		spin_lock_irq(&dev->lock);
1212:		dev->state = STATE_DEV_DISABLED;
1213:		spin_unlock_irq(&dev->lock);
1214:	
1215:		put_dev (dev);
1216:		return 0;
1217:	}
 SourceFile:drivers/usb/gadget/legacy/inode.c]

56/2 2026/08/07 05:39 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 39813
							output: 36
							thoughts: 543
						

Thoughts:
**Debugging a USB Gadget Driver Unregistration Scenario**

Okay, so I'm trying to figure out this `usb_gadget_unregister_driver` sequence, and specifically, whether it's correctly unbinding the `gadgetfs` driver. My initial concern is whether `gadgetfs_unbind` is always called when it should be. The crucial question is: does `usb_gadget_unregister_driver` reliably trigger the `gadgetfs_unbind` function?

I started with the assumption that if `usb_gadget_unregister_driver` is called, it *should* call `gadgetfs_unbind`. But then I realized, what if `gadgetfs_bind` was *never* called in the first place? If that's the case, then `gadgetfs_unbind` shouldn't be called either, right? That makes sense.

But what about the edge case? What if `gadgetfs_bind` *was* called, but something else went wrong during the probe process, say if `driver_sysfs_add` failed? That’s the real crux of the issue.

Let's dive back into `really_probe`. I need to re-examine the code flow:

```c
	ret = driver_sysfs_add(dev);
	if (ret) {
		dev_err(dev, "%s: driver_sysfs_add failed\n", __func__);
		goto sysfs_failed;
	}

	if (dev->pm_domain && dev->pm_domain->activate) {
		ret = dev->pm_domain->activate(dev);
		if (ret)
			goto probe_failed;
	}

	ret = call_driver_probe(dev, drv);
```

Aha! It's clear now. `driver_sysfs_add` is *before* `call_driver_probe`, which calls `gadgetfs_bind`. So, if `driver_sysfs_add` fails, the `call_driver_probe` (and, crucially, `gadgetfs_bind`) is never executed! That’s key. `gadgetfs_bind` would NOT be called, and the refcount of `dev` would *not* be incremented.

If that's the case, and assuming the device is correctly setup, the refcount remains at 2. When `ep0` is closed, `dev_release` calls `put_dev(dev)`. The refcount then goes down to 1. Then, `gadgetfs_kill_sb` calls `put_dev(the_device)`, dropping the refcount to 0. The device will then be freed. But, where is the extra `put_dev`?

Now, what if `dev_config` fails *after* `usb_gadget_register_driver`? Let's check:

```c
	value = usb_gadget_register_driver(&gadgetfs_driver);
	if (value != 0) {
		spin_lock_irq(&dev->lock);
		goto fail;
	} else {
		value = len;
		dev->gadget_registered = true;
	}
	return value;
```

Nope, the code clearly doesn’t fail after the registration.

So, what if `gadgetfs_bind` *is* called, but *something else* fails within the probe? Let me check `call_driver_probe` again to make sure I haven't missed any edge cases there.



57/2 2026/08/07 05:39 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/base/dd.c Name:call_driver_probe]

Results:
map[SourceCode: 621:	static int call_driver_probe(struct device *dev, const struct device_driver *drv)
 622:	{
 623:		int ret = 0;
 624:	
 625:		if (dev->bus->probe)
 626:			ret = dev->bus->probe(dev);
 627:		else if (drv->probe)
 628:			ret = drv->probe(dev);
 629:	
 630:		switch (ret) {
 631:		case 0:
 632:			break;
 633:		case -EPROBE_DEFER:
 634:			/* Driver requested deferred probing */
 635:			dev_dbg(dev, "Driver %s requests probe deferral\n", drv->name);
 636:			break;
 637:		case -ENODEV:
 638:		case -ENXIO:
 639:			dev_dbg(dev, "probe with driver %s rejects match %d\n",
 640:				drv->name, ret);
 641:			break;
 642:		default:
 643:			/* driver matched but the probe failed */
 644:			dev_err(dev, "probe with driver %s failed with error %d\n",
 645:				drv->name, ret);
 646:			break;
 647:		}
 648:	
 649:		return ret;
 650:	}
 SourceFile:drivers/base/dd.c]

58/2 2026/08/07 05:39 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 41602
							output: 45
							thoughts: 21
						

Thoughts:
Okay, here's my interpretation of that thought process, assuming I'm an embedded systems expert familiar with the Linux kernel and USB driver architecture:

**Gadget Driver Binding: A Familiar Path**

Right, so, thinking about gadgets and driver binding, specifically, when the system's probing for the correct driver, that `dev->bus->probe` pointer—that's the key. That function pointer, the one that the USB core calls to see if a driver can handle a device... in the gadget context, that probe function is going to be `udc_bind_to_driver`. That's the function that takes the USB device controller (UDC) information and associates it with the gadget driver. It's a fundamental part of the USB gadget driver initialization process. This is the mechanism that links the USB peripheral with the correct gadget driver.



59/2 2026/08/07 05:39 tool codesearch-definition-source
0m Error:
log-in to see details

Args:
map[ContextFile:drivers/usb/gadget/udc/core.c Name:udc_bind_to_driver]

Results:
map[SourceCode: SourceFile:]

60/2 2026/08/07 05:39 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 41868
							output: 38
							thoughts: 24
						

Thoughts:
Okay, here's my interpretation of that thought process, as if I were having it:

**Digging into the USB Gadget Driver Core**

Alright, time to dive in. I need to understand something related to the USB gadget driver framework, and the term that jumps to mind is `probe`. Seems like that's often a key function during device initialization. I know the general location of the relevant code; `drivers/usb/gadget/udc/core.c` is usually where the core Unidirectional Data Channel (UDC) logic resides, which makes sense. So, let's start there. I'll search for `probe` specifically within that file. That should give me a solid entry point to trace the initialization sequence and understand how the system discovers and configures USB gadgets. From there, I can likely understand how my target device interacts within the UDC framework.



61/2 2026/08/07 05:39 tool grepper
0m Args:
map[Expression:\.probe\s*= PathPrefix:drivers/usb/gadget/udc/core.c]

Results:
map[Output:drivers/usb/gadget/udc/core.c=1951=static const struct bus_type gadget_bus_type = {
drivers/usb/gadget/udc/core.c-1952-	.name = "gadget",
drivers/usb/gadget/udc/core.c:1953:	.probe = gadget_bind_driver,
drivers/usb/gadget/udc/core.c-1954-	.remove = gadget_unbind_driver,
]

62/2 2026/08/07 05:39 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 42249
							output: 43
							thoughts: 10
						

Thoughts:
Okay, here's my interpretation of that thought process, tailored for an expert audience, and written in the first person:

**Navigating the `gadget_bind_driver` Landscape**

Right, `gadget_bind_driver`. Just the mention of it sparks a familiar set of considerations. I'm immediately thinking about the intricacies of the USB gadget subsystem in the Linux kernel and the crucial role this function plays within it.

I'm mentally running through the driver binding process. Is this referring to a new driver trying to attach to a gadget, or a reconfiguration of an existing relationship? What specific circumstances triggered this thought? Are we talking about a standard gadget like a USB Ethernet device, or something more specialized? The devil, as always, is in the details, and the `gadget_bind_driver` function is the point of a great deal of the configuration.

My mind is jumping to the potential issues. Is there a race condition? Is the driver properly registering its supported functions and configurations? Are the endpoints correctly allocated and configured? Are there resource conflicts with other drivers or gadgets already attached to the bus? I need to consider all the different USB classes involved, the different device descriptors, and their interactions, and whether the bind is being requested at the correct time.

The thought then rolls on to the error handling... if the bind fails, what's the expected return value, and how is that propagated up the call stack? How does the system handle a partially bound driver? What debugging tools are available to pinpoint the root cause of the problem? The `gadget_bind_driver` function is the gatekeeper, and the surrounding processes are all that matters.

I am also considering what platform the discussion relates to. Are there any hardware-specific quirks I need to keep in mind? Are we talking about a system-on-chip with a tightly integrated USB controller, or a more traditional PCI-based setup? The underlying hardware architecture can have a significant impact on how `gadget_bind_driver` behaves.

In short, `gadget_bind_driver` is a nexus point – a starting point for thinking through the potential issues, complexities, and opportunities within a USB gadget driver context. It's a reminder to keep the broader system context in mind and consider all the possible failure points. It's time to dig deeper.



63/2 2026/08/07 05:39 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/udc/core.c Name:gadget_bind_driver]

Results:
map[SourceCode:1641:	static int gadget_bind_driver(struct device *dev)
1642:	{
1643:		struct usb_gadget *gadget = dev_to_usb_gadget(dev);
1644:		struct usb_udc *udc = gadget->udc;
1645:		struct usb_gadget_driver *driver = container_of(dev->driver,
1646:				struct usb_gadget_driver, driver);
1647:		int ret = 0;
1648:	
1649:		mutex_lock(&udc_lock);
1650:		if (driver->is_bound) {
1651:			mutex_unlock(&udc_lock);
1652:			return -ENXIO;		/* Driver binds to only one gadget */
1653:		}
1654:		driver->is_bound = true;
1655:		udc->driver = driver;
1656:		mutex_unlock(&udc_lock);
1657:	
1658:		dev_dbg(&udc->dev, "binding gadget driver [%s]\n", driver->function);
1659:	
1660:		usb_gadget_udc_set_speed(udc, driver->max_speed);
1661:	
1662:		ret = driver->bind(udc->gadget, driver);
1663:		if (ret)
1664:			goto err_bind;
1665:	
1666:		mutex_lock(&udc->connect_lock);
1667:		ret = usb_gadget_udc_start_locked(udc);
1668:		if (ret) {
1669:			mutex_unlock(&udc->connect_lock);
1670:			goto err_start;
1671:		}
1672:		usb_gadget_enable_async_callbacks(udc);
1673:		udc->allow_connect = true;
1674:		ret = usb_udc_connect_control_locked(udc);
1675:		if (ret)
1676:			goto err_connect_control;
1677:	
1678:		mutex_unlock(&udc->connect_lock);
1679:	
1680:		kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE);
1681:		return 0;
1682:	
1683:	 err_connect_control:
1684:		udc->allow_connect = false;
1685:		usb_gadget_disable_async_callbacks(udc);
1686:		if (gadget->irq)
1687:			synchronize_irq(gadget->irq);
1688:		usb_gadget_udc_stop_locked(udc);
1689:		mutex_unlock(&udc->connect_lock);
1690:	
1691:	 err_start:
1692:		driver->unbind(udc->gadget);
1693:	
1694:	 err_bind:
1695:		if (ret != -EISNAM)
1696:			dev_err(&udc->dev, "failed to start %s: %d\n",
1697:				driver->function, ret);
1698:	
1699:		mutex_lock(&udc_lock);
1700:		udc->driver = NULL;
1701:		driver->is_bound = false;
1702:		mutex_unlock(&udc_lock);
1703:	
1704:		return ret;
1705:	}
 SourceFile:drivers/usb/gadget/udc/core.c]

64/2 2026/08/07 05:39 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 43794
							output: 41
							thoughts: 48
						

Thoughts:
Okay, here's my interpretation of those thoughts, framed as my own:

**Unraveling a USB Gadget Failure**

Right, so I'm digging into this `usb_gadget_udc_start_locked` function. It looks like the critical path here. Aha! If *that* thing fails, it triggers the `driver->unbind(udc->gadget)` call, interesting. I need to be aware of this potential failure point when debugging.

And hang on, let me just confirm, `driver->unbind`… yes, that's defined as `gadgetfs_unbind`. Good. That confirms my understanding of how gadgetfs handles unbinding from the UDC. Knowing the precise unbinding function, helps me to correlate potential error messages with the specific unbinding procedure. This is key for efficient debugging.



65/2 2026/08/07 05:39 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c Name:gadgetfs_unbind]

Results:
map[SourceCode:1639:	static void
1640:	gadgetfs_unbind (struct usb_gadget *gadget)
1641:	{
1642:		struct dev_data		*dev = get_gadget_data (gadget);
1643:	
1644:		DBG (dev, "%s\n", __func__);
1645:	
1646:		spin_lock_irq (&dev->lock);
1647:		dev->state = STATE_DEV_UNBOUND;
1648:		while (dev->udc_usage > 0) {
1649:			spin_unlock_irq(&dev->lock);
1650:			usleep_range(1000, 2000);
1651:			spin_lock_irq(&dev->lock);
1652:		}
1653:		spin_unlock_irq (&dev->lock);
1654:	
1655:		destroy_ep_files (dev);
1656:		gadget->ep0->driver_data = NULL;
1657:		set_gadget_data (gadget, NULL);
1658:	
1659:		/* we've already been disconnected ... no i/o is active */
1660:		if (dev->req)
1661:			usb_ep_free_request (gadget->ep0, dev->req);
1662:		DBG (dev, "%s done\n", __func__);
1663:		put_dev (dev);
1664:	}
 SourceFile:drivers/usb/gadget/legacy/inode.c]

66/2 2026/08/07 05:39 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 44501
							output: 45
							thoughts: 1272
						

Thoughts:
**Analyzing the GadgetFS Driver Registration and Unregistration Flow**

Okay, let's break this down. My initial thought was: Yes! `gadgetfs_unbind` correctly calls `put_dev(dev)`! This makes sense: if `gadget_bind_driver` *fails* after the driver's `bind` function is called, the system properly calls `driver->unbind`, which *should* call `put_dev(dev)`. This seems balanced.

But hold on, let's trace this carefully. If `gadget_bind_driver` fails, we get an error back. This cascades up through `call_driver_probe`, `really_probe`, `__driver_probe_device`, `driver_probe_device`. And then, *strangely*, `__driver_attach` *ignores* the error and returns 0. So, `driver_attach` returns 0, and then `bus_add_driver` also returns 0, and then `driver_register` returns 0, which means `usb_gadget_register_driver_owner` returns 0!

Now, this is where things get tricky. Since `usb_gadget_register_driver_owner` returns 0, it means that `dev_config` is able to set `dev->gadget_registered = true`! But, wait... in the `err_bind` case, `driver->is_bound` is explicitly set to `false`:
```c
err_bind:
	if (ret != -EISNAM)
		dev_err(&udc->dev, "failed to start %s: %d\n",
			driver->function, ret);

	mutex_lock(&udc_lock);
	udc->driver = NULL;
	driver->is_bound = false;
	mutex_unlock(&udc_lock);
```
But `usb_gadget_register_driver_owner` *checks* `driver->is_bound`. Because this is `false`, and `driver->match_existing_only` is false, this function will still return 0, leading to `dev_config` succeeding anyway:
```c
	mutex_lock(&udc_lock);
	if (!driver->is_bound) {
		if (driver->match_existing_only) {
			pr_warn("%s: couldn't find an available UDC or it's busy\n",
					driver->function);
			ret = -EBUSY;
		} else {
			pr_info("%s: couldn't find an available UDC\n",
					driver->function);
			ret = 0;
		}
	}
	mutex_unlock(&udc_lock);
```
So, even if `gadget_bind_driver` *failed*, `dev->gadget_registered` is *still* set to `true`. This feels like a potential leak...

Okay, let's step back. If `gadget_bind_driver` failed *before* the registration was complete, `gadgetfs_unbind` was already called, and `put_dev(dev)` was already executed. Therefore, `dev` has refcount 1 (from `dev_new`).  Now, consider this: `gadget_dev_open` was called, so refcount was 2. Then, `gadgetfs_bind` calls `get_dev(dev)`, refcount is 3. `gadgetfs_unbind` calls `put_dev(dev)`, refcount becomes 2. Finally, `ep0` is closed, and `dev_release` is called.

Inside `dev_release`, because `dev->gadget_registered` is `true`, we call `usb_gadget_unregister_driver(&gadgetfs_driver)`, which will eventually call `driver_unregister`.  Then `dev_release` calls `put_dev(dev)`, refcount is 1. Then, `gadgetfs_kill_sb` calls `put_dev(the_device)`, so the refcount becomes 0, and `dev` is freed. This should be a balanced sequence, but where did that extra `put_dev` go? It looks balanced.

Okay, let's consider another scenario: what if `driver_sysfs_add` fails? If that happens, then `really_probe` jumps to `sysfs_failed`.
```c
	ret = driver_sysfs_add(dev);
	if (ret) {
		dev_err(dev, "%s: driver_sysfs_add failed\n", __func__);
		goto sysfs_failed;
	}
```
If


67/2 2026/08/07 05:39 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/udc/core.c Name:usb_gadget_unregister_driver]

Results:
map[SourceCode:1779:	int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
1780:	{
1781:		if (!driver || !driver->unbind)
1782:			return -EINVAL;
1783:	
1784:		driver_unregister(&driver->driver);
1785:		return 0;
1786:	}
 SourceFile:drivers/usb/gadget/udc/core.c]

68/2 2026/08/07 05:39 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 46983
							output: 34
							thoughts: 17
						

Thoughts:
Okay, here's my interpretation of that thought process, tailored for an expert audience, and written in the first person:

**Unraveling Driver Unregistration**

Hmm, this code is calling `driver_unregister`. That's interesting, and I need to immediately understand the implications. The immediate question burning in my mind is, what exactly does `driver_unregister` *do*? I'm familiar with the concept, of course – it's the kernel's mechanism for cleanly removing a device driver from the system. But the specifics are always critical. I need to refresh my understanding of the exact sequence of actions it undertakes. Does it handle resource cleanup, unbinding from devices, deregistering the driver from the core subsystems? Is it robust in handling potential errors during unregistration? More importantly, what are the implicit assumptions the driver has to satisfy to make `driver_unregister` successful? Are there any potential race conditions I need to be aware of? Are there any potential deadlocks I need to think about?



69/2 2026/08/07 05:39 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/base/driver.c Name:driver_unregister]

Results:
map[SourceCode: 189:	/**
 190:	 * driver_unregister - remove driver from system.
 191:	 * @drv: driver.
 192:	 *
 193:	 * Again, we pass off most of the work to the bus-level call.
 194:	 */
 195:	void driver_unregister(struct device_driver *drv)
 196:	{
 197:		if (!drv || !drv->p) {
 198:			WARN(1, "Unexpected driver unregister!\n");
 199:			return;
 200:		}
 201:		driver_remove_groups(drv, drv->groups);
 202:		bus_remove_driver(drv);
 203:	}
 SourceFile:drivers/base/driver.c]

70/2 2026/08/07 05:39 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 47477
							output: 36
							thoughts: 8
						

Thoughts:
Okay, here's my interpretation of that thought process, summarized as you requested:

**Deconstructing `bus_remove_driver`**

Alright, let's break this down. The implication here is that we're dealing with a system, probably an operating system kernel or some sort of device management framework, that has a concept of "buses" – virtual or physical connections that devices plug into. The function `bus_remove_driver` is specifically designed to handle the removal of a driver from one of those buses.

My initial questions would be: what triggers this removal? Is it a graceful un-plug, a forced unload, or an error condition? Understanding the *why* is crucial. Then, what are the key steps involved? I'm thinking:

*   **Safety Checks:** We'd definitely need to start with some sanity checks. Is the bus valid? Is the driver actually attached to this bus? Are there any pending I/O operations or references to the driver that need to be handled before we proceed? This is critical to prevent crashes or memory corruption.
*   **Device Disconnect:** Next, there's the device itself. Any devices controlled by the driver on this bus need to be disconnected, de-initialized, or otherwise properly handled. We probably need a systematic approach to that to avoid any resource leaks.
*   **Driver De-registration:** We'll likely need to "unhook" the driver from the bus's internal structures. This involves removing it from any lists or data structures that track which drivers are associated with which buses. This operation should be thread safe.
*   **Cleanup:** Lastly, we must free any resources specifically allocated for this driver, and perform any necessary final cleanup steps.

This process seems straightforward, but is fraught with peril if it isn't properly designed and executed. Thread safety, resource management, and error handling are absolutely paramount. This function needs to be robust. I'll need to know the specific architecture and framework involved to offer more precise insights, but at a high level, that's what I'm thinking.



71/2 2026/08/07 05:40 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/base/bus.c Name:bus_remove_driver]

Results:
map[SourceCode: 810:	/**
 811:	 * bus_remove_driver - delete driver from bus's knowledge.
 812:	 * @drv: driver.
 813:	 *
 814:	 * Detach the driver from the devices it controls, and remove
 815:	 * it from its bus's list of drivers. Finally, we drop the reference
 816:	 * to the bus we took in bus_add_driver().
 817:	 */
 818:	void bus_remove_driver(struct device_driver *drv)
 819:	{
 820:		struct subsys_private *sp = bus_to_subsys(drv->bus);
 821:	
 822:		if (!sp)
 823:			return;
 824:	
 825:		pr_debug("bus: '%s': remove driver %s\n", sp->bus->name, drv->name);
 826:	
 827:		if (!drv->suppress_bind_attrs)
 828:			remove_bind_files(drv);
 829:		driver_remove_groups(drv, sp->bus->drv_groups);
 830:		driver_remove_file(drv, &driver_attr_uevent);
 831:		klist_remove(&drv->p->knode_bus);
 832:		driver_detach(drv);
 833:		module_remove_driver(drv);
 834:		kobject_put(&drv->p->kobj);
 835:	
 836:		/*
 837:		 * Decrement the reference count twice, once for the bus_to_subsys()
 838:		 * call in the start of this function, and the second one from the
 839:		 * reference increment in bus_add_driver()
 840:		 */
 841:		subsys_put(sp);
 842:		subsys_put(sp);
 843:	}
 SourceFile:drivers/base/bus.c]

72/2 2026/08/07 05:40 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 48511
							output: 34
							thoughts: 10
						

Thoughts:
Okay, let's see. My mind's buzzing... I'm going over the execution flow here. Ah, right, I see it. **The `driver_detach` call is happening!** That's the key moment. What implications does that have, precisely? Now I need to unpack what's been happening before, and what will happen after this specific line of code. What state is the system in at this point? What resources are being freed? And crucially, what's *supposed* to happen versus what *could* happen, given potential race conditions or resource conflicts. I need to quickly recall the memory management strategy in this module to anticipate potential issues. Right, the detach… is that clean? Are we handling all the edge cases correctly? Am I missing a lock that might be needed, or conversely, leaving one held too long? I've got to ensure the driver's memory is properly cleaned up to prevent leaks. The order of operations at this stage is absolutely critical. Let me mentally step through the surrounding code again... I need to consider all possible failure paths, of course. Time to dive deeper into the surrounding context now.



73/2 2026/08/07 05:40 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/base/dd.c Name:driver_detach]

Results:
map[SourceCode:1411:	/**
1412:	 * driver_detach - detach driver from all devices it controls.
1413:	 * @drv: driver.
1414:	 */
1415:	void driver_detach(const struct device_driver *drv)
1416:	{
1417:		struct device_private *dev_prv;
1418:		struct device *dev;
1419:	
1420:		if (driver_allows_async_probing(drv))
1421:			async_synchronize_full();
1422:	
1423:		for (;;) {
1424:			spin_lock(&drv->p->klist_devices.k_lock);
1425:			if (list_empty(&drv->p->klist_devices.k_list)) {
1426:				spin_unlock(&drv->p->klist_devices.k_lock);
1427:				break;
1428:			}
1429:			dev_prv = list_last_entry(&drv->p->klist_devices.k_list,
1430:					     struct device_private,
1431:					     knode_driver.n_node);
1432:			dev = dev_prv->device;
1433:			get_device(dev);
1434:			spin_unlock(&drv->p->klist_devices.k_lock);
1435:			device_release_driver_internal(dev, drv, dev->parent);
1436:			put_device(dev);
1437:		}
1438:	}
 SourceFile:drivers/base/dd.c]

74/2 2026/08/07 05:40 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 49250
							output: 36
							thoughts: 345
						

Thoughts:
**Debugging a Driver Binding Issue**

Okay, so I'm trying to figure out why a driver isn't binding correctly, and it's got me thinking. If `gadgetfs_bind` was *never* called, then `dev->driver` should *not* be set to `gadgetfs_driver` – that seems straightforward. But, hold on... let's retrace my steps. The call to `device_set_driver` occurs in `really_probe` *before* the call to `driver_sysfs_add`! That's interesting, let me double-check the `really_probe` function again...

Okay, here it is: `device_set_driver(dev, drv);` then a few other functions are called. After that, we have `ret = driver_sysfs_add(dev);`.

If `driver_sysfs_add` fails, the `BUS_NOTIFY_DRIVER_NOT_BOUND` is called, and `device_unbind_cleanup` is run. Okay, this is getting closer. What does `device_unbind_cleanup` *actually* do? Let's go look that up.



75/2 2026/08/07 05:40 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/base/dd.c Name:device_unbind_cleanup]

Results:
map[SourceCode: 593:	static void device_unbind_cleanup(struct device *dev)
 594:	{
 595:		if (dev->driver->p_cb.post_unbind_rust)
 596:			dev->driver->p_cb.post_unbind_rust(dev);
 597:		devres_release_all(dev);
 598:		arch_teardown_dma_ops(dev);
 599:		kfree(dev->dma_range_map);
 600:		dev->dma_range_map = NULL;
 601:		device_set_driver(dev, NULL);
 602:		dev_set_drvdata(dev, NULL);
 603:		dev_pm_domain_detach(dev, dev->power.detach_power_off);
 604:		if (dev->pm_domain && dev->pm_domain->dismiss)
 605:			dev->pm_domain->dismiss(dev);
 606:		pm_runtime_reinit(dev);
 607:		dev_pm_set_driver_flags(dev, 0);
 608:	}
 SourceFile:drivers/base/dd.c]

76/2 2026/08/07 05:40 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 50209
							output: 34
							thoughts: 574
						

Thoughts:
**My Analysis of the Driver Unbinding Sequence**

Okay, so I'm tracing this `device_set_driver(dev, NULL)` call. The first thing that jumps out is that `dev->driver` becomes NULL. That means `drv->p->klist_devices` is empty, right? Which means `driver_detach` does absolutely *nothing*. And, consequently, `usb_gadget_unregister_driver` does nothing too. Therefore, `gadgetfs_unbind` is *never* called. And if `gadgetfs_unbind` isn't called, then the all-important `put_dev(dev)` call that *should* be happening from within it, is *also* never happening.

Hold on, if `put_dev(dev)` isn't called from `gadgetfs_unbind`, then the device refcount is currently at 2. It started at 1 from `dev_new` and increments to 2 after `gadget_dev_open`. Now, when `ep0` closes, `dev_release` gets called which *does* call `put_dev(dev)`. The refcount drops to 1. Then, `gadgetfs_kill_sb` calls `put_dev(the_device)` and the refcount goes to 0, which triggers a free of `dev`. So, where's the use-after-free vulnerability that I'm supposed to be seeing? It seems like everything is cleaned up in this case.

Okay, let's play devil's advocate and consider the scenario where `gadgetfs_bind` *does* succeed. The refcount is now 3 (1 from `dev_new`, 1 from `gadget_dev_open`, and 1 from `gadgetfs_bind`).

So, `driver_sysfs_add` succeeds, and `call_driver_probe` also succeeds. Then, the critical point: `device_add_groups` fails. Now what?  The code branches to `dev_groups_failed`, which leads to:
```c
dev_sysfs_state_synced_failed:
dev_groups_failed:
	device_remove(dev);
probe_failed:
	driver_sysfs_remove(dev);
sysfs_failed:
	bus_notify(dev, BUS_NOTIFY_DRIVER_NOT_BOUND);
	if (dev->bus && dev->bus->dma_cleanup)
		dev->bus->dma_cleanup(dev);
pinctrl_bind_failed:
	device_links_no_driver(dev);
	device_unbind_cleanup(dev);
```

Wait a second... if `call_driver_probe` *did* succeed, does the failure of `device_add_groups` trigger a call to the driver's `unbind` function?

*No!*  It doesn't look like `really_probe` calls `driver->remove` *or* `driver->unbind` if `device_add_groups` fails. I need to be absolutely sure about this. Let's dig deeper into the `really_probe` function to confirm.



77/2 2026/08/07 05:40 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/base/dd.c Name:really_probe]

Results:
map[SourceCode: 652:	static int really_probe(struct device *dev, const struct device_driver *drv)
 653:	{
 654:		bool test_remove = IS_ENABLED(CONFIG_DEBUG_TEST_DRIVER_REMOVE) &&
 655:				   !drv->suppress_bind_attrs;
 656:		int ret, link_ret;
 657:	
 658:		if (defer_all_probes) {
 659:			/*
 660:			 * Value of defer_all_probes can be set only by
 661:			 * device_block_probing() which, in turn, will call
 662:			 * wait_for_device_probe() right after that to avoid any races.
 663:			 */
 664:			dev_dbg(dev, "Driver %s force probe deferral\n", drv->name);
 665:			return -EPROBE_DEFER;
 666:		}
 667:	
 668:		link_ret = device_links_check_suppliers(dev);
 669:		if (link_ret == -EPROBE_DEFER)
 670:			return link_ret;
 671:	
 672:		dev_dbg(dev, "bus: '%s': %s: probing driver %s with device\n",
 673:			drv->bus->name, __func__, drv->name);
 674:		if (!list_empty(&dev->devres_head)) {
 675:			dev_crit(dev, "Resources present before probing\n");
 676:			ret = -EBUSY;
 677:			goto done;
 678:		}
 679:	
 680:	re_probe:
 681:		device_set_driver(dev, drv);
 682:	
 683:		/* If using pinctrl, bind pins now before probing */
 684:		ret = pinctrl_bind_pins(dev);
 685:		if (ret)
 686:			goto pinctrl_bind_failed;
 687:	
 688:		if (dev->bus->dma_configure) {
 689:			ret = dev->bus->dma_configure(dev);
 690:			if (ret)
 691:				goto pinctrl_bind_failed;
 692:		}
 693:	
 694:		ret = driver_sysfs_add(dev);
 695:		if (ret) {
 696:			dev_err(dev, "%s: driver_sysfs_add failed\n", __func__);
 697:			goto sysfs_failed;
 698:		}
 699:	
 700:		if (dev->pm_domain && dev->pm_domain->activate) {
 701:			ret = dev->pm_domain->activate(dev);
 702:			if (ret)
 703:				goto probe_failed;
 704:		}
 705:	
 706:		ret = call_driver_probe(dev, drv);
 707:		if (ret) {
 708:			/*
 709:			 * If fw_devlink_best_effort is active (denoted by -EAGAIN), the
 710:			 * device might actually probe properly once some of its missing
 711:			 * suppliers have probed. So, treat this as if the driver
 712:			 * returned -EPROBE_DEFER.
 713:			 */
 714:			if (link_ret == -EAGAIN)
 715:				ret = -EPROBE_DEFER;
 716:	
 717:			/*
 718:			 * Return probe errors as positive values so that the callers
 719:			 * can distinguish them from other errors.
 720:			 */
 721:			ret = -ret;
 722:			goto probe_failed;
 723:		}
 724:	
 725:		ret = device_add_groups(dev, drv->dev_groups);
 726:		if (ret) {
 727:			dev_err(dev, "device_add_groups() failed\n");
 728:			goto dev_groups_failed;
 729:		}
 730:	
 731:		if (dev_has_sync_state(dev)) {
 732:			ret = device_create_file(dev, &dev_attr_state_synced);
 733:			if (ret) {
 734:				dev_err(dev, "state_synced sysfs add failed\n");
 735:				goto dev_sysfs_state_synced_failed;
 736:			}
 737:		}
 738:	
 739:		if (test_remove) {
 740:			test_remove = false;
 741:	
 742:			device_remove(dev);
 743:			driver_sysfs_remove(dev);
 744:			if (dev->bus && dev->bus->dma_cleanup)
 745:				dev->bus->dma_cleanup(dev);
 746:			device_unbind_cleanup(dev);
 747:	
 748:			goto re_probe;
 749:		}
 750:	
 751:		pinctrl_init_done(dev);
 752:	
 753:		if (dev->pm_domain && dev->pm_domain->sync)
 754:			dev->pm_domain->sync(dev);
 755:	
 756:		driver_bound(dev);
 757:		dev_dbg(dev, "bus: '%s': %s: bound device to driver %s\n",
 758:			drv->bus->name, __func__, drv->name);
 759:		goto done;
 760:	
 761:	dev_sysfs_state_synced_failed:
 762:	dev_groups_failed:
 763:		device_remove(dev);
 764:	probe_failed:
 765:		driver_sysfs_remove(dev);
 766:	sysfs_failed:
 767:		bus_notify(dev, BUS_NOTIFY_DRIVER_NOT_BOUND);
 768:		if (dev->bus && dev->bus->dma_cleanup)
 769:			dev->bus->dma_cleanup(dev);
 770:	pinctrl_bind_failed:
 771:		device_links_no_driver(dev);
 772:		device_unbind_cleanup(dev);
 773:	done:
 774:		return ret;
 775:	}
 SourceFile:drivers/base/dd.c]

78/2 2026/08/07 05:40 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 53351
							output: 34
							thoughts: 165
						

Thoughts:
**My Analysis of Device Removal in the Kernel**

Okay, let me break this down. My initial assumption was wrong; `device_remove(dev)` doesn't trigger the driver's `remove` method directly. Instead, it appears to handle a cleanup that's more focused on removing groups and attributes with calls to `device_remove_groups` and `device_remove_attrs`. This changes my understanding.

Now, if `device_add_groups` fails during the probe sequence, `really_probe` then calls `device_remove(dev)`, `driver_sysfs_remove(dev)`, and `device_unbind_cleanup(dev)`. And it's apparent that at no point in that sequence do we see `dev->bus->remove(dev)` or the driver's own `drv->remove(dev)` function being called. This is a crucial oversight!

This implies a scenario where the driver could remain bound to the device even if `really_probe` returns an error due to the failure in `device_add_groups`! The driver is technically still associated, but the probe has been considered unsuccessful, which is a potentially nasty state to leave things in.

I need to confirm this understanding, so let me pull up the source code for `device_remove` in `drivers/base/core.c` and take a closer look at its exact behavior. Understanding its precise actions is key to comprehending this potential issue.



79/2 2026/08/07 05:40 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/base/core.c Name:device_remove]

Results:
map[SourceCode: 610:	static void device_remove(struct device *dev)
 611:	{
 612:		device_remove_file(dev, &dev_attr_state_synced);
 613:		device_remove_groups(dev, dev->driver->dev_groups);
 614:	
 615:		if (dev->bus && dev->bus->remove)
 616:			dev->bus->remove(dev);
 617:		else if (dev->driver->remove)
 618:			dev->driver->remove(dev);
 619:	}
 SourceFile:drivers/base/dd.c]

80/2 2026/08/07 05:40 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 54039
							output: 34
							thoughts: 3780
						

Thoughts:
**Analyzing the USB Gadget Driver Lifecycle and Potential UAF**

Okay, so I've been tracing the execution path here, trying to understand how this USB gadget driver unloads and where a potential use-after-free (UAF) could arise. Initially, it seemed pretty straightforward: `device_remove` calls `dev->bus->remove(dev)`, which then cascades through `gadget_unbind_driver`, `gadgetfs_unbind`, and finally `put_dev(dev)`. If `device_add_groups` fails early on, we end up with a clean unbind and `put_dev` call. And if all succeeds, then at the end, `dev` is freed with refcount 0. So far, so good, everything is balanced.

I thought about the `driver_sysfs_add` failing. If *that* happens, then `gadgetfs_bind` is never called, so `dev`'s refcount could be off by one (2). Again, the refcount ends up becoming 0 by the end of `gadgetfs_kill_sb`. All still seemed balanced.

Then there was the possibility of `driver_register` failing, which also looked safe because `dev` is eventually freed. But what if `usb_gadget_register_driver_owner` fails *after* `driver_register` succeeds? No, that can't happen, there's a check for that scenario that prevents the race.

The thought then turned to whether the driver could be registered twice. However, `dev->state` is checked, preventing double registrations. But then, what if `gadgetfs_bind` is never called because `driver_sysfs_add` failed? If `dev_config` is called *again*, it should fail with `-EINVAL` because `dev->buf` is already set.

But what if `dev_config` fails *after* `dev->buf` is set? That looks safer because `dev->buf` is freed. And the logic says `dev->buf` is freed if `usb_gadget_register_driver` fails. But, what if the gadget registers fine, but `gadgetfs_bind` is *never* called? The ref count gets a little squirrely again... but still, `dev` seems to be freed safely. No UAF there either.

The fault injection trace is where it got interesting. It's not one single error, it is a *loop* of fault injections at various points. Then I had a thought... `driver_sysfs_add` might fail. This is where I think there is the bug. If `driver_sysfs_add` fails, then `really_probe` returns an error, but the error is ignored in the `__driver_attach` and it still registers! Meaning, `dev->gadget_registered` becomes true, but `gadgetfs_bind` is *never* called. This means the refcount is off. Then when the device is unbound, we end up with `put_dev` calls that should make `dev` be freed at the end. Then, the `gadgetfs_kill_sb` code is hit: the device refcount becomes 0 and `dev` is freed. But is there a UAF there?

In this case, since the repro is running multiple times, I'm thinking the UAF has to be somewhere within `gadgetfs_kill_sb` or the stack of calls that it invokes. I need to dig further into `kill_anon_super`, `generic_shutdown_super` and what calls it.



81/2 2026/08/07 05:40 tool codesearch-definition-source
0m Args:
map[ContextFile:fs/super.c Name:kill_anon_super]

Results:
map[SourceCode:1235:	void kill_anon_super(struct super_block *sb)
1236:	{
1237:		dev_t dev = sb->s_dev;
1238:		generic_shutdown_super(sb);
1239:		kill_super_notify(sb);
1240:		free_anon_bdev(dev);
1241:	}
 SourceFile:fs/super.c]

82/2 2026/08/07 05:40 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 58756
							output: 41
							thoughts: 1147
						

Thoughts:
**UAF Hunting: A Deep Dive into GadgetFS Unbinding**

Okay, so I'm tracking down this potential UAF in GadgetFS, right? The key lies in the shutdown sequence. I see `generic_shutdown_super` calls `shrink_dcache_for_umount`, which is expected. But I'm fixated on `ep0` and the device's release. I have to figure out the timing. 

First thought: does freeing the `ep0` inode trigger `dev_release`? No, that's not it. `dev_release` is a file operation, called when the `struct file` is closed. Right! Now I'm getting somewhere. When is that `struct file` closed? Aha, the reproducer calls `close(fd)` BEFORE the `umount("/tmp/gadgetfs")`!

So, `dev_release` gets called BEFORE `gadgetfs_kill_sb`. Okay, this changes things: if `dev_release` happens first, the `dev` refcount goes to 1. Then, `gadgetfs_kill_sb` calls `put_dev(the_device)`, dropping the refcount to 0. The `dev` is freed. Perfectly normal, no UAF yet.

What if `dev_release` *doesn't* happen first? Impossible, `close(fd)` comes before `umount`. This must be a different code path. The real question then is what triggers `dev_release` if the normal umount isn't happening. I have to chase down the `usb_gadget_unregister_driver` calls in the shutdown process.

What if `usb_gadget_unregister_driver` calls `gadgetfs_unbind`? If `gadgetfs_bind` *succeeded*, and it did, the refcount should start at 3. The `gadget_registered` flag is set. Then, `driver_sysfs_add` succeeds, `call_driver_probe` also succeeds, but then `device_add_groups` FAILS. If THAT happens, `really_probe` then calls `device_remove(dev)`. This calls `dev->bus->remove(dev)`, and then calls `gadget_unbind_driver`, which then calls `gadgetfs_unbind`. `gadgetfs_unbind` calls `put_dev(dev)`, dropping the refcount to 2. `really_probe` returns an error. `__driver_attach` ignores the error and returns 0. That means `driver_register` returns 0. Therefore `usb_gadget_register_driver_owner` returns 0. The flag `dev->gadget_registered` is set. So, if `ep0` is closed, then `dev_release` is called.

```c
	if (dev->gadget_registered) {
		usb_gadget_unregister_driver (&gadgetfs_driver);
		dev->gadget_registered = false;
	}
```
`usb_gadget_unregister_driver` then calls `driver_unregister`. `driver_unregister` calls `bus_remove_driver`. That then calls `driver_detach`. BUT, `dev->driver` is NULL, so `driver_detach` doesn't actually DO anything. `dev_release` then calls `put_dev(dev)`, dropping the refcount to 1. Finally, `gadgetfs_kill_sb` calls `put_dev(the_device)`, dropping the refcount to 0. Still no UAF! It's all balanced.

Wait, what if `gadgetfs_bind` *fails*? Let's trace that path.

```c
	static int gadgetfs_bind(struct usb_gadget *gadget,
			struct usb_gadget_driver *driver)
	{
		struct dev_data		*dev = the_device;
...
		/* preallocate control response and buffer */
		dev->req = usb_ep_alloc_request (gadget->ep0, GFP_KERNEL);
		if (!dev->req)
			goto enomem;
...
		if (activate_ep_files (dev) < 0)
			goto enomem;
...
		get_dev (dev);
		return 0;

	enomem:
		gadgetfs_unbind (gadget);
		return -ENOMEM;
	}
```

If `gadgetfs_bind` fails, it *immediately* calls `gadgetfs_unbind`!

```c
	static void
	gadgetfs_unbind (struct usb_gadget *gadget)
	{



83/2 2026/08/07 05:41 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c Name:gadgetfs_bind]

Results:
map[SourceCode:1668:	static int gadgetfs_bind(struct usb_gadget *gadget,
1669:			struct usb_gadget_driver *driver)
1670:	{
1671:		struct dev_data		*dev = the_device;
1672:	
1673:		if (!dev)
1674:			return -ESRCH;
1675:		if (0 != strcmp (CHIP, gadget->name)) {
1676:			pr_err("%s expected %s controller not %s\n",
1677:				shortname, CHIP, gadget->name);
1678:			return -ENODEV;
1679:		}
1680:	
1681:		set_gadget_data (gadget, dev);
1682:		dev->gadget = gadget;
1683:		gadget->ep0->driver_data = dev;
1684:	
1685:		/* preallocate control response and buffer */
1686:		dev->req = usb_ep_alloc_request (gadget->ep0, GFP_KERNEL);
1687:		if (!dev->req)
1688:			goto enomem;
1689:		dev->req->context = NULL;
1690:		dev->req->complete = epio_complete;
1691:	
1692:		if (activate_ep_files (dev) < 0)
1693:			goto enomem;
1694:	
1695:		INFO (dev, "bound to %s driver\n", gadget->name);
1696:		spin_lock_irq(&dev->lock);
1697:		dev->state = STATE_DEV_UNCONNECTED;
1698:		spin_unlock_irq(&dev->lock);
1699:		get_dev (dev);
1700:		return 0;
1701:	
1702:	enomem:
1703:		gadgetfs_unbind (gadget);
1704:		return -ENOMEM;
1705:	}
 SourceFile:drivers/usb/gadget/legacy/inode.c]

84/2 2026/08/07 05:41 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 61554
							output: 41
							thoughts: 129
						

Thoughts:
**Reference Count Underflow Detected!**

Yes! I've found a critical issue. My analysis shows that if `usb_ep_alloc_request` fails, the code branches to `enomem`. That, in turn, calls `gadgetfs_unbind(gadget)`. Now, here's where it gets interesting – and concerning. `gadgetfs_unbind` then calls `put_dev(dev)`. The problem is that the corresponding `get_dev(dev)` call, which I'd expect to balance this, happens *later* at line 1699, and it happens AFTER the `activate_ep_files` call. This means `gadgetfs_unbind` is potentially dropping a reference that was never actually taken within the critical execution path! This is a textbook example of a reference count underflow, and it's something we *really* need to address before it causes major headaches. Let me just double-check that `gadgetfs_unbind` function...



85/2 2026/08/07 05:41 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c Name:gadgetfs_unbind]

Results:
map[SourceCode:1639:	static void
1640:	gadgetfs_unbind (struct usb_gadget *gadget)
1641:	{
1642:		struct dev_data		*dev = get_gadget_data (gadget);
1643:	
1644:		DBG (dev, "%s\n", __func__);
1645:	
1646:		spin_lock_irq (&dev->lock);
1647:		dev->state = STATE_DEV_UNBOUND;
1648:		while (dev->udc_usage > 0) {
1649:			spin_unlock_irq(&dev->lock);
1650:			usleep_range(1000, 2000);
1651:			spin_lock_irq(&dev->lock);
1652:		}
1653:		spin_unlock_irq (&dev->lock);
1654:	
1655:		destroy_ep_files (dev);
1656:		gadget->ep0->driver_data = NULL;
1657:		set_gadget_data (gadget, NULL);
1658:	
1659:		/* we've already been disconnected ... no i/o is active */
1660:		if (dev->req)
1661:			usb_ep_free_request (gadget->ep0, dev->req);
1662:		DBG (dev, "%s done\n", __func__);
1663:		put_dev (dev);
1664:	}
 SourceFile:drivers/usb/gadget/legacy/inode.c]

86/2 2026/08/07 05:41 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 62378
							output: 41
							thoughts: 76
						

Thoughts:
**Analyzing the GadgetFS Unbind Process**

Okay, so I'm tracing this `gadgetfs_unbind` function. It looks like the critical thing to note here is that it definitely calls `put_dev(dev)`. That's important for resource management, obviously. And then, there's this connection to `gadgetfs_bind`. If `activate_ep_files` fails during the bind process, the code cleverly calls `gadgetfs_unbind` to clean up. Smart.

Now, the real potential gotcha here is `activate_ep_files`. I remember that function allocates memory, and that's a classic area for potential fault injection, especially in a system like this. It’s absolutely critical that we handle those allocation failures gracefully. This feels like a good place to double-check error handling. Time to dive into the `activate_ep_files` code itself and see how robust it really is.



87/2 2026/08/07 05:41 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c Name:activate_ep_files]

Results:
map[SourceCode:1593:	static int activate_ep_files (struct dev_data *dev)
1594:	{
1595:		struct usb_ep	*ep;
1596:		struct ep_data	*data;
1597:		int err;
1598:	
1599:		gadget_for_each_ep (ep, dev->gadget) {
1600:	
1601:			data = kzalloc_obj(*data);
1602:			if (!data)
1603:				goto enomem0;
1604:			data->state = STATE_EP_DISABLED;
1605:			mutex_init(&data->lock);
1606:			init_waitqueue_head (&data->wait);
1607:	
1608:			strscpy(data->name, ep->name);
1609:			refcount_set (&data->count, 1);
1610:			data->dev = dev;
1611:			get_dev (dev);
1612:	
1613:			data->ep = ep;
1614:			ep->driver_data = data;
1615:	
1616:			data->req = usb_ep_alloc_request (ep, GFP_KERNEL);
1617:			if (!data->req)
1618:				goto enomem1;
1619:	
1620:			err = gadgetfs_create_file (dev->sb, data->name,
1621:					data, &ep_io_operations);
1622:			if (err)
1623:				goto enomem2;
1624:			list_add_tail (&data->epfiles, &dev->epfiles);
1625:		}
1626:		return 0;
1627:	
1628:	enomem2:
1629:		usb_ep_free_request (ep, data->req);
1630:	enomem1:
1631:		put_dev (dev);
1632:		kfree (data);
1633:	enomem0:
1634:		DBG (dev, "%s enomem\n", __func__);
1635:		destroy_ep_files (dev);
1636:		return -ENOMEM;
1637:	}
 SourceFile:drivers/usb/gadget/legacy/inode.c]

88/2 2026/08/07 05:41 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 63352
							output: 35
							thoughts: 5376
						

Thoughts:
**Bug Hunting: The Dreaded UAF in gadgetfs!**

Okay, so I've been staring at this code for a while now, and I think I've got a handle on this UAF issue, which is really exciting.  The basic idea is this: we've got a reference counting problem.  `dev_new` starts the refcount at one.  `gadget_dev_open` bumps it to two.  From then on things get interesting, and this is where it all goes sideways.

The core of the problem lies in the interaction between `gadgetfs_bind` and `gadgetfs_unbind`, and how they are used, or *misused*, in the error paths. I see that `gadgetfs_bind` is the function that causes the refcount to increase when `get_dev()` is called, and `gadgetfs_unbind` to cause the refcount to decrease, via `put_dev()`.

Here's my thought process on tracking down this nasty bug:

*   **Scenario 1: `gadgetfs_bind` fails.**  If `activate_ep_files` or `usb_ep_alloc_request` fails, `gadgetfs_bind` calls `gadgetfs_unbind` immediately. If it fails *before* calling `get_dev()` which increases the refcount, `gadgetfs_unbind` will call `put_dev()`, incorrectly decreasing the refcount.  I initially thought this was the culprit, but then I realized the fault injection traces don't show the failure happening *there*, but instead in another, separate place in the code. I didn't see where the fault injection happened, and I was wrong in thinking this was the bug,

*   **Scenario 2:  `driver_sysfs_add` failing.**  This seems to be where the fault injection is occurring.  But if `driver_sysfs_add` fails, then `gadgetfs_bind` is NEVER called, thus `put_dev()` is never called in error. I spent way too much time here.

*   **Scenario 3: `device_add_groups` fails.** If `device_add_groups` fails, `gadgetfs_unbind` calls `put_dev(dev)`. Refcount becomes 2. This does NOT cause a bug.

*   **What if `gadgetfs_bind` FAILS?** Again, if `gadgetfs_bind` fails, then its `put_dev()` call decrements the refcount that it had never incremented.

*   **The Big Picture:**  Here's how it shakes out now. If the `driver_sysfs_add` fails (or even if it succeeds), the refcount is one at `dev_release`.  `dev_release` calls `usb_gadget_unregister_driver`, and at the end of that call, `dev_release` calls `put_dev()`.  The refcount is *still* one.  Then, later, `gadgetfs_kill_sb` calls `put_dev(the_device)`, which is a UAF!

So, the root cause is this: `gadgetfs_bind` can fail and incorrectly call `put_dev` when it shouldn't.




89/2 2026/08/07 05:41 tool grepper
0m Args:
map[Expression:put_dev PathPrefix:drivers/usb/gadget/legacy/inode.c]

Results:
map[Output:drivers/usb/gadget/legacy/inode.c=158=static inline void get_dev (struct dev_data *data)
--
drivers/usb/gadget/legacy/inode.c-162-
drivers/usb/gadget/legacy/inode.c:163:static void put_dev (struct dev_data *data)
drivers/usb/gadget/legacy/inode.c-164-{
--
drivers/usb/gadget/legacy/inode.c=217=static void put_ep (struct ep_data *data)
--
drivers/usb/gadget/legacy/inode.c-220-		return;
drivers/usb/gadget/legacy/inode.c:221:	put_dev (data->dev);
drivers/usb/gadget/legacy/inode.c-222-	/* needs no more cleanup */
--
drivers/usb/gadget/legacy/inode.c=1191=dev_release (struct inode *inode, struct file *fd)
--
drivers/usb/gadget/legacy/inode.c-1214-
drivers/usb/gadget/legacy/inode.c:1215:	put_dev (dev);
drivers/usb/gadget/legacy/inode.c-1216-	return 0;
--
drivers/usb/gadget/legacy/inode.c=1593=static int activate_ep_files (struct dev_data *dev)
--
drivers/usb/gadget/legacy/inode.c-1630-enomem1:
drivers/usb/gadget/legacy/inode.c:1631:	put_dev (dev);
drivers/usb/gadget/legacy/inode.c-1632-	kfree (data);
--
drivers/usb/gadget/legacy/inode.c=1640=gadgetfs_unbind (struct usb_gadget *gadget)
--
drivers/usb/gadget/legacy/inode.c-1662-	DBG (dev, "%s done\n", __func__);
drivers/usb/gadget/legacy/inode.c:1663:	put_dev (dev);
drivers/usb/gadget/legacy/inode.c-1664-}
--
drivers/usb/gadget/legacy/inode.c=2015=gadgetfs_fill_super (struct super_block *sb, struct fs_context *fc)
--
drivers/usb/gadget/legacy/inode.c-2060-	if (rc) {
drivers/usb/gadget/legacy/inode.c:2061:		put_dev(dev);
drivers/usb/gadget/legacy/inode.c-2062-		goto Enomem;
--
drivers/usb/gadget/legacy/inode.c=2099=gadgetfs_kill_sb (struct super_block *sb)
--
drivers/usb/gadget/legacy/inode.c-2103-	if (the_device) {
drivers/usb/gadget/legacy/inode.c:2104:		put_dev (the_device);
drivers/usb/gadget/legacy/inode.c-2105-		the_device = NULL;
]

90/2 2026/08/07 05:41 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 70270
							output: 52
							thoughts: 28
						

Thoughts:
Okay, here's my interpretation of those thoughts, tailored for an expert audience, presented in the first person:

**Analyzing the `put_ep` Function Call**

Right, so it's finally clicked. The `put_ep` function is calling `put_dev(data->dev)`. That's a critical detail I was missing. It directly links the endpoint release mechanism with the underlying device. Now the next thing I need to investigate is when is `put_ep` actually called? I need to understand the control flow to determine when the endpoint resources are released, and thus when the device resources are cleaned up. What triggers the `put_ep` to be called is the key question now.



91/2 2026/08/07 05:42 tool codesearch-find-references
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c IncludeSnippetLines:0 Name:put_ep SourceTreePrefix:]

Results:
map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:destroy_ep_files SourceFile:drivers/usb/gadget/legacy/inode.c SourceLine:1582] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:ep_aio SourceFile:drivers/usb/gadget/legacy/inode.c SourceLine:575] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:ep_aio_complete SourceFile:drivers/usb/gadget/legacy/inode.c SourceLine:524] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:ep_release SourceFile:drivers/usb/gadget/legacy/inode.c SourceLine:398]] TruncatedOutput:false]

92/2 2026/08/07 05:42 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 70732
							output: 41
							thoughts: 25
						

Thoughts:
Here's a summary of my thought process, as if I were the one thinking it:

**Digging into the `destroy_ep_files` Function**

Okay, so `destroy_ep_files` seems to be calling `put_ep`. That's interesting, but I need to understand the relationship better. Let's start by diving directly into `destroy_ep_files` itself. I need to figure out what that specific function is doing, in order to properly understand its interaction with `put_ep` and, ultimately, what the implications are for the system. Time to get into the code!



93/2 2026/08/07 05:42 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c Name:destroy_ep_files]

Results:
map[SourceCode:1554:	static void destroy_ep_files (struct dev_data *dev)
1555:	{
1556:		DBG (dev, "%s %d\n", __func__, dev->state);
1557:	
1558:		/* dev->state must prevent interference */
1559:		spin_lock_irq (&dev->lock);
1560:		while (!list_empty(&dev->epfiles)) {
1561:			struct ep_data	*ep;
1562:	
1563:			/* break link to FS */
1564:			ep = list_first_entry (&dev->epfiles, struct ep_data, epfiles);
1565:			list_del_init (&ep->epfiles);
1566:			spin_unlock_irq (&dev->lock);
1567:	
1568:			/* break link to controller */
1569:			mutex_lock(&ep->lock);
1570:			if (ep->state == STATE_EP_ENABLED)
1571:				(void) usb_ep_disable (ep->ep);
1572:			ep->state = STATE_EP_UNBOUND;
1573:			usb_ep_free_request (ep->ep, ep->req);
1574:			ep->ep = NULL;
1575:			mutex_unlock(&ep->lock);
1576:	
1577:			wake_up (&ep->wait);
1578:	
1579:			/* break link to dcache */
1580:			simple_remove_by_name(dev->sb->s_root, ep->name, NULL);
1581:	
1582:			put_ep (ep);
1583:	
1584:			spin_lock_irq (&dev->lock);
1585:		}
1586:		spin_unlock_irq (&dev->lock);
1587:	}
 SourceFile:drivers/usb/gadget/legacy/inode.c]

94/2 2026/08/07 05:42 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 71470
							output: 37
							thoughts: 3317
						

Thoughts:
**The UAF in GadgetFS: A Journey Through Driver Registration and Unbinding**

Okay, let's break this down. My initial thought process focused on how endpoint files are handled in the `gadgetfs` driver. It all seemed straightforward, with reference counting ensuring proper resource management during endpoint creation, destruction, and unbinding. I was mainly looking for the reference count imbalance, but this was a red herring. Then, I was looking into other failure cases. What happens if an allocation fails during endpoint setup? What if `gadgetfs_unbind` is called before `get_dev`?

Then I went through `gadgetfs_unbind` and started suspecting that it drops a reference that was never taken. But I dismissed it by tracing the calls. Then I went through failure cases, and determined the correct sequence. 

I then re-examined the fault injection trace. The traces indicated that the fault injection occurs during driver registration, specifically in `bus_add_driver`. If `bus_add_driver` fails, the `dev_release` gets the ref count to 0, which is then re-used in `gadgetfs_kill_sb`!

So, to summarize this bug, the sequence is:

1.  A failure during driver registration *before* the device is fully bound (e.g., `bus_add_driver` fails). This is simulated by the fault injection.
2.  `gadgetfs_bind` does NOT run, and `get_dev()` is not called.
3.  The device is "registered" because the driver register succeeded.
4.  Then the unbind procedure is triggered.
5.  `gadgetfs_unbind` calls `put_dev(dev)` and reduces the ref count to 0.
6.  `gadgetfs_kill_sb` later calls `put_dev(the_device)`, and since the dev is now zero, this causes a use-after-free vulnerability!

Essentially, the bug stems from a race condition where the driver registration can *appear* to succeed partially, but a subsequent failure during the early setup phase skips the `get_dev` call. This leads to an imbalance in the device reference count, and a classic UAF!



95/2 2026/08/07 05:42 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/base/dd.c Name:driver_sysfs_add]

Results:
map[SourceCode: 483:	static int driver_sysfs_add(struct device *dev)
 484:	{
 485:		int ret;
 486:	
 487:		bus_notify(dev, BUS_NOTIFY_BIND_DRIVER);
 488:	
 489:		ret = sysfs_create_link(&dev->driver->p->kobj, &dev->kobj,
 490:					kobject_name(&dev->kobj));
 491:		if (ret)
 492:			goto fail;
 493:	
 494:		ret = sysfs_create_link(&dev->kobj, &dev->driver->p->kobj,
 495:					"driver");
 496:		if (ret)
 497:			goto rm_dev;
 498:	
 499:		if (!IS_ENABLED(CONFIG_DEV_COREDUMP) || !dev->driver->coredump)
 500:			return 0;
 501:	
 502:		ret = device_create_file(dev, &dev_attr_coredump);
 503:		if (!ret)
 504:			return 0;
 505:	
 506:		sysfs_remove_link(&dev->kobj, "driver");
 507:	
 508:	rm_dev:
 509:		sysfs_remove_link(&dev->driver->p->kobj,
 510:				  kobject_name(&dev->kobj));
 511:	
 512:	fail:
 513:		return ret;
 514:	}
 SourceFile:drivers/base/dd.c]

96/2 2026/08/07 05:42 llm debugger
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 75772
							output: 1148
							thoughts: 6281
						

Thoughts:
**Analysis of the gadgetfs UAF vulnerability**

Okay, so I've dug into this reproducer for a while, and the root cause of this use-after-free (UAF) in the `gadgetfs` driver is a classic refcount imbalance. It boils down to `gadgetfs_bind` calling `gadgetfs_unbind` incorrectly in its error path. Let me lay out the thought process and the crucial steps.

1.  **Device Initialization:** The process begins with the `dev` structure being allocated with an initial refcount of 1.

    ```c
    // From dev_new()
    dev->count = 1;
    ```

2.  **User Opens Ep0:**  When the user opens `/tmp/gadgetfs/ep0`, `gadget_dev_open` is called. This function does `get_dev(dev)`, incrementing the refcount to 2.

    ```c
    spin_lock_irq(&dev->lock);
    if (dev->state == STATE_DEV_DISABLED) {
    	dev->ev_next = 0;
    	dev->state = STATE_DEV_OPENED;
    	fd->private_data = dev;
    	get_dev (dev);
    	value = 0;
    }
    spin_unlock_irq(&dev->lock);
    ```

3.  **Driver Registration and Bind:** Then, the user writes to the endpoint, which triggers `dev_config`. Inside `dev_config`, `usb_gadget_register_driver(&gadgetfs_driver)` is called. This registers the driver, and as part of the binding process, calls `gadgetfs_bind`.

4.  **`gadgetfs_bind` (and Fault Injection):** Now, the critical part.  `gadgetfs_bind` attempts to allocate resources, specifically using `usb_ep_alloc_request` or calls `activate_ep_files` (which allocates resources too), and this is where the fault injection comes in. If a memory allocation fails in one of these calls (simulating a "fault"), the code jumps to an error label called `enomem`.

5.  **Refcount Leak in Error Path:**  Here's where the problem arises: the `enomem` path incorrectly calls `gadgetfs_unbind(gadget)`.

    ```c
    enomem:
    	gadgetfs_unbind (gadget);
    	return -ENOMEM;
    ```

    `gadgetfs_unbind` *does* cleanup and frees memory. Crucially, it also calls `put_dev(dev)`.

    ```c
    static void
    gadgetfs_unbind (struct usb_gadget *gadget)
    {
    	struct dev_data		*dev = get_gadget_data (gadget);

    	DBG (dev, "%s\n", __func__);

    	spin_lock_irq (&dev->lock);
    	dev->state = STATE_DEV_UNBOUND;
    	while (dev->udc_usage > 0) {
    		spin_unlock_irq(&dev->lock);
    		usleep_range(1000, 2000);
    		spin_lock_irq(&dev->lock);
    	}
    	spin_unlock_irq (&dev->lock);

    	destroy_ep_files (dev);
    	gadget->ep0->driver_data = NULL;
    	set_gadget_data (gadget, NULL);

    	/* we've already been disconnected ... no i/o is active */
    	if (dev->req)
    		usb_ep_free_request (gadget->ep0, dev->req);
    	DBG (dev, "%s done\n", __func__);
    	put_dev (dev);
    }
    ```

    *Here's the leak:* `get_dev(dev)` is called at the very *end* of `gadgetfs_bind`, only after the allocation succeeds. But on *failure*, `put_dev(dev)` is called via `gadgetfs_unbind`, *before* `get_dev` has a chance to be called. Therefore, `gadgetfs_unbind` decrements a refcount it didn't increment. This creates a one-off error.

6.  **Ignoring the Error:**  The probe then fails and returns -ENOMEM, however, the driver core ( `__driver_attach` ) *ignores* this error. This means


97/1 2026/08/07 05:43 agent history-explorer
3m Model:
best-expensive

Instruction:
You are an experienced Linux kernel developer researching prior art for fixing a kernel bug.
You are given a bug explanation. This explanation details the root cause of the bug resulting
from debugging, but does not provide the final fix strategy. Your goal is to explore how
similar bugs were fixed in the past in the same subsystem or files.

CRITICAL: Do NOT attempt to debug the issue further or write a patch for it yourself.
Your ONLY objective is to research and provide the necessary historical context.

Use the git-log tool with the Since parameter set to "3 years" to focus on recent history.
Search for commits that address issues with similar root causes (e.g. similar missing locks,
incorrect refcounting, or similar error path bugs) in the affected files.

Your final reply must summarize your findings: what idioms, locking rules, or common patterns
should be followed when writing a fix for this bug based on how previous similar bugs were addressed.
If you find no relevant past fixes, clearly state that.

Don't make assumptions about the kernel source code (it may be different from what you assume it is).
Extensively use the provided code access tools (codesearch-*, git-*, grepper, etc)
to examine the actual source code, and confirm any assumptions.

Prefer calling several tools at the same time to save round-trips.

Prompt:
The crash is:

udc dummy_udc.0: failed to start USB Gadget filesystem: -12
gadgetfs gadget.0: probe with driver gadgetfs failed with error -12
gadgetfs: bound to dummy_udc driver
==================================================================
BUG: KASAN: slab-use-after-free in instrument_atomic_read_write include/linux/instrumented.h:112 [inline]
BUG: KASAN: slab-use-after-free in atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:400 [inline]
BUG: KASAN: slab-use-after-free in __refcount_sub_and_test include/linux/refcount.h:389 [inline]
BUG: KASAN: slab-use-after-free in __refcount_dec_and_test include/linux/refcount.h:432 [inline]
BUG: KASAN: slab-use-after-free in refcount_dec_and_test include/linux/refcount.h:450 [inline]
BUG: KASAN: slab-use-after-free in put_dev drivers/usb/gadget/legacy/inode.c:165 [inline]
BUG: KASAN: slab-use-after-free in gadgetfs_kill_sb+0x46/0x110 drivers/usb/gadget/legacy/inode.c:2104
Write of size 4 at addr ffff88811638c080 by task syz-executor169/5848

CPU: 0 UID: 0 PID: 5848 Comm: syz-executor169 Not tainted syzkaller #1 PREEMPT_{RT,(full)} 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 print_address_description+0x55/0x1e0 mm/kasan/report.c:378
 print_report+0x58/0x70 mm/kasan/report.c:482
 kasan_report+0x117/0x150 mm/kasan/report.c:595
 check_region_inline mm/kasan/generic.c:-1 [inline]
 kasan_check_range+0x264/0x2c0 mm/kasan/generic.c:200
 instrument_atomic_read_write include/linux/instrumented.h:112 [inline]
 atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:400 [inline]
 __refcount_sub_and_test include/linux/refcount.h:389 [inline]
 __refcount_dec_and_test include/linux/refcount.h:432 [inline]
 refcount_dec_and_test include/linux/refcount.h:450 [inline]
 put_dev drivers/usb/gadget/legacy/inode.c:165 [inline]
 gadgetfs_kill_sb+0x46/0x110 drivers/usb/gadget/legacy/inode.c:2104
 deactivate_locked_super+0xbc/0x130 fs/super.c:477
 cleanup_mnt+0x3d3/0x460 fs/namespace.c:1317
 task_work_run+0x1d9/0x270 kernel/task_work.c:233
 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
 __exit_to_user_mode_loop kernel/entry/common.c:70 [inline]
 exit_to_user_mode_loop+0x1fa/0x730 kernel/entry/common.c:101
 __exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline]
 syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:230 [inline]
 syscall_exit_to_user_mode include/linux/entry-common.h:318 [inline]
 do_syscall_64+0x353/0x580 arch/x86/entry/syscall_64.c:100
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f5f0e505027
Code: a2 c7 05 54 b0 08 00 00 00 00 00 eb 96 e8 a1 08 00 00 90 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 c7 c2 d8 ff ff ff f7 d8 64 89 02 b8
RSP: 002b:00007ffcdf2b0288 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6
RAX: 0000000000000000 RBX: 0000000000000003 RCX: 00007f5f0e505027
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00007f5f0e55f05e
RBP: 00007f5f0e55f05e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f5f0e55f623
R13: 00007ffcdf2b03e0 R14: 00007f5f0e561510 R15: 00007f5f0e5614e8
 </TASK>

Allocated by task 5848:
 kasan_save_stack mm/kasan/common.c:57 [inline]
 kasan_save_track+0x3e/0x80 mm/kasan/common.c:78
 poison_kmalloc_redzone mm/kasan/common.c:398 [inline]
 __kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:415
 kasan_kmalloc include/linux/kasan.h:263 [inline]
 __kmalloc_cache_noprof+0x3d2/0x6b0 mm/slub.c:5489
 _kmalloc_noprof include/linux/slab.h:988 [inline]
 _kzalloc_noprof include/linux/slab.h:1309 [inline]
 dev_new drivers/usb/gadget/legacy/inode.c:176 [inline]
 gadgetfs_fill_super+0x27b/0x7a0 drivers/usb/gadget/legacy/inode.c:2054
 vfs_get_super fs/super.c:1273 [inline]
 get_tree_single+0xc0/0x150 fs/super.c:1300
 vfs_get_tree+0x92/0x2a0 fs/super.c:1700
 fc_mount fs/namespace.c:1198 [inline]
 do_new_mount_fc fs/namespace.c:3765 [inline]
 do_new_mount+0x319/0xdc0 fs/namespace.c:3841
 do_mount fs/namespace.c:4174 [inline]
 __do_sys_mount fs/namespace.c:4390 [inline]
 __se_sys_mount+0x31d/0x420 fs/namespace.c:4367
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Freed by task 5848:
 kasan_save_stack mm/kasan/common.c:57 [inline]
 kasan_save_track+0x3e/0x80 mm/kasan/common.c:78
 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:584
 poison_slab_object mm/kasan/common.c:253 [inline]
 __kasan_slab_free+0x5c/0x80 mm/kasan/common.c:285
 kasan_slab_free include/linux/kasan.h:235 [inline]
 slab_free_hook mm/slub.c:2677 [inline]
 slab_free mm/slub.c:6377 [inline]
 kfree+0x1c5/0x6c0 mm/slub.c:6692
 put_dev drivers/usb/gadget/legacy/inode.c:169 [inline]
 dev_release+0x173/0x210 drivers/usb/gadget/legacy/inode.c:1215
 __fput+0x42a/0xa80 fs/file_table.c:512
 fput_close_sync+0x11f/0x240 fs/file_table.c:617
 __do_sys_close fs/open.c:1511 [inline]
 __se_sys_close fs/open.c:1496 [inline]
 __x64_sys_close+0x7e/0x110 fs/open.c:1496
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

The buggy address belongs to the object at ffff88811638c000
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 128 bytes inside of
 freed 1024-byte region [ffff88811638c000, ffff88811638c400)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff88811638d000 pfn:0x116388
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0x100000000000240(workingset|head|node=0|zone=2)
page_type: f5(slab)
raw: 0100000000000240 ffff888100041dc0 ffffea00044a8a10 ffffea00043da810
raw: ffff88811638d000 000000080010000f 00000000f5000000 0000000000000000
head: 0100000000000240 ffff888100041dc0 ffffea00044a8a10 ffffea00043da810
head: ffff88811638d000 000000080010000f 00000000f5000000 0000000000000000
head: 0100000000000003 fffffffffffffe01 00000000ffffffff 00000000ffffffff
head: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000008
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5581, tgid 5581 (syz-executor), ts 49160475111, free_ts 0
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x1f9/0x250 mm/page_alloc.c:1859
 prep_new_page mm/page_alloc.c:1867 [inline]
 get_page_from_freelist+0x262a/0x26a0 mm/page_alloc.c:3946
 __alloc_frozen_pages_noprof+0x18d/0x380 mm/page_alloc.c:5304
 alloc_slab_page mm/slub.c:3266 [inline]
 allocate_slab+0x79/0x5e0 mm/slub.c:3380
 new_slab mm/slub.c:3426 [inline]
 refill_objects+0x2d8/0x350 mm/slub.c:7310
 refill_sheaf mm/slub.c:2804 [inline]
 __pcs_replace_empty_main+0x330/0x690 mm/slub.c:4675
 alloc_from_pcs mm/slub.c:4773 [inline]
 slab_alloc_node mm/slub.c:4905 [inline]
 __kmalloc_cache_noprof+0x468/0x6b0 mm/slub.c:5485
 _kmalloc_noprof include/linux/slab.h:988 [inline]
 _kzalloc_noprof include/linux/slab.h:1309 [inline]
 rxrpc_service_prealloc+0x9f/0x130 net/rxrpc/call_accept.c:167
 rxrpc_listen+0x1b7/0x360 net/rxrpc/af_rxrpc.c:237
 afs_open_socket+0x2fa/0x3f0 fs/afs/rxrpc.c:107
 afs_net_init+0x6ce/0x8f0 fs/afs/main.c:116
 ops_init+0x35d/0x5d0 net/core/net_namespace.c:137
 setup_net+0x118/0x350 net/core/net_namespace.c:446
 copy_net_ns+0x4f9/0x720 net/core/net_namespace.c:579
 create_new_namespaces+0x3f0/0x6b0 kernel/nsproxy.c:132
 unshare_nsproxy_namespaces+0x149/0x190 kernel/nsproxy.c:234
page_owner free stack trace missing

Memory state around the buggy address:
 ffff88811638bf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88811638c000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88811638c080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff88811638c100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88811638c180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


The explanation of the root cause of the bug is:

The root cause of this KASAN slab-use-after-free is a reference count underflow in the error handling path of `gadgetfs_bind()`. 

When fault injection forces a memory allocation failure during the binding process, `gadgetfs_bind()` incorrectly calls `gadgetfs_unbind()`, which drops a reference to the device (`dev`) that was never actually taken.

### Detailed Sequence of Events

1. **Initialization and Open:**
   When the gadgetfs superblock is created, `dev_new()` allocates the `dev_data` structure (`dev`) and initializes its refcount to 1. When the user opens the `/tmp/gadgetfs/ep0` file, `gadget_dev_open()` is called, which increments the refcount to 2 via `get_dev(dev)`.

2. **Driver Registration and Binding:**
   The user writes configuration data to `ep0`, invoking `dev_config()`. This function calls `usb_gadget_register_driver(&gadgetfs_driver)`, which registers the driver and attempts to bind it to the UDC, eventually calling `gadgetfs_bind()`.

3. **Fault Injection and Refcount Underflow:**
   In `gadgetfs_bind()`, memory allocations are performed (e.g., `usb_ep_alloc_request()` or inside `activate_ep_files()`). If fault injection causes one of these to fail, the code jumps to the `enomem` label:
   ```c
   // drivers/usb/gadget/legacy/inode.c : gadgetfs_bind()
   
   	dev->req = usb_ep_alloc_request (gadget->ep0, GFP_KERNEL);
   	if (!dev->req)
   		goto enomem;
   ...
   	if (activate_ep_files (dev) < 0)
   		goto enomem;
   ...
   	get_dev (dev); // <--- Reference is only taken on SUCCESS
   	return 0;
   
   enomem:
   	gadgetfs_unbind (gadget);
   	return -ENOMEM;
   ```
   The `enomem` path calls `gadgetfs_unbind()`, which performs cleanup and unconditionally calls `put_dev(dev)`. Because `get_dev(dev)` is only called at the very end of `gadgetfs_bind()` on success, `gadgetfs_unbind()` drops a reference that was never acquired. The refcount incorrectly drops from 2 to 1.

4. **Probe Failure Ignored:**
   The `-ENOMEM` error propagates up to the driver core. However, `__driver_attach()` intentionally ignores probe failures and returns `0`. Because `gadgetfs_driver` does not set `match_existing_only = true`, `usb_gadget_register_driver_owner()` also returns `0` (success).

5. **Closing ep0 and Freeing:**
   Seeing a success return value, `dev_config()` sets `dev->gadget_registered = true`. 
   Later, the reproducer closes the `ep0` file descriptor, triggering `dev_release()`. `dev_release()` cleans up and calls `put_dev(dev)`. The refcount drops from 1 to 0, and `dev` is prematurely freed.

6. **The Use-After-Free:**
   Finally, the reproducer unmounts the filesystem, which invokes `gadgetfs_kill_sb()`. 
   ```c
   // drivers/usb/gadget/legacy/inode.c : gadgetfs_kill_sb()
   
   	if (the_device) {
   		put_dev (the_device); // <--- UAF here
   		the_device = NULL;
   	}
   ```
   `gadgetfs_kill_sb()` attempts to drop the initial reference by calling `put_dev(the_device)`. Since `the_device` points to the `dev` structure that was already freed in step 5, this triggers the KASAN slab-use-after-free.

### Suggested Fix

`gadgetfs_bind()` should not call `gadgetfs_unbind()` in its error path, as `gadgetfs_unbind()` is designed to tear down a fully bound gadget (and thus expects the extra reference to exist). Instead, `gadgetfs_bind()` should manually clean up the specific state it altered before the failure occurred.

```c
 enomem:
-	gadgetfs_unbind (gadget);
+	if (dev->req) {
+		usb_ep_free_request (gadget->ep0, dev->req);
+		dev->req = NULL;
+	}
+	gadget->ep0->driver_data = NULL;
+	set_gadget_data (gadget, NULL);
+	dev->gadget = NULL;
 	return -ENOMEM;
```
*(Note: `activate_ep_files()` already perfectly cleans up after itself on failure, so no additional teardown is needed for it in `gadgetfs_bind()`'s error path).*

Reply:
Based on a review of recent commits in the USB gadget subsystem, this type of bug—where an error path incorrectly calls a full teardown function (like `unbind`) on a partially initialized object—is a known and recurring pattern. 

When a full teardown function is called during a failed initialization, it often assumes that all resources, locks, and reference counts were successfully acquired. If they were not, it leads to issues like the refcount underflow and subsequent use-after-free seen in this bug, or NULL pointer dereferences and double-frees.

### Prior Art and Similar Fixes

Recent history in the `drivers/usb/gadget/` tree shows several commits addressing the exact same class of error-path bugs:

1. **Refactoring to avoid unified teardown on error:**
   In late 2025, a series of commits fixed similar issues across multiple gadget functions where a failed `bind` would jump to a unified error label that freed stale or uninitialized pointers (e.g., `notify_req`), causing NULL pointer dereferences.
   - `47b2116e54b4 usb: gadget: f_acm: Refactor bind path to use __free()`
   - `42988380ac67 usb: gadget: f_ecm: Refactor bind path to use __free()`
   - `75a5b8d4ddd4 usb: gadget: f_ncm: Refactor bind path to use __free()`
   - `082289414360 usb: gadget: f_rndis: Refactor bind path to use __free()`
   
   **The fix strategy:** Instead of relying on a catch-all error label that cleans up struct members, the developers refactored the code to use the `__free()` automatic cleanup mechanism for local variables, only assigning them to the main structure upon complete success.

2. **Manual reverse-order cleanup:**
   Another recent example is `62783c30d78a USB: gadget: f_hid: Fix memory leak in hidg_bind error path`. In this commit, the error handling was restructured to use proper `goto` cleanup labels (`fail_free_all`, `fail_free_descs`, `fail`). 
   
   **The fix strategy:** The commit ensured that allocated resources were properly freed manually in the exact reverse order of their allocation, rather than relying on a single cleanup path that might miss things or free things incorrectly.

3. **Stale state in `gadgetfs` itself:**
   Historically, `drivers/usb/gadget/legacy/inode.c` has suffered from similar stale state issues on error paths. For example, in `add333a81a16 USB: gadgetfs: fix use-after-free bug`, an error path in `dev_config()` failed to clear a pointer (`dev->hs_config`), which was later dereferenced on a subsequent call, causing a use-after-free.

### Idioms and Patterns to Follow for the Fix

Based on how these similar bugs were addressed, the following idioms and rules should be followed when writing the fix for `gadgetfs_bind()`:

1. **Do not call `unbind()` from `bind()`'s error path:** 
   Functions like `gadgetfs_unbind()` are designed to tear down a *fully bound and initialized* gadget. They expect invariants (like the extra `get_dev()` reference) to be true. Calling them on a partially initialized object violates these invariants.
   
2. **Manual, localized cleanup:**
   The error path in `gadgetfs_bind()` should manually undo *only* the specific state it successfully altered before the failure occurred. As suggested in your bug explanation, freeing the `dev->req` (if allocated) and clearing the pointers (`gadget->ep0->driver_data`, `dev->gadget`, etc.) is the correct historical pattern for this subsystem.

3. **Reverse order of initialization:**
   If multiple allocations or state changes occur, the error path should clean them up in the exact reverse order of how they were set up, typically using cascading `goto` labels (though in `gadgetfs_bind()`, a single `enomem` label with localized `if` checks is sufficient since the setup is relatively short).

98/2 2026/08/07 05:43 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 9303
							output: 35
							thoughts: 245
						

Thoughts:
**Investigating a Refcount Underflow Bug in gadgetfs_bind()**

Okay, so I've got a tricky one here. It seems there's a potential refcount underflow in `drivers/usb/gadget/legacy/inode.c`, specifically around how `gadgetfs_bind()` and `gadgetfs_unbind()` interact on the error path. The core problem is that `gadgetfs_unbind()` expects `get_dev(dev)` to have been called, and the refcount increment, but it seems that's only happening on the successful path in `gadgetfs_bind()`. If an error occurs *before* that increment, `gadgetfs_unbind()` is going to decrement a refcount that was never increased, which is bad news bears.

The user, knowing my area of expertise, has asked me to dig into the prior art. They want me to find out if this kind of bug, with these kinds of underlying causes (missing locks, refcount issues, error path problems) has shown up before in this subsystem. I need to be efficient about it, so I'll limit the search to the past three years using `git-log`.

My focus will be on the files involved – specifically `drivers/usb/gadget/legacy/inode.c`. However, I need to be a bit broader in my search criteria. This kind of problem could also be hidden in `drivers/usb/gadget/` or even just in the generic `drivers/usb/` directory.

So, first I'll use `git-log` on `drivers/usb/gadget/legacy/inode.c` to look at recent commits there. That'll be a good starting point. I can then broaden the search if needed. This initial investigation should give me some insights into the code's history and if similar issues have been addressed before. Time to get to work.



99/2 2026/08/07 05:43 tool git-log
0m Args:
map[PathPrefix:drivers/usb/gadget/legacy/inode.c Since:3 years]

Results:
map[Output:bf4afc53b77a Convert 'alloc_obj' family to use the new default GFP_KERNEL argument
69050f8d6d07 treewide: Replace kmalloc with kmalloc_obj for non-scalar types
57db9d428ba5 convert gadgetfs
b65e3b11e923 gadgetfs: switch to simple_remove_by_name()
f99b3917789d fs: rename generic_delete_inode() and generic_drop_inode()
bad356bb50e6 functionfs, gadgetfs: use simple_recursive_removal()
bd3cf1a9396e USB: gadget: Replace deprecated strncpy() with strscpy()
5b6dc50e9ed8 USB: gadget: Use str_enable_disable-like helpers
cb787f4ac0c2 [tree-wide] finally take no_llseek out
69f73ca33d6b legacy: convert to new timestamp accessors
]

100/2 2026/08/07 05:43 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 10242
							output: 52
							thoughts: 64
						

Thoughts:
Okay, let's see what's going on.

**USB Gadget Driver Analysis: Identifying Potential Issues**

Hmm, `drivers/usb/gadget/legacy/inode.c` hasn't seen much activity in the way of bug fixes over the last three years. That makes me wonder if there are underlying issues we're not seeing surface actively. To get a broader perspective, I should expand my search scope. Let's cast a wider net and look at the entire `drivers/usb/gadget/` directory.

I'm thinking, specifically, about areas prone to subtle, hard-to-debug problems. Refcounting is always a good place to start – `refcount` itself. Then, I'll need to look at common memory safety issues, namely `use-after-free`, and of course the always tricky `error path` handling. Finally, I'll also want to examine anything related to the device `unbind` process, where resources might be mishandled when detaching and shutting down, which can often be a source of memory corruption. By focusing on these keywords and concepts, hopefully, I can identify areas that warrant a closer look.



101/2 2026/08/07 05:43 tool git-log
0m Args:
map[MessageRegexps:[(refcount|use-after-free|error path|unbind)] PathPrefix:drivers/usb/gadget/ Since:3 years]

Results:
map[Output:]

102/2 2026/08/07 05:43 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 10617
							output: 42
							thoughts: 54
						

Thoughts:
Okay, let's see...

**Debugging Thought Process: Narrowing Down the Search**

Hmm, I'm getting a hunch that the regex I was about to use might not be the most straightforward approach, or perhaps I'm overcomplicating things. Maybe the specific syntax isn't supported as I expect, or perhaps I should just try simpler, more direct terms. My mind immediately jumps to the classic suspects in memory corruption, especially when dealing with low-level kernel code – "refcount" issues, or the dreaded "use-after-free". That's often where the vulnerabilities hide in these sorts of subsystems.

Right, so instead of playing around with regex, let's keep it simple. My immediate focus will be on searching for "use-after-free" within the `drivers/usb/gadget/` directory. That seems like a pretty targeted and reasonable starting point, given the context we're dealing with. Let's see what that search turns up.



103/2 2026/08/07 05:43 tool git-log
0m Args:
map[MessageRegexps:[use-after-free] PathPrefix:drivers/usb/gadget/ Since:3 years]

Results:
map[Output:5650c18d93a1 usb: gadget: f_midi: cancel pending IN work before freeing the midi object
0583f2fbf8f8 usb: gadget: udc: bdc: free IRQ and drain func_wake_notify before teardown
79e2d75725c8 usb: gadget: f_tcm: synchronize delayed set_alt with teardown
67e511d2989e usb: gadget: udc: Fix use-after-free in gadget_match_driver
30adce93d5c4 usb: gadget: f_printer: take kref only for successful open
2796646f6d89 usb: gadget: f_fs: serialize DMABUF cancel against request completion
eba2936bbe6b usb: gadget: uvc: fix NULL pointer dereference during unbind race
0d6c8144ca4d usb: gadget: f_ncm: Fix atomic context locking issue
56a512a9b410 usb: gadget: f_ncm: align net_device lifecycle with bind/unbind
baeb66fbd420 usb: gadget: udc: fix use-after-free in usb_gadget_state_work
]

104/2 2026/08/07 05:43 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 11230
							output: 25
							thoughts: 66
						

Thoughts:
Okay, let's dive into these commits.

**Analyzing USB Gadget Driver Fixes**

Alright, I'm taking a look at `30adce93d5c4 usb: gadget: f_printer: take kref only for successful open` and `67e511d2989e usb: gadget: udc: Fix use-after-free in gadget_match_driver`. Seems like some core USB gadget driver issues are being addressed. The first commit, `30adce93d5c4`, is about the printer function driver. The description suggests there was likely a potential reference counting problem. Specifically, it appears the `kref` was being taken without ensuring a successful open, which is a classic resource management bug. This means the driver might have been prematurely incrementing the reference count, potentially leading to leaks or double frees if the open failed for any reason. I need to see how the code was structured to fully assess if the fix is sound and robust against different error conditions. The change probably ensures the `kref` is only incremented when the resource allocation is indeed successful. I need to determine how the open function reports the success/failure to properly evaluate the change.

Now, the second commit, `67e511d2989e`, that's a "use-after-free" bug in the `gadget_match_driver` function within the USB Device Controller (UDC) layer. Use-after-free bugs are nasty; they lead to unpredictable behavior and crashes. The title alone is enough to spike my interest. It implies that a pointer, likely to a data structure related to a gadget or driver, was being accessed *after* it had been freed, probably by the UDC. This is a very common vulnerability in C, and I need to see exactly where the reference count was lost and how they are addressing the memory management issues. The details of the code need close scrutiny to understand the context and how the fix truly resolves the race condition or incorrect memory handling that led to the vulnerability. I'm keen to examine the surrounding code to determine how this match function is used. The fix probably involved ensuring that any data referenced by the match function is properly managed via reference counting or careful checks on the lifetime of the objects involved. This will require understanding the lifetime of the devices, drivers, and gadgets involved.



105/2 2026/08/07 05:43 tool git-show
0m Args:
map[Commit:30adce93d5c4]

Results:
map[Output:commit 30adce93d5c4a5a1ec29d9249e3fdfcc391d406b
Author: Xu Rao <raoxu@uniontech.com>
Date:   Fri Jun 26 14:46:17 2026 +0800

    usb: gadget: f_printer: take kref only for successful open
    
    printer_open() returns -EBUSY when the character device is already
    open, but it increments dev->kref regardless of the return value. VFS
    does not call ->release() for a failed open, so every rejected second
    open permanently leaks one reference.
    
    Move kref_get() into the successful-open branch.
    
    Fixes: e8d5f92b8d30 ("usb: gadget: function: printer: fix use-after-free in __lock_acquire")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Xu Rao <raoxu@uniontech.com>
    Link: https://patch.msgid.link/80295742B820DA9B+20260626064617.4090626-1-raoxu@uniontech.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

diff --git a/drivers/usb/gadget/function/f_printer.c b/drivers/usb/gadget/function/f_printer.c
index e4f7828ae75d..837f753d0cae 100644
--- a/drivers/usb/gadget/function/f_printer.c
+++ b/drivers/usb/gadget/function/f_printer.c
@@ -363,12 +363,11 @@ printer_open(struct inode *inode, struct file *fd)
 		ret = 0;
 		/* Change the printer status to show that it's on-line. */
 		dev->printer_status |= PRINTER_SELECTED;
+		kref_get(&dev->kref);
 	}
 
 	spin_unlock_irqrestore(&dev->lock, flags);
 
-	kref_get(&dev->kref);
-
 	return ret;
 }
 
]

106/2 2026/08/07 05:43 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 12410
							output: 27
							thoughts: 87
						

Thoughts:
Okay, let's break this down.

**Fixing a Reference Mishap**

Right, so we're dealing with a reference counting issue, specifically the scenario where we're supposed to *only* increment the reference count on a successful operation. The problem boils down to a potential use-after-free situation because we're calling a cleanup function, in this case `gadgetfs_unbind`, which *expects* a reference to have been taken at some point. However, the logic allows for the cleanup to be invoked even if the initial reference wasn't successfully acquired. This is where things go sideways.

The code's going to trip over this if we don't handle the failure appropriately. That cleanup function shouldn't be called without the corresponding reference.

Let's dive into the details of that commit – `67e511d2989e usb: gadget: udc: Fix use-after-free in gadget_match_driver` – that should shed some light on the specific context and how it was resolved. That looks like the key to understanding the specific issue we are facing.



107/2 2026/08/07 05:43 tool git-show
0m Args:
map[Commit:67e511d2989e]

Results:
map[Output:commit 67e511d2989eb1c8c588b599ce2fcc6bb8e6f7ea
Author: Jimmy Hu <hhhuuu@google.com>
Date:   Thu Jun 25 15:37:04 2026 +0800

    usb: gadget: udc: Fix use-after-free in gadget_match_driver
    
    The udc structure acts as the management structure for the gadget,
    but their lifecycles are decoupled. A race condition exists where
    usb_del_gadget() frees the udc memory (e.g., via mode-switch work)
    while gadget_match_driver() concurrently accesses the freed udc memory
    (e.g., via configfs), causing a Use-After-Free (UAF) that triggers a
    NULL pointer dereference when the freed memory is zeroed:
    
    [39430.908615][ T1171] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
    [39430.911397][ T1171] pc : __pi_strcmp+0x20/0x140
    [39430.911441][ T1171] lr : gadget_match_driver+0x34/0x60
    ...
    [39430.911890][ T1171]  usb_gadget_register_driver_owner+0x50/0xf8
    [39430.911910][ T1171]  gadget_dev_desc_UDC_store+0xf4/0x140
    [39430.931308][ T1171]  configfs_write_iter+0xec/0x134
    
    [39430.957058][ T1171] Workqueue: events_freezable __dwc3_set_mode
    [39430.957287][ T1171]  dwc3_gadget_exit+0x34/0x8c
    [39430.957304][ T1171]  __dwc3_set_mode+0xc0/0x664
    
    Fix this by ensuring the udc structure remains allocated until the
    gadget is released. To achieve this, introduce a new
    usb_gadget_release() routine to the core. When the gadget is added,
    usb_add_gadget() stores the gadget's release routine in the udc
    structure and takes a reference to the udc. When the gadget is
    released, usb_gadget_release() drops the reference to the udc and
    then calls the gadget's release routine.
    
    Suggested-by: Alan Stern <stern@rowland.harvard.edu>
    Cc: stable <stable@kernel.org>
    Signed-off-by: Jimmy Hu <hhhuuu@google.com>
    Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
    Link: https://patch.msgid.link/20260625073705.803880-1-hhhuuu@google.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
index 60340ff9edbf..f6da12b553a0 100644
--- a/drivers/usb/gadget/udc/core.c
+++ b/drivers/usb/gadget/udc/core.c
@@ -31,8 +31,9 @@ static const struct bus_type gadget_bus_type;
 /**
  * struct usb_udc - describes one usb device controller
  * @driver: the gadget driver pointer. For use by the class code
- * @dev: the child device to the actual controller
  * @gadget: the gadget. For use by the class code
+ * @gadget_release: the gadget's release routine
+ * @dev: the child device to the actual controller
  * @list: for use by the udc class driver
  * @vbus: for udcs who care about vbus status, this value is real vbus status;
  * for udcs who do not care about vbus status, this value is always true
@@ -53,6 +54,7 @@ static const struct bus_type gadget_bus_type;
 struct usb_udc {
 	struct usb_gadget_driver	*driver;
 	struct usb_gadget		*gadget;
+	void				(*gadget_release)(struct device *dev);
 	struct device			dev;
 	struct list_head		list;
 	bool				vbus;
@@ -1362,6 +1364,17 @@ static void usb_udc_nop_release(struct device *dev)
 	dev_vdbg(dev, "%s\n", __func__);
 }
 
+static void usb_gadget_release(struct device *dev)
+{
+	struct usb_gadget *gadget = dev_to_usb_gadget(dev);
+	struct usb_udc *udc = gadget->udc;
+	/* Cache the gadget's release routine to prevent UAF */
+	void (*release)(struct device *dev) = udc->gadget_release;
+
+	put_device(&udc->dev);
+	release(dev);
+}
+
 /**
  * usb_initialize_gadget - initialize a gadget and its embedded struct device
  * @parent: the parent device to this udc. Usually the controller driver's
@@ -1418,6 +1431,14 @@ int usb_add_gadget(struct usb_gadget *gadget)
 	mutex_init(&udc->connect_lock);
 
 	udc->started = false;
+	/*
+	 * Align decoupled lifecycles: take a UDC reference to ensure it
+	 * remains allocated until the gadget is released, requiring an
+	 * override of the gadget's release routine to drop it.
+	 */
+	udc->gadget_release = gadget->dev.release;
+	gadget->dev.release = usb_gadget_release;
+	get_device(&udc->dev);
 
 	mutex_lock(&udc_lock);
 	list_add_tail(&udc->list, &udc_list);
@@ -1462,6 +1483,12 @@ int usb_add_gadget(struct usb_gadget *gadget)
 	mutex_lock(&udc_lock);
 	list_del(&udc->list);
 	mutex_unlock(&udc_lock);
+	/*
+	 * Revert the override and drop the UDC reference to prevent
+	 * leaking the UDC if the gadget was statically allocated.
+	 */
+	gadget->dev.release = udc->gadget_release;
+	put_device(&udc->dev);
 
  err_put_udc:
 	put_device(&udc->dev);
]

108/2 2026/08/07 05:43 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 14570
							output: 39
							thoughts: 43
						

Thoughts:
Okay, here's my take on those thoughts, framed as an expert's internal monologue:

**Navigating a Tricky Lifecycle Alignment Issue**

Alright, this isn't the usual kind of problem; this feels like a lifecycle alignment issue. I need to figure out how these components are interacting, especially during error handling or resource cleanup within the USB gadget driver framework. It's often a tangled web of dependencies and refcounting, making debugging a nightmare.

My initial approach will be targeted. Let's dig into the `drivers/usb/gadget/` directory. I'll do a quick `git grep` looking for commits that specifically mention "error path," because that's always a good starting point for understanding how potential failures are handled. And while I'm at it, I'll incorporate a search for keywords like "refcount" or "unbind," because those are key indicators of resource management and potential leak areas in a USB gadget driver, which can lead to instability if handled incorrectly. This targeted approach is much more efficient than a broad sweep. I need to understand the historical context of these keywords and how the developers previously approached these types of challenges in the code base. Let's see what the commit history reveals...



109/2 2026/08/07 05:43 tool git-log
0m Args:
map[MessageRegexps:[error path] PathPrefix:drivers/usb/gadget/ Since:3 years]

Results:
map[Output:0583f2fbf8f8 usb: gadget: udc: bdc: free IRQ and drain func_wake_notify before teardown
29a142d3e8b3 USB: gadget: snps-udc: fix device name leak on probe failure
6b874d00c466 USB: gadget: fsl-udc: fix device name leak on probe failure
2796646f6d89 usb: gadget: f_fs: serialize DMABUF cancel against request completion
68aa70648b62 usb: gadget: uvc: hold opts->lock across XU walks in uvc_function_bind
c8547c74988e usb: gadget: net2280: Fix double free in probe error path
2c863dbbeac7 usb: gadget: f_hid: Add missing error code
782be79e4551 usb: gadget: lpc32xx_udc: fix clock imbalance in error path
62783c30d78a USB: gadget: f_hid: Fix memory leak in hidg_bind error path
725d1f1e338b usb: gadget: pxa25x_udc: Convert to platform remove callback returning void
]

110/2 2026/08/07 05:43 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 15227
							output: 27
							thoughts: 37
						

Thoughts:
Okay, let's dive into this `62783c30d78a` commit, "USB: gadget: f_hid: Fix memory leak in hidg_bind error path." Immediately, I'm thinking, "f_hid," that's the USB HID gadget driver. A memory leak in the `hidg_bind` error path? That's definitely worth investigating. I know the `hidg_bind` function is crucial for setting up the interface. A leak there could be nasty, potentially leading to resource exhaustion, instability, or even system crashes during device setup. I wonder what the specific error condition is that triggers the leak. Is it related to failure during descriptor setup, allocation issues, or something else entirely? The description strongly suggests that an allocation that happened during the initialization is not being freed if an error occurs. I will try to think of which allocations that are involved here, and where they are placed in the code. I need to understand the control flow during binding to pinpoint the exact location and root cause. The "error path" wording implies a potential `goto` statement or similar mechanism to handle error scenarios. It's usually the error handling that is the issue here. I need to track down the affected memory, the context where it should have been freed, and the precise circumstances under which it's being missed.



111/2 2026/08/07 05:43 tool git-show
0m Args:
map[Commit:62783c30d78a]

Results:
map[Output:commit 62783c30d78aecf9810dae46fd4d11420ad38b74
Author: Yuhao Jiang <danisjiang@gmail.com>
Date:   Mon Jun 23 17:48:44 2025 +0800

    USB: gadget: f_hid: Fix memory leak in hidg_bind error path
    
    In hidg_bind(), if alloc_workqueue() fails after usb_assign_descriptors()
    has successfully allocated the USB descriptors, the current error handling
    does not call usb_free_all_descriptors() to free the allocated descriptors,
    resulting in a memory leak.
    
    Restructure the error handling by adding proper cleanup labels:
    - fail_free_all: cleans up workqueue and descriptors
    - fail_free_descs: cleans up descriptors only
    - fail: original cleanup for earlier failures
    
    This ensures that allocated resources are properly freed in reverse order
    of their allocation, preventing the memory leak when alloc_workqueue() fails.
    
    Fixes: a139c98f760ef ("USB: gadget: f_hid: Add GET_REPORT via userspace IOCTL")
    Cc: stable@vger.kernel.org
    Signed-off-by: Yuhao Jiang <danisjiang@gmail.com>
    Link: https://lore.kernel.org/r/20250623094844.244977-1-danisjiang@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c
index 97a62b926415..8e1d1e884050 100644
--- a/drivers/usb/gadget/function/f_hid.c
+++ b/drivers/usb/gadget/function/f_hid.c
@@ -1278,18 +1278,19 @@ static int hidg_bind(struct usb_configuration *c, struct usb_function *f)
 
 	if (!hidg->workqueue) {
 		status = -ENOMEM;
-		goto fail;
+		goto fail_free_descs;
 	}
 
 	/* create char device */
 	cdev_init(&hidg->cdev, &f_hidg_fops);
 	status = cdev_device_add(&hidg->cdev, &hidg->dev);
 	if (status)
-		goto fail_free_descs;
+		goto fail_free_all;
 
 	return 0;
-fail_free_descs:
+fail_free_all:
 	destroy_workqueue(hidg->workqueue);
+fail_free_descs:
 	usb_free_all_descriptors(f);
 fail:
 	ERROR(f->config->cdev, "hidg_bind FAILED\n");
]

112/2 2026/08/07 05:43 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 16342
							output: 41
							thoughts: 62
						

Thoughts:
Okay, here's my interpretation of that thought process, tailored for an expert audience:

**Analyzing State Cleanup in `bind` Function**

Hmm, this is interesting. It looks like we're seeing a trend here, a pattern of directly manipulating specific state variables *before* a failure within the `bind` function occurs. Instead of relying on a dedicated cleanup mechanism like `unbind`, the code is meticulously undoing the changes made prior to the potential error. I need to understand this better. Let's dig into the `gadgetfs_bind` function. I think it's in `drivers/usb/gadget/legacy/inode.c`, right? Let's check there and see what's going on with that function. I need to understand why they're doing manual state restoration instead of `unbind` calls.



113/2 2026/08/07 05:43 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c Name:gadgetfs_bind]

Results:
map[SourceCode:1668:	static int gadgetfs_bind(struct usb_gadget *gadget,
1669:			struct usb_gadget_driver *driver)
1670:	{
1671:		struct dev_data		*dev = the_device;
1672:	
1673:		if (!dev)
1674:			return -ESRCH;
1675:		if (0 != strcmp (CHIP, gadget->name)) {
1676:			pr_err("%s expected %s controller not %s\n",
1677:				shortname, CHIP, gadget->name);
1678:			return -ENODEV;
1679:		}
1680:	
1681:		set_gadget_data (gadget, dev);
1682:		dev->gadget = gadget;
1683:		gadget->ep0->driver_data = dev;
1684:	
1685:		/* preallocate control response and buffer */
1686:		dev->req = usb_ep_alloc_request (gadget->ep0, GFP_KERNEL);
1687:		if (!dev->req)
1688:			goto enomem;
1689:		dev->req->context = NULL;
1690:		dev->req->complete = epio_complete;
1691:	
1692:		if (activate_ep_files (dev) < 0)
1693:			goto enomem;
1694:	
1695:		INFO (dev, "bound to %s driver\n", gadget->name);
1696:		spin_lock_irq(&dev->lock);
1697:		dev->state = STATE_DEV_UNCONNECTED;
1698:		spin_unlock_irq(&dev->lock);
1699:		get_dev (dev);
1700:		return 0;
1701:	
1702:	enomem:
1703:		gadgetfs_unbind (gadget);
1704:		return -ENOMEM;
1705:	}
 SourceFile:drivers/usb/gadget/legacy/inode.c]

114/2 2026/08/07 05:43 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 17206
							output: 41
							thoughts: 84
						

Thoughts:
**Analyzing a Bug Report: A Refinement in Gadgetfs Binding**

Okay, so this bug report is pointing out a potential flaw in the error handling within `gadgetfs_bind()`. The core issue is that `gadgetfs_unbind()` seems to be getting called during a failure scenario within `gadgetfs_bind()`. That immediately raises a flag for me. The report specifically calls out that `gadgetfs_unbind()` is intended to manage a *fully bound* gadget, which implies a certain state has been reached. Calling it prematurely, especially during an error, feels wrong. The report anticipates an expectation of a certain reference existing which will not exist if `gadgetfs_unbind` is called when it is not expected. This suggests a potential double-free or reference count corruption issue – something I need to be very wary of. Instead of relying on `gadgetfs_unbind()` to handle the cleanup during error paths in `gadgetfs_bind()`, the suggestion is to manually handle the state that was altered before the error. This is a solid approach; it makes error recovery much more precise and predictable and avoids this potential edge case, but requires careful consideration as to the exact state which needs to be cleaned up. I need to take a closer look at the implementation of `gadgetfs_unbind`.



115/2 2026/08/07 05:43 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c Name:gadgetfs_unbind]

Results:
map[SourceCode:1639:	static void
1640:	gadgetfs_unbind (struct usb_gadget *gadget)
1641:	{
1642:		struct dev_data		*dev = get_gadget_data (gadget);
1643:	
1644:		DBG (dev, "%s\n", __func__);
1645:	
1646:		spin_lock_irq (&dev->lock);
1647:		dev->state = STATE_DEV_UNBOUND;
1648:		while (dev->udc_usage > 0) {
1649:			spin_unlock_irq(&dev->lock);
1650:			usleep_range(1000, 2000);
1651:			spin_lock_irq(&dev->lock);
1652:		}
1653:		spin_unlock_irq (&dev->lock);
1654:	
1655:		destroy_ep_files (dev);
1656:		gadget->ep0->driver_data = NULL;
1657:		set_gadget_data (gadget, NULL);
1658:	
1659:		/* we've already been disconnected ... no i/o is active */
1660:		if (dev->req)
1661:			usb_ep_free_request (gadget->ep0, dev->req);
1662:		DBG (dev, "%s done\n", __func__);
1663:		put_dev (dev);
1664:	}
 SourceFile:drivers/usb/gadget/legacy/inode.c]

116/2 2026/08/07 05:43 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 18047
							output: 43
							thoughts: 74
						

Thoughts:
Okay, here's my understanding, thinking through this USB gadget driver issue:

**Analyzing `gadgetfs_unbind` and Potential Error Handling**

Alright, so `gadgetfs_unbind` definitely calls `put_dev(dev)`. That's the baseline. Now, I need to investigate if this function, or others, potentially in the legacy or function directories, may have encountered similar problems where the original code would call `unbind` on the error path. Perhaps the fix was to avoid calling `unbind` and perform manual cleanup instead. That's a good place to start my hunt for code patterns.



117/2 2026/08/07 05:44 tool git-log
0m Args:
map[MessageRegexps:[unbind error path] PathPrefix:drivers/usb/gadget/ Since:3 years]

Results:
map[Output:]

118/2 2026/08/07 05:44 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 18306
							output: 42
							thoughts: 28
						

Thoughts:
Okay, here's my interpretation of that thought process, as if it were my own:

**Investigating USB Gadget Driver Errors**

Alright, time to dive into this USB gadget issue. My first instinct, given the likely symptom and the nature of the problem, is to target the core of the USB gadget driver code. I'm going to start by searching within the `drivers/usb/gadget/` directory.

I'll be specifically looking for instances of `bind`, `unbind`, and "error path." The binding and unbinding functions are critical entry points, and errors related to these would be a primary suspect, likely indicating problems during device initialization, detachment, or configuration. "Error path" will be the key search term, as this will help me quickly identify the driver's error handling routines and associated logging/debugging code. I want to understand what the driver does when something goes wrong, and where those error conditions are handled. This should give me a good starting point for debugging. Let's see what we find!



119/2 2026/08/07 05:44 tool git-log
0m Args:
map[MessageRegexps:[bind error] PathPrefix:drivers/usb/gadget/ Since:3 years]

Results:
map[Output:f05847a216a7 USB: gadget: fsl-udc: drop misleading unbind sanity check
50246d57233a usb: udc: pxa: fix error handling
68aa70648b62 usb: gadget: uvc: hold opts->lock across XU walks in uvc_function_bind
2c863dbbeac7 usb: gadget: f_hid: Add missing error code
2ca9e46f8f1f USB: dummy-hcd: Fix interrupt synchronization error
616a63ff495d USB: dummy-hcd: Fix locking/synchronization error
0d6c8144ca4d usb: gadget: f_ncm: Fix atomic context locking issue
56a512a9b410 usb: gadget: f_ncm: align net_device lifecycle with bind/unbind
082289414360 usb: gadget: f_rndis: Refactor bind path to use __free()
42988380ac67 usb: gadget: f_ecm: Refactor bind path to use __free()
]

120/2 2026/08/07 05:44 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 18881
							output: 27
							thoughts: 29
						

Thoughts:
Okay, here's my interpretation of that commit message, expressed as my internal thought process:

**Diving into that USB Fix**

Alright, let's take a look at this commit: `50246d57233a usb: udc: pxa: fix error handling`. The first thing that jumps out is the subject line: "fix error handling." Right away, I'm thinking, "Good, we need robust error handling in all our drivers." USB device controllers, especially the PXA ones, can be notoriously sensitive. It's crucial we're not silently swallowing errors or, even worse, misinterpreting them and causing data corruption or even system instability.

I'm immediately assuming this patch is addressing a specific scenario. Maybe a race condition where an error is missed, or perhaps an incorrect return code being checked. I'll need to dig into the commit itself to figure out the exact nature of the bug and the proposed solution. I bet it involves properly checking return values from specific USB functions, possibly involving the driver's interaction with the hardware or the USB subsystem. I’m hoping it’s not too complicated, but I'm prepared for a deep dive if it's necessary. Let's see what they've done!



121/2 2026/08/07 05:44 tool git-show
0m Args:
map[Commit:50246d57233a]

Results:
map[Output:commit 50246d57233ad3b3c5dab99001a84d93e3e3d8f0
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Tue May 26 12:47:52 2026 +0200

    usb: udc: pxa: fix error handling
    
    As Dan Carpenter points out, my recent change makes subtle
    changes to the error handling that were not intended.
    
    Move the warning print up so it does not get skipped in
    case of an error, but handle -EPROBE_DEFER properly now.
    
    Change the devm_gpiod_get() to the _optional variant, which
    is in line with the intended behavior and the DT binding,
    though this did not work previously.
    
    Reported-by: Dan Carpenter <error27@gmail.com>
    Link: https://lore.kernel.org/linux-usb/ag6-xhfFjb5NpXQz@stanley.mountain/
    Fixes: 25bd55f46032 ("usb: udc: pxa: remove unused platform_data")
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Link: https://patch.msgid.link/20260526104810.3906090-1-arnd@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c b/drivers/usb/gadget/udc/pxa27x_udc.c
index 640f81988c04..df5cca43afbe 100644
--- a/drivers/usb/gadget/udc/pxa27x_udc.c
+++ b/drivers/usb/gadget/udc/pxa27x_udc.c
@@ -2374,9 +2374,10 @@ static int pxa_udc_probe(struct platform_device *pdev)
 	struct pxa_udc *udc = &memory;
 	int retval = 0;
 
-	udc->gpiod = devm_gpiod_get(&pdev->dev, NULL, GPIOD_ASIS);
+	udc->gpiod = devm_gpiod_get_optional(&pdev->dev, NULL, GPIOD_ASIS);
 	if (IS_ERR(udc->gpiod))
-		return PTR_ERR(udc->gpiod);
+		return dev_err_probe(&pdev->dev, PTR_ERR(udc->gpiod),
+				     "Couldn't find or request D+ gpio\n");
 
 	udc->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(udc->regs))
@@ -2395,11 +2396,6 @@ static int pxa_udc_probe(struct platform_device *pdev)
 		udc->transceiver = usb_get_phy(USB_PHY_TYPE_USB2);
 	}
 
-	if (IS_ERR(udc->gpiod)) {
-		dev_err(&pdev->dev, "Couldn't find or request D+ gpio : %ld\n",
-			PTR_ERR(udc->gpiod));
-		return PTR_ERR(udc->gpiod);
-	}
 	if (udc->gpiod)
 		gpiod_direction_output(udc->gpiod, 0);
 
]

122/2 2026/08/07 05:44 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 20148
							output: 43
							thoughts: 27
						

Thoughts:
Okay, here's my summary, presented as a stream of thought:

**USB Gadget Driver Analysis - Keywords & Code Search**

Alright, nothing there in the initial prompt is useful. Time to get down to brass tacks. I need to understand how the USB gadget driver is functioning, so I need to find specific areas to search within the code. Let's start with a focused search. Given the typical flow of USB gadget drivers, I'm thinking about how resources are managed and how the driver interfaces with the underlying USB hardware. "refcount" is a good starting point – I need to see how the driver handles reference counting to ensure objects aren't freed prematurely, particularly around device binding and unbinding. Then, the word "bind" is crucial. This will likely reveal how the device is attached to the USB bus. Searching within `drivers/usb/gadget/` is the correct place to begin the investigation. From there, I can begin to unpack the core mechanics.



123/2 2026/08/07 05:44 tool git-log
0m Args:
map[MessageRegexps:[refcount bind] PathPrefix:drivers/usb/gadget/ Since:3 years]

Results:
map[Output:5650c18d93a1 usb: gadget: f_midi: cancel pending IN work before freeing the midi object
]

124/2 2026/08/07 05:44 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 20467
							output: 27
							thoughts: 35
						

Thoughts:
Okay, here's my interpretation of that commit message, thinking through it as an expert in embedded systems and USB gadget drivers:

**Analyzing a USB MIDI Driver Fix**

Alright, so the commit message says "Let's see `5650c18d93a1 usb: gadget: f_midi: cancel pending IN work before freeing the midi object`." That immediately flags a specific area for me: the `f_midi` gadget driver. This is a common situation, it is important to think what problem the person who wrote the comment was trying to fix. I know that driver, and it handles MIDI (Musical Instrument Digital Interface) data over USB. The title suggests a critical problem related to object lifecycle and asynchronous operations.

The phrase "cancel pending IN work" is the key. In USB, especially in gadget mode where the device is acting as a peripheral, data transfers aren't always immediate. Data comes and goes, and each side can signal the other by creating "work" to read or send it. In this case, "IN work" refers to an *incoming* transfer – the device (the MIDI gadget) is *receiving* data from the host (e.g., a computer) via the USB connection.

"Freeing the midi object" means the driver is about to release the memory it's using to represent the MIDI device, likely during device disconnect or when a particular MIDI endpoint is closed. The potential bug is obvious: if there are still *outstanding* IN transfers – work that has been initiated but not completed – and the driver frees the object managing those transfers, it's a recipe for disaster. This leads to a crash, data corruption, or undefined behavior. The driver will try to access freed memory, causing a mess.

The fix, therefore, is to *cancel* those pending IN transfers *before* freeing the MIDI object. This ensures that the system handles those incoming data packets gracefully, either completing the transfers properly or, if necessary, cleanly aborting them. The developer realized that they needed to write new "work" to cancel pending "work". This is a common and important pattern in asynchronous systems: always clean up your mess before exiting or freeing resources. It's a fundamental principle of avoiding race conditions and memory leaks in embedded systems.



125/2 2026/08/07 05:44 tool git-show
0m Args:
map[Commit:5650c18d93a1]

Results:
map[Output:commit 5650c18d93a1db7e27cb5a40b394747eb4686d5b
Author: Fan Wu <fanwu01@zju.edu.cn>
Date:   Thu Jul 9 15:07:17 2026 +0000

    usb: gadget: f_midi: cancel pending IN work before freeing the midi object
    
    The f_midi driver embeds a work item (midi->work) whose handler,
    f_midi_in_work(), dereferences the enclosing struct f_midi through
    container_of().  This work is armed from two sites: f_midi_complete(),
    on a normal IN-endpoint completion, and f_midi_in_trigger(), on an ALSA
    rawmidi output-stream start.
    
    Neither f_midi_disable() nor f_midi_unbind() cancels midi->work.
    f_midi_disable() only disables the endpoints and drains the in_req_fifo;
    it does not synchronize the work item, and the sound card is released
    asynchronously to the final free of the midi object.
    
    The midi object is reference-counted (midi->free_ref) and is freed in
    f_midi_free() only once both the usb_function reference and the rawmidi
    private_data reference have been dropped.  In f_midi_unbind(),
    f_midi_disable() runs before the sound card is released, so while the
    USB endpoints are already disabled the rawmidi device is still usable by
    an open substream.  A concurrent userspace write on such a substream can
    reach f_midi_in_trigger() and queue midi->work again after
    f_midi_disable() has returned.  A work item armed this way may still be
    pending when the last reference drops and f_midi_free() proceeds to
    kfree(midi), letting f_midi_in_work() dereference the struct after it
    has been freed, a use-after-free.
    
    For this reason cancelling midi->work in f_midi_disable() would not be
    sufficient: the ALSA trigger path can rearm the work after disable()
    returns.  Cancelling at the refcount-zero free site is the boundary
    after which neither arming source can survive, because by then both
    references that keep the midi object alive have been dropped: the USB
    endpoints are already disabled and the rawmidi device has been released.
    
    Fix this by calling cancel_work_sync(&midi->work) in the refcount-zero
    block of f_midi_free(), before the embedded work_struct is freed along
    with the rest of the structure.  opts->lock is a sleeping mutex, so
    calling cancel_work_sync() under it is permitted, and the handler takes
    midi->transmit_lock rather than opts->lock, so no self-deadlock can
    occur while it waits for a running instance of the work to finish.
    
    This issue was found by an in-house static analysis tool.
    
    Fixes: 8653d71ce3763 ("usb/gadget: f_midi: Replace tasklet with work")
    Cc: stable <stable@kernel.org>
    Assisted-by: Codex:gpt-5.5
    Signed-off-by: Fan Wu <fanwu01@zju.edu.cn>
    Link: https://patch.msgid.link/20260709150717.399083-1-fanwu01@zju.edu.cn
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c
index 4d9e4bd700d8..fba8cf787d6c 100644
--- a/drivers/usb/gadget/function/f_midi.c
+++ b/drivers/usb/gadget/function/f_midi.c
@@ -1309,6 +1309,7 @@ static void f_midi_free(struct usb_function *f)
 	opts = container_of(f->fi, struct f_midi_opts, func_inst);
 	mutex_lock(&opts->lock);
 	if (!--midi->free_ref) {
+		cancel_work_sync(&midi->work);
 		kfree(midi->id);
 		kfifo_free(&midi->in_req_fifo);
 		kfree(midi);
]

126/2 2026/08/07 05:44 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 22114
							output: 27
							thoughts: 46
						

Thoughts:
Okay, here's my interpretation of those thoughts, presented as my own mental process, given my expertise:

**Diving into the Workqueue Cancellation Problem**

Alright, this looks like a workqueue cancellation issue – that's my initial assessment. I need to figure out what's causing this problem. I've seen these before.

Let's start by digging into this commit: `082289414360 usb: gadget: f_rndis: Refactor bind path to use __free()`. This could be the starting point. I want to see if this change introduced, or exposed, a problem related to how the gadget's RNDIS function is bound and unbound, specifically within the context of workqueue management. The "bind path to use __free()" phrase is particularly interesting. That could definitely be a spot to look at for how resources are managed, particularly as things are cleaned up during the cancellation process. I'm already anticipating some of the common workqueue pitfalls related to race conditions or improper synchronization that I need to keep in mind. Let's see if this refactoring sheds any light.



127/2 2026/08/07 05:44 tool git-show
0m Args:
map[Commit:082289414360]

Results:
map[Output:commit 08228941436047bdcd35a612c1aec0912a29d8cd
Author: Kuen-Han Tsai <khtsai@google.com>
Date:   Tue Sep 16 16:21:37 2025 +0800

    usb: gadget: f_rndis: Refactor bind path to use __free()
    
    After an bind/unbind cycle, the rndis->notify_req is left stale. If a
    subsequent bind fails, the unified error label attempts to free this
    stale request, leading to a NULL pointer dereference when accessing
    ep->ops->free_request.
    
    Refactor the error handling in the bind path to use the __free()
    automatic cleanup mechanism.
    
    Fixes: 45fe3b8e5342 ("usb ethernet gadget: split RNDIS function")
    Cc: stable@kernel.org
    Signed-off-by: Kuen-Han Tsai <khtsai@google.com>
    Link: https://lore.kernel.org/r/20250916-ready-v1-6-4997bf277548@google.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Link: https://lore.kernel.org/r/20250916-ready-v1-6-4997bf277548@google.com

diff --git a/drivers/usb/gadget/function/f_rndis.c b/drivers/usb/gadget/function/f_rndis.c
index 7cec19d65fb5..7451e7cb7a85 100644
--- a/drivers/usb/gadget/function/f_rndis.c
+++ b/drivers/usb/gadget/function/f_rndis.c
@@ -19,6 +19,8 @@
 
 #include <linux/atomic.h>
 
+#include <linux/usb/gadget.h>
+
 #include "u_ether.h"
 #include "u_ether_configfs.h"
 #include "u_rndis.h"
@@ -662,6 +664,8 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f)
 	struct usb_ep		*ep;
 
 	struct f_rndis_opts *rndis_opts;
+	struct usb_os_desc_table        *os_desc_table __free(kfree) = NULL;
+	struct usb_request		*request __free(free_usb_request) = NULL;
 
 	if (!can_support_rndis(c))
 		return -EINVAL;
@@ -669,12 +673,9 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f)
 	rndis_opts = container_of(f->fi, struct f_rndis_opts, func_inst);
 
 	if (cdev->use_os_string) {
-		f->os_desc_table = kzalloc(sizeof(*f->os_desc_table),
-					   GFP_KERNEL);
-		if (!f->os_desc_table)
+		os_desc_table = kzalloc(sizeof(*os_desc_table), GFP_KERNEL);
+		if (!os_desc_table)
 			return -ENOMEM;
-		f->os_desc_n = 1;
-		f->os_desc_table[0].os_desc = &rndis_opts->rndis_os_desc;
 	}
 
 	rndis_iad_descriptor.bFunctionClass = rndis_opts->class;
@@ -692,16 +693,14 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f)
 		gether_set_gadget(rndis_opts->net, cdev->gadget);
 		status = gether_register_netdev(rndis_opts->net);
 		if (status)
-			goto fail;
+			return status;
 		rndis_opts->bound = true;
 	}
 
 	us = usb_gstrings_attach(cdev, rndis_strings,
 				 ARRAY_SIZE(rndis_string_defs));
-	if (IS_ERR(us)) {
-		status = PTR_ERR(us);
-		goto fail;
-	}
+	if (IS_ERR(us))
+		return PTR_ERR(us);
 	rndis_control_intf.iInterface = us[0].id;
 	rndis_data_intf.iInterface = us[1].id;
 	rndis_iad_descriptor.iFunction = us[2].id;
@@ -709,36 +708,30 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f)
 	/* allocate instance-specific interface IDs */
 	status = usb_interface_id(c, f);
 	if (status < 0)
-		goto fail;
+		return status;
 	rndis->ctrl_id = status;
 	rndis_iad_descriptor.bFirstInterface = status;
 
 	rndis_control_intf.bInterfaceNumber = status;
 	rndis_union_desc.bMasterInterface0 = status;
 
-	if (cdev->use_os_string)
-		f->os_desc_table[0].if_id =
-			rndis_iad_descriptor.bFirstInterface;
-
 	status = usb_interface_id(c, f);
 	if (status < 0)
-		goto fail;
+		return status;
 	rndis->data_id = status;
 
 	rndis_data_intf.bInterfaceNumber = status;
 	rndis_union_desc.bSlaveInterface0 = status;
 
-	status = -ENODEV;
-
 	/* allocate instance-specific endpoints */
 	ep = usb_ep_autoconfig(cdev->gadget, &fs_in_desc);
 	if (!ep)
-		goto fail;
+		return -ENODEV;
 	rndis->port.in_ep = ep;
 
 	ep = usb_ep_autoconfig(cdev->gadget, &fs_out_desc);
 	if (!ep)
-		goto fail;
+		return -ENODEV;
 	rndis->port.out_ep = ep;
 
 	/* NOTE:  a status/notification endpoint is, strictly speaking,
@@ -747,21 +740,19 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f)
 	 */
 	ep = usb_ep_autoconfig(cdev->gadget, &fs_notify_desc);
 	if (!ep)
-		goto fail;
+		return -ENODEV;
 	rndis->notify = ep;
 
-	status = -ENOMEM;
-
 	/* allocate notification request and buffer */
-	rndis->notify_req = usb_ep_alloc_request(ep, GFP_KERNEL);
-	if (!rndis->notify_req)
-		goto fail;
-	rndis->notify_req->buf = kmalloc(STATUS_BYTECOUNT, GFP_KERNEL);
-	if (!rndis->notify_req->buf)
-		goto fail;
-	rndis->notify_req->length = STATUS_BYTECOUNT;
-	rndis->notify_req->context = rndis;
-	rndis->notify_req->complete = rndis_response_complete;
+	request = usb_ep_alloc_request(ep, GFP_KERNEL);
+	if (!request)
+		return -ENOMEM;
+	request->buf = kmalloc(STATUS_BYTECOUNT, GFP_KERNEL);
+	if (!request->buf)
+		return -ENOMEM;
+	request->length = STATUS_BYTECOUNT;
+	request->context = rndis;
+	request->complete = rndis_response_complete;
 
 	/* support all relevant hardware speeds... we expect that when
 	 * hardware is dual speed, all bulk-capable endpoints work at
@@ -778,7 +769,7 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f)
 	status = usb_assign_descriptors(f, eth_fs_function, eth_hs_function,
 			eth_ss_function, eth_ss_function);
 	if (status)
-		goto fail;
+		return status;
 
 	rndis->port.open = rndis_open;
 	rndis->port.close = rndis_close;
@@ -789,9 +780,18 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f)
 	if (rndis->manufacturer && rndis->vendorID &&
 			rndis_set_param_vendor(rndis->params, rndis->vendorID,
 					       rndis->manufacturer)) {
-		status = -EINVAL;
-		goto fail_free_descs;
+		usb_free_all_descriptors(f);
+		return -EINVAL;
+	}
+
+	if (cdev->use_os_string) {
+		os_desc_table[0].os_desc = &rndis_opts->rndis_os_desc;
+		os_desc_table[0].if_id = rndis_iad_descriptor.bFirstInterface;
+		f->os_desc_table = no_free_ptr(os_desc_table);
+		f->os_desc_n = 1;
+
 	}
+	rndis->notify_req = no_free_ptr(request);
 
 	/* NOTE:  all that is done without knowing or caring about
 	 * the network link ... which is unavailable to this code
@@ -802,21 +802,6 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f)
 			rndis->port.in_ep->name, rndis->port.out_ep->name,
 			rndis->notify->name);
 	return 0;
-
-fail_free_descs:
-	usb_free_all_descriptors(f);
-fail:
-	kfree(f->os_desc_table);
-	f->os_desc_n = 0;
-
-	if (rndis->notify_req) {
-		kfree(rndis->notify_req->buf);
-		usb_ep_free_request(rndis->notify, rndis->notify_req);
-	}
-
-	ERROR(cdev, "%s: can't bind, err %d\n", f->name, status);
-
-	return status;
 }
 
 void rndis_borrow_net(struct usb_function_instance *f, struct net_device *net)
]

128/2 2026/08/07 05:44 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 25152
							output: 26
							thoughts: 91
						

Thoughts:
Okay, here's my take on those thoughts, framed from my expert perspective:

**Addressing the Dangling Pointer Bug in RNDIS**

Alright, so this commit's zeroing in on a critical vulnerability – a classic dangling pointer scenario in the RNDIS module. What's happening is a failed bind operation leaves some stale pointers hanging around, specifically `rndis->notify_req`, which can then become a source of NULL pointer dereferences later on. We all know how insidious those can be.

The proposed solution, as I understand it, is pretty straightforward and elegant: leverage `__free()` directly, and only assign the pointer on the condition of a successful operation. This prevents the possibility of a premature pointer allocation that leaves the driver in a bad state if the bind goes south.

I should probably take a closer look at the refactoring in `42988380ac67 usb: gadget: f_ecm: Refactor bind path to use __free()`. I suspect it's likely a well-implemented approach. From past experiences, I know it is always best to perform deallocation operations as early as possible so that a consistent state can be ensured.



129/2 2026/08/07 05:44 tool git-show
0m Args:
map[Commit:42988380ac67]

Results:
map[Output:commit 42988380ac67c76bb9dff8f77d7ef3eefd50b7b5
Author: Kuen-Han Tsai <khtsai@google.com>
Date:   Tue Sep 16 16:21:36 2025 +0800

    usb: gadget: f_ecm: Refactor bind path to use __free()
    
    After an bind/unbind cycle, the ecm->notify_req is left stale. If a
    subsequent bind fails, the unified error label attempts to free this
    stale request, leading to a NULL pointer dereference when accessing
    ep->ops->free_request.
    
    Refactor the error handling in the bind path to use the __free()
    automatic cleanup mechanism.
    
    Fixes: da741b8c56d6 ("usb ethernet gadget: split CDC Ethernet function")
    Cc: stable@kernel.org
    Signed-off-by: Kuen-Han Tsai <khtsai@google.com>
    Link: https://lore.kernel.org/r/20250916-ready-v1-5-4997bf277548@google.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Link: https://lore.kernel.org/r/20250916-ready-v1-5-4997bf277548@google.com

diff --git a/drivers/usb/gadget/function/f_ecm.c b/drivers/usb/gadget/function/f_ecm.c
index 027226325039..675d2bc538a4 100644
--- a/drivers/usb/gadget/function/f_ecm.c
+++ b/drivers/usb/gadget/function/f_ecm.c
@@ -8,6 +8,7 @@
 
 /* #define VERBOSE_DEBUG */
 
+#include <linux/cleanup.h>
 #include <linux/slab.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
@@ -15,6 +16,8 @@
 #include <linux/etherdevice.h>
 #include <linux/string_choices.h>
 
+#include <linux/usb/gadget.h>
+
 #include "u_ether.h"
 #include "u_ether_configfs.h"
 #include "u_ecm.h"
@@ -678,6 +681,7 @@ ecm_bind(struct usb_configuration *c, struct usb_function *f)
 	struct usb_ep		*ep;
 
 	struct f_ecm_opts	*ecm_opts;
+	struct usb_request	*request __free(free_usb_request) = NULL;
 
 	if (!can_support_ecm(cdev->gadget))
 		return -EINVAL;
@@ -711,7 +715,7 @@ ecm_bind(struct usb_configuration *c, struct usb_function *f)
 	/* allocate instance-specific interface IDs */
 	status = usb_interface_id(c, f);
 	if (status < 0)
-		goto fail;
+		return status;
 	ecm->ctrl_id = status;
 	ecm_iad_descriptor.bFirstInterface = status;
 
@@ -720,24 +724,22 @@ ecm_bind(struct usb_configuration *c, struct usb_function *f)
 
 	status = usb_interface_id(c, f);
 	if (status < 0)
-		goto fail;
+		return status;
 	ecm->data_id = status;
 
 	ecm_data_nop_intf.bInterfaceNumber = status;
 	ecm_data_intf.bInterfaceNumber = status;
 	ecm_union_desc.bSlaveInterface0 = status;
 
-	status = -ENODEV;
-
 	/* allocate instance-specific endpoints */
 	ep = usb_ep_autoconfig(cdev->gadget, &fs_ecm_in_desc);
 	if (!ep)
-		goto fail;
+		return -ENODEV;
 	ecm->port.in_ep = ep;
 
 	ep = usb_ep_autoconfig(cdev->gadget, &fs_ecm_out_desc);
 	if (!ep)
-		goto fail;
+		return -ENODEV;
 	ecm->port.out_ep = ep;
 
 	/* NOTE:  a status/notification endpoint is *OPTIONAL* but we
@@ -746,20 +748,18 @@ ecm_bind(struct usb_configuration *c, struct usb_function *f)
 	 */
 	ep = usb_ep_autoconfig(cdev->gadget, &fs_ecm_notify_desc);
 	if (!ep)
-		goto fail;
+		return -ENODEV;
 	ecm->notify = ep;
 
-	status = -ENOMEM;
-
 	/* allocate notification request and buffer */
-	ecm->notify_req = usb_ep_alloc_request(ep, GFP_KERNEL);
-	if (!ecm->notify_req)
-		goto fail;
-	ecm->notify_req->buf = kmalloc(ECM_STATUS_BYTECOUNT, GFP_KERNEL);
-	if (!ecm->notify_req->buf)
-		goto fail;
-	ecm->notify_req->context = ecm;
-	ecm->notify_req->complete = ecm_notify_complete;
+	request = usb_ep_alloc_request(ep, GFP_KERNEL);
+	if (!request)
+		return -ENOMEM;
+	request->buf = kmalloc(ECM_STATUS_BYTECOUNT, GFP_KERNEL);
+	if (!request->buf)
+		return -ENOMEM;
+	request->context = ecm;
+	request->complete = ecm_notify_complete;
 
 	/* support all relevant hardware speeds... we expect that when
 	 * hardware is dual speed, all bulk-capable endpoints work at
@@ -778,7 +778,7 @@ ecm_bind(struct usb_configuration *c, struct usb_function *f)
 	status = usb_assign_descriptors(f, ecm_fs_function, ecm_hs_function,
 			ecm_ss_function, ecm_ss_function);
 	if (status)
-		goto fail;
+		return status;
 
 	/* NOTE:  all that is done without knowing or caring about
 	 * the network link ... which is unavailable to this code
@@ -788,20 +788,12 @@ ecm_bind(struct usb_configuration *c, struct usb_function *f)
 	ecm->port.open = ecm_open;
 	ecm->port.close = ecm_close;
 
+	ecm->notify_req = no_free_ptr(request);
+
 	DBG(cdev, "CDC Ethernet: IN/%s OUT/%s NOTIFY/%s\n",
 			ecm->port.in_ep->name, ecm->port.out_ep->name,
 			ecm->notify->name);
 	return 0;
-
-fail:
-	if (ecm->notify_req) {
-		kfree(ecm->notify_req->buf);
-		usb_ep_free_request(ecm->notify, ecm->notify_req);
-	}
-
-	ERROR(cdev, "%s: can't bind, err %d\n", f->name, status);
-
-	return status;
 }
 
 static inline struct f_ecm_opts *to_f_ecm_opts(struct config_item *item)
]

130/2 2026/08/07 05:44 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 27491
							output: 46
							thoughts: 177
						

Thoughts:
**Analyzing a Nasty Pointer Dereference**

Okay, here we go again. This is the exact pattern I've seen before! The commit message nails it: after a bind/unbind cycle, the `ecm->notify_req` pointer is left dangling. A failed subsequent bind then tries to free this stale request through a unified error label, but the `ep->ops->free_request` call on that dangling pointer causes a NULL pointer dereference. Classic.

The fix is smart. Either rely on the `__free()` automatic cleanup, which is usually preferable, or meticulously clean up the specific states that were changed *before* the bind failure occurred. Avoid that catch-all error label that could inadvertently trash important memory. It's a textbook approach to robust error handling.

Hold on, I see something else. The problem is actually within `gadgetfs_bind`, which incorrectly calls `gadgetfs_unbind` during its error path. It looks like `gadgetfs_unbind` is prematurely dropping a reference that was never actually acquired. I wonder, is this a symptom of other similar errors where `unbind` is incorrectly called in the bind's error handling paths? I should probably dig through the commit history for any similar fixes to see if this is a systemic issue.



131/2 2026/08/07 05:44 tool git-log
0m Args:
map[MessageRegexps:[unbind bind error] PathPrefix:drivers/usb/gadget/ Since:3 years]

Results:
map[Output:f05847a216a7 USB: gadget: fsl-udc: drop misleading unbind sanity check
2ca9e46f8f1f USB: dummy-hcd: Fix interrupt synchronization error
616a63ff495d USB: dummy-hcd: Fix locking/synchronization error
0d6c8144ca4d usb: gadget: f_ncm: Fix atomic context locking issue
56a512a9b410 usb: gadget: f_ncm: align net_device lifecycle with bind/unbind
082289414360 usb: gadget: f_rndis: Refactor bind path to use __free()
42988380ac67 usb: gadget: f_ecm: Refactor bind path to use __free()
47b2116e54b4 usb: gadget: f_acm: Refactor bind path to use __free()
75a5b8d4ddd4 usb: gadget: f_ncm: Refactor bind path to use __free()
6334b8e4553c usb: gadget: f_ncm: Fix UAF ncm object at re-bind after usb ep transport error
]

132/2 2026/08/07 05:44 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 28287
							output: 27
							thoughts: 36
						

Thoughts:
Okay, let's dive into this commit, `47b2116e54b4 usb: gadget: f_acm: Refactor bind path to use __free()`. I need to understand what's been changed, what the motivation was, and why this refactoring is considered beneficial. The title itself suggests a move towards better memory management, which is always a good sign in kernel development. Using `__free()` instead of whatever was there previously implies a more direct and potentially safer approach to deallocating resources, specifically within the `f_acm` gadget driver. My gut feeling is that we're likely addressing some subtle memory leak or, perhaps, ensuring more predictable deallocation behavior during error handling or device detachment. I'll need to look at the diff to confirm those assumptions, of course. Hopefully, this commit simplifies the code and improves robustness. I'll be looking for improved clarity and potentially reduced chances of dangling pointers. A well-written commit message will be key to understanding the full context. Let's dig in.



133/2 2026/08/07 05:44 tool git-show
0m Args:
map[Commit:47b2116e54b4]

Results:
map[Output:commit 47b2116e54b4a854600341487e8b55249e926324
Author: Kuen-Han Tsai <khtsai@google.com>
Date:   Tue Sep 16 16:21:35 2025 +0800

    usb: gadget: f_acm: Refactor bind path to use __free()
    
    After an bind/unbind cycle, the acm->notify_req is left stale. If a
    subsequent bind fails, the unified error label attempts to free this
    stale request, leading to a NULL pointer dereference when accessing
    ep->ops->free_request.
    
    Refactor the error handling in the bind path to use the __free()
    automatic cleanup mechanism.
    
    Unable to handle kernel NULL pointer dereference at virtual address 0000000000000020
    Call trace:
     usb_ep_free_request+0x2c/0xec
     gs_free_req+0x30/0x44
     acm_bind+0x1b8/0x1f4
     usb_add_function+0xcc/0x1f0
     configfs_composite_bind+0x468/0x588
     gadget_bind_driver+0x104/0x270
     really_probe+0x190/0x374
     __driver_probe_device+0xa0/0x12c
     driver_probe_device+0x3c/0x218
     __device_attach_driver+0x14c/0x188
     bus_for_each_drv+0x10c/0x168
     __device_attach+0xfc/0x198
     device_initial_probe+0x14/0x24
     bus_probe_device+0x94/0x11c
     device_add+0x268/0x48c
     usb_add_gadget+0x198/0x28c
     dwc3_gadget_init+0x700/0x858
     __dwc3_set_mode+0x3cc/0x664
     process_scheduled_works+0x1d8/0x488
     worker_thread+0x244/0x334
     kthread+0x114/0x1bc
     ret_from_fork+0x10/0x20
    
    Fixes: 1f1ba11b6494 ("usb gadget: issue notifications from ACM function")
    Cc: stable@kernel.org
    Signed-off-by: Kuen-Han Tsai <khtsai@google.com>
    Link: https://lore.kernel.org/r/20250916-ready-v1-4-4997bf277548@google.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Link: https://lore.kernel.org/r/20250916-ready-v1-4-4997bf277548@google.com

diff --git a/drivers/usb/gadget/function/f_acm.c b/drivers/usb/gadget/function/f_acm.c
index 7061720b9732..106046e17c4e 100644
--- a/drivers/usb/gadget/function/f_acm.c
+++ b/drivers/usb/gadget/function/f_acm.c
@@ -11,12 +11,15 @@
 
 /* #define VERBOSE_DEBUG */
 
+#include <linux/cleanup.h>
 #include <linux/slab.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/device.h>
 #include <linux/err.h>
 
+#include <linux/usb/gadget.h>
+
 #include "u_serial.h"
 
 
@@ -613,6 +616,7 @@ acm_bind(struct usb_configuration *c, struct usb_function *f)
 	struct usb_string	*us;
 	int			status;
 	struct usb_ep		*ep;
+	struct usb_request	*request __free(free_usb_request) = NULL;
 
 	/* REVISIT might want instance-specific strings to help
 	 * distinguish instances ...
@@ -630,7 +634,7 @@ acm_bind(struct usb_configuration *c, struct usb_function *f)
 	/* allocate instance-specific interface IDs, and patch descriptors */
 	status = usb_interface_id(c, f);
 	if (status < 0)
-		goto fail;
+		return status;
 	acm->ctrl_id = status;
 	acm_iad_descriptor.bFirstInterface = status;
 
@@ -639,43 +643,41 @@ acm_bind(struct usb_configuration *c, struct usb_function *f)
 
 	status = usb_interface_id(c, f);
 	if (status < 0)
-		goto fail;
+		return status;
 	acm->data_id = status;
 
 	acm_data_interface_desc.bInterfaceNumber = status;
 	acm_union_desc.bSlaveInterface0 = status;
 	acm_call_mgmt_descriptor.bDataInterface = status;
 
-	status = -ENODEV;
-
 	/* allocate instance-specific endpoints */
 	ep = usb_ep_autoconfig(cdev->gadget, &acm_fs_in_desc);
 	if (!ep)
-		goto fail;
+		return -ENODEV;
 	acm->port.in = ep;
 
 	ep = usb_ep_autoconfig(cdev->gadget, &acm_fs_out_desc);
 	if (!ep)
-		goto fail;
+		return -ENODEV;
 	acm->port.out = ep;
 
 	ep = usb_ep_autoconfig(cdev->gadget, &acm_fs_notify_desc);
 	if (!ep)
-		goto fail;
+		return -ENODEV;
 	acm->notify = ep;
 
 	acm_iad_descriptor.bFunctionProtocol = acm->bInterfaceProtocol;
 	acm_control_interface_desc.bInterfaceProtocol = acm->bInterfaceProtocol;
 
 	/* allocate notification */
-	acm->notify_req = gs_alloc_req(ep,
-			sizeof(struct usb_cdc_notification) + 2,
-			GFP_KERNEL);
-	if (!acm->notify_req)
-		goto fail;
+	request = gs_alloc_req(ep,
+			       sizeof(struct usb_cdc_notification) + 2,
+			       GFP_KERNEL);
+	if (!request)
+		return -ENODEV;
 
-	acm->notify_req->complete = acm_cdc_notify_complete;
-	acm->notify_req->context = acm;
+	request->complete = acm_cdc_notify_complete;
+	request->context = acm;
 
 	/* support all relevant hardware speeds... we expect that when
 	 * hardware is dual speed, all bulk-capable endpoints work at
@@ -692,7 +694,9 @@ acm_bind(struct usb_configuration *c, struct usb_function *f)
 	status = usb_assign_descriptors(f, acm_fs_function, acm_hs_function,
 			acm_ss_function, acm_ss_function);
 	if (status)
-		goto fail;
+		return status;
+
+	acm->notify_req = no_free_ptr(request);
 
 	dev_dbg(&cdev->gadget->dev,
 		"acm ttyGS%d: IN/%s OUT/%s NOTIFY/%s\n",
@@ -700,14 +704,6 @@ acm_bind(struct usb_configuration *c, struct usb_function *f)
 		acm->port.in->name, acm->port.out->name,
 		acm->notify->name);
 	return 0;
-
-fail:
-	if (acm->notify_req)
-		gs_free_req(acm->notify, acm->notify_req);
-
-	ERROR(cdev, "%s/%p: can't bind, err %d\n", f->name, f, status);
-
-	return status;
 }
 
 static void acm_unbind(struct usb_configuration *c, struct usb_function *f)
]

134/2 2026/08/07 05:44 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 30807
							output: 25
							thoughts: 213
						

Thoughts:
**Analyzing a Tricky USB Gadget Driver Bug**

Okay, so I'm looking at this issue, and it's strikingly familiar. The root of the problem seems to be the error handling in the `bind` function. Specifically, it's that damn shared error path. In this case, `bind` frees `acm->notify_req`, but if that pointer is stale from a previous `unbind`, we're dealing with a NULL pointer dereference, or worse, a double free. Classic. The immediate solution that springs to mind is to abandon this unified error label and opt for either `__free()` directly, or the old-fashioned manual cleanup of local variables before they're assigned to the struct. Much less prone to these kinds of race conditions.

Hmm, this reminds me of something else. Wait, in `gadgetfs_bind` they're calling `gadgetfs_unbind(gadget)` in the error path. And I believe that `gadgetfs_unbind` then calls `put_dev(dev)` on a reference that was never actually taken. Yes, similar to how `f_acm`, `f_ecm`, and `f_rndis` handle errors. The error paths in `bind` are trying to clean up things that weren’t fully initialized, or were left in a stale state from a previous operation. We really need to get this error handling under control.

I need to confirm if my suspicions are correct. I should check the commit `75a5b8d4ddd4 usb: gadget: f_ncm: Refactor bind path to use __free()` to see if I'm on the right track.



135/2 2026/08/07 05:44 tool git-show
0m Args:
map[Commit:75a5b8d4ddd4]

Results:
map[Output:commit 75a5b8d4ddd4eb6b16cb0b475d14ff4ae64295ef
Author: Kuen-Han Tsai <khtsai@google.com>
Date:   Tue Sep 16 16:21:34 2025 +0800

    usb: gadget: f_ncm: Refactor bind path to use __free()
    
    After an bind/unbind cycle, the ncm->notify_req is left stale. If a
    subsequent bind fails, the unified error label attempts to free this
    stale request, leading to a NULL pointer dereference when accessing
    ep->ops->free_request.
    
    Refactor the error handling in the bind path to use the __free()
    automatic cleanup mechanism.
    
    Unable to handle kernel NULL pointer dereference at virtual address 0000000000000020
    Call trace:
     usb_ep_free_request+0x2c/0xec
     ncm_bind+0x39c/0x3dc
     usb_add_function+0xcc/0x1f0
     configfs_composite_bind+0x468/0x588
     gadget_bind_driver+0x104/0x270
     really_probe+0x190/0x374
     __driver_probe_device+0xa0/0x12c
     driver_probe_device+0x3c/0x218
     __device_attach_driver+0x14c/0x188
     bus_for_each_drv+0x10c/0x168
     __device_attach+0xfc/0x198
     device_initial_probe+0x14/0x24
     bus_probe_device+0x94/0x11c
     device_add+0x268/0x48c
     usb_add_gadget+0x198/0x28c
     dwc3_gadget_init+0x700/0x858
     __dwc3_set_mode+0x3cc/0x664
     process_scheduled_works+0x1d8/0x488
     worker_thread+0x244/0x334
     kthread+0x114/0x1bc
     ret_from_fork+0x10/0x20
    
    Fixes: 9f6ce4240a2b ("usb: gadget: f_ncm.c added")
    Cc: stable@kernel.org
    Signed-off-by: Kuen-Han Tsai <khtsai@google.com>
    Link: https://lore.kernel.org/r/20250916-ready-v1-3-4997bf277548@google.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Link: https://lore.kernel.org/r/20250916-ready-v1-3-4997bf277548@google.com

diff --git a/drivers/usb/gadget/function/f_ncm.c b/drivers/usb/gadget/function/f_ncm.c
index 58b0dd575af3..0148d60926dc 100644
--- a/drivers/usb/gadget/function/f_ncm.c
+++ b/drivers/usb/gadget/function/f_ncm.c
@@ -11,6 +11,7 @@
  * Copyright (C) 2008 Nokia Corporation
  */
 
+#include <linux/cleanup.h>
 #include <linux/kernel.h>
 #include <linux/interrupt.h>
 #include <linux/module.h>
@@ -20,6 +21,7 @@
 #include <linux/string_choices.h>
 
 #include <linux/usb/cdc.h>
+#include <linux/usb/gadget.h>
 
 #include "u_ether.h"
 #include "u_ether_configfs.h"
@@ -1436,18 +1438,18 @@ static int ncm_bind(struct usb_configuration *c, struct usb_function *f)
 	struct usb_ep		*ep;
 	struct f_ncm_opts	*ncm_opts;
 
+	struct usb_os_desc_table	*os_desc_table __free(kfree) = NULL;
+	struct usb_request		*request __free(free_usb_request) = NULL;
+
 	if (!can_support_ecm(cdev->gadget))
 		return -EINVAL;
 
 	ncm_opts = container_of(f->fi, struct f_ncm_opts, func_inst);
 
 	if (cdev->use_os_string) {
-		f->os_desc_table = kzalloc(sizeof(*f->os_desc_table),
-					   GFP_KERNEL);
-		if (!f->os_desc_table)
+		os_desc_table = kzalloc(sizeof(*os_desc_table), GFP_KERNEL);
+		if (!os_desc_table)
 			return -ENOMEM;
-		f->os_desc_n = 1;
-		f->os_desc_table[0].os_desc = &ncm_opts->ncm_os_desc;
 	}
 
 	mutex_lock(&ncm_opts->lock);
@@ -1459,16 +1461,15 @@ static int ncm_bind(struct usb_configuration *c, struct usb_function *f)
 	mutex_unlock(&ncm_opts->lock);
 
 	if (status)
-		goto fail;
+		return status;
 
 	ncm_opts->bound = true;
 
 	us = usb_gstrings_attach(cdev, ncm_strings,
 				 ARRAY_SIZE(ncm_string_defs));
-	if (IS_ERR(us)) {
-		status = PTR_ERR(us);
-		goto fail;
-	}
+	if (IS_ERR(us))
+		return PTR_ERR(us);
+
 	ncm_control_intf.iInterface = us[STRING_CTRL_IDX].id;
 	ncm_data_nop_intf.iInterface = us[STRING_DATA_IDX].id;
 	ncm_data_intf.iInterface = us[STRING_DATA_IDX].id;
@@ -1478,20 +1479,16 @@ static int ncm_bind(struct usb_configuration *c, struct usb_function *f)
 	/* allocate instance-specific interface IDs */
 	status = usb_interface_id(c, f);
 	if (status < 0)
-		goto fail;
+		return status;
 	ncm->ctrl_id = status;
 	ncm_iad_desc.bFirstInterface = status;
 
 	ncm_control_intf.bInterfaceNumber = status;
 	ncm_union_desc.bMasterInterface0 = status;
 
-	if (cdev->use_os_string)
-		f->os_desc_table[0].if_id =
-			ncm_iad_desc.bFirstInterface;
-
 	status = usb_interface_id(c, f);
 	if (status < 0)
-		goto fail;
+		return status;
 	ncm->data_id = status;
 
 	ncm_data_nop_intf.bInterfaceNumber = status;
@@ -1500,35 +1497,31 @@ static int ncm_bind(struct usb_configuration *c, struct usb_function *f)
 
 	ecm_desc.wMaxSegmentSize = cpu_to_le16(ncm_opts->max_segment_size);
 
-	status = -ENODEV;
-
 	/* allocate instance-specific endpoints */
 	ep = usb_ep_autoconfig(cdev->gadget, &fs_ncm_in_desc);
 	if (!ep)
-		goto fail;
+		return -ENODEV;
 	ncm->port.in_ep = ep;
 
 	ep = usb_ep_autoconfig(cdev->gadget, &fs_ncm_out_desc);
 	if (!ep)
-		goto fail;
+		return -ENODEV;
 	ncm->port.out_ep = ep;
 
 	ep = usb_ep_autoconfig(cdev->gadget, &fs_ncm_notify_desc);
 	if (!ep)
-		goto fail;
+		return -ENODEV;
 	ncm->notify = ep;
 
-	status = -ENOMEM;
-
 	/* allocate notification request and buffer */
-	ncm->notify_req = usb_ep_alloc_request(ep, GFP_KERNEL);
-	if (!ncm->notify_req)
-		goto fail;
-	ncm->notify_req->buf = kmalloc(NCM_STATUS_BYTECOUNT, GFP_KERNEL);
-	if (!ncm->notify_req->buf)
-		goto fail;
-	ncm->notify_req->context = ncm;
-	ncm->notify_req->complete = ncm_notify_complete;
+	request = usb_ep_alloc_request(ep, GFP_KERNEL);
+	if (!request)
+		return -ENOMEM;
+	request->buf = kmalloc(NCM_STATUS_BYTECOUNT, GFP_KERNEL);
+	if (!request->buf)
+		return -ENOMEM;
+	request->context = ncm;
+	request->complete = ncm_notify_complete;
 
 	/*
 	 * support all relevant hardware speeds... we expect that when
@@ -1548,7 +1541,7 @@ static int ncm_bind(struct usb_configuration *c, struct usb_function *f)
 	status = usb_assign_descriptors(f, ncm_fs_function, ncm_hs_function,
 			ncm_ss_function, ncm_ss_function);
 	if (status)
-		goto fail;
+		return status;
 
 	/*
 	 * NOTE:  all that is done without knowing or caring about
@@ -1561,23 +1554,18 @@ static int ncm_bind(struct usb_configuration *c, struct usb_function *f)
 
 	hrtimer_setup(&ncm->task_timer, ncm_tx_timeout, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT);
 
+	if (cdev->use_os_string) {
+		os_desc_table[0].os_desc = &ncm_opts->ncm_os_desc;
+		os_desc_table[0].if_id = ncm_iad_desc.bFirstInterface;
+		f->os_desc_table = no_free_ptr(os_desc_table);
+		f->os_desc_n = 1;
+	}
+	ncm->notify_req = no_free_ptr(request);
+
 	DBG(cdev, "CDC Network: IN/%s OUT/%s NOTIFY/%s\n",
 			ncm->port.in_ep->name, ncm->port.out_ep->name,
 			ncm->notify->name);
 	return 0;
-
-fail:
-	kfree(f->os_desc_table);
-	f->os_desc_n = 0;
-
-	if (ncm->notify_req) {
-		kfree(ncm->notify_req->buf);
-		usb_ep_free_request(ncm->notify, ncm->notify_req);
-	}
-
-	ERROR(cdev, "%s: can't bind, err %d\n", f->name, status);
-
-	return status;
 }
 
 static inline struct f_ncm_opts *to_f_ncm_opts(struct config_item *item)
]

136/2 2026/08/07 05:44 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 34451
							output: 27
							thoughts: 493
						

Thoughts:
**Analyzing USB Gadget Driver Error Handling**

Okay, so I'm looking at this bug report, and it immediately screams familiarity. It's the same fundamental issue plaguing `f_acm`, `f_ecm`, and `f_rndis`. The core problem seems to be stale data left behind after a bind/unbind cycle. Specifically, a structure's member is left pointing to a dangling pointer. If a subsequent bind fails, the unified error handling attempts to clean up this stale request, leading to a nasty NULL pointer dereference when it calls `ep->ops->free_request`. That's bad.

Now, let's zoom in on `gadgetfs_bind`. The bug lies in how it handles errors. If `gadgetfs_bind` fails, it calls `gadgetfs_unbind(gadget)`. Wait, isn't `gadgetfs_unbind` designed to tear down a fully bound gadget? It expects an extra reference that might not exist at this point. Essentially, it's like calling `unbind` when there's nothing to unbind or, even worse, using a catch-all cleanup label that assumes things have been fully initialized when they haven't. The bug report is spot-on: `gadgetfs_bind` needs to do its own cleanup, manually undoing the steps it took *before* the failure, rather than assuming a full teardown.

I'm thinking this echoes similar problems I've seen before. Let me pull up some relevant commits. Here's `62783c30d78a USB: gadget: f_hid: Fix memory leak in hidg_bind error path`. This commit specifically addresses the issue by restructuring the error handling and introducing proper cleanup labels. That means it ensures that allocated resources are freed in the reverse order of their allocation. Good practice, that.

And look at `082289414360 usb: gadget: f_rndis: Refactor bind path to use __free()`. This one explicitly mentions the same stale request issue I described earlier and, again, points to using `__free()` for a more robust and cleaner approach to error handling.

Finally, `56a512a9b410 usb: gadget: f_ncm: align net_device lifecycle with bind/unbind`. Let's see if this applies. 
So, the takeaway is clear: We need to refactor the error handling in these bind paths. Using `__free()` or adding specific cleanup labels is the key. The current unified error path approach is brittle and prone to these memory corruption issues. Let's get to work on that.



137/2 2026/08/07 05:45 tool git-show
0m Args:
map[Commit:56a512a9b410]

Results:
map[Output:commit 56a512a9b4107079f68701e7d55da8507eb963d9
Author: Kuen-Han Tsai <khtsai@google.com>
Date:   Tue Dec 30 18:13:16 2025 +0800

    usb: gadget: f_ncm: align net_device lifecycle with bind/unbind
    
    Currently, the net_device is allocated in ncm_alloc_inst() and freed in
    ncm_free_inst(). This ties the network interface's lifetime to the
    configuration instance rather than the USB connection (bind/unbind).
    
    This decoupling causes issues when the USB gadget is disconnected where
    the underlying gadget device is removed. The net_device can outlive its
    parent, leading to dangling sysfs links and NULL pointer dereferences
    when accessing the freed gadget device.
    
    Problem 1: NULL pointer dereference on disconnect
     Unable to handle kernel NULL pointer dereference at virtual address
     0000000000000000
     Call trace:
       __pi_strlen+0x14/0x150
       rtnl_fill_ifinfo+0x6b4/0x708
       rtmsg_ifinfo_build_skb+0xd8/0x13c
       rtmsg_ifinfo+0x50/0xa0
       __dev_notify_flags+0x4c/0x1f0
       dev_change_flags+0x54/0x70
       do_setlink+0x390/0xebc
       rtnl_newlink+0x7d0/0xac8
       rtnetlink_rcv_msg+0x27c/0x410
       netlink_rcv_skb+0x134/0x150
       rtnetlink_rcv+0x18/0x28
       netlink_unicast+0x254/0x3f0
       netlink_sendmsg+0x2e0/0x3d4
    
    Problem 2: Dangling sysfs symlinks
     console:/ # ls -l /sys/class/net/ncm0
     lrwxrwxrwx ... /sys/class/net/ncm0 ->
     /sys/devices/platform/.../gadget.0/net/ncm0
     console:/ # ls -l /sys/devices/platform/.../gadget.0/net/ncm0
     ls: .../gadget.0/net/ncm0: No such file or directory
    
    Move the net_device allocation to ncm_bind() and deallocation to
    ncm_unbind(). This ensures the network interface exists only when the
    gadget function is actually bound to a configuration.
    
    To support pre-bind configuration (e.g., setting interface name or MAC
    address via configfs), cache user-provided options in f_ncm_opts
    using the gether_opts structure. Apply these cached settings to the
    net_device upon creation in ncm_bind().
    
    Preserve the use-after-free fix from commit 6334b8e4553c ("usb: gadget:
    f_ncm: Fix UAF ncm object at re-bind after usb ep transport error").
    Check opts->net in ncm_set_alt() and ncm_disable() to ensure
    gether_disconnect() runs only if a connection was established.
    
    Fixes: 40d133d7f542 ("usb: gadget: f_ncm: convert to new function interface with backward compatibility")
    Cc: stable@kernel.org
    Signed-off-by: Kuen-Han Tsai <khtsai@google.com>
    Link: https://patch.msgid.link/20251230-ncm-refactor-v1-3-793e347bc7a7@google.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

diff --git a/drivers/usb/gadget/function/f_ncm.c b/drivers/usb/gadget/function/f_ncm.c
index 0e38330271d5..e23adc132f88 100644
--- a/drivers/usb/gadget/function/f_ncm.c
+++ b/drivers/usb/gadget/function/f_ncm.c
@@ -83,6 +83,11 @@ static inline struct f_ncm *func_to_ncm(struct usb_function *f)
 	return container_of(f, struct f_ncm, port.func);
 }
 
+static inline struct f_ncm_opts *func_to_ncm_opts(struct usb_function *f)
+{
+	return container_of(f->fi, struct f_ncm_opts, func_inst);
+}
+
 /*-------------------------------------------------------------------------*/
 
 /*
@@ -859,6 +864,7 @@ static int ncm_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl)
 static int ncm_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
 {
 	struct f_ncm		*ncm = func_to_ncm(f);
+	struct f_ncm_opts	*opts = func_to_ncm_opts(f);
 	struct usb_composite_dev *cdev = f->config->cdev;
 
 	/* Control interface has only altsetting 0 */
@@ -881,12 +887,13 @@ static int ncm_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
 		if (alt > 1)
 			goto fail;
 
-		if (ncm->netdev) {
-			DBG(cdev, "reset ncm\n");
-			ncm->netdev = NULL;
-			gether_disconnect(&ncm->port);
-			ncm_reset_values(ncm);
-		}
+		scoped_guard(mutex, &opts->lock)
+			if (opts->net) {
+				DBG(cdev, "reset ncm\n");
+				opts->net = NULL;
+				gether_disconnect(&ncm->port);
+				ncm_reset_values(ncm);
+			}
 
 		/*
 		 * CDC Network only sends data in non-default altsettings.
@@ -919,7 +926,8 @@ static int ncm_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
 			net = gether_connect(&ncm->port);
 			if (IS_ERR(net))
 				return PTR_ERR(net);
-			ncm->netdev = net;
+			scoped_guard(mutex, &opts->lock)
+				opts->net = net;
 		}
 
 		spin_lock(&ncm->lock);
@@ -1366,14 +1374,16 @@ static int ncm_unwrap_ntb(struct gether *port,
 static void ncm_disable(struct usb_function *f)
 {
 	struct f_ncm		*ncm = func_to_ncm(f);
+	struct f_ncm_opts	*opts = func_to_ncm_opts(f);
 	struct usb_composite_dev *cdev = f->config->cdev;
 
 	DBG(cdev, "ncm deactivated\n");
 
-	if (ncm->netdev) {
-		ncm->netdev = NULL;
-		gether_disconnect(&ncm->port);
-	}
+	scoped_guard(mutex, &opts->lock)
+		if (opts->net) {
+			opts->net = NULL;
+			gether_disconnect(&ncm->port);
+		}
 
 	if (ncm->notify->enabled) {
 		usb_ep_disable(ncm->notify);
@@ -1433,39 +1443,44 @@ static int ncm_bind(struct usb_configuration *c, struct usb_function *f)
 {
 	struct usb_composite_dev *cdev = c->cdev;
 	struct f_ncm		*ncm = func_to_ncm(f);
+	struct f_ncm_opts	*ncm_opts = func_to_ncm_opts(f);
 	struct usb_string	*us;
 	int			status = 0;
 	struct usb_ep		*ep;
-	struct f_ncm_opts	*ncm_opts;
 
 	struct usb_os_desc_table	*os_desc_table __free(kfree) = NULL;
+	struct net_device		*netdev __free(free_gether_netdev) = NULL;
 	struct usb_request		*request __free(free_usb_request) = NULL;
 
 	if (!can_support_ecm(cdev->gadget))
 		return -EINVAL;
 
-	ncm_opts = container_of(f->fi, struct f_ncm_opts, func_inst);
-
 	if (cdev->use_os_string) {
 		os_desc_table = kzalloc(sizeof(*os_desc_table), GFP_KERNEL);
 		if (!os_desc_table)
 			return -ENOMEM;
 	}
 
-	mutex_lock(&ncm_opts->lock);
-	gether_set_gadget(ncm_opts->net, cdev->gadget);
-	if (!ncm_opts->bound) {
-		ncm_opts->net->mtu = (ncm_opts->max_segment_size - ETH_HLEN);
-		status = gether_register_netdev(ncm_opts->net);
+	netdev = gether_setup_default();
+	if (IS_ERR(netdev))
+		return -ENOMEM;
+
+	scoped_guard(mutex, &ncm_opts->lock) {
+		gether_apply_opts(netdev, &ncm_opts->net_opts);
+		netdev->mtu = ncm_opts->max_segment_size - ETH_HLEN;
 	}
-	mutex_unlock(&ncm_opts->lock);
 
+	gether_set_gadget(netdev, cdev->gadget);
+	status = gether_register_netdev(netdev);
 	if (status)
 		return status;
 
-	ncm_opts->bound = true;
-
-	ncm_string_defs[1].s = ncm->ethaddr;
+	/* export host's Ethernet address in CDC format */
+	status = gether_get_host_addr_cdc(netdev, ncm->ethaddr,
+					  sizeof(ncm->ethaddr));
+	if (status < 12)
+		return -EINVAL;
+	ncm_string_defs[STRING_MAC_IDX].s = ncm->ethaddr;
 
 	us = usb_gstrings_attach(cdev, ncm_strings,
 				 ARRAY_SIZE(ncm_string_defs));
@@ -1563,6 +1578,8 @@ static int ncm_bind(struct usb_configuration *c, struct usb_function *f)
 		f->os_desc_n = 1;
 	}
 	ncm->notify_req = no_free_ptr(request);
+	ncm->netdev = no_free_ptr(netdev);
+	ncm->port.ioport = netdev_priv(ncm->netdev);
 
 	DBG(cdev, "CDC Network: IN/%s OUT/%s NOTIFY/%s\n",
 			ncm->port.in_ep->name, ncm->port.out_ep->name,
@@ -1577,19 +1594,19 @@ static inline struct f_ncm_opts *to_f_ncm_opts(struct config_item *item)
 }
 
 /* f_ncm_item_ops */
-USB_ETHERNET_CONFIGFS_ITEM(ncm);
+USB_ETHER_OPTS_ITEM(ncm);
 
 /* f_ncm_opts_dev_addr */
-USB_ETHERNET_CONFIGFS_ITEM_ATTR_DEV_ADDR(ncm);
+USB_ETHER_OPTS_ATTR_DEV_ADDR(ncm);
 
 /* f_ncm_opts_host_addr */
-USB_ETHERNET_CONFIGFS_ITEM_ATTR_HOST_ADDR(ncm);
+USB_ETHER_OPTS_ATTR_HOST_ADDR(ncm);
 
 /* f_ncm_opts_qmult */
-USB_ETHERNET_CONFIGFS_ITEM_ATTR_QMULT(ncm);
+USB_ETHER_OPTS_ATTR_QMULT(ncm);
 
 /* f_ncm_opts_ifname */
-USB_ETHERNET_CONFIGFS_ITEM_ATTR_IFNAME(ncm);
+USB_ETHER_OPTS_ATTR_IFNAME(ncm);
 
 static ssize_t ncm_opts_max_segment_size_show(struct config_item *item,
 					      char *page)
@@ -1655,34 +1672,27 @@ static void ncm_free_inst(struct usb_function_instance *f)
 	struct f_ncm_opts *opts;
 
 	opts = container_of(f, struct f_ncm_opts, func_inst);
-	if (opts->bound)
-		gether_cleanup(netdev_priv(opts->net));
-	else
-		free_netdev(opts->net);
 	kfree(opts->ncm_interf_group);
 	kfree(opts);
 }
 
 static struct usb_function_instance *ncm_alloc_inst(void)
 {
-	struct f_ncm_opts *opts;
+	struct usb_function_instance *ret;
 	struct usb_os_desc *descs[1];
 	char *names[1];
 	struct config_group *ncm_interf_group;
 
-	opts = kzalloc(sizeof(*opts), GFP_KERNEL);
+	struct f_ncm_opts *opts __free(kfree) = kzalloc(sizeof(*opts), GFP_KERNEL);
 	if (!opts)
 		return ERR_PTR(-ENOMEM);
+
+	opts->net = NULL;
 	opts->ncm_os_desc.ext_compat_id = opts->ncm_ext_compat_id;
+	gether_setup_opts_default(&opts->net_opts, "usb");
 
 	mutex_init(&opts->lock);
 	opts->func_inst.free_func_inst = ncm_free_inst;
-	opts->net = gether_setup_default();
-	if (IS_ERR(opts->net)) {
-		struct net_device *net = opts->net;
-		kfree(opts);
-		return ERR_CAST(net);
-	}
 	opts->max_segment_size = ETH_FRAME_LEN;
 	INIT_LIST_HEAD(&opts->ncm_os_desc.ext_prop);
 
@@ -1693,26 +1703,22 @@ static struct usb_function_instance *ncm_alloc_inst(void)
 	ncm_interf_group =
 		usb_os_desc_prepare_interf_dir(&opts->func_inst.group, 1, descs,
 					       names, THIS_MODULE);
-	if (IS_ERR(ncm_interf_group)) {
-		ncm_free_inst(&opts->func_inst);
+	if (IS_ERR(ncm_interf_group))
 		return ERR_CAST(ncm_interf_group);
-	}
 	opts->ncm_interf_group = ncm_interf_group;
 
-	return &opts->func_inst;
+	ret = &opts->func_inst;
+	retain_and_null_ptr(opts);
+	return ret;
 }
 
 static void ncm_free(struct usb_function *f)
 {
-	struct f_ncm *ncm;
-	struct f_ncm_opts *opts;
+	struct f_ncm_opts *opts = func_to_ncm_opts(f);
 
-	ncm = func_to_ncm(f);
-	opts = container_of(f->fi, struct f_ncm_opts, func_inst);
-	kfree(ncm);
-	mutex_lock(&opts->lock);
-	opts->refcnt--;
-	mutex_unlock(&opts->lock);
+	scoped_guard(mutex, &opts->lock)
+		opts->refcnt--;
+	kfree(func_to_ncm(f));
 }
 
 static void ncm_unbind(struct usb_configuration *c, struct usb_function *f)
@@ -1736,13 +1742,15 @@ static void ncm_unbind(struct usb_configuration *c, struct usb_function *f)
 
 	kfree(ncm->notify_req->buf);
 	usb_ep_free_request(ncm->notify, ncm->notify_req);
+
+	ncm->port.ioport = NULL;
+	gether_cleanup(netdev_priv(ncm->netdev));
 }
 
 static struct usb_function *ncm_alloc(struct usb_function_instance *fi)
 {
 	struct f_ncm		*ncm;
 	struct f_ncm_opts	*opts;
-	int status;
 
 	/* allocate and initialize one new instance */
 	ncm = kzalloc(sizeof(*ncm), GFP_KERNEL);
@@ -1750,22 +1758,12 @@ static struct usb_function *ncm_alloc(struct usb_function_instance *fi)
 		return ERR_PTR(-ENOMEM);
 
 	opts = container_of(fi, struct f_ncm_opts, func_inst);
-	mutex_lock(&opts->lock);
-	opts->refcnt++;
 
-	/* export host's Ethernet address in CDC format */
-	status = gether_get_host_addr_cdc(opts->net, ncm->ethaddr,
-				      sizeof(ncm->ethaddr));
-	if (status < 12) { /* strlen("01234567890a") */
-		kfree(ncm);
-		mutex_unlock(&opts->lock);
-		return ERR_PTR(-EINVAL);
-	}
+	scoped_guard(mutex, &opts->lock)
+		opts->refcnt++;
 
 	spin_lock_init(&ncm->lock);
 	ncm_reset_values(ncm);
-	ncm->port.ioport = netdev_priv(opts->net);
-	mutex_unlock(&opts->lock);
 	ncm->port.is_fixed = true;
 	ncm->port.supports_multi_frame = true;
 
diff --git a/drivers/usb/gadget/function/u_ncm.h b/drivers/usb/gadget/function/u_ncm.h
index 49ec095cdb4b..d99330fe31e8 100644
--- a/drivers/usb/gadget/function/u_ncm.h
+++ b/drivers/usb/gadget/function/u_ncm.h
@@ -15,11 +15,13 @@
 
 #include <linux/usb/composite.h>
 
+#include "u_ether.h"
+
 struct f_ncm_opts {
 	struct usb_function_instance	func_inst;
 	struct net_device		*net;
-	bool				bound;
 
+	struct gether_opts		net_opts;
 	struct config_group		*ncm_interf_group;
 	struct usb_os_desc		ncm_os_desc;
 	char				ncm_ext_compat_id[16];
]

138/2 2026/08/07 05:45 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 40555
							output: 27
							thoughts: 50
						

Thoughts:
Okay, here's my interpretation of that commit message, expressed as my internal thought process:

**Reflecting on Net Device Lifecycle Alignment**

Alright, so this commit's about bringing the handling of the network device lifecycle into closer alignment with the bind and unbind operations. Good, that makes sense. It's usually a good practice to keep those operations tightly coupled. Prevents a lot of subtle, hard-to-debug issues. Let's delve in and see what's changed.

Specifically, I'm thinking about the implications, it seems we have to look at `29a142d3e8b3 USB: gadget: snps-udc: fix device name leak on probe failure`. It must have been an example which brought this to their attention. The phrase "device name leak on probe failure" immediately grabs my attention. That's precisely the kind of situation where lifecycle management needs to be spot-on. I'll need to see how the binding and unbinding procedures were related there. Was the name allocated too early? Released too late? Or maybe missed entirely? This will probably be a good case to study.



139/2 2026/08/07 05:45 tool git-show
0m Args:
map[Commit:29a142d3e8b3]

Results:
map[Output:commit 29a142d3e8b35ebc9e0bcc78f4bc26c9b6a9ac0b
Author: Johan Hovold <johan@kernel.org>
Date:   Thu Jul 2 16:15:34 2026 +0200

    USB: gadget: snps-udc: fix device name leak on probe failure
    
    The gadget device name is set by UDC core when registering the gadget
    and must not be set before to avoid leaking the name in intermediate
    error paths (e.g. when detecting an older chip revision).
    
    Fixes: 12ad0fcaf2fb ("usb: gadget: amd5536udc: let udc-core manage gadget->dev")
    Cc: stable <stable@kernel.org>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Link: https://patch.msgid.link/20260702141536.90887-3-johan@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

diff --git a/drivers/usb/gadget/udc/snps_udc_core.c b/drivers/usb/gadget/udc/snps_udc_core.c
index 0e0db68e0b27..d506f9d92bca 100644
--- a/drivers/usb/gadget/udc/snps_udc_core.c
+++ b/drivers/usb/gadget/udc/snps_udc_core.c
@@ -3133,7 +3133,6 @@ int udc_probe(struct udc *dev)
 	/* device struct setup */
 	dev->gadget.ops = &udc_ops;
 
-	dev_set_name(&dev->gadget.dev, "gadget");
 	dev->gadget.name = name;
 	dev->gadget.max_speed = USB_SPEED_HIGH;
 
]

140/2 2026/08/07 05:45 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 41402
							output: 43
							thoughts: 141
						

Thoughts:
**USB Gadget Driver Error Path Investigation**

Okay, this isn't relevant, let's skip that. Time to go back to the source. I need to re-examine the `drivers/usb/gadget/` directory, specifically looking for the terms "error path" and "unbind."

Ah, right, the bug report...it's reminding me that `gadgetfs_bind()` shouldn't call `gadgetfs_unbind()` within its error handling. That's a classic mistake, given `gadgetfs_unbind()` assumes a fully bound gadget with the extra reference. Instead, the focus should be on *manually* cleaning up only the state modified *before* the failure, a critical distinction for robustness.

So, let's expand the search. I should look through `drivers/usb/gadget/` for any other commits where the phrases "manually clean up" or "error path" appear in conjunction with "unbind". That broader scope might reveal related patterns or best practices I can leverage. I know there have been similar issues in the past, a systematic review should provide the answers.



141/2 2026/08/07 05:45 tool git-log
0m Args:
map[MessageRegexps:[unbind error path] PathPrefix:drivers/usb/gadget/ Since:3 years]

Results:
map[Output:]

142/2 2026/08/07 05:45 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 41836
							output: 43
							thoughts: 24
						

Thoughts:
Here's my thought process, as if I were considering this search:

**Investigating a Potential USB Gadget Driver Issue**

Okay, I need to get to the bottom of this USB gadget issue. My initial hunch is that there might be a problem related to error handling or binding, given the symptoms. Let's see... if I were going to start poking around in the driver code, my first approach would be a targeted search within the USB gadget directory. The key terms I'd focus on initially are "error path" – because any robust driver needs graceful failure handling – and "bind," since that's where the device should be initially associated and started with its driver. I'll search for those strings within `drivers/usb/gadget/` and then start digging from there.



143/2 2026/08/07 05:45 tool git-log
0m Args:
map[MessageRegexps:[error path bind] PathPrefix:drivers/usb/gadget/ Since:3 years]

Results:
map[Output:68aa70648b62 usb: gadget: uvc: hold opts->lock across XU walks in uvc_function_bind
2c863dbbeac7 usb: gadget: f_hid: Add missing error code
62783c30d78a USB: gadget: f_hid: Fix memory leak in hidg_bind error path
]

144/2 2026/08/07 05:45 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 42169
							output: 27
							thoughts: 219
						

Thoughts:
**Addressing a Memory Leak in USB Descriptor Allocation**

Okay, let's revisit commit `62783c30d78a`. The core issue, as I understand it, is a memory leak in the `hidg_bind()` function. It seems that when `alloc_workqueue()` fails *after* `usb_assign_descriptors()` has already allocated the USB descriptors, the error handling doesn't properly free those descriptors. This leaves them stranded, leading to a memory leak, which is precisely what the bug report highlighted, stating that `gadgetfs_bind()` should manually clean up the state before failure.

The solution being proposed is a more structured error handling mechanism. We're introducing cleanup labels—`fail_free_all`, `fail_free_descs`, and `fail`—to ensure that resources are freed in the reverse order of their allocation. So, `fail_free_all` handles the workqueue and descriptors, `fail_free_descs` frees just the descriptors, and `fail` takes care of the earlier failures. This meticulous approach guarantees complete cleanup and, crucially, prevents the memory leak when `alloc_workqueue()` fails.

I also want to quickly check related commit `f05847a216a7 USB: gadget: fsl-udc: drop misleading unbind sanity check` and confirm there are no regressions.



145/2 2026/08/07 05:45 tool git-show
0m Args:
map[Commit:f05847a216a7]

Results:
map[Output:commit f05847a216a74e1f2387169a336edbc198960016
Author: Johan Hovold <johan@kernel.org>
Date:   Thu Jul 2 16:15:36 2026 +0200

    USB: gadget: fsl-udc: drop misleading unbind sanity check
    
    The UDC pointer is set on successful probe and will never be NULL when
    the driver is later unbound so drop the misleading sanity check (and
    confused error message).
    
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Link: https://patch.msgid.link/20260702141536.90887-5-johan@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c
index c4761933ec86..20392409afb1 100644
--- a/drivers/usb/gadget/udc/fsl_udc_core.c
+++ b/drivers/usb/gadget/udc/fsl_udc_core.c
@@ -2539,12 +2539,6 @@ static void fsl_udc_remove(struct platform_device *pdev)
 
 	DECLARE_COMPLETION_ONSTACK(done);
 
-	if (!udc_controller) {
-		dev_err(&pdev->dev,
-			"Driver still in use but removing anyhow\n");
-		return;
-	}
-
 	udc_controller->done = &done;
 	usb_del_gadget_udc(&udc_controller->gadget);
 
]

146/2 2026/08/07 05:45 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 43213
							output: 44
							thoughts: 18
						

Thoughts:
Okay, here's my summary, presented as a stream of thought:

**Focusing In: Refcount and Error Handling**

Alright, that initial information was a dead end – nothing to see there. Time to narrow the focus. My gut says the interesting bits are likely related to how the code handles resource management and potential failures. Let's dig deeper. I'm going to start by searching specifically for instances of "refcount" and "error path." Those two terms, together, usually point me directly to the heart of concurrency and resilience challenges. This feels like the right angle to approach this situation, so I'll begin there.



147/2 2026/08/07 05:45 tool git-log
0m Args:
map[MessageRegexps:[refcount error path] PathPrefix:drivers/usb/gadget/ Since:3 years]

Results:
map[Output:]

148/2 2026/08/07 05:45 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 43422
							output: 39
							thoughts: 19
						

Thoughts:
Here's my thought process, summarized as you requested:

**Investigating Potential Underflow Issues in USB Gadget Drivers**

Okay, so I need to dig into the USB gadget driver code to look for potential underflow issues. My initial thought is to target the `drivers/usb/gadget/` directory. That's the logical place to start, given the context. I'll use "underflow" as my primary search term to see what comes up. This should help me identify areas where data might be prematurely exhausted or not handled correctly, which is, essentially, the definition of an underflow in this context. I'm expecting to find instances related to buffer management, data transfer rates, and potentially error handling surrounding those aspects. Time to see what the search reveals!



149/2 2026/08/07 05:45 tool git-log
0m Args:
map[MessageRegexps:[underflow] PathPrefix:drivers/usb/gadget/ Since:3 years]

Results:
map[Output:6c5dbc104dad usb: gadget: composite: fix integer underflow in WebUSB GET_URL handling
8f993d30b95d usb: gadget: f_ncm: validate minimum block_len in ncm_unwrap_ntb()
202ad1aaca77 usb: gadget: tegra-xudc: fix PM use count underflow
]

150/2 2026/08/07 05:45 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 43745
							output: 24
							thoughts: 32
						

Thoughts:
Okay, let's dive into this commit, `202ad1aaca77 usb: gadget: tegra-xudc: fix PM use count underflow`. My immediate thought is, "Ah, another USB driver tweak." I know this area intimately – power management is always a potential minefield, especially in embedded systems like Tegra. An underflow in the PM use count? That’s concerning. It suggests the driver could be releasing a power reference it never acquired, potentially leading to incorrect power state transitions for the gadget controller (Tegra-XUDC). This could manifest as all sorts of USB connectivity issues: intermittent disconnects, device not being recognized, poor performance, or even complete system hangs. The impact of such a bug could be widespread, affecting a range of USB peripherals and use cases. I'll need to carefully examine the code in this commit to understand the specific scenario where the underflow was occurring. I'm keen to see the exact logic that manages the power references and how they were incorrectly handled. This usually happens in error handling paths or race conditions; it’s going to be interesting.



151/2 2026/08/07 05:45 tool git-show
0m Args:
map[Commit:202ad1aaca77]

Results:
map[Output:commit 202ad1aaca777dc7fd24f459f5f808f5abd2bfda
Author: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Date:   Fri Aug 1 18:40:41 2025 +0100

    usb: gadget: tegra-xudc: fix PM use count underflow
    
    Upon resume from system suspend, the PM runtime core issues the
    following warning:
    
    tegra-xudc 3550000.usb: Runtime PM usage count underflow!
    
    This is because tegra_xudc_resume() unconditionally calls
    schedule_work(&xudc->usb_role_sw_work) whether or not anything has
    changed, which causes tegra_xudc_device_mode_off() to be called
    even when we're already in that mode.
    
    Keep track of the current state of "device_mode", and only schedule
    this work if it has changed from the hardware state on resume.
    
    Signed-off-by: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
    Link: https://lore.kernel.org/r/E1uhtkH-007KDZ-JT@rmk-PC.armlinux.org.uk
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

diff --git a/drivers/usb/gadget/udc/tegra-xudc.c b/drivers/usb/gadget/udc/tegra-xudc.c
index 2957316fd3d0..1d3085cc9d22 100644
--- a/drivers/usb/gadget/udc/tegra-xudc.c
+++ b/drivers/usb/gadget/udc/tegra-xudc.c
@@ -502,6 +502,7 @@ struct tegra_xudc {
 	struct clk_bulk_data *clks;
 
 	bool device_mode;
+	bool current_device_mode;
 	struct work_struct usb_role_sw_work;
 
 	struct phy **usb3_phy;
@@ -715,6 +716,8 @@ static void tegra_xudc_device_mode_on(struct tegra_xudc *xudc)
 
 	phy_set_mode_ext(xudc->curr_utmi_phy, PHY_MODE_USB_OTG,
 			 USB_ROLE_DEVICE);
+
+	xudc->current_device_mode = true;
 }
 
 static void tegra_xudc_device_mode_off(struct tegra_xudc *xudc)
@@ -725,6 +728,8 @@ static void tegra_xudc_device_mode_off(struct tegra_xudc *xudc)
 
 	dev_dbg(xudc->dev, "device mode off\n");
 
+	xudc->current_device_mode = false;
+
 	connected = !!(xudc_readl(xudc, PORTSC) & PORTSC_CCS);
 
 	reinit_completion(&xudc->disconnect_complete);
@@ -4044,10 +4049,10 @@ static int __maybe_unused tegra_xudc_resume(struct device *dev)
 
 	spin_lock_irqsave(&xudc->lock, flags);
 	xudc->suspended = false;
+	if (xudc->device_mode != xudc->current_device_mode)
+		schedule_work(&xudc->usb_role_sw_work);
 	spin_unlock_irqrestore(&xudc->lock, flags);
 
-	schedule_work(&xudc->usb_role_sw_work);
-
 	pm_runtime_enable(dev);
 
 	return 0;
]

152/2 2026/08/07 05:45 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 45046
							output: 19
							thoughts: 30
						

Thoughts:
Okay, here's my take on those thoughts, framed as an expert's internal monologue:

**Investigating a Potential PM Runtime Usage Count Underflow**

Alright, this looks like a PM runtime usage count underflow. That's never good. We've got a potential issue with how the power management runtime is tracking device usage, and if it's underflowing, that means the counts are getting messed up, which could lead to devices being powered down prematurely or other unpredictable behavior.

First things first, I need to understand where this might be happening. "Refcount" and "error path" are going to be key terms here. I need to get a handle on all the places within the kernel where these are mentioned in the power management area. I'm thinking a broad search across the entire kernel source tree is the right approach. That should catch any obscure or potentially related areas. I'm going to start there and then refine my search as I get results. The goal is to identify all places where we're decrementing or manipulating reference counts related to power management and pinpoint potential error handling pathways. Hopefully, this reveals the root cause quickly.



153/2 2026/08/07 05:45 tool grepper
0m Args:
map[Expression:refcount.*error path]

Results:
map[Output:kernel/events/core.c=5808=static void _free_event(struct perf_event *event)
--
kernel/events/core.c-5834-/*
kernel/events/core.c:5835: * Used to free events which have a known refcount of 1, such as in error paths
kernel/events/core.c-5836- * of inherited events.
]

154/2 2026/08/07 05:45 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 45445
							output: 44
							thoughts: 1015
						

Thoughts:
**Analysis of the gadgetfs_bind() Error Path**

Okay, so here's the deal: I've got a handle on this `gadgetfs_bind()` issue. The core problem is that `gadgetfs_bind()` calls `gadgetfs_unbind()` in its error path.  That's a textbook anti-pattern. `gadgetfs_unbind()` is designed to tear down a *fully bound* gadget, which means it expects the `dev` reference to be held. By calling it when `gadgetfs_bind()` has only partially initialized the device, we're dropping a reference that was never taken, and that's just begging for trouble – refcount underflow, double frees, or worse, NULL pointer dereferences.

This is a familiar scenario, and I've seen it pop up in the kernel's USB gadget subsystem before. I was thinking of examples, and I was reminded of a few recent fixes. The commits highlighted are instructive here:

*   **62783c30d78a:** "USB: gadget: f\_hid: Fix memory leak in hidg\_bind error path." This one refactored the error handling by introducing cleanup labels, carefully cleaning up allocated resources in reverse allocation order. This is a solid approach.
*   **082289414360, 42988380ac67, 47b2116e54b4, 75a5b8d4ddd4:** These commits ("usb: gadget: f\_rndis: Refactor bind path to use \_\_free()", "usb: gadget: f\_ecm: Refactor bind path to use \_\_free()", "usb: gadget: f\_acm: Refactor bind path to use \_\_free()", and "usb: gadget: f\_ncm: Refactor bind path to use \_\_free()", respectively) addressed a similar issue in the `bind` path of several USB gadget functions. They had a unified error label that tried to clean up stale requests, resulting in NULL pointer dereferences. The fix in these cases was to switch to the `__free()` automatic cleanup mechanism or perform manual cleanup of only what had been initialized.

The bug report hits the nail on the head: We shouldn't be calling the complete `unbind` or `cleanup` routine in the `bind` error path unless the object is fully bound. Instead, `gadgetfs_bind()` needs to surgically clean up only the resources it actually allocated or modified before the error occurred. That's the key. This is a common pattern in kernel development. You either use `goto` labels to explicitly manage cleanup in reverse allocation order or adopt the newer `__free()` mechanism to handle automatic cleanup.

So, the summary is this: The problem is the incorrect use of a full teardown function in an error path, leading to reference count issues. The fix is to refactor error handling to manually clean up only the initialized state or use the `__free()` mechanism. I'm going to double-check `drivers/usb/gadget/legacy/inode.c` for any related commits I might have missed, but I'm pretty confident in this analysis.



155/2 2026/08/07 05:45 tool git-log
0m Args:
map[MessageRegexps:[error] PathPrefix:drivers/usb/gadget/legacy/inode.c Since:10 years]

Results:
map[Output:4c3d8accdce2 usb: remove res2 argument from gadget code completions
3343f376d4ba usb: gadget: prevent a ternary sign expansion bug
87bed3d7d26c usb: gadget: Fix memleak in gadgetfs_fill_super
f16443a034c7 USB: gadgetfs, dummy-hcd, net2280: fix locking for callbacks
add333a81a16 USB: gadgetfs: fix use-after-free bug
faab50984fe6 USB: gadgetfs: fix unbounded memory allocation bug
]

156/2 2026/08/07 05:45 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 47358
							output: 25
							thoughts: 28
						

Thoughts:
Here's my analysis of the provided text, rendered as a first-person expert summary:

**Analyzing the USB Gadgetfs Fix**

Alright, let's dive into this commit, `add333a81a16 USB: gadgetfs: fix use-after-free bug`. The title alone suggests a critical vulnerability. Use-after-free bugs in kernel code are nasty – they can lead to data corruption, privilege escalation, or even complete system crashes. Gadgetfs, being a userspace-driven USB device emulation framework, is a prime target for these kinds of problems, especially considering its interaction with user-provided data. I need to understand the specifics of the bug to assess its potential impact and the effectiveness of the fix. I'll need to dig into the diffs, focusing on where data pointers are being managed, freed, and accessed. What object is it related to? What sequence of actions leads to the free? Is it due to races or logic errors? Is the fix complete, or does it leave any edge cases unaddressed? This commit title has my attention, definitely worthy of an in-depth review.



157/2 2026/08/07 05:46 tool git-show
0m Args:
map[Commit:add333a81a16]

Results:
map[Output:commit add333a81a16abbd4f106266a2553677a165725f
Author: Alan Stern <stern@rowland.harvard.edu>
Date:   Fri Dec 9 15:18:43 2016 -0500

    USB: gadgetfs: fix use-after-free bug
    
    Andrey Konovalov reports that fuzz testing with syzkaller causes a
    KASAN use-after-free bug report in gadgetfs:
    
    BUG: KASAN: use-after-free in gadgetfs_setup+0x208a/0x20e0 at addr ffff88003dfe5bf2
    Read of size 2 by task syz-executor0/22994
    CPU: 3 PID: 22994 Comm: syz-executor0 Not tainted 4.9.0-rc7+ #16
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
     ffff88006df06a18 ffffffff81f96aba ffffffffe0528500 1ffff1000dbe0cd6
     ffffed000dbe0cce ffff88006df068f0 0000000041b58ab3 ffffffff8598b4c8
     ffffffff81f96828 1ffff1000dbe0ccd ffff88006df06708 ffff88006df06748
    Call Trace:
     <IRQ> [  201.343209]  [<     inline     >] __dump_stack lib/dump_stack.c:15
     <IRQ> [  201.343209]  [<ffffffff81f96aba>] dump_stack+0x292/0x398 lib/dump_stack.c:51
     [<ffffffff817e4dec>] kasan_object_err+0x1c/0x70 mm/kasan/report.c:159
     [<     inline     >] print_address_description mm/kasan/report.c:197
     [<ffffffff817e5080>] kasan_report_error+0x1f0/0x4e0 mm/kasan/report.c:286
     [<     inline     >] kasan_report mm/kasan/report.c:306
     [<ffffffff817e562a>] __asan_report_load_n_noabort+0x3a/0x40 mm/kasan/report.c:337
     [<     inline     >] config_buf drivers/usb/gadget/legacy/inode.c:1298
     [<ffffffff8322c8fa>] gadgetfs_setup+0x208a/0x20e0 drivers/usb/gadget/legacy/inode.c:1368
     [<ffffffff830fdcd0>] dummy_timer+0x11f0/0x36d0 drivers/usb/gadget/udc/dummy_hcd.c:1858
     [<ffffffff814807c1>] call_timer_fn+0x241/0x800 kernel/time/timer.c:1308
     [<     inline     >] expire_timers kernel/time/timer.c:1348
     [<ffffffff81482de6>] __run_timers+0xa06/0xec0 kernel/time/timer.c:1641
     [<ffffffff814832c1>] run_timer_softirq+0x21/0x80 kernel/time/timer.c:1654
     [<ffffffff84f4af8b>] __do_softirq+0x2fb/0xb63 kernel/softirq.c:284
    
    The cause of the bug is subtle.  The dev_config() routine gets called
    twice by the fuzzer.  The first time, the user data contains both a
    full-speed configuration descriptor and a high-speed config
    descriptor, causing dev->hs_config to be set.  But it also contains an
    invalid device descriptor, so the buffer containing the descriptors is
    deallocated and dev_config() returns an error.
    
    The second time dev_config() is called, the user data contains only a
    full-speed config descriptor.  But dev->hs_config still has the stale
    pointer remaining from the first call, causing the routine to think
    that there is a valid high-speed config.  Later on, when the driver
    dereferences the stale pointer to copy that descriptor, we get a
    use-after-free access.
    
    The fix is simple: Clear dev->hs_config if the passed-in data does not
    contain a high-speed config descriptor.
    
    Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
    Reported-by: Andrey Konovalov <andreyknvl@google.com>
    Tested-by: Andrey Konovalov <andreyknvl@google.com>
    CC: <stable@vger.kernel.org>
    Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>

diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c
index 01ed3bc0c3c8..f1ca33942607 100644
--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -1800,6 +1800,8 @@ dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
 			goto fail;
 		kbuf += total;
 		length -= total;
+	} else {
+		dev->hs_config = NULL;
 	}
 
 	/* could support multiple configs, using another encoding! */
]

158/2 2026/08/07 05:46 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 49212
							output: 25
							thoughts: 49
						

Thoughts:
Okay, here's my take on those thoughts, framed as an expert's internal monologue:

**Investigating a Subtle State Bug**

Alright, this looks like *another* one of those gnarly bugs that pops up around stale state when things go sideways. We’re talking about error paths, which always seem to be fertile ground for this kind of thing. Let's dig in and see what's happening.

My gut tells me this is related to how we handle state transitions when an error occurs, probably in a corner case. I'm going to have to check this out - specifically the commit `87bed3d7d26c usb: gadget: Fix memleak in gadgetfs_fill_super`. It seems like the best place to start. Let's see if this has a familiar ring to it... I'm hoping I can trace this back to the root cause of my specific issue, this could be a good find.



159/2 2026/08/07 05:46 tool git-show
0m Args:
map[Commit:87bed3d7d26c]

Results:
map[Output:commit 87bed3d7d26c974948a3d6e7176f304b2d41272b
Author: Zhang Qilong <zhangqilong3@huawei.com>
Date:   Tue Nov 17 10:16:29 2020 +0800

    usb: gadget: Fix memleak in gadgetfs_fill_super
    
    usb_get_gadget_udc_name will alloc memory for CHIP
    in "Enomem" branch. we should free it before error
    returns to prevent memleak.
    
    Fixes: 175f712119c57 ("usb: gadget: provide interface for legacy gadgets to get UDC name")
    Reported-by: Hulk Robot <hulkci@huawei.com>
    Acked-by: Alan Stern <stern@rowland.harvard.edu>
    Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
    Link: https://lore.kernel.org/r/20201117021629.1470544-3-zhangqilong3@huawei.com
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c
index 1b430b36d0a6..71e7d10dd76b 100644
--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -2039,6 +2039,9 @@ gadgetfs_fill_super (struct super_block *sb, struct fs_context *fc)
 	return 0;
 
 Enomem:
+	kfree(CHIP);
+	CHIP = NULL;
+
 	return -ENOMEM;
 }
 
]

160/2 2026/08/07 05:46 llm history-explorer
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 50018
							output: 940
							thoughts: 443
						

Thoughts:
**Analyzing the Bug and Formulating a Solution**

Okay, here we go again. This looks like yet another error path bug, and it's in the same file as the last one I looked at. Fortunately, I have enough information to get to the bottom of this and provide a solid answer.

Here's what I'm seeing: the root of the problem is a classic error path issue. A full teardown function, `gadgetfs_unbind`, is being called even when the object hasn't been completely initialized. This leads to a refcount underflow because the teardown function assumes the object is in a fully initialized state and that a reference was properly taken.

I've seen similar bugs fixed in the USB gadget subsystem recently. For example, in `f_acm`, `f_ecm`, `f_ncm`, and `f_rndis` (those commits are good references!), the `bind` functions were using a single error label to clean up everything, including resources like `notify_req`, which might not have been initialized at the point of the error, causing null pointer dereferences. The fix was to refactor the error handling. They either used the `__free()` automatic cleanup mechanism, or they manually cleaned up only the specific parts that were actually altered.

Another example that comes to mind is the `62783c30d78a` commit, which fixed a memory leak in `f_hid`. The key there was restructuring the error handling to use cleanup labels that freed resources in the reverse order of allocation, instead of relying on a single catch-all.

So, the general pattern I see here is to avoid using the full unbind/teardown function in the bind/init error path unless the object is completely initialized. The error path needs to focus on manually cleaning up only the resources that were successfully allocated or initialized up to the point where the error happened. This is best achieved using `goto` labels for reverse-order cleanup, or adopting the new `__free()` mechanism for local variables. In that case, you only assign them to the main structure when everything is fully successful.

I'll craft a clear response based on these findings.



161/1 2026/08/07 05:46 action kernel-scratch-checkouter
0m Results:
map[KernelScratchSrc:/app/workdir/cache/tmp/tmp4208508807]

162/1 2026/08/07 05:46 loop
21m
163/2 2026/08/07 05:46 iteration 0
21m
164/3 2026/08/07 05:46 agent patch-generator
1m Model:
best-expensive

Instruction:
You are an experienced Linux kernel developer tasked with creating a fix for a kernel bug.
You will be given a crash report, an initial explanation of the root cause done by another
kernel expert, and a summary of how similar bugs were fixed in the past.

Use the codeeditor tool to do code edits.
Note: you will not see your changes when looking at the code using codesearch tools.
Use the patch-diff tool to review the modifications you applied.

Your final reply should contain explanation of what you did in the patch and why
(details not present in the initial explanation of the bug).

Your fix must not just prevent the given crash, but also be the best fix for the underlying
root cause from the software engineering point of view. There can be several ways to fix the
same bug. Consider alternatives, and pick the best one. For example, additional checks may be
added at different locations/functions, it's usually better to place them earlier in the
execution to avoid multiple checks at various locations later.

Frequently the same coding mistake is done in several locations in the source code.
Check if your fix should be extended/applied to similar cases around to fix other similar bugs.
But don't go too wide, don't try to fix problems kernel-wide, fix similar issues
in the same file only.


If you are changing post-conditions of a function, consider all callers of the functions,
and if they need to be updated to handle new post-conditions. For example, if you make
a function that previously never returned a NULL, return NULL, consider if callers
need to be updated to handle NULL return value.



Prefer calling several tools at the same time to save round-trips.

Prompt:
The crash that corresponds to the bug is:

udc dummy_udc.0: failed to start USB Gadget filesystem: -12
gadgetfs gadget.0: probe with driver gadgetfs failed with error -12
gadgetfs: bound to dummy_udc driver
==================================================================
BUG: KASAN: slab-use-after-free in instrument_atomic_read_write include/linux/instrumented.h:112 [inline]
BUG: KASAN: slab-use-after-free in atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:400 [inline]
BUG: KASAN: slab-use-after-free in __refcount_sub_and_test include/linux/refcount.h:389 [inline]
BUG: KASAN: slab-use-after-free in __refcount_dec_and_test include/linux/refcount.h:432 [inline]
BUG: KASAN: slab-use-after-free in refcount_dec_and_test include/linux/refcount.h:450 [inline]
BUG: KASAN: slab-use-after-free in put_dev drivers/usb/gadget/legacy/inode.c:165 [inline]
BUG: KASAN: slab-use-after-free in gadgetfs_kill_sb+0x46/0x110 drivers/usb/gadget/legacy/inode.c:2104
Write of size 4 at addr ffff88811638c080 by task syz-executor169/5848

CPU: 0 UID: 0 PID: 5848 Comm: syz-executor169 Not tainted syzkaller #1 PREEMPT_{RT,(full)} 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 print_address_description+0x55/0x1e0 mm/kasan/report.c:378
 print_report+0x58/0x70 mm/kasan/report.c:482
 kasan_report+0x117/0x150 mm/kasan/report.c:595
 check_region_inline mm/kasan/generic.c:-1 [inline]
 kasan_check_range+0x264/0x2c0 mm/kasan/generic.c:200
 instrument_atomic_read_write include/linux/instrumented.h:112 [inline]
 atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:400 [inline]
 __refcount_sub_and_test include/linux/refcount.h:389 [inline]
 __refcount_dec_and_test include/linux/refcount.h:432 [inline]
 refcount_dec_and_test include/linux/refcount.h:450 [inline]
 put_dev drivers/usb/gadget/legacy/inode.c:165 [inline]
 gadgetfs_kill_sb+0x46/0x110 drivers/usb/gadget/legacy/inode.c:2104
 deactivate_locked_super+0xbc/0x130 fs/super.c:477
 cleanup_mnt+0x3d3/0x460 fs/namespace.c:1317
 task_work_run+0x1d9/0x270 kernel/task_work.c:233
 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
 __exit_to_user_mode_loop kernel/entry/common.c:70 [inline]
 exit_to_user_mode_loop+0x1fa/0x730 kernel/entry/common.c:101
 __exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline]
 syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:230 [inline]
 syscall_exit_to_user_mode include/linux/entry-common.h:318 [inline]
 do_syscall_64+0x353/0x580 arch/x86/entry/syscall_64.c:100
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f5f0e505027
Code: a2 c7 05 54 b0 08 00 00 00 00 00 eb 96 e8 a1 08 00 00 90 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 c7 c2 d8 ff ff ff f7 d8 64 89 02 b8
RSP: 002b:00007ffcdf2b0288 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6
RAX: 0000000000000000 RBX: 0000000000000003 RCX: 00007f5f0e505027
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00007f5f0e55f05e
RBP: 00007f5f0e55f05e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f5f0e55f623
R13: 00007ffcdf2b03e0 R14: 00007f5f0e561510 R15: 00007f5f0e5614e8
 </TASK>

Allocated by task 5848:
 kasan_save_stack mm/kasan/common.c:57 [inline]
 kasan_save_track+0x3e/0x80 mm/kasan/common.c:78
 poison_kmalloc_redzone mm/kasan/common.c:398 [inline]
 __kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:415
 kasan_kmalloc include/linux/kasan.h:263 [inline]
 __kmalloc_cache_noprof+0x3d2/0x6b0 mm/slub.c:5489
 _kmalloc_noprof include/linux/slab.h:988 [inline]
 _kzalloc_noprof include/linux/slab.h:1309 [inline]
 dev_new drivers/usb/gadget/legacy/inode.c:176 [inline]
 gadgetfs_fill_super+0x27b/0x7a0 drivers/usb/gadget/legacy/inode.c:2054
 vfs_get_super fs/super.c:1273 [inline]
 get_tree_single+0xc0/0x150 fs/super.c:1300
 vfs_get_tree+0x92/0x2a0 fs/super.c:1700
 fc_mount fs/namespace.c:1198 [inline]
 do_new_mount_fc fs/namespace.c:3765 [inline]
 do_new_mount+0x319/0xdc0 fs/namespace.c:3841
 do_mount fs/namespace.c:4174 [inline]
 __do_sys_mount fs/namespace.c:4390 [inline]
 __se_sys_mount+0x31d/0x420 fs/namespace.c:4367
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Freed by task 5848:
 kasan_save_stack mm/kasan/common.c:57 [inline]
 kasan_save_track+0x3e/0x80 mm/kasan/common.c:78
 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:584
 poison_slab_object mm/kasan/common.c:253 [inline]
 __kasan_slab_free+0x5c/0x80 mm/kasan/common.c:285
 kasan_slab_free include/linux/kasan.h:235 [inline]
 slab_free_hook mm/slub.c:2677 [inline]
 slab_free mm/slub.c:6377 [inline]
 kfree+0x1c5/0x6c0 mm/slub.c:6692
 put_dev drivers/usb/gadget/legacy/inode.c:169 [inline]
 dev_release+0x173/0x210 drivers/usb/gadget/legacy/inode.c:1215
 __fput+0x42a/0xa80 fs/file_table.c:512
 fput_close_sync+0x11f/0x240 fs/file_table.c:617
 __do_sys_close fs/open.c:1511 [inline]
 __se_sys_close fs/open.c:1496 [inline]
 __x64_sys_close+0x7e/0x110 fs/open.c:1496
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

The buggy address belongs to the object at ffff88811638c000
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 128 bytes inside of
 freed 1024-byte region [ffff88811638c000, ffff88811638c400)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff88811638d000 pfn:0x116388
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0x100000000000240(workingset|head|node=0|zone=2)
page_type: f5(slab)
raw: 0100000000000240 ffff888100041dc0 ffffea00044a8a10 ffffea00043da810
raw: ffff88811638d000 000000080010000f 00000000f5000000 0000000000000000
head: 0100000000000240 ffff888100041dc0 ffffea00044a8a10 ffffea00043da810
head: ffff88811638d000 000000080010000f 00000000f5000000 0000000000000000
head: 0100000000000003 fffffffffffffe01 00000000ffffffff 00000000ffffffff
head: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000008
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5581, tgid 5581 (syz-executor), ts 49160475111, free_ts 0
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x1f9/0x250 mm/page_alloc.c:1859
 prep_new_page mm/page_alloc.c:1867 [inline]
 get_page_from_freelist+0x262a/0x26a0 mm/page_alloc.c:3946
 __alloc_frozen_pages_noprof+0x18d/0x380 mm/page_alloc.c:5304
 alloc_slab_page mm/slub.c:3266 [inline]
 allocate_slab+0x79/0x5e0 mm/slub.c:3380
 new_slab mm/slub.c:3426 [inline]
 refill_objects+0x2d8/0x350 mm/slub.c:7310
 refill_sheaf mm/slub.c:2804 [inline]
 __pcs_replace_empty_main+0x330/0x690 mm/slub.c:4675
 alloc_from_pcs mm/slub.c:4773 [inline]
 slab_alloc_node mm/slub.c:4905 [inline]
 __kmalloc_cache_noprof+0x468/0x6b0 mm/slub.c:5485
 _kmalloc_noprof include/linux/slab.h:988 [inline]
 _kzalloc_noprof include/linux/slab.h:1309 [inline]
 rxrpc_service_prealloc+0x9f/0x130 net/rxrpc/call_accept.c:167
 rxrpc_listen+0x1b7/0x360 net/rxrpc/af_rxrpc.c:237
 afs_open_socket+0x2fa/0x3f0 fs/afs/rxrpc.c:107
 afs_net_init+0x6ce/0x8f0 fs/afs/main.c:116
 ops_init+0x35d/0x5d0 net/core/net_namespace.c:137
 setup_net+0x118/0x350 net/core/net_namespace.c:446
 copy_net_ns+0x4f9/0x720 net/core/net_namespace.c:579
 create_new_namespaces+0x3f0/0x6b0 kernel/nsproxy.c:132
 unshare_nsproxy_namespaces+0x149/0x190 kernel/nsproxy.c:234
page_owner free stack trace missing

Memory state around the buggy address:
 ffff88811638bf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88811638c000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88811638c080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff88811638c100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88811638c180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


The explanation of the root cause of the bug is:

The root cause of this KASAN slab-use-after-free is a reference count underflow in the error handling path of `gadgetfs_bind()`. 

When fault injection forces a memory allocation failure during the binding process, `gadgetfs_bind()` incorrectly calls `gadgetfs_unbind()`, which drops a reference to the device (`dev`) that was never actually taken.

### Detailed Sequence of Events

1. **Initialization and Open:**
   When the gadgetfs superblock is created, `dev_new()` allocates the `dev_data` structure (`dev`) and initializes its refcount to 1. When the user opens the `/tmp/gadgetfs/ep0` file, `gadget_dev_open()` is called, which increments the refcount to 2 via `get_dev(dev)`.

2. **Driver Registration and Binding:**
   The user writes configuration data to `ep0`, invoking `dev_config()`. This function calls `usb_gadget_register_driver(&gadgetfs_driver)`, which registers the driver and attempts to bind it to the UDC, eventually calling `gadgetfs_bind()`.

3. **Fault Injection and Refcount Underflow:**
   In `gadgetfs_bind()`, memory allocations are performed (e.g., `usb_ep_alloc_request()` or inside `activate_ep_files()`). If fault injection causes one of these to fail, the code jumps to the `enomem` label:
   ```c
   // drivers/usb/gadget/legacy/inode.c : gadgetfs_bind()
   
   	dev->req = usb_ep_alloc_request (gadget->ep0, GFP_KERNEL);
   	if (!dev->req)
   		goto enomem;
   ...
   	if (activate_ep_files (dev) < 0)
   		goto enomem;
   ...
   	get_dev (dev); // <--- Reference is only taken on SUCCESS
   	return 0;
   
   enomem:
   	gadgetfs_unbind (gadget);
   	return -ENOMEM;
   ```
   The `enomem` path calls `gadgetfs_unbind()`, which performs cleanup and unconditionally calls `put_dev(dev)`. Because `get_dev(dev)` is only called at the very end of `gadgetfs_bind()` on success, `gadgetfs_unbind()` drops a reference that was never acquired. The refcount incorrectly drops from 2 to 1.

4. **Probe Failure Ignored:**
   The `-ENOMEM` error propagates up to the driver core. However, `__driver_attach()` intentionally ignores probe failures and returns `0`. Because `gadgetfs_driver` does not set `match_existing_only = true`, `usb_gadget_register_driver_owner()` also returns `0` (success).

5. **Closing ep0 and Freeing:**
   Seeing a success return value, `dev_config()` sets `dev->gadget_registered = true`. 
   Later, the reproducer closes the `ep0` file descriptor, triggering `dev_release()`. `dev_release()` cleans up and calls `put_dev(dev)`. The refcount drops from 1 to 0, and `dev` is prematurely freed.

6. **The Use-After-Free:**
   Finally, the reproducer unmounts the filesystem, which invokes `gadgetfs_kill_sb()`. 
   ```c
   // drivers/usb/gadget/legacy/inode.c : gadgetfs_kill_sb()
   
   	if (the_device) {
   		put_dev (the_device); // <--- UAF here
   		the_device = NULL;
   	}
   ```
   `gadgetfs_kill_sb()` attempts to drop the initial reference by calling `put_dev(the_device)`. Since `the_device` points to the `dev` structure that was already freed in step 5, this triggers the KASAN slab-use-after-free.

### Suggested Fix

`gadgetfs_bind()` should not call `gadgetfs_unbind()` in its error path, as `gadgetfs_unbind()` is designed to tear down a fully bound gadget (and thus expects the extra reference to exist). Instead, `gadgetfs_bind()` should manually clean up the specific state it altered before the failure occurred.

```c
 enomem:
-	gadgetfs_unbind (gadget);
+	if (dev->req) {
+		usb_ep_free_request (gadget->ep0, dev->req);
+		dev->req = NULL;
+	}
+	gadget->ep0->driver_data = NULL;
+	set_gadget_data (gadget, NULL);
+	dev->gadget = NULL;
 	return -ENOMEM;
```
*(Note: `activate_ep_files()` already perfectly cleans up after itself on failure, so no additional teardown is needed for it in `gadgetfs_bind()`'s error path).*


Historical context on how similar bugs were fixed in the past:

Based on a review of recent commits in the USB gadget subsystem, this type of bug—where an error path incorrectly calls a full teardown function (like `unbind`) on a partially initialized object—is a known and recurring pattern. 

When a full teardown function is called during a failed initialization, it often assumes that all resources, locks, and reference counts were successfully acquired. If they were not, it leads to issues like the refcount underflow and subsequent use-after-free seen in this bug, or NULL pointer dereferences and double-frees.

### Prior Art and Similar Fixes

Recent history in the `drivers/usb/gadget/` tree shows several commits addressing the exact same class of error-path bugs:

1. **Refactoring to avoid unified teardown on error:**
   In late 2025, a series of commits fixed similar issues across multiple gadget functions where a failed `bind` would jump to a unified error label that freed stale or uninitialized pointers (e.g., `notify_req`), causing NULL pointer dereferences.
   - `47b2116e54b4 usb: gadget: f_acm: Refactor bind path to use __free()`
   - `42988380ac67 usb: gadget: f_ecm: Refactor bind path to use __free()`
   - `75a5b8d4ddd4 usb: gadget: f_ncm: Refactor bind path to use __free()`
   - `082289414360 usb: gadget: f_rndis: Refactor bind path to use __free()`
   
   **The fix strategy:** Instead of relying on a catch-all error label that cleans up struct members, the developers refactored the code to use the `__free()` automatic cleanup mechanism for local variables, only assigning them to the main structure upon complete success.

2. **Manual reverse-order cleanup:**
   Another recent example is `62783c30d78a USB: gadget: f_hid: Fix memory leak in hidg_bind error path`. In this commit, the error handling was restructured to use proper `goto` cleanup labels (`fail_free_all`, `fail_free_descs`, `fail`). 
   
   **The fix strategy:** The commit ensured that allocated resources were properly freed manually in the exact reverse order of their allocation, rather than relying on a single cleanup path that might miss things or free things incorrectly.

3. **Stale state in `gadgetfs` itself:**
   Historically, `drivers/usb/gadget/legacy/inode.c` has suffered from similar stale state issues on error paths. For example, in `add333a81a16 USB: gadgetfs: fix use-after-free bug`, an error path in `dev_config()` failed to clear a pointer (`dev->hs_config`), which was later dereferenced on a subsequent call, causing a use-after-free.

### Idioms and Patterns to Follow for the Fix

Based on how these similar bugs were addressed, the following idioms and rules should be followed when writing the fix for `gadgetfs_bind()`:

1. **Do not call `unbind()` from `bind()`'s error path:** 
   Functions like `gadgetfs_unbind()` are designed to tear down a *fully bound and initialized* gadget. They expect invariants (like the extra `get_dev()` reference) to be true. Calling them on a partially initialized object violates these invariants.
   
2. **Manual, localized cleanup:**
   The error path in `gadgetfs_bind()` should manually undo *only* the specific state it successfully altered before the failure occurred. As suggested in your bug explanation, freeing the `dev->req` (if allocated) and clearing the pointers (`gadget->ep0->driver_data`, `dev->gadget`, etc.) is the correct historical pattern for this subsystem.

3. **Reverse order of initialization:**
   If multiple allocations or state changes occur, the error path should clean them up in the exact reverse order of how they were set up, typically using cascading `goto` labels (though in `gadgetfs_bind()`, a single `enomem` label with localized `if` checks is sufficient since the setup is relatively short).




Reply:
I have applied a fix to resolve the KASAN slab-use-after-free bug in `gadgetfs_kill_sb()`.

### Cause of the Bug
The root cause is a reference count underflow in the error handling path of `gadgetfs_bind()`. When `gadgetfs_bind()` encounters an error (e.g., memory allocation failure during `usb_ep_alloc_request()` or `activate_ep_files()`), it jumps to the `enomem` label and calls `gadgetfs_unbind()`. 

However, `gadgetfs_unbind()` is designed to tear down a fully initialized and bound gadget. It unconditionally drops a device reference by calling `put_dev(dev)`. Since `gadgetfs_bind()` only acquires this reference (`get_dev(dev)`) at the very end of the function upon complete success, calling `gadgetfs_unbind()` in the error path drops a reference that was never taken. This leads to a premature free of the `dev` structure when the `ep0` file is closed, and subsequently a use-after-free when the filesystem is unmounted and `gadgetfs_kill_sb()` tries to drop the initial reference.

### The Fix
To fix this, we must stop calling the full teardown function `gadgetfs_unbind()` from the `gadgetfs_bind()` error path. Instead, we should manually and locally clean up only the specific state that was successfully altered before the failure occurred.

I replaced the call to `gadgetfs_unbind(gadget)` in the `enomem` label with localized cleanup:
1. Freeing `dev->req` if it was allocated, and setting it to `NULL`.
2. Clearing the pointers that were set earlier in the function (`gadget->ep0->driver_data`, `dev->gadget`, and `set_gadget_data(gadget, NULL)`).

Note that if `activate_ep_files()` fails, it already perfectly cleans up after itself by calling `destroy_ep_files()`, so no additional teardown is needed for it in `gadgetfs_bind()`'s error path.

This aligns with the historical pattern in the USB gadget subsystem of avoiding unified teardown functions on error paths in favor of manual, reverse-order cleanup of partially initialized objects.

165/4 2026/08/07 05:46 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 10703
							output: 31
							thoughts: 336
						

Thoughts:
**Analyzing a KASAN Slab-Use-After-Free Vulnerability in gadgetfs**

Okay, so I've been digging into this KASAN slab-use-after-free issue, and it looks like the problem is stemming from `gadgetfs_kill_sb` ultimately calling `put_dev`. I can see that the root cause lies in an integer underflow in the reference counting within the `gadgetfs_bind` error path. The code jumps to the `enomem` label when `gadgetfs_bind` fails, say, due to a memory allocation error. From there, it calls `gadgetfs_unbind(gadget)`.

Here's the kicker: `gadgetfs_unbind` unconditionally calls `put_dev(dev)`. However, there's a crucial detail – `get_dev(dev)` is *only* called at the very end of `gadgetfs_bind`, when everything goes according to plan. That means `gadgetfs_unbind` is dropping a reference to the `dev` structure that was never actually acquired in the first place, leading to that underflow.

The proposed fix makes total sense. Instead of a blanket call to `gadgetfs_unbind(gadget)` in the `enomem` path, we should perform manual cleanup directly. By doing so, we prevent calling `put_dev` when it shouldn't be. Specifically, this manual cleanup focuses on freeing the USB endpoint request, nullifying driver data, and setting gadget/device pointers to null, ensuring there's no dangling reference. This seems like a much cleaner solution than the original `gadgetfs_unbind` call in the error path.
I'll now head to `drivers/usb/gadget/legacy/inode.c` to take a closer look at the actual code and make sure this fix is properly implemented.



166/4 2026/08/07 05:46 tool codesearch-file-index
0m Args:
map[SourceFile:drivers/usb/gadget/legacy/inode.c]

Results:
map[Entities:[map[Kind:function Name:__check_default_gid] map[Kind:function Name:__check_default_perm] map[Kind:function Name:__check_default_uid] map[Kind:function Name:activate_ep_files] map[Kind:function Name:clean_req] map[Kind:function Name:config_buf] map[Kind:function Name:destroy_ep_files] map[Kind:function Name:dev_config] map[Kind:function Name:dev_new] map[Kind:function Name:dev_release] map[Kind:function Name:ep0_complete] map[Kind:function Name:ep0_fasync] map[Kind:function Name:ep0_poll] map[Kind:function Name:ep0_read] map[Kind:function Name:ep0_readable] map[Kind:function Name:ep0_write] map[Kind:function Name:ep_aio] map[Kind:function Name:ep_aio_cancel] map[Kind:function Name:ep_aio_complete] map[Kind:function Name:ep_config] map[Kind:function Name:ep_io] map[Kind:function Name:ep_ioctl] map[Kind:function Name:ep_open] map[Kind:function Name:ep_read_iter] map[Kind:function Name:ep_release] map[Kind:function Name:ep_user_copy_worker] map[Kind:function Name:ep_write_iter] map[Kind:function Name:epio_complete] map[Kind:function Name:gadget_dev_ioctl] map[Kind:function Name:gadget_dev_open] map[Kind:function Name:gadgetfs_bind] map[Kind:function Name:gadgetfs_cleanup] map[Kind:function Name:gadgetfs_create_file] map[Kind:function Name:gadgetfs_disconnect] map[Kind:function Name:gadgetfs_fill_super] map[Kind:function Name:gadgetfs_get_tree] map[Kind:function Name:gadgetfs_init] map[Kind:function Name:gadgetfs_init_fs_context] map[Kind:function Name:gadgetfs_kill_sb] map[Kind:function Name:gadgetfs_make_inode] map[Kind:function Name:gadgetfs_setup] map[Kind:function Name:gadgetfs_suspend] map[Kind:function Name:gadgetfs_unbind] map[Kind:function Name:get_dev] map[Kind:function Name:get_ep] map[Kind:function Name:get_ready_ep] map[Kind:function Name:is_valid_config] map[Kind:function Name:make_qualifier] map[Kind:function Name:next_event] map[Kind:function Name:put_dev] map[Kind:function Name:put_ep] map[Kind:function Name:setup_req] map[Kind:struct Name:dev_data] map[Kind:struct Name:ep_data] map[Kind:struct Name:kiocb_priv] map[Kind:global_variable Name:__UNIQUE_ID_addressable_gadgetfs_init_1067] map[Kind:global_variable Name:__UNIQUE_ID_modinfo_1026] map[Kind:global_variable Name:__UNIQUE_ID_modinfo_1027] map[Kind:global_variable Name:__UNIQUE_ID_modinfo_1028] map[Kind:global_variable Name:__UNIQUE_ID_modinfo_1029] map[Kind:global_variable Name:__UNIQUE_ID_modinfo_1062] map[Kind:global_variable Name:__UNIQUE_ID_modinfo_1063] map[Kind:global_variable Name:__UNIQUE_ID_modinfo_1064] map[Kind:global_variable Name:__UNIQUE_ID_modinfo_1065] map[Kind:global_variable Name:__exitcall_gadgetfs_cleanup] map[Kind:global_variable Name:__param_default_gid] map[Kind:global_variable Name:__param_default_perm] map[Kind:global_variable Name:__param_default_uid] map[Kind:global_variable Name:__param_str_default_gid] map[Kind:global_variable Name:__param_str_default_perm] map[Kind:global_variable Name:__param_str_default_uid] map[Kind:global_variable Name:default_perm] map[Kind:global_variable Name:driver_desc] map[Kind:global_variable Name:ep0_operations] map[Kind:global_variable Name:ep_io_operations] map[Kind:global_variable Name:gadget_fs_operations] map[Kind:global_variable Name:gadgetfs_context_ops] map[Kind:global_variable Name:gadgetfs_driver] map[Kind:global_variable Name:gadgetfs_type] map[Kind:global_variable Name:sb_mutex] map[Kind:global_variable Name:shortname] map[Kind:enum Name:ep0_state] map[Kind:enum Name:ep_state]]]

167/4 2026/08/07 05:46 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 12914
							output: 41
							thoughts: 19
						

Thoughts:
Okay, let's dive into these functions. Here's what I'm thinking as I look at `gadgetfs_bind` and `gadgetfs_unbind`:

**Analyzing GadgetFS Bind and Unbind Operations**

Right, let's break down `gadgetfs_bind`. My immediate expectation is that this function is where the core connection between the USB gadget and the filesystem is established. I'd imagine it handles the initial setup, associating the filesystem's operations with the USB gadget's communication structures. It probably involves some interaction with the gadget driver, maybe setting up endpoints or registering some callbacks. I'm keen to see how the filesystem's inode operations are linked to the gadget's requests – that's where the magic has to happen. It'll also likely need to handle any setup specific to the filesystem itself, creating internal structures or allocating resources. I bet it has error handling in there somewhere to deal with things like resource exhaustion or if the gadget isn't properly initialized.

Now, shifting gears to `gadgetfs_unbind`. This will undoubtedly be the cleanup routine. My guess is it reverses everything `gadgetfs_bind` did. It's got to gracefully tear down the connection, free any allocated resources, unregister callbacks, and potentially inform the gadget driver that the filesystem is going away. I'm expecting a careful process to avoid dangling pointers or memory leaks. The crucial thing will be ensuring that all outstanding operations are properly handled – aborting any in-flight transactions or waiting for them to complete gracefully. It's likely this function will need to synchronize its operations to avoid race conditions during the shutdown process. I am keen to see how they handle any lingering data transfers or open files.



168/4 2026/08/07 05:46 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c Name:gadgetfs_bind]

Results:
map[SourceCode:1668:	static int gadgetfs_bind(struct usb_gadget *gadget,
1669:			struct usb_gadget_driver *driver)
1670:	{
1671:		struct dev_data		*dev = the_device;
1672:	
1673:		if (!dev)
1674:			return -ESRCH;
1675:		if (0 != strcmp (CHIP, gadget->name)) {
1676:			pr_err("%s expected %s controller not %s\n",
1677:				shortname, CHIP, gadget->name);
1678:			return -ENODEV;
1679:		}
1680:	
1681:		set_gadget_data (gadget, dev);
1682:		dev->gadget = gadget;
1683:		gadget->ep0->driver_data = dev;
1684:	
1685:		/* preallocate control response and buffer */
1686:		dev->req = usb_ep_alloc_request (gadget->ep0, GFP_KERNEL);
1687:		if (!dev->req)
1688:			goto enomem;
1689:		dev->req->context = NULL;
1690:		dev->req->complete = epio_complete;
1691:	
1692:		if (activate_ep_files (dev) < 0)
1693:			goto enomem;
1694:	
1695:		INFO (dev, "bound to %s driver\n", gadget->name);
1696:		spin_lock_irq(&dev->lock);
1697:		dev->state = STATE_DEV_UNCONNECTED;
1698:		spin_unlock_irq(&dev->lock);
1699:		get_dev (dev);
1700:		return 0;
1701:	
1702:	enomem:
1703:		gadgetfs_unbind (gadget);
1704:		return -ENOMEM;
1705:	}
 SourceFile:drivers/usb/gadget/legacy/inode.c]

169/4 2026/08/07 05:46 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 13922
							output: 41
							thoughts: 11
						

Thoughts:
Okay, let's dive into this. Here's my take on `gadgetfs_unbind`, as if these are my immediate thoughts:

**Analyzing the `gadgetfs_unbind` Function**

Alright, `gadgetfs_unbind`. Time to unpack this one. My initial instinct is to go straight to the code and see how it handles the unbinding process. I'm already anticipating the typical challenges: resource cleanup, error handling, and making sure everything is neatly undone to prevent any lingering issues. I want to see how it interacts with the underlying USB gadget framework. Specifically, I'm looking for where it detaches the device from the filesystem, and how it handles potential race conditions with other operations. I'm wondering if it uses any locking mechanisms to ensure the integrity of the data structures. I'll need to pay close attention to the order of operations, especially if it involves releasing resources or signaling other threads. The devil is in the details with these unbind functions. I'm expecting this to be a crucial point in the device's lifecycle.



170/4 2026/08/07 05:47 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c Name:gadgetfs_unbind]

Results:
map[SourceCode:1639:	static void
1640:	gadgetfs_unbind (struct usb_gadget *gadget)
1641:	{
1642:		struct dev_data		*dev = get_gadget_data (gadget);
1643:	
1644:		DBG (dev, "%s\n", __func__);
1645:	
1646:		spin_lock_irq (&dev->lock);
1647:		dev->state = STATE_DEV_UNBOUND;
1648:		while (dev->udc_usage > 0) {
1649:			spin_unlock_irq(&dev->lock);
1650:			usleep_range(1000, 2000);
1651:			spin_lock_irq(&dev->lock);
1652:		}
1653:		spin_unlock_irq (&dev->lock);
1654:	
1655:		destroy_ep_files (dev);
1656:		gadget->ep0->driver_data = NULL;
1657:		set_gadget_data (gadget, NULL);
1658:	
1659:		/* we've already been disconnected ... no i/o is active */
1660:		if (dev->req)
1661:			usb_ep_free_request (gadget->ep0, dev->req);
1662:		DBG (dev, "%s done\n", __func__);
1663:		put_dev (dev);
1664:	}
 SourceFile:drivers/usb/gadget/legacy/inode.c]

171/4 2026/08/07 05:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 14638
							output: 41
							thoughts: 78
						

Thoughts:
Here's my analysis of the situation:

**Investigating a Reference Counting Issue in GadgetFS**

Okay, so I'm looking at this `gadgetfs` code, and it seems there's a potential reference counting problem lurking in the `gadgetfs_unbind` function. My initial concern stems from the fact that it's calling `put_dev(dev)` directly. This is raising a red flag because it appears to be dropping a reference to the `dev` struct that wasn't properly acquired during the error handling path of `gadgetfs_bind`. That's a classic recipe for a double free or use-after-free scenario, and those are bugs I *really* want to avoid.

Furthermore, `gadgetfs_unbind` is also responsible for calling `destroy_ep_files(dev)`. That's got me thinking I need to carefully compare the behaviours of `activate_ep_files` and `destroy_ep_files` functions, to see if there's any inconsistencies in how they relate to the `dev` structure's lifecycle. I need to trace the references to that `dev` pointer throughout these functions to fully understand the issue. I'll need to examine how each function is related to the reference count of the device in the context of binding and unbinding. This is clearly a critical area that needs deeper scrutiny.



172/4 2026/08/07 05:47 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c Name:activate_ep_files]

Results:
map[SourceCode:1593:	static int activate_ep_files (struct dev_data *dev)
1594:	{
1595:		struct usb_ep	*ep;
1596:		struct ep_data	*data;
1597:		int err;
1598:	
1599:		gadget_for_each_ep (ep, dev->gadget) {
1600:	
1601:			data = kzalloc_obj(*data);
1602:			if (!data)
1603:				goto enomem0;
1604:			data->state = STATE_EP_DISABLED;
1605:			mutex_init(&data->lock);
1606:			init_waitqueue_head (&data->wait);
1607:	
1608:			strscpy(data->name, ep->name);
1609:			refcount_set (&data->count, 1);
1610:			data->dev = dev;
1611:			get_dev (dev);
1612:	
1613:			data->ep = ep;
1614:			ep->driver_data = data;
1615:	
1616:			data->req = usb_ep_alloc_request (ep, GFP_KERNEL);
1617:			if (!data->req)
1618:				goto enomem1;
1619:	
1620:			err = gadgetfs_create_file (dev->sb, data->name,
1621:					data, &ep_io_operations);
1622:			if (err)
1623:				goto enomem2;
1624:			list_add_tail (&data->epfiles, &dev->epfiles);
1625:		}
1626:		return 0;
1627:	
1628:	enomem2:
1629:		usb_ep_free_request (ep, data->req);
1630:	enomem1:
1631:		put_dev (dev);
1632:		kfree (data);
1633:	enomem0:
1634:		DBG (dev, "%s enomem\n", __func__);
1635:		destroy_ep_files (dev);
1636:		return -ENOMEM;
1637:	}
 SourceFile:drivers/usb/gadget/legacy/inode.c]

173/4 2026/08/07 05:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 15705
							output: 41
							thoughts: 93
						

Thoughts:
Okay, let's break this down.

**Ensuring Cleanliness and Memory Safety**

Right, so `activate_ep_files` is designed pretty robustly. If it runs into trouble, like a memory allocation issue and returns `-ENOMEM`, it knows to call `destroy_ep_files(dev)` to clean up after itself. That means that if the operation fails, `dev->epfiles` will be empty. That's good - we don't want any lingering, partially allocated resources.

Now, if `gadgetfs_bind` is the culprit and fails, it should just free up the `dev->req` and clear those associated pointers. We've got to make sure all that is in place, we will take another look at the code responsible.



174/4 2026/08/07 05:47 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c Name:gadgetfs_bind]

Results:
map[SourceCode:1668:	static int gadgetfs_bind(struct usb_gadget *gadget,
1669:			struct usb_gadget_driver *driver)
1670:	{
1671:		struct dev_data		*dev = the_device;
1672:	
1673:		if (!dev)
1674:			return -ESRCH;
1675:		if (0 != strcmp (CHIP, gadget->name)) {
1676:			pr_err("%s expected %s controller not %s\n",
1677:				shortname, CHIP, gadget->name);
1678:			return -ENODEV;
1679:		}
1680:	
1681:		set_gadget_data (gadget, dev);
1682:		dev->gadget = gadget;
1683:		gadget->ep0->driver_data = dev;
1684:	
1685:		/* preallocate control response and buffer */
1686:		dev->req = usb_ep_alloc_request (gadget->ep0, GFP_KERNEL);
1687:		if (!dev->req)
1688:			goto enomem;
1689:		dev->req->context = NULL;
1690:		dev->req->complete = epio_complete;
1691:	
1692:		if (activate_ep_files (dev) < 0)
1693:			goto enomem;
1694:	
1695:		INFO (dev, "bound to %s driver\n", gadget->name);
1696:		spin_lock_irq(&dev->lock);
1697:		dev->state = STATE_DEV_UNCONNECTED;
1698:		spin_unlock_irq(&dev->lock);
1699:		get_dev (dev);
1700:		return 0;
1701:	
1702:	enomem:
1703:		gadgetfs_unbind (gadget);
1704:		return -ENOMEM;
1705:	}
 SourceFile:drivers/usb/gadget/legacy/inode.c]

175/4 2026/08/07 05:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 16591
							output: 41
							thoughts: 169
						

Thoughts:
**Analyzing Potential Redundancy in USB Gadget Cleanup**

Okay, so I'm looking at some USB gadget code and I've spotted a potential inefficiency, or perhaps even a subtle bug. My thought process is centered around the interaction between `activate_ep_files`, `gadgetfs_unbind`, and `destroy_ep_files`. Here's what's going through my head:

If `activate_ep_files` fails, there's a cleanup routine that takes care of `dev->epfiles`. Fine, that seems standard. However, the `gadgetfs_unbind` function also calls `destroy_ep_files(dev)`. This triggers a red flag: Could we be doing redundant cleanup?

If we were to replace the call to `gadgetfs_unbind(gadget)` with a more manual cleanup approach (which might be necessary for some reason), we'd need to ensure we cover all the necessary steps, and avoid double-frees or other memory issues. I believe I've got this sketched out, and it would look like this:

```c
enomem:
	if (dev->req) {
		usb_ep_free_request (gadget->ep0, dev->req);
		dev->req = NULL;
	}
	gadget->ep0->driver_data = NULL;
	dev->gadget = NULL;
	set_gadget_data (gadget, NULL);
	return -ENOMEM;
```

Essentially, we need to handle the `req` (request) field, clear the driver data, null the gadget and dev, and return ENOMEM. Now, the next step is crucial – to verify that my assumptions are correct, I need to meticulously inspect the `destroy_ep_files` function. I'm going to dig into the source code to confirm the overlap and see if my manual approach is a viable alternative. This should help me identify any unexpected behaviors I should be aware of.



176/4 2026/08/07 05:47 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c Name:destroy_ep_files]

Results:
map[SourceCode:1554:	static void destroy_ep_files (struct dev_data *dev)
1555:	{
1556:		DBG (dev, "%s %d\n", __func__, dev->state);
1557:	
1558:		/* dev->state must prevent interference */
1559:		spin_lock_irq (&dev->lock);
1560:		while (!list_empty(&dev->epfiles)) {
1561:			struct ep_data	*ep;
1562:	
1563:			/* break link to FS */
1564:			ep = list_first_entry (&dev->epfiles, struct ep_data, epfiles);
1565:			list_del_init (&ep->epfiles);
1566:			spin_unlock_irq (&dev->lock);
1567:	
1568:			/* break link to controller */
1569:			mutex_lock(&ep->lock);
1570:			if (ep->state == STATE_EP_ENABLED)
1571:				(void) usb_ep_disable (ep->ep);
1572:			ep->state = STATE_EP_UNBOUND;
1573:			usb_ep_free_request (ep->ep, ep->req);
1574:			ep->ep = NULL;
1575:			mutex_unlock(&ep->lock);
1576:	
1577:			wake_up (&ep->wait);
1578:	
1579:			/* break link to dcache */
1580:			simple_remove_by_name(dev->sb->s_root, ep->name, NULL);
1581:	
1582:			put_ep (ep);
1583:	
1584:			spin_lock_irq (&dev->lock);
1585:		}
1586:		spin_unlock_irq (&dev->lock);
1587:	}
 SourceFile:drivers/usb/gadget/legacy/inode.c]

177/4 2026/08/07 05:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 17768
							output: 155
							thoughts: 62
						

Thoughts:
**Understanding the Ephemeral File Cleanup**

Okay, so I'm looking at this cleanup process for the ephemeral files associated with a device (`dev->epfiles`), and I've got to make sure I understand the logic. It looks like `activate_ep_files` is responsible for setting up those files, but crucially, it's also responsible for cleaning them up if it encounters any kind of error during that setup.

This means that if `activate_ep_files` fails, or if it simply hasn't been called yet, `destroy_ep_files` will be handed an empty list to deal with. This makes sense; we don't want `destroy_ep_files` trying to free memory that doesn't exist or is corrupted. It handles the cleanup on its own, so we need to ensure this works.

Alright, with this understanding, I think I've got a solid grasp of how it should behave. Let's get this code edit done.



178/4 2026/08/07 05:47 tool codeeditor
0m Args:
map[CurrentCode:enomem:
	gadgetfs_unbind (gadget);
	return -ENOMEM;
} NewCode:enomem:
	if (dev->req) {
		usb_ep_free_request (gadget->ep0, dev->req);
		dev->req = NULL;
	}
	gadget->ep0->driver_data = NULL;
	dev->gadget = NULL;
	set_gadget_data (gadget, NULL);
	return -ENOMEM;
} SourceFile:drivers/usb/gadget/legacy/inode.c]

Results:
map[]

179/4 2026/08/07 05:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 18199
							output: 27
							thoughts: 8
						

Thoughts:
Okay, let's dive into this. Here's my thought process as I approach the provided task, assuming I'm an expert in my field and presented as a fulsome summary:

**Initial Assessment: Navigating the Patch Diff**

Right, so we've got a patch diff to review. My immediate instinct is to get a handle on the scope of the changes. I'm already mentally forming questions: *What's the overall context? Is this a bug fix, a feature addition, a refactor, or something else entirely? What modules or areas of the codebase are impacted? What's the potential risk profile associated with these changes, considering our current architectural state and known vulnerabilities?*

My first step is to quickly scan the diff itself, probably starting with the file headers and then the most substantial hunks. I'm looking for a "lay of the land" view, noting any files that jump out at me as particularly critical or potentially problematic based on my prior knowledge of the system. I will look for patterns, as my mind is forming the big picture. Are there recurring changes? Are there changes touching core components? Are there areas I'm unfamiliar with?

Next, I need to evaluate the details. I will quickly compare with the current version and think about why each change was made and if the changes make sense. I'll need to assess the technical merit of each change. Does the logic hold? Are there obvious edge cases overlooked? Are there potential performance bottlenecks introduced? Does the code adhere to our established coding style and best practices? I need to analyze for any security vulnerabilities.

I'll be paying close attention to any changes in interfaces or data structures, as these have the potential to ripple throughout the codebase. The goal is to perform a sanity check to make sure the core design remains consistent with what's expected and intended.

Ultimately, I'm aiming for a comprehensive assessment, identifying both potential positives and negatives of the patch. I need to be ready to articulate my findings clearly, and support them with solid reasoning. This will allow for more focused discussions with the development team and other stakeholders.



180/4 2026/08/07 05:47 tool patch-diff
0m Args:
map[File:drivers/usb/gadget/legacy/inode.c]

Results:
map[Output:diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c
index d87a8ab51..1a05819c0 100644
--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -1668,46 +1668,52 @@ static struct dev_data		*the_device;
 static int gadgetfs_bind(struct usb_gadget *gadget,
 		struct usb_gadget_driver *driver)
 {
 	struct dev_data		*dev = the_device;
 
 	if (!dev)
 		return -ESRCH;
 	if (0 != strcmp (CHIP, gadget->name)) {
 		pr_err("%s expected %s controller not %s\n",
 			shortname, CHIP, gadget->name);
 		return -ENODEV;
 	}
 
 	set_gadget_data (gadget, dev);
 	dev->gadget = gadget;
 	gadget->ep0->driver_data = dev;
 
 	/* preallocate control response and buffer */
 	dev->req = usb_ep_alloc_request (gadget->ep0, GFP_KERNEL);
 	if (!dev->req)
 		goto enomem;
 	dev->req->context = NULL;
 	dev->req->complete = epio_complete;
 
 	if (activate_ep_files (dev) < 0)
 		goto enomem;
 
 	INFO (dev, "bound to %s driver\n", gadget->name);
 	spin_lock_irq(&dev->lock);
 	dev->state = STATE_DEV_UNCONNECTED;
 	spin_unlock_irq(&dev->lock);
 	get_dev (dev);
 	return 0;
 
 enomem:
-	gadgetfs_unbind (gadget);
+	if (dev->req) {
+		usb_ep_free_request (gadget->ep0, dev->req);
+		dev->req = NULL;
+	}
+	gadget->ep0->driver_data = NULL;
+	dev->gadget = NULL;
+	set_gadget_data (gadget, NULL);
 	return -ENOMEM;
 }
 
 static void
 gadgetfs_disconnect (struct usb_gadget *gadget)
 {
 	struct dev_data		*dev = get_gadget_data (gadget);
 	unsigned long		flags;
 
 	spin_lock_irqsave (&dev->lock, flags);
]

181/4 2026/08/07 05:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 19347
							output: 54
							thoughts: 44
						

Thoughts:
Okay, here's my take on those thoughts, tailored for an expert audience:

**Analyzing the GadgetFS Cleanup Implementation**

Alright, that code review looks promising. This proposed fix, specifically replacing `gadgetfs_unbind` with the manual cleanup, seems spot-on in addressing that lingering issue. The logic appears to be sound, accurately addressing the problematic unbinding.

However, I'm not going to just sign off on this blindly. We need to be absolutely certain we haven't just patched a symptom and not the root cause, or, worse, missed other instances of that kind of error. Time to expand the search. I want to delve deeper now and scan the entire codebase – or at least, the relevant sections of it – for any *other* calls to `gadgetfs_unbind`. A comprehensive audit is critical here. It's imperative that we identify any other potential misuses of that function throughout the driver to ensure the system's overall stability and prevent future regressions. We should also investigate whether a higher-level refactoring may be appropriate if those extra calls exist.



182/4 2026/08/07 05:47 tool codesearch-find-references
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c IncludeSnippetLines:2 Name:gadgetfs_unbind SourceTreePrefix:]

Results:
map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:gadgetfs_bind SourceFile:drivers/usb/gadget/legacy/inode.c SourceLine:1703 SourceSnippet:1701:	
1702:	enomem:
1703:		gadgetfs_unbind (gadget);
1704:		return -ENOMEM;
1705:	}
] map[ReferenceKind:takes-address-of ReferencingEntityKind:global_variable ReferencingEntityName:gadgetfs_driver SourceFile:drivers/usb/gadget/legacy/inode.c SourceLine:1749 SourceSnippet:1747:		.function	= (char *) driver_desc,
1748:		.bind		= gadgetfs_bind,
1749:		.unbind		= gadgetfs_unbind,
1750:		.setup		= gadgetfs_setup,
1751:		.reset		= gadgetfs_disconnect,
]] TruncatedOutput:false]

183/4 2026/08/07 05:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 19958
							output: 52
							thoughts: 49
						

Thoughts:
Okay, here's my interpretation of those thoughts, framed as my own:

**Investigating `put_dev` Calls in `gadgetfs`**

Right, let me think this through. `gadgetfs_unbind` is *exclusively* called as the `.unbind` callback, or during an error path within `gadgetfs_bind`, which makes sense. I have to wonder though, is there *any* other place within the codebase where a `put_dev` call is made unconditionally, particularly within an error handling sequence? I need to be sure I'm not missing a potential resource leak or an unexpected release scenario. I have to think about other error paths in the module. I can't just assume these are the only ones, I need to do a broader search for any unexpected calls to `put_dev`.



184/4 2026/08/07 05:47 tool codesearch-find-references
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c IncludeSnippetLines:2 Name:put_dev SourceTreePrefix:]

Results:
map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:activate_ep_files SourceFile:drivers/usb/gadget/legacy/inode.c SourceLine:1631 SourceSnippet:1629:		usb_ep_free_request (ep, data->req);
1630:	enomem1:
1631:		put_dev (dev);
1632:		kfree (data);
1633:	enomem0:
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:dev_release SourceFile:drivers/usb/gadget/legacy/inode.c SourceLine:1215 SourceSnippet:1213:		spin_unlock_irq(&dev->lock);
1214:	
1215:		put_dev (dev);
1216:		return 0;
1217:	}
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:gadgetfs_fill_super SourceFile:drivers/usb/gadget/legacy/inode.c SourceLine:2061 SourceSnippet:2059:		rc = gadgetfs_create_file(sb, CHIP, dev, &ep0_operations);
2060:		if (rc) {
2061:			put_dev(dev);
2062:			goto Enomem;
2063:		}
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:gadgetfs_kill_sb SourceFile:drivers/usb/gadget/legacy/inode.c SourceLine:2104 SourceSnippet:2102:		kill_anon_super (sb);
2103:		if (the_device) {
2104:			put_dev (the_device);
2105:			the_device = NULL;
2106:		}
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:gadgetfs_unbind SourceFile:drivers/usb/gadget/legacy/inode.c SourceLine:1663 SourceSnippet:1661:			usb_ep_free_request (gadget->ep0, dev->req);
1662:		DBG (dev, "%s done\n", __func__);
1663:		put_dev (dev);
1664:	}
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:put_ep SourceFile:drivers/usb/gadget/legacy/inode.c SourceLine:221 SourceSnippet: 219:		if (likely (!refcount_dec_and_test (&data->count)))
 220:			return;
 221:		put_dev (data->dev);
 222:		/* needs no more cleanup */
 223:		BUG_ON (!list_empty (&data->epfiles));
]] TruncatedOutput:false]

185/4 2026/08/07 05:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 21033
							output: 41
							thoughts: 11
						

Thoughts:
Okay, here's my attempt at summarizing that thought process, keeping in mind I'm speaking to a fellow expert:

**Checking `activate_ep_files`**

Alright, time to dig in. The immediate need here is to examine `activate_ep_files`. I know this function/script/module (depending on the context) is crucial. It’s likely the entry point, or at least a key component, in initializing the environment or data setup related to those "ep files". My experience tells me that without knowing what this does, I'm flying blind. I need to understand its functionality, dependencies, and any side effects it might have. My intuition is telling me that this is a critical step to ensure that I have all the proper files in place. I'm going to start by reading the documentation/comments, or if that's insufficient, dive into the code itself.



186/4 2026/08/07 05:47 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c Name:activate_ep_files]

Results:
map[SourceCode:1593:	static int activate_ep_files (struct dev_data *dev)
1594:	{
1595:		struct usb_ep	*ep;
1596:		struct ep_data	*data;
1597:		int err;
1598:	
1599:		gadget_for_each_ep (ep, dev->gadget) {
1600:	
1601:			data = kzalloc_obj(*data);
1602:			if (!data)
1603:				goto enomem0;
1604:			data->state = STATE_EP_DISABLED;
1605:			mutex_init(&data->lock);
1606:			init_waitqueue_head (&data->wait);
1607:	
1608:			strscpy(data->name, ep->name);
1609:			refcount_set (&data->count, 1);
1610:			data->dev = dev;
1611:			get_dev (dev);
1612:	
1613:			data->ep = ep;
1614:			ep->driver_data = data;
1615:	
1616:			data->req = usb_ep_alloc_request (ep, GFP_KERNEL);
1617:			if (!data->req)
1618:				goto enomem1;
1619:	
1620:			err = gadgetfs_create_file (dev->sb, data->name,
1621:					data, &ep_io_operations);
1622:			if (err)
1623:				goto enomem2;
1624:			list_add_tail (&data->epfiles, &dev->epfiles);
1625:		}
1626:		return 0;
1627:	
1628:	enomem2:
1629:		usb_ep_free_request (ep, data->req);
1630:	enomem1:
1631:		put_dev (dev);
1632:		kfree (data);
1633:	enomem0:
1634:		DBG (dev, "%s enomem\n", __func__);
1635:		destroy_ep_files (dev);
1636:		return -ENOMEM;
1637:	}
 SourceFile:drivers/usb/gadget/legacy/inode.c]

187/4 2026/08/07 05:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 21931
							output: 43
							thoughts: 274
						

Thoughts:
**Analyzing the USB Endpoint File Activation Flow**

Okay, let's break down this `activate_ep_files` function. Line 1611, it's calling `get_dev(dev)`. That's the crucial first step to bump the device's reference count. Then, looking at the error handling, if `usb_ep_alloc_request` fails, we jump to `enomem1`, which immediately calls `put_dev(dev)`. That's right, because we *did* just call `get_dev(dev)` earlier for this endpoint. Perfect.

Now, if `gadgetfs_create_file` throws an error, we hit `enomem2`, free the request, and then we *fall through* to `enomem1`, which again calls `put_dev(dev)`. Makes sense. We have to release that initial `get_dev()` call. Still good. Then we fall to `enomem0`, which leads to `destroy_ep_files(dev)`.

Inside `destroy_ep_files(dev)`, the function iterates through `dev->epfiles` and for each endpoint `ep`, it calls `put_ep(ep)`. That's where it all comes together. `put_ep(ep)` will decrement `data->count`. And when that count drops to zero, *then* it calls `put_dev(data->dev)`. Bingo! This is correct because `get_dev(dev)` was called for each `ep` added to `dev->epfiles`. So, the entire cleanup process is linked to the initial reference increase, so nothing will be leaked.

So, yeah, after going over this, it looks like `activate_ep_files` is handling the reference counts correctly, it is well-designed. I'm satisfied. Now, let's switch gears and take a look at `gadgetfs_fill_super`.



188/4 2026/08/07 05:47 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c Name:gadgetfs_fill_super]

Results:
map[SourceCode:2014:	static int
2015:	gadgetfs_fill_super (struct super_block *sb, struct fs_context *fc)
2016:	{
2017:		struct inode	*inode;
2018:		struct dev_data	*dev;
2019:		int		rc;
2020:	
2021:		mutex_lock(&sb_mutex);
2022:	
2023:		if (the_device) {
2024:			rc = -ESRCH;
2025:			goto Done;
2026:		}
2027:	
2028:		CHIP = usb_get_gadget_udc_name();
2029:		if (!CHIP) {
2030:			rc = -ENODEV;
2031:			goto Done;
2032:		}
2033:	
2034:		/* superblock */
2035:		sb->s_blocksize = PAGE_SIZE;
2036:		sb->s_blocksize_bits = PAGE_SHIFT;
2037:		sb->s_magic = GADGETFS_MAGIC;
2038:		sb->s_op = &gadget_fs_operations;
2039:		sb->s_time_gran = 1;
2040:	
2041:		/* root inode */
2042:		inode = gadgetfs_make_inode (sb,
2043:				NULL, &simple_dir_operations,
2044:				S_IFDIR | S_IRUGO | S_IXUGO);
2045:		if (!inode)
2046:			goto Enomem;
2047:		inode->i_op = &simple_dir_inode_operations;
2048:		if (!(sb->s_root = d_make_root (inode)))
2049:			goto Enomem;
2050:	
2051:		/* the ep0 file is named after the controller we expect;
2052:		 * user mode code can use it for sanity checks, like we do.
2053:		 */
2054:		dev = dev_new ();
2055:		if (!dev)
2056:			goto Enomem;
2057:	
2058:		dev->sb = sb;
2059:		rc = gadgetfs_create_file(sb, CHIP, dev, &ep0_operations);
2060:		if (rc) {
2061:			put_dev(dev);
2062:			goto Enomem;
2063:		}
2064:	
2065:		/* other endpoint files are available after hardware setup,
2066:		 * from binding to a controller.
2067:		 */
2068:		the_device = dev;
2069:		rc = 0;
2070:		goto Done;
2071:	
2072:	 Enomem:
2073:		kfree(CHIP);
2074:		CHIP = NULL;
2075:		rc = -ENOMEM;
2076:	
2077:	 Done:
2078:		mutex_unlock(&sb_mutex);
2079:		return rc;
2080:	}
 SourceFile:drivers/usb/gadget/legacy/inode.c]

189/4 2026/08/07 05:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 23577
							output: 43
							thoughts: 81
						

Thoughts:
Here's my take on the thought process, as if it were my own:

**Verifying Resource Management in GadgetFS**

Okay, let's break this down. In `gadgetfs_fill_super`, `dev_new()` is used. Right, that's the function that allocates the `dev` structure – a critical device representation – and crucially, it initializes its reference count to 1. That's standard and expected.

Now, the important part: if `gadgetfs_create_file` hits an error... well, it's designed to *fail*. When it does, it calls `put_dev(dev)`. That's *precisely* what we want! `put_dev()` decrements the reference count. Since it was initialized to 1, a decrement to 0 on failure means the device is freed properly. Excellent. That's the correct cleanup path. No lingering resources, no memory leaks.

Now, let me shift gears and review `gadgetfs_kill_sb`. We need to verify that there are no leaks there.



190/4 2026/08/07 05:47 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c Name:gadgetfs_kill_sb]

Results:
map[SourceCode:2098:	static void
2099:	gadgetfs_kill_sb (struct super_block *sb)
2100:	{
2101:		mutex_lock(&sb_mutex);
2102:		kill_anon_super (sb);
2103:		if (the_device) {
2104:			put_dev (the_device);
2105:			the_device = NULL;
2106:		}
2107:		kfree(CHIP);
2108:		CHIP = NULL;
2109:		mutex_unlock(&sb_mutex);
2110:	}
 SourceFile:drivers/usb/gadget/legacy/inode.c]

191/4 2026/08/07 05:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 24135
							output: 39
							thoughts: 45
						

Thoughts:
Okay, here's my take on those thoughts, framed as my own mental processing:

**GadgetFS Shutdown Sequence Analysis**

Alright, so `gadgetfs_kill_sb` is the right function for cleaning up the filesystem. It's calling `put_dev(the_device)` which should release the initial reference that `dev_new()` created. Yep, that's standard practice, makes sense. We're carefully releasing those resources, keeping the reference counting sane.

Now, I really need to confirm this is happening as expected. My next step should be to thoroughly examine `dev_release`. I'll want to see exactly what operations it's performing on that device structure. Is it properly freeing all associated resources, memory, and associated data. I'm especially interested in how it interacts with the lower level device drivers at this point. Gotta make sure we're not leaking anything or causing any unexpected side effects during this shutdown process. A deeper look at the release path is definitely warranted.



192/4 2026/08/07 05:47 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c Name:dev_release]

Results:
map[SourceCode:1190:	static int
1191:	dev_release (struct inode *inode, struct file *fd)
1192:	{
1193:		struct dev_data		*dev = fd->private_data;
1194:	
1195:		/* closing ep0 === shutdown all */
1196:	
1197:		if (dev->gadget_registered) {
1198:			usb_gadget_unregister_driver (&gadgetfs_driver);
1199:			dev->gadget_registered = false;
1200:		}
1201:	
1202:		/* at this point "good" hardware has disconnected the
1203:		 * device from USB; the host won't see it any more.
1204:		 * alternatively, all host requests will time out.
1205:		 */
1206:	
1207:		kfree (dev->buf);
1208:		dev->buf = NULL;
1209:	
1210:		/* other endpoints were all decoupled from this device */
1211:		spin_lock_irq(&dev->lock);
1212:		dev->state = STATE_DEV_DISABLED;
1213:		spin_unlock_irq(&dev->lock);
1214:	
1215:		put_dev (dev);
1216:		return 0;
1217:	}
 SourceFile:drivers/usb/gadget/legacy/inode.c]

193/4 2026/08/07 05:47 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 24839
							output: 42
							thoughts: 33
						

Thoughts:
Here's my understanding of the situation, tailored for my expert perspective:

**Interpreting the Device Release Sequence**

Okay, so I'm looking at this code and immediately keying in on a critical interaction: `dev_release` initiates a call to `put_dev(dev)`. That's the signal, the crucial point where the driver is relinquishing control, or at least its current hold on the device. Then, I remember how this fits into the broader picture of device lifecycle management, specifically within the `gadget_dev_open` context.  I can see that the `put_dev(dev)` called here mirrors a previous `get_dev(dev)` call within `gadget_dev_open`. That connection is what tells me that this is intended as a balanced sequence.



194/4 2026/08/07 05:47 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c Name:gadget_dev_open]

Results:
map[SourceCode:1913:	static int
1914:	gadget_dev_open (struct inode *inode, struct file *fd)
1915:	{
1916:		struct dev_data		*dev = inode->i_private;
1917:		int			value = -EBUSY;
1918:	
1919:		spin_lock_irq(&dev->lock);
1920:		if (dev->state == STATE_DEV_DISABLED) {
1921:			dev->ev_next = 0;
1922:			dev->state = STATE_DEV_OPENED;
1923:			fd->private_data = dev;
1924:			get_dev (dev);
1925:			value = 0;
1926:		}
1927:		spin_unlock_irq(&dev->lock);
1928:		return value;
1929:	}
 SourceFile:drivers/usb/gadget/legacy/inode.c]

195/4 2026/08/07 05:48 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 25360
							output: 27
							thoughts: 45
						

Thoughts:
Okay, here's my take on those thoughts, framed as my own mental processing:

**Analyzing the GadgetFS Bind Error**

Right, so `gadget_dev_open` directly calls `get_dev(dev)`. That's good to have confirmed; it's the expected behavior. This means the problem, the root cause of this particular issue we're seeing, *has* to be isolated within the error handling path of `gadgetfs_bind`. We're not seeing something unexpected in the device opening sequence itself.

Alright, let's step back and meticulously review that patch again, focusing specifically on how it handles errors in `gadgetfs_bind`. We need to be absolutely certain we haven't introduced any regressions or overlooked something in the cleanup or resource release sequences within that function. Time to dig in deep and be precise, as this is all that it could be.



196/4 2026/08/07 05:48 tool patch-diff
0m Args:
map[File:drivers/usb/gadget/legacy/inode.c]

Results:
map[Output:diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c
index d87a8ab51..1a05819c0 100644
--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -1668,46 +1668,52 @@ static struct dev_data		*the_device;
 static int gadgetfs_bind(struct usb_gadget *gadget,
 		struct usb_gadget_driver *driver)
 {
 	struct dev_data		*dev = the_device;
 
 	if (!dev)
 		return -ESRCH;
 	if (0 != strcmp (CHIP, gadget->name)) {
 		pr_err("%s expected %s controller not %s\n",
 			shortname, CHIP, gadget->name);
 		return -ENODEV;
 	}
 
 	set_gadget_data (gadget, dev);
 	dev->gadget = gadget;
 	gadget->ep0->driver_data = dev;
 
 	/* preallocate control response and buffer */
 	dev->req = usb_ep_alloc_request (gadget->ep0, GFP_KERNEL);
 	if (!dev->req)
 		goto enomem;
 	dev->req->context = NULL;
 	dev->req->complete = epio_complete;
 
 	if (activate_ep_files (dev) < 0)
 		goto enomem;
 
 	INFO (dev, "bound to %s driver\n", gadget->name);
 	spin_lock_irq(&dev->lock);
 	dev->state = STATE_DEV_UNCONNECTED;
 	spin_unlock_irq(&dev->lock);
 	get_dev (dev);
 	return 0;
 
 enomem:
-	gadgetfs_unbind (gadget);
+	if (dev->req) {
+		usb_ep_free_request (gadget->ep0, dev->req);
+		dev->req = NULL;
+	}
+	gadget->ep0->driver_data = NULL;
+	dev->gadget = NULL;
+	set_gadget_data (gadget, NULL);
 	return -ENOMEM;
 }
 
 static void
 gadgetfs_disconnect (struct usb_gadget *gadget)
 {
 	struct dev_data		*dev = get_gadget_data (gadget);
 	unsigned long		flags;
 
 	spin_lock_irqsave (&dev->lock, flags);
]

197/4 2026/08/07 05:48 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 26296
							output: 41
							thoughts: 30
						

Thoughts:
Here's my take on the thought process, as requested:

**Assessing the Patch and Potential Blind Spots**

Okay, the patch itself appears sound. Everything seems to be present and accounted for, based on my initial review. But I've learned enough in this game to know that surface-level correctness isn't always enough. My immediate instinct is to dig deeper. I need to make *absolutely* certain that we haven't missed any subtle implications or side effects. The key question now is: does `gadgetfs_unbind` do anything else, anything *under the hood*, that could be relevant to this change? I need to meticulously verify that we haven't inadvertently broken something or created a new vulnerability by focusing solely on what's immediately obvious. I need to leave no stone unturned.



198/4 2026/08/07 05:48 tool codesearch-definition-source
0m Args:
map[ContextFile:drivers/usb/gadget/legacy/inode.c Name:gadgetfs_unbind]

Results:
map[SourceCode:1639:	static void
1640:	gadgetfs_unbind (struct usb_gadget *gadget)
1641:	{
1642:		struct dev_data		*dev = get_gadget_data (gadget);
1643:	
1644:		DBG (dev, "%s\n", __func__);
1645:	
1646:		spin_lock_irq (&dev->lock);
1647:		dev->state = STATE_DEV_UNBOUND;
1648:		while (dev->udc_usage > 0) {
1649:			spin_unlock_irq(&dev->lock);
1650:			usleep_range(1000, 2000);
1651:			spin_lock_irq(&dev->lock);
1652:		}
1653:		spin_unlock_irq (&dev->lock);
1654:	
1655:		destroy_ep_files (dev);
1656:		gadget->ep0->driver_data = NULL;
1657:		set_gadget_data (gadget, NULL);
1658:	
1659:		/* we've already been disconnected ... no i/o is active */
1660:		if (dev->req)
1661:			usb_ep_free_request (gadget->ep0, dev->req);
1662:		DBG (dev, "%s done\n", __func__);
1663:		put_dev (dev);
1664:	}
 SourceFile:drivers/usb/gadget/legacy/inode.c]

199/4 2026/08/07 05:48 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 26977
							output: 15
							thoughts: 162
						

Thoughts:
**Analyzing the gadgetfs Bind/Unbind State Transitions**

Okay, let's break down this `gadgetfs` bind/unbind logic. My initial concern was about how the device state is handled. `gadgetfs_unbind` clearly sets `dev->state` to `STATE_DEV_UNBOUND`. That's straightforward enough. The potential issue, though, is in the `gadgetfs_bind` function.

I see that `dev->state` isn't updated *before* `activate_ep_files` in `gadgetfs_bind`. It only transitions to `STATE_DEV_UNCONNECTED` *after* a successful operation. This means that, in between `gadget_dev_open` and the success of a bind, `dev->state` is remaining at whatever initial value was set in `gadget_dev_open`, likely `STATE_DEV_OPENED`. This isn't necessarily a *problem* given the rest of the flow, but it's a detail worth noting for state tracking.

What really matters is the cleanup, especially on error paths. The `dev->udc_usage` counter isn't incremented in `gadgetfs_bind`, which confirms my assumption that it is managed elsewhere, but does this mean there is some un-accounted usage on failure?

Fortunately, it looks like `destroy_ep_files` is already covered by `activate_ep_files` in the failure path. The error path within `gadgetfs_bind` *does* perform manual cleanup. This reinforces my view that this approach is sufficient, as `activate_ep_files` handles all endpoint files cleanup that is necessary on failure.



200/4 2026/08/07 05:48 tool patch-diff
0m Args:
map[File:]

Results:
map[Output:diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c
index d87a8ab51..1a05819c0 100644
--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -1668,46 +1668,52 @@ static struct dev_data		*the_device;
 static int gadgetfs_bind(struct usb_gadget *gadget,
 		struct usb_gadget_driver *driver)
 {
 	struct dev_data		*dev = the_device;
 
 	if (!dev)
 		return -ESRCH;
 	if (0 != strcmp (CHIP, gadget->name)) {
 		pr_err("%s expected %s controller not %s\n",
 			shortname, CHIP, gadget->name);
 		return -ENODEV;
 	}
 
 	set_gadget_data (gadget, dev);
 	dev->gadget = gadget;
 	gadget->ep0->driver_data = dev;
 
 	/* preallocate control response and buffer */
 	dev->req = usb_ep_alloc_request (gadget->ep0, GFP_KERNEL);
 	if (!dev->req)
 		goto enomem;
 	dev->req->context = NULL;
 	dev->req->complete = epio_complete;
 
 	if (activate_ep_files (dev) < 0)
 		goto enomem;
 
 	INFO (dev, "bound to %s driver\n", gadget->name);
 	spin_lock_irq(&dev->lock);
 	dev->state = STATE_DEV_UNCONNECTED;
 	spin_unlock_irq(&dev->lock);
 	get_dev (dev);
 	return 0;
 
 enomem:
-	gadgetfs_unbind (gadget);
+	if (dev->req) {
+		usb_ep_free_request (gadget->ep0, dev->req);
+		dev->req = NULL;
+	}
+	gadget->ep0->driver_data = NULL;
+	dev->gadget = NULL;
+	set_gadget_data (gadget, NULL);
 	return -ENOMEM;
 }
 
 static void
 gadgetfs_disconnect (struct usb_gadget *gadget)
 {
 	struct dev_data		*dev = get_gadget_data (gadget);
 	unsigned long		flags;
 
 	spin_lock_irqsave (&dev->lock, flags);
]

201/4 2026/08/07 05:48 llm patch-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 28185
							output: 502
							thoughts: 14
						

Thoughts:
Here's a summary of my thinking process, rendered as requested:

**Patch Complete and Explanation Time**

Okay, the patch is finished, and the tests all pass. I've reviewed it thoroughly, and I'm confident in its correctness. Now, it's time to articulate exactly *why* this fix works and how it addresses the underlying problem. I need to be precise, clear, and ensure the explanation is easy to understand, even for someone who might not be as deeply familiar with this specific area of the codebase as I am. Time to structure my thoughts to make sure all important aspects are conveyed. I need to explain the problem concisely, describe my approach, detail the specific code changes, and then justify the choices made, including any trade-offs considered. The goal is to provide a complete and convincing narrative that leaves no room for confusion. Let's make this explanation rock-solid.



202/3 2026/08/07 05:48 action test-patch
19m Results:
map[PatchDiff:diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c
index d87a8ab51..1a05819c0 100644
--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -1700,7 +1700,13 @@ static int gadgetfs_bind(struct usb_gadget *gadget,
 	return 0;
 
 enomem:
-	gadgetfs_unbind (gadget);
+	if (dev->req) {
+		usb_ep_free_request (gadget->ep0, dev->req);
+		dev->req = NULL;
+	}
+	gadget->ep0->driver_data = NULL;
+	dev->gadget = NULL;
+	set_gadget_data (gadget, NULL);
 	return -ENOMEM;
 }
 
 TestError:]

203/1 2026/08/07 06:08 action apply-patch
0m Results:
map[]

204/1 2026/08/07 06:08 action init-style-items
0m Results:
map[StyleItems:<nil>]

205/1 2026/08/07 06:08 loop
4m
206/2 2026/08/07 06:08 iteration 0
4m
207/3 2026/08/07 06:08 agent patch-formatter
0m Model:
good-balanced

Instruction:
You are an expert Linux kernel developer tasked with formatting a kernel patch.
Your objective is purely formatting: you must ensure the patch complies with the kernel's coding style,
conforms to the surrounding code rules, and passes checkpatch.pl, while preserving the code logic exactly as it is.
You should stop once the requested formatting changes are done and checkpatch.pl is happy.
Do not question the requested changes unless they are obviously wrong.
If the code already conforms to the requested changes, surrounding code rules,
and checkpatch.pl is happy, you should just finish your task.

WARNING: The clang-format tool may break the formatting of the surrounding code (like manual alignment).
Use it with caution. We want to make the change fit into the existing formatting as much as possible.

Prefer calling several tools at the same time to save round-trips.

Prompt:
The current patch diff is:

diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c
index d87a8ab51..1a05819c0 100644
--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -1700,7 +1700,13 @@ static int gadgetfs_bind(struct usb_gadget *gadget,
 	return 0;
 
 enomem:
-	gadgetfs_unbind (gadget);
+	if (dev->req) {
+		usb_ep_free_request (gadget->ep0, dev->req);
+		dev->req = NULL;
+	}
+	gadget->ep0->driver_data = NULL;
+	dev->gadget = NULL;
+	set_gadget_data (gadget, NULL);
 	return -ENOMEM;
 }
 










Use the provided tools to format the patch.

Reply:
I have formatted the patch to comply with the Linux kernel's coding style and pass `checkpatch.pl` with zero errors and zero warnings, while preserving the exact logic of the changes.

Here is the formatted patch:

```diff
diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c
index d87a8ab51..365f9ab4d 100644
--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -1700,7 +1700,13 @@ static int gadgetfs_bind(struct usb_gadget *gadget,
 	return 0;
 
 enomem:
-	gadgetfs_unbind (gadget);
+	if (dev->req) {
+		usb_ep_free_request(gadget->ep0, dev->req);
+		dev->req = NULL;
+	}
+	gadget->ep0->driver_data = NULL;
+	dev->gadget = NULL;
+	set_gadget_data(gadget, NULL);
 	return -ENOMEM;
 }
```

208/4 2026/08/07 06:08 llm patch-formatter
0m Model:
gemini-3.5-flash

Tokens:
							input: 4557
							output: 41
							thoughts: 95
						

Thoughts:
**Kernel Patch Formatting - Initial Assessment**

Okay, so the user wants me to format a kernel patch. My first step is to get a solid grasp of what's happening. I need to dive into the patch diff itself and, importantly, the relevant file – `drivers/usb/gadget/legacy/inode.c`. That's where the heart of this seems to be. To truly understand the context of this patch, I'm going to read around line 1700 of `drivers/usb/gadget/legacy/inode.c`. Knowing the surrounding code is crucial for proper formatting and ensuring it aligns with existing style. I'll use `read-file` to get a good chunk of the code from there and get the context. Let's see what we are dealing with.



209/4 2026/08/07 06:08 tool read-file
0m Args:
map[File:drivers/usb/gadget/legacy/inode.c FirstLine:1680 LineCount:40]

Results:
map[Contents:1680:	
1681:		set_gadget_data (gadget, dev);
1682:		dev->gadget = gadget;
1683:		gadget->ep0->driver_data = dev;
1684:	
1685:		/* preallocate control response and buffer */
1686:		dev->req = usb_ep_alloc_request (gadget->ep0, GFP_KERNEL);
1687:		if (!dev->req)
1688:			goto enomem;
1689:		dev->req->context = NULL;
1690:		dev->req->complete = epio_complete;
1691:	
1692:		if (activate_ep_files (dev) < 0)
1693:			goto enomem;
1694:	
1695:		INFO (dev, "bound to %s driver\n", gadget->name);
1696:		spin_lock_irq(&dev->lock);
1697:		dev->state = STATE_DEV_UNCONNECTED;
1698:		spin_unlock_irq(&dev->lock);
1699:		get_dev (dev);
1700:		return 0;
1701:	
1702:	enomem:
1703:		gadgetfs_unbind (gadget);
1704:		return -ENOMEM;
1705:	}
1706:	
1707:	static void
1708:	gadgetfs_disconnect (struct usb_gadget *gadget)
1709:	{
1710:		struct dev_data		*dev = get_gadget_data (gadget);
1711:		unsigned long		flags;
1712:	
1713:		spin_lock_irqsave (&dev->lock, flags);
1714:		if (dev->state == STATE_DEV_UNCONNECTED)
1715:			goto exit;
1716:		dev->state = STATE_DEV_UNCONNECTED;
1717:	
1718:		INFO (dev, "disconnected\n");
1719:		next_event (dev, GADGETFS_DISCONNECT);
]

210/4 2026/08/07 06:08 llm patch-formatter
0m Model:
gemini-3.5-flash

Tokens:
							input: 5450
							output: 27
							thoughts: 58
						

Thoughts:
Okay, here's my summary, considering my expertise:

**Checking Patch Application and Formatting**

Alright, before I dive into any deeper analysis, my initial step is always to ensure the patch is cleanly applied and adheres to the project's coding standards. My immediate instinct is to run `checkpatch`. That'll give me a rapid assessment of any style violations, potential issues, and basic coding errors in the diff. However, I'm just reminded, I have to assume the patch is in the repo, so a quick `patch-diff` check is probably best. This will tell me definitively whether the changes are already incorporated. It’s a crucial first step; nothing wastes time like reviewing already-merged code or debugging a patch that hasn't even been integrated yet.



211/4 2026/08/07 06:08 tool patch-diff
0m Args:
map[File:drivers/usb/gadget/legacy/inode.c]

Results:
map[Output:diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c
index d87a8ab51..1a05819c0 100644
--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -1668,46 +1668,52 @@ static struct dev_data		*the_device;
 static int gadgetfs_bind(struct usb_gadget *gadget,
 		struct usb_gadget_driver *driver)
 {
 	struct dev_data		*dev = the_device;
 
 	if (!dev)
 		return -ESRCH;
 	if (0 != strcmp (CHIP, gadget->name)) {
 		pr_err("%s expected %s controller not %s\n",
 			shortname, CHIP, gadget->name);
 		return -ENODEV;
 	}
 
 	set_gadget_data (gadget, dev);
 	dev->gadget = gadget;
 	gadget->ep0->driver_data = dev;
 
 	/* preallocate control response and buffer */
 	dev->req = usb_ep_alloc_request (gadget->ep0, GFP_KERNEL);
 	if (!dev->req)
 		goto enomem;
 	dev->req->context = NULL;
 	dev->req->complete = epio_complete;
 
 	if (activate_ep_files (dev) < 0)
 		goto enomem;
 
 	INFO (dev, "bound to %s driver\n", gadget->name);
 	spin_lock_irq(&dev->lock);
 	dev->state = STATE_DEV_UNCONNECTED;
 	spin_unlock_irq(&dev->lock);
 	get_dev (dev);
 	return 0;
 
 enomem:
-	gadgetfs_unbind (gadget);
+	if (dev->req) {
+		usb_ep_free_request (gadget->ep0, dev->req);
+		dev->req = NULL;
+	}
+	gadget->ep0->driver_data = NULL;
+	dev->gadget = NULL;
+	set_gadget_data (gadget, NULL);
 	return -ENOMEM;
 }
 
 static void
 gadgetfs_disconnect (struct usb_gadget *gadget)
 {
 	struct dev_data		*dev = get_gadget_data (gadget);
 	unsigned long		flags;
 
 	spin_lock_irqsave (&dev->lock, flags);
]

212/4 2026/08/07 06:08 llm patch-formatter
0m Model:
gemini-3.5-flash

Tokens:
							input: 6370
							output: 9
							thoughts: 26
						

Thoughts:
Here's my attempt at summarizing the thought process, tailored for an expert audience:

**Quick Check: Patch Applied, Time for Style**

Alright, looks like that patch I was waiting on is already integrated. Good, good. Now, before I even *think* about diving into the functional aspects, I want to ensure we're adhering to our established coding style. Muscle memory takes over – time to run `checkpatch`. I'm hoping it's clean, of course, but experience tells me there's almost *always* something to tweak. Might be a subtle whitespace issue, perhaps an overly long line, or maybe something more substantial regarding commenting conventions. Either way, `checkpatch` is the first line of defense; ensures consistency and readability, which are paramount, and a baseline before diving into the core logic.



213/4 2026/08/07 06:08 tool checkpatch
0m Results:
map[Output:WARNING: space prohibited between function name and open parenthesis '('
#11: FILE: drivers/usb/gadget/legacy/inode.c:1704:
+		usb_ep_free_request (gadget->ep0, dev->req);

WARNING: space prohibited between function name and open parenthesis '('
#16: FILE: drivers/usb/gadget/legacy/inode.c:1709:
+	set_gadget_data (gadget, NULL);

total: 0 errors, 2 warnings, 14 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

Your patch has style problems, please review.

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.
]

214/4 2026/08/07 06:08 llm patch-formatter
0m Model:
gemini-3.5-flash

Tokens:
							input: 6789
							output: 217
							thoughts: 540
						

Thoughts:
**Analyzing and Correcting C Code Formatting**

Okay, let's break this down. First, I'm seeing warnings from `checkpatch.pl` regarding spaces before parentheses in these two lines: `usb_ep_free_request (gadget->ep0, dev->req);` and `set_gadget_data (gadget, NULL);`. My instinct is always to check the surrounding code for consistency, and the snippet provided shows a mix. We have lines like `set_gadget_data (gadget, dev);` and `usb_ep_alloc_request (gadget->ep0, GFP_KERNEL);` with spaces, as well as `strcmp (CHIP, gadget->name)` and `spin_lock_irqsave (&dev->lock, flags);` using the proper formatting.

However, the directive is clear. My objective is formatting and `checkpatch.pl` compliance, preserving the code's functionality, so I need to listen to the tool.

The objective is to make `checkpatch.pl` happy with the formatting. Given the rules I am working within, it seems the formatting for the functions `usb_ep_free_request` and `set_gadget_data` needs to change.

So I need to check the relevant block of code.
```c
	if (dev->req) {
		usb_ep_free_request(gadget->ep0, dev->req);
		dev->req = NULL;
	}
	gadget->ep0->driver_data = NULL;
	dev->gadget = NULL;
	set_gadget_data(gadget, NULL);
```

Checking this block, I see these two lines that need to be changed: `usb_ep_free_request(gadget->ep0, dev->req);` and `set_gadget_data(gadget, NULL);`. There are no other formatting issues. So, the fix is simple: remove the space before the open parenthesis for both function calls. That's it. Time to get this done.



215/4 2026/08/07 06:08 tool codeeditor
0m Args:
map[CurrentCode:enomem:
	if (dev->req) {
		usb_ep_free_request (gadget->ep0, dev->req);
		dev->req = NULL;
	}
	gadget->ep0->driver_data = NULL;
	dev->gadget = NULL;
	set_gadget_data (gadget, NULL);
	return -ENOMEM; NewCode:enomem:
	if (dev->req) {
		usb_ep_free_request(gadget->ep0, dev->req);
		dev->req = NULL;
	}
	gadget->ep0->driver_data = NULL;
	dev->gadget = NULL;
	set_gadget_data(gadget, NULL);
	return -ENOMEM; SourceFile:drivers/usb/gadget/legacy/inode.c]

Results:
map[]

216/4 2026/08/07 06:08 llm patch-formatter
0m Model:
gemini-3.5-flash

Tokens:
							input: 8001
							output: 9
							thoughts: 17
						

Thoughts:
Okay, here's my interpretation of those thoughts, crafted with an expert audience in mind:

**Rerunning the Patch Checker**

Alright, time to revisit this. I've been wrestling with this patch, making a few tweaks based on previous feedback. It's always a good practice to revisit the standard checking tool, so let's run `checkpatch` again. I want to make absolutely sure I've addressed all the style issues, coding conventions, and potential gotchas before I even consider submitting it for review. It's about being thorough and respecting the maintainers' time. Let's see if this iteration finally earns a clean bill of health. No point in wasting anyone's time with a submission that's going to be rejected for easily avoidable formatting issues. Hopefully this will be the last time I run it.



217/4 2026/08/07 06:08 tool checkpatch
0m Results:
map[Output:total: 0 errors, 0 warnings, 14 lines checked

Your patch has no obvious style problems and is ready for submission.
]

218/4 2026/08/07 06:08 llm patch-formatter
0m Model:
gemini-3.5-flash

Tokens:
							input: 8244
							output: 27
							thoughts: 38
						

Thoughts:
Okay, here's my take on those thoughts, summarizing them from a first-person perspective, assuming I'm an expert:

**Code Review - A Clean Bill of Health & Verification**

Alright, *finally*. `checkpatch` is giving me the green light – absolutely no errors or warnings. That's a good sign, a strong indication that the formatting and style are spot-on. However, I never fully trust an automated tool, not even this one which I have spent a lot of time reviewing. So, let's not get ahead of ourselves. I'm going to run a `patch-diff` on this now. I want to be 100% certain that the changes are clean, understandable at a glance, and reflect exactly what I intend. This extra step ensures that I haven't missed anything subtle, or introduced a hidden issue with my latest work, which sometimes even a seasoned expert such as myself has been known to do. Time to double-check those changes with another set of eyes – my own!



219/4 2026/08/07 06:08 tool patch-diff
0m Args:
map[File:drivers/usb/gadget/legacy/inode.c]

Results:
map[Output:diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c
index d87a8ab51..365f9ab4d 100644
--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -1668,46 +1668,52 @@ static struct dev_data		*the_device;
 static int gadgetfs_bind(struct usb_gadget *gadget,
 		struct usb_gadget_driver *driver)
 {
 	struct dev_data		*dev = the_device;
 
 	if (!dev)
 		return -ESRCH;
 	if (0 != strcmp (CHIP, gadget->name)) {
 		pr_err("%s expected %s controller not %s\n",
 			shortname, CHIP, gadget->name);
 		return -ENODEV;
 	}
 
 	set_gadget_data (gadget, dev);
 	dev->gadget = gadget;
 	gadget->ep0->driver_data = dev;
 
 	/* preallocate control response and buffer */
 	dev->req = usb_ep_alloc_request (gadget->ep0, GFP_KERNEL);
 	if (!dev->req)
 		goto enomem;
 	dev->req->context = NULL;
 	dev->req->complete = epio_complete;
 
 	if (activate_ep_files (dev) < 0)
 		goto enomem;
 
 	INFO (dev, "bound to %s driver\n", gadget->name);
 	spin_lock_irq(&dev->lock);
 	dev->state = STATE_DEV_UNCONNECTED;
 	spin_unlock_irq(&dev->lock);
 	get_dev (dev);
 	return 0;
 
 enomem:
-	gadgetfs_unbind (gadget);
+	if (dev->req) {
+		usb_ep_free_request(gadget->ep0, dev->req);
+		dev->req = NULL;
+	}
+	gadget->ep0->driver_data = NULL;
+	dev->gadget = NULL;
+	set_gadget_data(gadget, NULL);
 	return -ENOMEM;
 }
 
 static void
 gadgetfs_disconnect (struct usb_gadget *gadget)
 {
 	struct dev_data		*dev = get_gadget_data (gadget);
 	unsigned long		flags;
 
 	spin_lock_irqsave (&dev->lock, flags);
]

220/4 2026/08/07 06:08 llm patch-formatter
0m Model:
gemini-3.5-flash

Tokens:
							input: 9198
							output: 296
							thoughts: 39
						

Thoughts:
Okay, here's my summary, presented as my own internal thought process, assuming I'm an expert:

**Ready to Ship This Patch**

Alright, let's take a look. This diff is *pristine*. Whoever formatted this patch did an exceptional job. The formatting is spot on; it's clean, easy to read, and adheres perfectly to the style guidelines. The logic? It's all there, exactly as it should be. They haven't altered any functionality, just cleaned up the presentation, which is exactly what I needed. And let's see... *checkpatch.pl* is giving it a clean bill of health. No warnings, no errors, nothing. Perfect! I'm completely satisfied. This patch is ready for review. I'm ready to sign off on this and get it submitted. Time to wrap this up and present it.



221/3 2026/08/07 06:08 action test-patch-inplace
4m Results:
map[PatchDiff:diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c
index d87a8ab51..365f9ab4d 100644
--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -1700,7 +1700,13 @@ static int gadgetfs_bind(struct usb_gadget *gadget,
 	return 0;
 
 enomem:
-	gadgetfs_unbind (gadget);
+	if (dev->req) {
+		usb_ep_free_request(gadget->ep0, dev->req);
+		dev->req = NULL;
+	}
+	gadget->ep0->driver_data = NULL;
+	dev->gadget = NULL;
+	set_gadget_data(gadget, NULL);
 	return -ENOMEM;
 }
 
 TestError:]

222/3 2026/08/07 06:12 action run-checkpatch
0m Results:
map[CheckpatchOutput:total: 0 errors, 0 warnings, 14 lines checked

Your patch has no obvious style problems and is ready for submission.
 NeedRefinement:false]

223/1 2026/08/07 06:12 agent fixes-finder
12m Model:
best-expensive

Results:
map[FixesHash:1da177e4c3f41524e886b7f1b8a0c1fc7321cac2]

Instruction:
You are an experienced Linux kernel developer tasked with identifying the commit
that introduced the bug being fixed. Identifying the correct buggy commit is crucial
for proper kernel maintenance (backporting to stable trees, etc.).

Your investigation strategy:
1. Examine the patch that fixes the bug. Use git tools (like git-log or git-blame)
   to trace the history of the lines or functions modified by the patch.
2. Analyze the stack trace in the crash report. Identify the key files and functions
   involved in the crash and investigate their history to see when the problematic
   logic was introduced.
3. Compare the bug explanation with the commit history to find the point where
   the described logic error first appeared.

A bug is typically introduced when a piece of code is first written, or when
a refactoring changed its logic in a way that introduced the bug.
Trace the history of relevant symbols or find when specific code patterns were introduced/removed.

You must provide exactly one bug-introducing commit hash.
If you are unable to confidently determine the bug-introducing commit after investigation,
return an empty string rather than guessing.

Prefer calling several tools at the same time to save round-trips.


Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.

Prompt:
The crash is:

udc dummy_udc.0: failed to start USB Gadget filesystem: -12
gadgetfs gadget.0: probe with driver gadgetfs failed with error -12
gadgetfs: bound to dummy_udc driver
==================================================================
BUG: KASAN: slab-use-after-free in instrument_atomic_read_write include/linux/instrumented.h:112 [inline]
BUG: KASAN: slab-use-after-free in atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:400 [inline]
BUG: KASAN: slab-use-after-free in __refcount_sub_and_test include/linux/refcount.h:389 [inline]
BUG: KASAN: slab-use-after-free in __refcount_dec_and_test include/linux/refcount.h:432 [inline]
BUG: KASAN: slab-use-after-free in refcount_dec_and_test include/linux/refcount.h:450 [inline]
BUG: KASAN: slab-use-after-free in put_dev drivers/usb/gadget/legacy/inode.c:165 [inline]
BUG: KASAN: slab-use-after-free in gadgetfs_kill_sb+0x46/0x110 drivers/usb/gadget/legacy/inode.c:2104
Write of size 4 at addr ffff88811638c080 by task syz-executor169/5848

CPU: 0 UID: 0 PID: 5848 Comm: syz-executor169 Not tainted syzkaller #1 PREEMPT_{RT,(full)} 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 print_address_description+0x55/0x1e0 mm/kasan/report.c:378
 print_report+0x58/0x70 mm/kasan/report.c:482
 kasan_report+0x117/0x150 mm/kasan/report.c:595
 check_region_inline mm/kasan/generic.c:-1 [inline]
 kasan_check_range+0x264/0x2c0 mm/kasan/generic.c:200
 instrument_atomic_read_write include/linux/instrumented.h:112 [inline]
 atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:400 [inline]
 __refcount_sub_and_test include/linux/refcount.h:389 [inline]
 __refcount_dec_and_test include/linux/refcount.h:432 [inline]
 refcount_dec_and_test include/linux/refcount.h:450 [inline]
 put_dev drivers/usb/gadget/legacy/inode.c:165 [inline]
 gadgetfs_kill_sb+0x46/0x110 drivers/usb/gadget/legacy/inode.c:2104
 deactivate_locked_super+0xbc/0x130 fs/super.c:477
 cleanup_mnt+0x3d3/0x460 fs/namespace.c:1317
 task_work_run+0x1d9/0x270 kernel/task_work.c:233
 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
 __exit_to_user_mode_loop kernel/entry/common.c:70 [inline]
 exit_to_user_mode_loop+0x1fa/0x730 kernel/entry/common.c:101
 __exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline]
 syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:230 [inline]
 syscall_exit_to_user_mode include/linux/entry-common.h:318 [inline]
 do_syscall_64+0x353/0x580 arch/x86/entry/syscall_64.c:100
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f5f0e505027
Code: a2 c7 05 54 b0 08 00 00 00 00 00 eb 96 e8 a1 08 00 00 90 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 c7 c2 d8 ff ff ff f7 d8 64 89 02 b8
RSP: 002b:00007ffcdf2b0288 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6
RAX: 0000000000000000 RBX: 0000000000000003 RCX: 00007f5f0e505027
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00007f5f0e55f05e
RBP: 00007f5f0e55f05e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f5f0e55f623
R13: 00007ffcdf2b03e0 R14: 00007f5f0e561510 R15: 00007f5f0e5614e8
 </TASK>

Allocated by task 5848:
 kasan_save_stack mm/kasan/common.c:57 [inline]
 kasan_save_track+0x3e/0x80 mm/kasan/common.c:78
 poison_kmalloc_redzone mm/kasan/common.c:398 [inline]
 __kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:415
 kasan_kmalloc include/linux/kasan.h:263 [inline]
 __kmalloc_cache_noprof+0x3d2/0x6b0 mm/slub.c:5489
 _kmalloc_noprof include/linux/slab.h:988 [inline]
 _kzalloc_noprof include/linux/slab.h:1309 [inline]
 dev_new drivers/usb/gadget/legacy/inode.c:176 [inline]
 gadgetfs_fill_super+0x27b/0x7a0 drivers/usb/gadget/legacy/inode.c:2054
 vfs_get_super fs/super.c:1273 [inline]
 get_tree_single+0xc0/0x150 fs/super.c:1300
 vfs_get_tree+0x92/0x2a0 fs/super.c:1700
 fc_mount fs/namespace.c:1198 [inline]
 do_new_mount_fc fs/namespace.c:3765 [inline]
 do_new_mount+0x319/0xdc0 fs/namespace.c:3841
 do_mount fs/namespace.c:4174 [inline]
 __do_sys_mount fs/namespace.c:4390 [inline]
 __se_sys_mount+0x31d/0x420 fs/namespace.c:4367
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Freed by task 5848:
 kasan_save_stack mm/kasan/common.c:57 [inline]
 kasan_save_track+0x3e/0x80 mm/kasan/common.c:78
 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:584
 poison_slab_object mm/kasan/common.c:253 [inline]
 __kasan_slab_free+0x5c/0x80 mm/kasan/common.c:285
 kasan_slab_free include/linux/kasan.h:235 [inline]
 slab_free_hook mm/slub.c:2677 [inline]
 slab_free mm/slub.c:6377 [inline]
 kfree+0x1c5/0x6c0 mm/slub.c:6692
 put_dev drivers/usb/gadget/legacy/inode.c:169 [inline]
 dev_release+0x173/0x210 drivers/usb/gadget/legacy/inode.c:1215
 __fput+0x42a/0xa80 fs/file_table.c:512
 fput_close_sync+0x11f/0x240 fs/file_table.c:617
 __do_sys_close fs/open.c:1511 [inline]
 __se_sys_close fs/open.c:1496 [inline]
 __x64_sys_close+0x7e/0x110 fs/open.c:1496
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

The buggy address belongs to the object at ffff88811638c000
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 128 bytes inside of
 freed 1024-byte region [ffff88811638c000, ffff88811638c400)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff88811638d000 pfn:0x116388
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0x100000000000240(workingset|head|node=0|zone=2)
page_type: f5(slab)
raw: 0100000000000240 ffff888100041dc0 ffffea00044a8a10 ffffea00043da810
raw: ffff88811638d000 000000080010000f 00000000f5000000 0000000000000000
head: 0100000000000240 ffff888100041dc0 ffffea00044a8a10 ffffea00043da810
head: ffff88811638d000 000000080010000f 00000000f5000000 0000000000000000
head: 0100000000000003 fffffffffffffe01 00000000ffffffff 00000000ffffffff
head: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000008
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5581, tgid 5581 (syz-executor), ts 49160475111, free_ts 0
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x1f9/0x250 mm/page_alloc.c:1859
 prep_new_page mm/page_alloc.c:1867 [inline]
 get_page_from_freelist+0x262a/0x26a0 mm/page_alloc.c:3946
 __alloc_frozen_pages_noprof+0x18d/0x380 mm/page_alloc.c:5304
 alloc_slab_page mm/slub.c:3266 [inline]
 allocate_slab+0x79/0x5e0 mm/slub.c:3380
 new_slab mm/slub.c:3426 [inline]
 refill_objects+0x2d8/0x350 mm/slub.c:7310
 refill_sheaf mm/slub.c:2804 [inline]
 __pcs_replace_empty_main+0x330/0x690 mm/slub.c:4675
 alloc_from_pcs mm/slub.c:4773 [inline]
 slab_alloc_node mm/slub.c:4905 [inline]
 __kmalloc_cache_noprof+0x468/0x6b0 mm/slub.c:5485
 _kmalloc_noprof include/linux/slab.h:988 [inline]
 _kzalloc_noprof include/linux/slab.h:1309 [inline]
 rxrpc_service_prealloc+0x9f/0x130 net/rxrpc/call_accept.c:167
 rxrpc_listen+0x1b7/0x360 net/rxrpc/af_rxrpc.c:237
 afs_open_socket+0x2fa/0x3f0 fs/afs/rxrpc.c:107
 afs_net_init+0x6ce/0x8f0 fs/afs/main.c:116
 ops_init+0x35d/0x5d0 net/core/net_namespace.c:137
 setup_net+0x118/0x350 net/core/net_namespace.c:446
 copy_net_ns+0x4f9/0x720 net/core/net_namespace.c:579
 create_new_namespaces+0x3f0/0x6b0 kernel/nsproxy.c:132
 unshare_nsproxy_namespaces+0x149/0x190 kernel/nsproxy.c:234
page_owner free stack trace missing

Memory state around the buggy address:
 ffff88811638bf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88811638c000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88811638c080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff88811638c100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88811638c180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================



The explanation of the root cause is:

The root cause of this KASAN slab-use-after-free is a reference count underflow in the error handling path of `gadgetfs_bind()`. 

When fault injection forces a memory allocation failure during the binding process, `gadgetfs_bind()` incorrectly calls `gadgetfs_unbind()`, which drops a reference to the device (`dev`) that was never actually taken.

### Detailed Sequence of Events

1. **Initialization and Open:**
   When the gadgetfs superblock is created, `dev_new()` allocates the `dev_data` structure (`dev`) and initializes its refcount to 1. When the user opens the `/tmp/gadgetfs/ep0` file, `gadget_dev_open()` is called, which increments the refcount to 2 via `get_dev(dev)`.

2. **Driver Registration and Binding:**
   The user writes configuration data to `ep0`, invoking `dev_config()`. This function calls `usb_gadget_register_driver(&gadgetfs_driver)`, which registers the driver and attempts to bind it to the UDC, eventually calling `gadgetfs_bind()`.

3. **Fault Injection and Refcount Underflow:**
   In `gadgetfs_bind()`, memory allocations are performed (e.g., `usb_ep_alloc_request()` or inside `activate_ep_files()`). If fault injection causes one of these to fail, the code jumps to the `enomem` label:
   ```c
   // drivers/usb/gadget/legacy/inode.c : gadgetfs_bind()
   
   	dev->req = usb_ep_alloc_request (gadget->ep0, GFP_KERNEL);
   	if (!dev->req)
   		goto enomem;
   ...
   	if (activate_ep_files (dev) < 0)
   		goto enomem;
   ...
   	get_dev (dev); // <--- Reference is only taken on SUCCESS
   	return 0;
   
   enomem:
   	gadgetfs_unbind (gadget);
   	return -ENOMEM;
   ```
   The `enomem` path calls `gadgetfs_unbind()`, which performs cleanup and unconditionally calls `put_dev(dev)`. Because `get_dev(dev)` is only called at the very end of `gadgetfs_bind()` on success, `gadgetfs_unbind()` drops a reference that was never acquired. The refcount incorrectly drops from 2 to 1.

4. **Probe Failure Ignored:**
   The `-ENOMEM` error propagates up to the driver core. However, `__driver_attach()` intentionally ignores probe failures and returns `0`. Because `gadgetfs_driver` does not set `match_existing_only = true`, `usb_gadget_register_driver_owner()` also returns `0` (success).

5. **Closing ep0 and Freeing:**
   Seeing a success return value, `dev_config()` sets `dev->gadget_registered = true`. 
   Later, the reproducer closes the `ep0` file descriptor, triggering `dev_release()`. `dev_release()` cleans up and calls `put_dev(dev)`. The refcount drops from 1 to 0, and `dev` is prematurely freed.

6. **The Use-After-Free:**
   Finally, the reproducer unmounts the filesystem, which invokes `gadgetfs_kill_sb()`. 
   ```c
   // drivers/usb/gadget/legacy/inode.c : gadgetfs_kill_sb()
   
   	if (the_device) {
   		put_dev (the_device); // <--- UAF here
   		the_device = NULL;
   	}
   ```
   `gadgetfs_kill_sb()` attempts to drop the initial reference by calling `put_dev(the_device)`. Since `the_device` points to the `dev` structure that was already freed in step 5, this triggers the KASAN slab-use-after-free.

### Suggested Fix

`gadgetfs_bind()` should not call `gadgetfs_unbind()` in its error path, as `gadgetfs_unbind()` is designed to tear down a fully bound gadget (and thus expects the extra reference to exist). Instead, `gadgetfs_bind()` should manually clean up the specific state it altered before the failure occurred.

```c
 enomem:
-	gadgetfs_unbind (gadget);
+	if (dev->req) {
+		usb_ep_free_request (gadget->ep0, dev->req);
+		dev->req = NULL;
+	}
+	gadget->ep0->driver_data = NULL;
+	set_gadget_data (gadget, NULL);
+	dev->gadget = NULL;
 	return -ENOMEM;
```
*(Note: `activate_ep_files()` already perfectly cleans up after itself on failure, so no additional teardown is needed for it in `gadgetfs_bind()`'s error path).*


The patch that fixes the bug is:

diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c
index d87a8ab51..365f9ab4d 100644
--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -1700,7 +1700,13 @@ static int gadgetfs_bind(struct usb_gadget *gadget,
 	return 0;
 
 enomem:
-	gadgetfs_unbind (gadget);
+	if (dev->req) {
+		usb_ep_free_request(gadget->ep0, dev->req);
+		dev->req = NULL;
+	}
+	gadget->ep0->driver_data = NULL;
+	dev->gadget = NULL;
+	set_gadget_data(gadget, NULL);
 	return -ENOMEM;
 }
 


Search for the commit(s) that introduced this bug.

224/2 2026/08/07 06:12 llm fixes-finder
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 9675
							output: 39
							thoughts: 211
						

Thoughts:
**Pinpointing the Root Cause of the USB Gadgetfs Bug**

Okay, so we've got a patch that fixes a `gadgetfs` bug. My immediate thought is, let's nail down precisely *when* this bug was introduced. We're dealing with `drivers/usb/gadget/legacy/inode.c`, specifically the `gadgetfs_bind()` function. The core of the issue seems to be the error handling in the `enomem` path, where `gadgetfs_unbind(gadget)` is called, and the patch provides manual cleanup in its place.

My plan? Dive into the commit history. I need to trace the evolution of that `gadgetfs_bind()` function within `inode.c` (or perhaps the earlier incarnation, without the `legacy/` directory) and identify the specific commit that introduced that problematic `gadgetfs_unbind` call in the `enomem` error handling. I'm going to determine if it was a later addition or if the call was there from the start of `gadgetfs_bind`'s implementation.

Naturally, `git log` is the tool of choice here. I'll focus that command on `gadgetfs_bind` within the relevant file to get a clear and concise view of the changes over time. That's the best way to track down the root commit, and then we'll have a better understanding of how the bug arose.



225/2 2026/08/07 06:12 tool git-log
0m Args:
map[SourcePath:drivers/usb/gadget/legacy/inode.c SymbolName:gadgetfs_bind]

Results:
map[Output:ffe0b3350625 usb: gadget: remove global variable composite in composite.c
765f5b830e54 usb: gadget: defer setting maxpacket till ->setup()
00274921a052 USB: gadget code switches to pr_err() and friends
7489d1494318 USB: gadgetfs cleanups
1da177e4c3f4 Linux-2.6.12-rc2
]

226/2 2026/08/07 06:12 llm fixes-finder
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 10361
							output: 37
							thoughts: 42
						

Thoughts:
Okay, let's dive into this. Here's how I'd approach this task, as if these were my internal thoughts:

**Analyzing Initial Commit for `gadgetfs_unbind`**

Right, so we're trying to figure out if `gadgetfs_unbind` was already present or handled within the context of `gadgetfs_bind` in the very first commit, specifically `1da177e4c3f4`. That's a reasonable starting point. Checking the genesis, the very foundation, is the logical first step. I need to establish the baseline of how these functions interacted, or didn't, from the beginning. This might give us clues about the evolution of the gadgetfs design and whether unbinding was always a critical consideration from the outset. Understanding the initial architecture is fundamental before going further down the rabbit hole.



227/2 2026/08/07 06:12 tool git-show
0m Args:
map[Commit:1da177e4c3f4:drivers/usb/gadget/inode.c]

Results:
map[Output:
Full output is too long, showing 1000 out of 2110 lines.

[/*
  * inode.c -- user mode filesystem api for usb gadget controllers
  *
  * Copyright (C) 2003-2004 David Brownell
  * Copyright (C) 2003 Agilent Technologies
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
 
 // #define	DEBUG 			/* data to help fault diagnosis */
 // #define	VERBOSE		/* extra debug messages (success too) */
 
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/fs.h>
 #include <linux/pagemap.h>
 #include <linux/uts.h>
 #include <linux/wait.h>
 #include <linux/compiler.h>
 #include <asm/uaccess.h>
 #include <linux/slab.h>
 
 #include <linux/device.h>
 #include <linux/moduleparam.h>
 
 #include <linux/usb_gadgetfs.h>
 #include <linux/usb_gadget.h>
 
 
 /*
  * The gadgetfs API maps each endpoint to a file descriptor so that you
  * can use standard synchronous read/write calls for I/O.  There's some
  * O_NONBLOCK and O_ASYNC/FASYNC style i/o support.  Example usermode
  * drivers show how this works in practice.  You can also use AIO to
  * eliminate I/O gaps between requests, to help when streaming data.
  *
  * Key parts that must be USB-specific are protocols defining how the
  * read/write operations relate to the hardware state machines.  There
  * are two types of files.  One type is for the device, implementing ep0.
  * The other type is for each IN or OUT endpoint.  In both cases, the
  * user mode driver must configure the hardware before using it.
  *
  * - First, dev_config() is called when /dev/gadget/$CHIP is configured
  *   (by writing configuration and device descriptors).  Afterwards it
  *   may serve as a source of device events, used to handle all control
  *   requests other than basic enumeration.
  *
  * - Then either immediately, or after a SET_CONFIGURATION control request,
  *   ep_config() is called when each /dev/gadget/ep* file is configured
  *   (by writing endpoint descriptors).  Afterwards these files are used
  *   to write() IN data or to read() OUT data.  To halt the endpoint, a
  *   "wrong direction" request is issued (like reading an IN endpoint).
  *
  * Unlike "usbfs" the only ioctl()s are for things that are rare, and maybe
  * not possible on all hardware.  For example, precise fault handling with
  * respect to data left in endpoint fifos after aborted operations; or
  * selective clearing of endpoint halts, to implement SET_INTERFACE.
  */
 
 #define	DRIVER_DESC	"USB Gadget filesystem"
 #define	DRIVER_VERSION	"24 Aug 2004"
 
 static const char driver_desc [] = DRIVER_DESC;
 static const char shortname [] = "gadgetfs";
 
 MODULE_DESCRIPTION (DRIVER_DESC);
 MODULE_AUTHOR ("David Brownell");
 MODULE_LICENSE ("GPL");
 
 
 /*----------------------------------------------------------------------*/
 
 #define GADGETFS_MAGIC		0xaee71ee7
 #define DMA_ADDR_INVALID	(~(dma_addr_t)0)
 
 /* /dev/gadget/$CHIP represents ep0 and the whole device */
 enum ep0_state {
 	/* DISBLED is the initial state.
 	 */
 	STATE_DEV_DISABLED = 0,
 
 	/* Only one open() of /dev/gadget/$CHIP; only one file tracks
 	 * ep0/device i/o modes and binding to the controller.  Driver
 	 * must always write descriptors to initialize the device, then
 	 * the device becomes UNCONNECTED until enumeration.
 	 */
 	STATE_OPENED,
 
 	/* From then on, ep0 fd is in either of two basic modes:
 	 * - (UN)CONNECTED: read usb_gadgetfs_event(s) from it
 	 * - SETUP: read/write will transfer control data and succeed;
 	 *   or if "wrong direction", performs protocol stall
 	 */
 	STATE_UNCONNECTED,
 	STATE_CONNECTED,
 	STATE_SETUP,
 
 	/* UNBOUND means the driver closed ep0, so the device won't be
 	 * accessible again (DEV_DISABLED) until all fds are closed.
 	 */
 	STATE_DEV_UNBOUND,
 };
 
 /* enough for the whole queue: most events invalidate others */
 #define	N_EVENT			5
 
 struct dev_data {
 	spinlock_t			lock;
 	atomic_t			count;
 	enum ep0_state			state;
 	struct usb_gadgetfs_event	event [N_EVENT];
 	unsigned			ev_next;
 	struct fasync_struct		*fasync;
 	u8				current_config;
 
 	/* drivers reading ep0 MUST handle control requests (SETUP)
 	 * reported that way; else the host will time out.
 	 */
 	unsigned			usermode_setup : 1,
 					setup_in : 1,
 					setup_can_stall : 1,
 					setup_out_ready : 1,
 					setup_out_error : 1,
 					setup_abort : 1;
 
 	/* the rest is basically write-once */
 	struct usb_config_descriptor	*config, *hs_config;
 	struct usb_device_descriptor	*dev;
 	struct usb_request		*req;
 	struct usb_gadget		*gadget;
 	struct list_head		epfiles;
 	void				*buf;
 	wait_queue_head_t		wait;
 	struct super_block		*sb;
 	struct dentry			*dentry;
 
 	/* except this scratch i/o buffer for ep0 */
 	u8				rbuf [256];
 };
 
 static inline void get_dev (struct dev_data *data)
 {
 	atomic_inc (&data->count);
 }
 
 static void put_dev (struct dev_data *data)
 {
 	if (likely (!atomic_dec_and_test (&data->count)))
 		return;
 	/* needs no more cleanup */
 	BUG_ON (waitqueue_active (&data->wait));
 	kfree (data);
 }
 
 static struct dev_data *dev_new (void)
 {
 	struct dev_data		*dev;
 
 	dev = kmalloc (sizeof *dev, GFP_KERNEL);
 	if (!dev)
 		return NULL;
 	memset (dev, 0, sizeof *dev);
 	dev->state = STATE_DEV_DISABLED;
 	atomic_set (&dev->count, 1);
 	spin_lock_init (&dev->lock);
 	INIT_LIST_HEAD (&dev->epfiles);
 	init_waitqueue_head (&dev->wait);
 	return dev;
 }
 
 /*----------------------------------------------------------------------*/
 
 /* other /dev/gadget/$ENDPOINT files represent endpoints */
 enum ep_state {
 	STATE_EP_DISABLED = 0,
 	STATE_EP_READY,
 	STATE_EP_DEFER_ENABLE,
 	STATE_EP_ENABLED,
 	STATE_EP_UNBOUND,
 };
 
 struct ep_data {
 	struct semaphore		lock;
 	enum ep_state			state;
 	atomic_t			count;
 	struct dev_data			*dev;
 	/* must hold dev->lock before accessing ep or req */
 	struct usb_ep			*ep;
 	struct usb_request		*req;
 	ssize_t				status;
 	char				name [16];
 	struct usb_endpoint_descriptor	desc, hs_desc;
 	struct list_head		epfiles;
 	wait_queue_head_t		wait;
 	struct dentry			*dentry;
 	struct inode			*inode;
 };
 
 static inline void get_ep (struct ep_data *data)
 {
 	atomic_inc (&data->count);
 }
 
 static void put_ep (struct ep_data *data)
 {
 	if (likely (!atomic_dec_and_test (&data->count)))
 		return;
 	put_dev (data->dev);
 	/* needs no more cleanup */
 	BUG_ON (!list_empty (&data->epfiles));
 	BUG_ON (waitqueue_active (&data->wait));
 	BUG_ON (down_trylock (&data->lock) != 0);
 	kfree (data);
 }
 
 /*----------------------------------------------------------------------*/
 
 /* most "how to use the hardware" policy choices are in userspace:
  * mapping endpoint roles (which the driver needs) to the capabilities
  * which the usb controller has.  most of those capabilities are exposed
  * implicitly, starting with the driver name and then endpoint names.
  */
 
 static const char *CHIP;
 
 /*----------------------------------------------------------------------*/
 
 /* NOTE:  don't use dev_printk calls before binding to the gadget
  * at the end of ep0 configuration, or after unbind.
  */
 
 /* too wordy: dev_printk(level , &(d)->gadget->dev , fmt , ## args) */
 #define xprintk(d,level,fmt,args...) \
 	printk(level "%s: " fmt , shortname , ## args)
 
 #ifdef DEBUG
 #define DBG(dev,fmt,args...) \
 	xprintk(dev , KERN_DEBUG , fmt , ## args)
 #else
 #define DBG(dev,fmt,args...) \
 	do { } while (0)
 #endif /* DEBUG */
 
 #ifdef VERBOSE
 #define VDEBUG	DBG
 #else
 #define VDEBUG(dev,fmt,args...) \
 	do { } while (0)
 #endif /* DEBUG */
 
 #define ERROR(dev,fmt,args...) \
 	xprintk(dev , KERN_ERR , fmt , ## args)
 #define WARN(dev,fmt,args...) \
 	xprintk(dev , KERN_WARNING , fmt , ## args)
 #define INFO(dev,fmt,args...) \
 	xprintk(dev , KERN_INFO , fmt , ## args)
 
 
 /*----------------------------------------------------------------------*/
 
 /* SYNCHRONOUS ENDPOINT OPERATIONS (bulk/intr/iso)
  *
  * After opening, configure non-control endpoints.  Then use normal
  * stream read() and write() requests; and maybe ioctl() to get more
  * precise FIFO status when recovering from cancelation.
  */
 
 static void epio_complete (struct usb_ep *ep, struct usb_request *req)
 {
 	struct ep_data	*epdata = ep->driver_data;
 
 	if (!req->context)
 		return;
 	if (req->status)
 		epdata->status = req->status;
 	else
 		epdata->status = req->actual;
 	complete ((struct completion *)req->context);
 }
 
 /* tasklock endpoint, returning when it's connected.
  * still need dev->lock to use epdata->ep.
  */
 static int
 get_ready_ep (unsigned f_flags, struct ep_data *epdata)
 {
 	int	val;
 
 	if (f_flags & O_NONBLOCK) {
 		if (down_trylock (&epdata->lock) != 0)
 			goto nonblock;
 		if (epdata->state != STATE_EP_ENABLED) {
 			up (&epdata->lock);
 nonblock:
 			val = -EAGAIN;
 		} else
 			val = 0;
 		return val;
 	}
 
 	if ((val = down_interruptible (&epdata->lock)) < 0)
 		return val;
 newstate:
 	switch (epdata->state) {
 	case STATE_EP_ENABLED:
 		break;
 	case STATE_EP_DEFER_ENABLE:
 		DBG (epdata->dev, "%s wait for host\n", epdata->name);
 		if ((val = wait_event_interruptible (epdata->wait, 
 				epdata->state != STATE_EP_DEFER_ENABLE
 				|| epdata->dev->state == STATE_DEV_UNBOUND
 				)) < 0)
 			goto fail;
 		goto newstate;
 	// case STATE_EP_DISABLED:		/* "can't happen" */
 	// case STATE_EP_READY:			/* "can't happen" */
 	default:				/* error! */
 		pr_debug ("%s: ep %p not available, state %d\n",
 				shortname, epdata, epdata->state);
 		// FALLTHROUGH
 	case STATE_EP_UNBOUND:			/* clean disconnect */
 		val = -ENODEV;
 fail:
 		up (&epdata->lock);
 	}
 	return val;
 }
 
 static ssize_t
 ep_io (struct ep_data *epdata, void *buf, unsigned len)
 {
 	DECLARE_COMPLETION (done);
 	int value;
 
 	spin_lock_irq (&epdata->dev->lock);
 	if (likely (epdata->ep != NULL)) {
 		struct usb_request	*req = epdata->req;
 
 		req->context = &done;
 		req->complete = epio_complete;
 		req->buf = buf;
 		req->length = len;
 		value = usb_ep_queue (epdata->ep, req, GFP_ATOMIC);
 	} else
 		value = -ENODEV;
 	spin_unlock_irq (&epdata->dev->lock);
 
 	if (likely (value == 0)) {
 		value = wait_event_interruptible (done.wait, done.done);
 		if (value != 0) {
 			spin_lock_irq (&epdata->dev->lock);
 			if (likely (epdata->ep != NULL)) {
 				DBG (epdata->dev, "%s i/o interrupted\n",
 						epdata->name);
 				usb_ep_dequeue (epdata->ep, epdata->req);
 				spin_unlock_irq (&epdata->dev->lock);
 
 				wait_event (done.wait, done.done);
 				if (epdata->status == -ECONNRESET)
 					epdata->status = -EINTR;
 			} else {
 				spin_unlock_irq (&epdata->dev->lock);
 
 				DBG (epdata->dev, "endpoint gone\n");
 				epdata->status = -ENODEV;
 			}
 		}
 		return epdata->status;
 	}
 	return value;
 }
 
 
 /* handle a synchronous OUT bulk/intr/iso transfer */
 static ssize_t
 ep_read (struct file *fd, char __user *buf, size_t len, loff_t *ptr)
 {
 	struct ep_data		*data = fd->private_data;
 	void			*kbuf;
 	ssize_t			value;
 
 	if ((value = get_ready_ep (fd->f_flags, data)) < 0)
 		return value;
 
 	/* halt any endpoint by doing a "wrong direction" i/o call */
 	if (data->desc.bEndpointAddress & USB_DIR_IN) {
 		if ((data->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
 				== USB_ENDPOINT_XFER_ISOC)
 			return -EINVAL;
 		DBG (data->dev, "%s halt\n", data->name);
 		spin_lock_irq (&data->dev->lock);
 		if (likely (data->ep != NULL))
 			usb_ep_set_halt (data->ep);
 		spin_unlock_irq (&data->dev->lock);
 		up (&data->lock);
 		return -EBADMSG;
 	}
 
 	/* FIXME readahead for O_NONBLOCK and poll(); careful with ZLPs */
 
 	value = -ENOMEM;
 	kbuf = kmalloc (len, SLAB_KERNEL);
 	if (unlikely (!kbuf))
 		goto free1;
 
 	value = ep_io (data, kbuf, len);
 	VDEBUG (data->dev, "%s read %d OUT, status %d\n",
 		data->name, len, value);
 	if (value >= 0 && copy_to_user (buf, kbuf, value))
 		value = -EFAULT;
 
 free1:
 	up (&data->lock);
 	kfree (kbuf);
 	return value;
 }
 
 /* handle a synchronous IN bulk/intr/iso transfer */
 static ssize_t
 ep_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
 {
 	struct ep_data		*data = fd->private_data;
 	void			*kbuf;
 	ssize_t			value;
 
 	if ((value = get_ready_ep (fd->f_flags, data)) < 0)
 		return value;
 
 	/* halt any endpoint by doing a "wrong direction" i/o call */
 	if (!(data->desc.bEndpointAddress & USB_DIR_IN)) {
 		if ((data->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
 				== USB_ENDPOINT_XFER_ISOC)
 			return -EINVAL;
 		DBG (data->dev, "%s halt\n", data->name);
 		spin_lock_irq (&data->dev->lock);
 		if (likely (data->ep != NULL))
 			usb_ep_set_halt (data->ep);
 		spin_unlock_irq (&data->dev->lock);
 		up (&data->lock);
 		return -EBADMSG;
 	}
 
 	/* FIXME writebehind for O_NONBLOCK and poll(), qlen = 1 */
 
 	value = -ENOMEM;
 	kbuf = kmalloc (len, SLAB_KERNEL);
 	if (!kbuf)
 		goto free1;
 	if (copy_from_user (kbuf, buf, len)) {
 		value = -EFAULT;
 		goto free1;
 	}
 
 	value = ep_io (data, kbuf, len);
 	VDEBUG (data->dev, "%s write %d IN, status %d\n",
 		data->name, len, value);
 free1:
 	up (&data->lock);
 	kfree (kbuf);
 	return value;
 }
 
 static int
 ep_release (struct inode *inode, struct file *fd)
 {
 	struct ep_data		*data = fd->private_data;
 
 	/* clean up if this can be reopened */
 	if (data->state != STATE_EP_UNBOUND) {
 		data->state = STATE_EP_DISABLED;
 		data->desc.bDescriptorType = 0;
 		data->hs_desc.bDescriptorType = 0;
 	}
 	put_ep (data);
 	return 0;
 }
 
 static int ep_ioctl (struct inode *inode, struct file *fd,
 		unsigned code, unsigned long value)
 {
 	struct ep_data		*data = fd->private_data;
 	int			status;
 
 	if ((status = get_ready_ep (fd->f_flags, data)) < 0)
 		return status;
 
 	spin_lock_irq (&data->dev->lock);
 	if (likely (data->ep != NULL)) {
 		switch (code) {
 		case GADGETFS_FIFO_STATUS:
 			status = usb_ep_fifo_status (data->ep);
 			break;
 		case GADGETFS_FIFO_FLUSH:
 			usb_ep_fifo_flush (data->ep);
 			break;
 		case GADGETFS_CLEAR_HALT:
 			status = usb_ep_clear_halt (data->ep);
 			break;
 		default:
 			status = -ENOTTY;
 		}
 	} else
 		status = -ENODEV;
 	spin_unlock_irq (&data->dev->lock);
 	up (&data->lock);
 	return status;
 }
 
 /*----------------------------------------------------------------------*/
 
 /* ASYNCHRONOUS ENDPOINT I/O OPERATIONS (bulk/intr/iso) */
 
 struct kiocb_priv {
 	struct usb_request	*req;
 	struct ep_data		*epdata;
 	void			*buf;
 	char __user		*ubuf;
 	unsigned		actual;
 };
 
 static int ep_aio_cancel(struct kiocb *iocb, struct io_event *e)
 {
 	struct kiocb_priv	*priv = iocb->private;
 	struct ep_data		*epdata;
 	int			value;
 
 	local_irq_disable();
 	epdata = priv->epdata;
 	// spin_lock(&epdata->dev->lock);
 	kiocbSetCancelled(iocb);
 	if (likely(epdata && epdata->ep && priv->req))
 		value = usb_ep_dequeue (epdata->ep, priv->req);
 	else
 		value = -EINVAL;
 	// spin_unlock(&epdata->dev->lock);
 	local_irq_enable();
 
 	aio_put_req(iocb);
 	return value;
 }
 
 static ssize_t ep_aio_read_retry(struct kiocb *iocb)
 {
 	struct kiocb_priv	*priv = iocb->private;
 	ssize_t			status = priv->actual;
 
 	/* we "retry" to get the right mm context for this: */
 	status = copy_to_user(priv->ubuf, priv->buf, priv->actual);
 	if (unlikely(0 != status))
 		status = -EFAULT;
 	else
 		status = priv->actual;
 	kfree(priv->buf);
 	kfree(priv);
 	aio_put_req(iocb);
 	return status;
 }
 
 static void ep_aio_complete(struct usb_ep *ep, struct usb_request *req)
 {
 	struct kiocb		*iocb = req->context;
 	struct kiocb_priv	*priv = iocb->private;
 	struct ep_data		*epdata = priv->epdata;
 
 	/* lock against disconnect (and ideally, cancel) */
 	spin_lock(&epdata->dev->lock);
 	priv->req = NULL;
 	priv->epdata = NULL;
 	if (NULL == iocb->ki_retry
 			|| unlikely(0 == req->actual)
 			|| unlikely(kiocbIsCancelled(iocb))) {
 		kfree(req->buf);
 		kfree(priv);
 		iocb->private = NULL;
 		/* aio_complete() reports bytes-transferred _and_ faults */
 		if (unlikely(kiocbIsCancelled(iocb)))
 			aio_put_req(iocb);
 		else
 			aio_complete(iocb,
 				req->actual ? req->actual : req->status,
 				req->status);
 	} else {
 		/* retry() won't report both; so we hide some faults */
 		if (unlikely(0 != req->status))
 			DBG(epdata->dev, "%s fault %d len %d\n",
 				ep->name, req->status, req->actual);
 
 		priv->buf = req->buf;
 		priv->actual = req->actual;
 		kick_iocb(iocb);
 	}
 	spin_unlock(&epdata->dev->lock);
 
 	usb_ep_free_request(ep, req);
 	put_ep(epdata);
 }
 
 static ssize_t
 ep_aio_rwtail(
 	struct kiocb	*iocb,
 	char		*buf,
 	size_t		len,
 	struct ep_data	*epdata,
 	char __user	*ubuf
 )
 {
 	struct kiocb_priv	*priv = (void *) &iocb->private;
 	struct usb_request	*req;
 	ssize_t			value;
 
 	priv = kmalloc(sizeof *priv, GFP_KERNEL);
 	if (!priv) {
 		value = -ENOMEM;
 fail:
 		kfree(buf);
 		return value;
 	}
 	iocb->private = priv;
 	priv->ubuf = ubuf;
 
 	value = get_ready_ep(iocb->ki_filp->f_flags, epdata);
 	if (unlikely(value < 0)) {
 		kfree(priv);
 		goto fail;
 	}
 
 	iocb->ki_cancel = ep_aio_cancel;
 	get_ep(epdata);
 	priv->epdata = epdata;
 	priv->actual = 0;
 
 	/* each kiocb is coupled to one usb_request, but we can't
 	 * allocate or submit those if the host disconnected.
 	 */
 	spin_lock_irq(&epdata->dev->lock);
 	if (likely(epdata->ep)) {
 		req = usb_ep_alloc_request(epdata->ep, GFP_ATOMIC);
 		if (likely(req)) {
 			priv->req = req;
 			req->buf = buf;
 			req->length = len;
 			req->complete = ep_aio_complete;
 			req->context = iocb;
 			value = usb_ep_queue(epdata->ep, req, GFP_ATOMIC);
 			if (unlikely(0 != value))
 				usb_ep_free_request(epdata->ep, req);
 		} else
 			value = -EAGAIN;
 	} else
 		value = -ENODEV;
 	spin_unlock_irq(&epdata->dev->lock);
 
 	up(&epdata->lock);
 
 	if (unlikely(value)) {
 		kfree(priv);
 		put_ep(epdata);
 	} else
 		value = -EIOCBQUEUED;
 	return value;
 }
 
 static ssize_t
 ep_aio_read(struct kiocb *iocb, char __user *ubuf, size_t len, loff_t o)
 {
 	struct ep_data		*epdata = iocb->ki_filp->private_data;
 	char			*buf;
 
 	if (unlikely(epdata->desc.bEndpointAddress & USB_DIR_IN))
 		return -EINVAL;
 	buf = kmalloc(len, GFP_KERNEL);
 	if (unlikely(!buf))
 		return -ENOMEM;
 	iocb->ki_retry = ep_aio_read_retry;
 	return ep_aio_rwtail(iocb, buf, len, epdata, ubuf);
 }
 
 static ssize_t
 ep_aio_write(struct kiocb *iocb, const char __user *ubuf, size_t len, loff_t o)
 {
 	struct ep_data		*epdata = iocb->ki_filp->private_data;
 	char			*buf;
 
 	if (unlikely(!(epdata->desc.bEndpointAddress & USB_DIR_IN)))
 		return -EINVAL;
 	buf = kmalloc(len, GFP_KERNEL);
 	if (unlikely(!buf))
 		return -ENOMEM;
 	if (unlikely(copy_from_user(buf, ubuf, len) != 0)) {
 		kfree(buf);
 		return -EFAULT;
 	}
 	return ep_aio_rwtail(iocb, buf, len, epdata, NULL);
 }
 
 /*----------------------------------------------------------------------*/
 
 /* used after endpoint configuration */
 static struct file_operations ep_io_operations = {
 	.owner =	THIS_MODULE,
 	.llseek =	no_llseek,
 
 	.read =		ep_read,
 	.write =	ep_write,
 	.ioctl =	ep_ioctl,
 	.release =	ep_release,
 
 	.aio_read =	ep_aio_read,
 	.aio_write =	ep_aio_write,
 };
 
 /* ENDPOINT INITIALIZATION
  *
  *     fd = open ("/dev/gadget/$ENDPOINT", O_RDWR)
  *     status = write (fd, descriptors, sizeof descriptors)
  *
  * That write establishes the endpoint configuration, configuring
  * the controller to process bulk, interrupt, or isochronous transfers
  * at the right maxpacket size, and so on.
  *
  * The descriptors are message type 1, identified by a host order u32
  * at the beginning of what's written.  Descriptor order is: full/low
  * speed descriptor, then optional high speed descriptor.
  */
 static ssize_t
 ep_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
 {
 	struct ep_data		*data = fd->private_data;
 	struct usb_ep		*ep;
 	u32			tag;
 	int			value;
 
 	if ((value = down_interruptible (&data->lock)) < 0)
 		return value;
 
 	if (data->state != STATE_EP_READY) {
 		value = -EL2HLT;
 		goto fail;
 	}
 
 	value = len;
 	if (len < USB_DT_ENDPOINT_SIZE + 4)
 		goto fail0;
 
 	/* we might need to change message format someday */
 	if (copy_from_user (&tag, buf, 4)) {
 		goto fail1;
 	}
 	if (tag != 1) {
 		DBG(data->dev, "config %s, bad tag %d\n", data->name, tag);
 		goto fail0;
 	}
 	buf += 4;
 	len -= 4;
 
 	/* NOTE:  audio endpoint extensions not accepted here;
 	 * just don't include the extra bytes.
 	 */
 
 	/* full/low speed descriptor, then high speed */
 	if (copy_from_user (&data->desc, buf, USB_DT_ENDPOINT_SIZE)) {
 		goto fail1;
 	}
 	if (data->desc.bLength != USB_DT_ENDPOINT_SIZE
 			|| data->desc.bDescriptorType != USB_DT_ENDPOINT)
 		goto fail0;
 	if (len != USB_DT_ENDPOINT_SIZE) {
 		if (len != 2 * USB_DT_ENDPOINT_SIZE)
 			goto fail0;
 		if (copy_from_user (&data->hs_desc, buf + USB_DT_ENDPOINT_SIZE,
 					USB_DT_ENDPOINT_SIZE)) {
 			goto fail1;
 		}
 		if (data->hs_desc.bLength != USB_DT_ENDPOINT_SIZE
 				|| data->hs_desc.bDescriptorType
 					!= USB_DT_ENDPOINT) {
 			DBG(data->dev, "config %s, bad hs length or type\n",
 					data->name);
 			goto fail0;
 		}
 	}
 	value = len;
 
 	spin_lock_irq (&data->dev->lock);
 	if (data->dev->state == STATE_DEV_UNBOUND) {
 		value = -ENOENT;
 		goto gone;
 	} else if ((ep = data->ep) == NULL) {
 		value = -ENODEV;
 		goto gone;
 	}
 	switch (data->dev->gadget->speed) {
 	case USB_SPEED_LOW:
 	case USB_SPEED_FULL:
 		value = usb_ep_enable (ep, &data->desc);
 		if (value == 0)
 			data->state = STATE_EP_ENABLED;
 		break;
 #ifdef	HIGHSPEED
 	case USB_SPEED_HIGH:
 		/* fails if caller didn't provide that descriptor... */
 		value = usb_ep_enable (ep, &data->hs_desc);
 		if (value == 0)
 			data->state = STATE_EP_ENABLED;
 		break;
 #endif
 	default:
 		DBG (data->dev, "unconnected, %s init deferred\n",
 				data->name);
 		data->state = STATE_EP_DEFER_ENABLE;
 	}
 	if (value == 0)
 		fd->f_op = &ep_io_operations;
 gone:
 	spin_unlock_irq (&data->dev->lock);
 	if (value < 0) {
 fail:
 		data->desc.bDescriptorType = 0;
 		data->hs_desc.bDescriptorType = 0;
 	}
 	up (&data->lock);
 	return value;
 fail0:
 	value = -EINVAL;
 	goto fail;
 fail1:
 	value = -EFAULT;
 	goto fail;
 }
 
 static int
 ep_open (struct inode *inode, struct file *fd)
 {
 	struct ep_data		*data = inode->u.generic_ip;
 	int			value = -EBUSY;
 
 	if (down_interruptible (&data->lock) != 0)
 		return -EINTR;
 	spin_lock_irq (&data->dev->lock);
 	if (data->dev->state == STATE_DEV_UNBOUND)
 		value = -ENOENT;
 	else if (data->state == STATE_EP_DISABLED) {
 		value = 0;
 		data->state = STATE_EP_READY;
 		get_ep (data);
 		fd->private_data = data;
 		VDEBUG (data->dev, "%s ready\n", data->name);
 	} else
 		DBG (data->dev, "%s state %d\n",
 			data->name, data->state);
 	spin_unlock_irq (&data->dev->lock);
 	up (&data->lock);
 	return value;
 }
 
 /* used before endpoint configuration */
 static struct file_operations ep_config_operations = {
 	.owner =	THIS_MODULE,
 	.llseek =	no_llseek,
 
 	.open =		ep_open,
 	.write =	ep_config,
 	.release =	ep_release,
 };
 
 /*----------------------------------------------------------------------*/
 
 /* EP0 IMPLEMENTATION can be partly in userspace.
  *
  * Drivers that use this facility receive various events, including
  * control requests the kernel doesn't handle.  Drivers that don't
  * use this facility may be too simple-minded for real applications.
  */
 
 static inline void ep0_readable (struct dev_data *dev)
 {
 	wake_up (&dev->wait);
 	kill_fasync (&dev->fasync, SIGIO, POLL_IN);
 }
 
 static void clean_req (struct usb_ep *ep, struct usb_request *req)
 {
 	struct dev_data		*dev = ep->driver_data;
 
 	if (req->buf != dev->rbuf) {
 		usb_ep_free_buffer (ep, req->buf, req->dma, req->length);
 		req->buf = dev->rbuf;
 		req->dma = DMA_ADDR_INVALID;
 	}
 	req->complete = epio_complete;
 	dev->setup_out_ready = 0;
 }
 
 static void ep0_complete (struct usb_ep *ep, struct usb_request *req)
 {
 	struct dev_data		*dev = ep->driver_data;
 	int			free = 1;
 
 	/* for control OUT, data must still get to userspace */
 	if (!dev->setup_in) {
 		dev->setup_out_error = (req->status != 0);
 		if (!dev->setup_out_error)
 			free = 0;
 		dev->setup_out_ready = 1;
 		ep0_readable (dev);
 	} else if (dev->state == STATE_SETUP)
 		dev->state = STATE_CONNECTED;
 
 	/* clean up as appropriate */
 	if (free && req->buf != &dev->rbuf)
 		clean_req (ep, req);
 	req->complete = epio_complete;
 }
 
 static int setup_req (struct usb_ep *ep, struct usb_request *req, u16 len)
 {
 	struct dev_data	*dev = ep->driver_data;
 
 	if (dev->setup_out_ready) {
 		DBG (dev, "ep0 request busy!\n");
 		return -EBUSY;
 	}
 	if (len > sizeof (dev->rbuf))
 		req->buf = usb_ep_alloc_buffer (ep, len, &req->dma, GFP_ATOMIC);
 	if (req->buf == 0) {
 		req->buf = dev->rbuf;
 		return -ENOMEM;
 	}
 	req->complete = ep0_complete;
 	req->length = len;
 	return 0;
 }
 
 static ssize_t
 ep0_read (struct file *fd, char __user *buf, size_t len, loff_t *ptr)
 {
 	struct dev_data			*dev = fd->private_data;
 	ssize_t				retval;
 	enum ep0_state			state;
 
 	spin_lock_irq (&dev->lock);
 
 	/* report fd mode change before acting on it */
 	if (dev->setup_abort) {
 		dev->setup_abort = 0;
 		retval = -EIDRM;
 		goto done;
 	}
 
 	/* control DATA stage */
 	if ((state = dev->state) == STATE_SETUP) {
 
 		if (dev->setup_in) {		/* stall IN */
 			VDEBUG(dev, "ep0in stall\n");
 			(void) usb_ep_set_halt (dev->gadget->ep0);
 			retval = -EL2HLT;
 			dev->state = STATE_CONNECTED;
 
 		} else if (len == 0) {		/* ack SET_CONFIGURATION etc */
 			struct usb_ep		*ep = dev->gadget->ep0;
 			struct usb_request	*req = dev->req;
 
 			if ((retval = setup_req (ep, req, 0)) == 0)
 				retval = usb_ep_queue (ep, req, GFP_ATOMIC);
 			dev->state = STATE_CONNECTED;
 
 			/* assume that was SET_CONFIGURATION */
 			if (dev->current_config) {
 				unsigned power;
 #ifdef	HIGHSPEED
 				if (dev->gadget->speed == USB_SPEED_HIGH)
 					power = dev->hs_config->bMaxPower;
 				else
 #endif
 					power = dev->config->bMaxPower;
 				usb_gadget_vbus_draw(dev->gadget, 2 * power);
 			}
 
 		} else {			/* collect OUT data */
 			if ((fd->f_flags & O_NONBLOCK) != 0
 					&& !dev->setup_out_ready) {
 				retval = -EAGAIN;
 				goto done;
 			}
 			spin_unlock_irq (&dev->lock);
 			retval = wait_event_interruptible (dev->wait,
 					dev->setup_out_ready != 0);
]
]

228/2 2026/08/07 06:12 llm fixes-finder
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 20912
							output: 35
							thoughts: 72
						

Thoughts:
Here's my summary, as the thought process unfolds:

**Examining a Truncated Output**

Okay, the output's been cut off, which is frustrating. I need to find the context for that. Right, I remember seeing something about `gadgetfs_bind`. That's the key. Let's see...I need to trace that function. Given that I have a specific commit ID (`1da177e4c3f4`) and I know the relevant file is `drivers/usb/gadget/inode.c`, the quickest way is probably to just grab the source of that file from that commit and grep for the definition. I could use `codesearch-definition-source` if I was sure it was indexed, but `git-show` with a grep should be faster and more reliable right now. It'll give me the precise source I need. That's the direct approach – no need to overcomplicate things. I'll get the definition and understand how it’s being used.



229/2 2026/08/07 06:12 tool grepper
0m Error:
log-in to see details

Args:
map[Expression:gadgetfs_bind PathPrefix:drivers/usb/gadget/inode.c]

Results:
map[Output:]

230/2 2026/08/07 06:12 llm fixes-finder
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 21252
							output: 39
							thoughts: 65
						

Thoughts:
**Investigating a Potential File Path Change**

Okay, hold on a second. I have a hunch, a nagging feeling that the `drivers/usb/gadget/inode.c` file *might* have been reorganized, perhaps moved to `drivers/usb/gadget/legacy/inode.c`. That kind of change happens in these projects. Let's not assume, though, and go directly to checking for it, so I should now investigate the commit history around the `gadgetfs_bind` function. I will check the legacy file path first, and then, if necessary, the original. It would be good to confirm that this is where the code now resides, and to understand *when* the change occurred. That will give me the context I need to proceed confidently.



231/2 2026/08/07 06:12 tool git-log
0m Args:
map[SourcePath:drivers/usb/gadget/legacy/inode.c SymbolName:gadgetfs_bind]

Results:
map[Output:ffe0b3350625 usb: gadget: remove global variable composite in composite.c
765f5b830e54 usb: gadget: defer setting maxpacket till ->setup()
00274921a052 USB: gadget code switches to pr_err() and friends
7489d1494318 USB: gadgetfs cleanups
1da177e4c3f4 Linux-2.6.12-rc2
]

232/2 2026/08/07 06:13 llm fixes-finder
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 21648
							output: 26
							thoughts: 26
						

Thoughts:
Okay, let's dive into this. Here's my take on those thoughts, as if they're my own:

**Analyzing the GadgetFS Bind Implementation**

Right, let's start by digging into `1da177e4c3f4` and see what's happening with `gadgetfs_bind`. My immediate thought is, what are the key aspects of this binding process in `gadgetfs`? I'm already mentally running through the various steps: is it handling device registration, resource allocation, permission checks, potential race conditions? I need to understand how the filesystem interfaces with the gadget driver and the underlying USB stack here. I'm assuming this function is critical for getting the virtual device instantiated and ready for use. So, I need to see if it's handling the initial setup, ensuring the right hooks are in place, and the data structures are properly initialized. I'll need to pay close attention to the error handling and see how it gracefully deals with potential failures during the binding phase. Ultimately, I'm expecting this to be the core of making the gadget appear as a usable USB device to the host.



233/2 2026/08/07 06:13 tool git-show
0m Args:
map[Commit:1da177e4c3f4]

Results:
map[Output:
Full output is too long, showing 1000 out of 6822520 lines.

[commit 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2
 Author: Linus Torvalds <torvalds@ppc970.osdl.org>
 Date:   Sat Apr 16 15:20:36 2005 -0700
 
     Linux-2.6.12-rc2
     
     Initial git repository build. I'm not bothering with the full history,
     even though we have it. We can create a separate "historical" git
     archive of that later if we want to, and in the meantime it's about
     3.2GB when imported into git - space that would just make the early
     git days unnecessarily complicated, when we don't have a lot of good
     infrastructure for it.
     
     Let it rip!
 
 diff --git a/COPYING b/COPYING
 new file mode 100644
 index 000000000000..2a7e338ec2fc
 --- /dev/null
 +++ b/COPYING
 @@ -0,0 +1,356 @@
 +
 +   NOTE! This copyright does *not* cover user programs that use kernel
 + services by normal system calls - this is merely considered normal use
 + of the kernel, and does *not* fall under the heading of "derived work".
 + Also note that the GPL below is copyrighted by the Free Software
 + Foundation, but the instance of code that it refers to (the Linux
 + kernel) is copyrighted by me and others who actually wrote it.
 +
 + Also note that the only valid version of the GPL as far as the kernel
 + is concerned is _this_ particular version of the license (ie v2, not
 + v2.2 or v3.x or whatever), unless explicitly otherwise stated.
 +
 +			Linus Torvalds
 +
 +----------------------------------------
 +
 +		    GNU GENERAL PUBLIC LICENSE
 +		       Version 2, June 1991
 +
 + Copyright (C) 1989, 1991 Free Software Foundation, Inc.
 +                       59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 + Everyone is permitted to copy and distribute verbatim copies
 + of this license document, but changing it is not allowed.
 +
 +			    Preamble
 +
 +  The licenses for most software are designed to take away your
 +freedom to share and change it.  By contrast, the GNU General Public
 +License is intended to guarantee your freedom to share and change free
 +software--to make sure the software is free for all its users.  This
 +General Public License applies to most of the Free Software
 +Foundation's software and to any other program whose authors commit to
 +using it.  (Some other Free Software Foundation software is covered by
 +the GNU Library General Public License instead.)  You can apply it to
 +your programs, too.
 +
 +  When we speak of free software, we are referring to freedom, not
 +price.  Our General Public Licenses are designed to make sure that you
 +have the freedom to distribute copies of free software (and charge for
 +this service if you wish), that you receive source code or can get it
 +if you want it, that you can change the software or use pieces of it
 +in new free programs; and that you know you can do these things.
 +
 +  To protect your rights, we need to make restrictions that forbid
 +anyone to deny you these rights or to ask you to surrender the rights.
 +These restrictions translate to certain responsibilities for you if you
 +distribute copies of the software, or if you modify it.
 +
 +  For example, if you distribute copies of such a program, whether
 +gratis or for a fee, you must give the recipients all the rights that
 +you have.  You must make sure that they, too, receive or can get the
 +source code.  And you must show them these terms so they know their
 +rights.
 +
 +  We protect your rights with two steps: (1) copyright the software, and
 +(2) offer you this license which gives you legal permission to copy,
 +distribute and/or modify the software.
 +
 +  Also, for each author's protection and ours, we want to make certain
 +that everyone understands that there is no warranty for this free
 +software.  If the software is modified by someone else and passed on, we
 +want its recipients to know that what they have is not the original, so
 +that any problems introduced by others will not reflect on the original
 +authors' reputations.
 +
 +  Finally, any free program is threatened constantly by software
 +patents.  We wish to avoid the danger that redistributors of a free
 +program will individually obtain patent licenses, in effect making the
 +program proprietary.  To prevent this, we have made it clear that any
 +patent must be licensed for everyone's free use or not licensed at all.
 +
 +  The precise terms and conditions for copying, distribution and
 +modification follow.
 +
 +		    GNU GENERAL PUBLIC LICENSE
 +   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
 +
 +  0. This License applies to any program or other work which contains
 +a notice placed by the copyright holder saying it may be distributed
 +under the terms of this General Public License.  The "Program", below,
 +refers to any such program or work, and a "work based on the Program"
 +means either the Program or any derivative work under copyright law:
 +that is to say, a work containing the Program or a portion of it,
 +either verbatim or with modifications and/or translated into another
 +language.  (Hereinafter, translation is included without limitation in
 +the term "modification".)  Each licensee is addressed as "you".
 +
 +Activities other than copying, distribution and modification are not
 +covered by this License; they are outside its scope.  The act of
 +running the Program is not restricted, and the output from the Program
 +is covered only if its contents constitute a work based on the
 +Program (independent of having been made by running the Program).
 +Whether that is true depends on what the Program does.
 +
 +  1. You may copy and distribute verbatim copies of the Program's
 +source code as you receive it, in any medium, provided that you
 +conspicuously and appropriately publish on each copy an appropriate
 +copyright notice and disclaimer of warranty; keep intact all the
 +notices that refer to this License and to the absence of any warranty;
 +and give any other recipients of the Program a copy of this License
 +along with the Program.
 +
 +You may charge a fee for the physical act of transferring a copy, and
 +you may at your option offer warranty protection in exchange for a fee.
 +
 +  2. You may modify your copy or copies of the Program or any portion
 +of it, thus forming a work based on the Program, and copy and
 +distribute such modifications or work under the terms of Section 1
 +above, provided that you also meet all of these conditions:
 +
 +    a) You must cause the modified files to carry prominent notices
 +    stating that you changed the files and the date of any change.
 +
 +    b) You must cause any work that you distribute or publish, that in
 +    whole or in part contains or is derived from the Program or any
 +    part thereof, to be licensed as a whole at no charge to all third
 +    parties under the terms of this License.
 +
 +    c) If the modified program normally reads commands interactively
 +    when run, you must cause it, when started running for such
 +    interactive use in the most ordinary way, to print or display an
 +    announcement including an appropriate copyright notice and a
 +    notice that there is no warranty (or else, saying that you provide
 +    a warranty) and that users may redistribute the program under
 +    these conditions, and telling the user how to view a copy of this
 +    License.  (Exception: if the Program itself is interactive but
 +    does not normally print such an announcement, your work based on
 +    the Program is not required to print an announcement.)
 +
 +These requirements apply to the modified work as a whole.  If
 +identifiable sections of that work are not derived from the Program,
 +and can be reasonably considered independent and separate works in
 +themselves, then this License, and its terms, do not apply to those
 +sections when you distribute them as separate works.  But when you
 +distribute the same sections as part of a whole which is a work based
 +on the Program, the distribution of the whole must be on the terms of
 +this License, whose permissions for other licensees extend to the
 +entire whole, and thus to each and every part regardless of who wrote it.
 +
 +Thus, it is not the intent of this section to claim rights or contest
 +your rights to work written entirely by you; rather, the intent is to
 +exercise the right to control the distribution of derivative or
 +collective works based on the Program.
 +
 +In addition, mere aggregation of another work not based on the Program
 +with the Program (or with a work based on the Program) on a volume of
 +a storage or distribution medium does not bring the other work under
 +the scope of this License.
 +
 +  3. You may copy and distribute the Program (or a work based on it,
 +under Section 2) in object code or executable form under the terms of
 +Sections 1 and 2 above provided that you also do one of the following:
 +
 +    a) Accompany it with the complete corresponding machine-readable
 +    source code, which must be distributed under the terms of Sections
 +    1 and 2 above on a medium customarily used for software interchange; or,
 +
 +    b) Accompany it with a written offer, valid for at least three
 +    years, to give any third party, for a charge no more than your
 +    cost of physically performing source distribution, a complete
 +    machine-readable copy of the corresponding source code, to be
 +    distributed under the terms of Sections 1 and 2 above on a medium
 +    customarily used for software interchange; or,
 +
 +    c) Accompany it with the information you received as to the offer
 +    to distribute corresponding source code.  (This alternative is
 +    allowed only for noncommercial distribution and only if you
 +    received the program in object code or executable form with such
 +    an offer, in accord with Subsection b above.)
 +
 +The source code for a work means the preferred form of the work for
 +making modifications to it.  For an executable work, complete source
 +code means all the source code for all modules it contains, plus any
 +associated interface definition files, plus the scripts used to
 +control compilation and installation of the executable.  However, as a
 +special exception, the source code distributed need not include
 +anything that is normally distributed (in either source or binary
 +form) with the major components (compiler, kernel, and so on) of the
 +operating system on which the executable runs, unless that component
 +itself accompanies the executable.
 +
 +If distribution of executable or object code is made by offering
 +access to copy from a designated place, then offering equivalent
 +access to copy the source code from the same place counts as
 +distribution of the source code, even though third parties are not
 +compelled to copy the source along with the object code.
 +
 +  4. You may not copy, modify, sublicense, or distribute the Program
 +except as expressly provided under this License.  Any attempt
 +otherwise to copy, modify, sublicense or distribute the Program is
 +void, and will automatically terminate your rights under this License.
 +However, parties who have received copies, or rights, from you under
 +this License will not have their licenses terminated so long as such
 +parties remain in full compliance.
 +
 +  5. You are not required to accept this License, since you have not
 +signed it.  However, nothing else grants you permission to modify or
 +distribute the Program or its derivative works.  These actions are
 +prohibited by law if you do not accept this License.  Therefore, by
 +modifying or distributing the Program (or any work based on the
 +Program), you indicate your acceptance of this License to do so, and
 +all its terms and conditions for copying, distributing or modifying
 +the Program or works based on it.
 +
 +  6. Each time you redistribute the Program (or any work based on the
 +Program), the recipient automatically receives a license from the
 +original licensor to copy, distribute or modify the Program subject to
 +these terms and conditions.  You may not impose any further
 +restrictions on the recipients' exercise of the rights granted herein.
 +You are not responsible for enforcing compliance by third parties to
 +this License.
 +
 +  7. If, as a consequence of a court judgment or allegation of patent
 +infringement or for any other reason (not limited to patent issues),
 +conditions are imposed on you (whether by court order, agreement or
 +otherwise) that contradict the conditions of this License, they do not
 +excuse you from the conditions of this License.  If you cannot
 +distribute so as to satisfy simultaneously your obligations under this
 +License and any other pertinent obligations, then as a consequence you
 +may not distribute the Program at all.  For example, if a patent
 +license would not permit royalty-free redistribution of the Program by
 +all those who receive copies directly or indirectly through you, then
 +the only way you could satisfy both it and this License would be to
 +refrain entirely from distribution of the Program.
 +
 +If any portion of this section is held invalid or unenforceable under
 +any particular circumstance, the balance of the section is intended to
 +apply and the section as a whole is intended to apply in other
 +circumstances.
 +
 +It is not the purpose of this section to induce you to infringe any
 +patents or other property right claims or to contest validity of any
 +such claims; this section has the sole purpose of protecting the
 +integrity of the free software distribution system, which is
 +implemented by public license practices.  Many people have made
 +generous contributions to the wide range of software distributed
 +through that system in reliance on consistent application of that
 +system; it is up to the author/donor to decide if he or she is willing
 +to distribute software through any other system and a licensee cannot
 +impose that choice.
 +
 +This section is intended to make thoroughly clear what is believed to
 +be a consequence of the rest of this License.
 +
 +  8. If the distribution and/or use of the Program is restricted in
 +certain countries either by patents or by copyrighted interfaces, the
 +original copyright holder who places the Program under this License
 +may add an explicit geographical distribution limitation excluding
 +those countries, so that distribution is permitted only in or among
 +countries not thus excluded.  In such case, this License incorporates
 +the limitation as if written in the body of this License.
 +
 +  9. The Free Software Foundation may publish revised and/or new versions
 +of the General Public License from time to time.  Such new versions will
 +be similar in spirit to the present version, but may differ in detail to
 +address new problems or concerns.
 +
 +Each version is given a distinguishing version number.  If the Program
 +specifies a version number of this License which applies to it and "any
 +later version", you have the option of following the terms and conditions
 +either of that version or of any later version published by the Free
 +Software Foundation.  If the Program does not specify a version number of
 +this License, you may choose any version ever published by the Free Software
 +Foundation.
 +
 +  10. If you wish to incorporate parts of the Program into other free
 +programs whose distribution conditions are different, write to the author
 +to ask for permission.  For software which is copyrighted by the Free
 +Software Foundation, write to the Free Software Foundation; we sometimes
 +make exceptions for this.  Our decision will be guided by the two goals
 +of preserving the free status of all derivatives of our free software and
 +of promoting the sharing and reuse of software generally.
 +
 +			    NO WARRANTY
 +
 +  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
 +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
 +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
 +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
 +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
 +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
 +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
 +REPAIR OR CORRECTION.
 +
 +  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
 +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
 +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
 +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
 +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
 +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
 +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
 +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
 +POSSIBILITY OF SUCH DAMAGES.
 +
 +		     END OF TERMS AND CONDITIONS
 +
 +	    How to Apply These Terms to Your New Programs
 +
 +  If you develop a new program, and you want it to be of the greatest
 +possible use to the public, the best way to achieve this is to make it
 +free software which everyone can redistribute and change under these terms.
 +
 +  To do so, attach the following notices to the program.  It is safest
 +to attach them to the start of each source file to most effectively
 +convey the exclusion of warranty; and each file should have at least
 +the "copyright" line and a pointer to where the full notice is found.
 +
 +    <one line to give the program's name and a brief idea of what it does.>
 +    Copyright (C) <year>  <name of author>
 +
 +    This program is free software; you can redistribute it and/or modify
 +    it under the terms of the GNU General Public License as published by
 +    the Free Software Foundation; either version 2 of the License, or
 +    (at your option) any later version.
 +
 +    This program is distributed in the hope that it will be useful,
 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 +    GNU General Public License for more details.
 +
 +    You should have received a copy of the GNU General Public License
 +    along with this program; if not, write to the Free Software
 +    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 +
 +
 +Also add information on how to contact you by electronic and paper mail.
 +
 +If the program is interactive, make it output a short notice like this
 +when it starts in an interactive mode:
 +
 +    Gnomovision version 69, Copyright (C) year name of author
 +    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
 +    This is free software, and you are welcome to redistribute it
 +    under certain conditions; type `show c' for details.
 +
 +The hypothetical commands `show w' and `show c' should show the appropriate
 +parts of the General Public License.  Of course, the commands you use may
 +be called something other than `show w' and `show c'; they could even be
 +mouse-clicks or menu items--whatever suits your program.
 +
 +You should also get your employer (if you work as a programmer) or your
 +school, if any, to sign a "copyright disclaimer" for the program, if
 +necessary.  Here is a sample; alter the names:
 +
 +  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
 +  `Gnomovision' (which makes passes at compilers) written by James Hacker.
 +
 +  <signature of Ty Coon>, 1 April 1989
 +  Ty Coon, President of Vice
 +
 +This General Public License does not permit incorporating your program into
 +proprietary programs.  If your program is a subroutine library, you may
 +consider it more useful to permit linking proprietary applications with the
 +library.  If this is what you want to do, use the GNU Library General
 +Public License instead of this License.
 diff --git a/CREDITS b/CREDITS
 new file mode 100644
 index 000000000000..671e9c2d31fe
 --- /dev/null
 +++ b/CREDITS
 @@ -0,0 +1,3743 @@
 +	This is at least a partial credits-file of people that have
 +	contributed to the Linux project.  It is sorted by name and
 +	formatted to allow easy grepping and beautification by
 +	scripts.  The fields are: name (N), email (E), web-address
 +	(W), PGP key ID and fingerprint (P), description (D), and
 +	snail-mail address (S).
 +	Thanks,
 +
 +			Linus
 +----------
 +
 +N: Matti Aarnio
 +E: mea@nic.funet.fi
 +D: Alpha systems hacking, IPv6 and other network related stuff
 +D: One of assisting postmasters for vger.kernel.org's lists
 +S: (ask for current address)
 +S: Finland
 +
 +N: Dragos Acostachioaie
 +E: dragos@iname.com
 +W: http://www.arbornet.org/~dragos
 +D: /proc/sysvipc
 +S: C. Negri 6, bl. D3
 +S: Iasi 6600
 +S: Romania
 +
 +N: Monalisa Agrawal
 +E: magrawal@nortelnetworks.com
 +D: Basic Interphase 5575 driver with UBR and ABR support.
 +S: 75 Donald St, Apt 42
 +S: Weymouth, MA 02188
 +
 +N: Dave Airlie
 +E: airlied@linux.ie
 +W: http://www.csn.ul.ie/~airlied
 +D: NFS over TCP patches
 +D: in-kernel DRM Maintainer
 +S: Longford, Ireland
 +S: Sydney, Australia
 +
 +N: Tigran A. Aivazian
 +E: tigran@veritas.com
 +W: http://www.moses.uklinux.net/patches
 +D: BFS filesystem
 +D: Intel IA32 CPU microcode update support
 +D: Various kernel patches
 +S: United Kingdom
 +
 +N: Werner Almesberger
 +E: werner@almesberger.net
 +W: http://www.almesberger.net/
 +D: dosfs, LILO, some fd features, ATM, various other hacks here and there
 +S: Buenos Aires
 +S: Argentina
 +
 +N: Tim Alpaerts
 +E: tim_alpaerts@toyota-motor-europe.com
 +D: 802.2 class II logical link control layer,
 +D: the humble start of an opening towards the IBM SNA protocols
 +S: Klaproosstraat 72 c 10
 +S: B-2610 Wilrijk-Antwerpen
 +S: Belgium
 +
 +N: Anton Altaparmakov
 +E: aia21@cantab.net
 +W: http://www-stu.christs.cam.ac.uk/~aia21/
 +D: Author of new NTFS driver, various other kernel hacks.
 +S: Christ's College
 +S: Cambridge CB2 3BU
 +S: United Kingdom
 +
 +N: C. Scott Ananian
 +E: cananian@alumni.princeton.edu
 +W: http://www.pdos.lcs.mit.edu/~cananian
 +P: 1024/85AD9EED AD C0 49 08 91 67 DF D7  FA 04 1A EE 09 E8 44 B0
 +D: Unix98 pty support.
 +D: APM update to 1.2 spec.
 +D: /devfs hacking.
 +S: 7 Kiwi Loop
 +S: Howell, NJ 07731
 +S: USA
 +
 +N: Erik Andersen
 +E: andersen@codepoet.org
 +W: http://www.codepoet.org/
 +P: 1024D/30D39057 1BC4 2742 E885 E4DE 9301  0C82 5F9B 643E 30D3 9057
 +D: Maintainer of ide-cd and Uniform CD-ROM driver, 
 +D: ATAPI CD-Changer support, Major 2.1.x CD-ROM update.
 +S: 352 North 525 East
 +S: Springville, Utah 84663
 +S: USA
 +
 +N: Michael Ang
 +E: mang@subcarrier.org
 +W: http://www.subcarrier.org/mang
 +D: Linux/PA-RISC hacker
 +S: 85 Frank St.
 +S: Ottawa, Ontario
 +S: Canada K2P 0X3
 +
 +N: H. Peter Anvin
 +E: hpa@zytor.com
 +W: http://www.zytor.com/~hpa/
 +P: 2047/2A960705 BA 03 D3 2C 14 A8 A8 BD  1E DF FE 69 EE 35 BD 74
 +D: Author of the SYSLINUX boot loader, maintainer of the linux.* news
 +D: hierarchy and the Linux Device List; various kernel hacks
 +S: 4390 Albany Drive #46
 +S: San Jose, California 95129
 +S: USA
 +
 +N: Andrea Arcangeli
 +E: andrea@suse.de
 +W: http://www.kernel.org/pub/linux/kernel/people/andrea/
 +P: 1024D/68B9CB43 13D9 8355 295F 4823 7C49  C012 DFA1 686E 68B9 CB43
 +P: 1024R/CB4660B9 CC A0 71 81 F4 A0 63 AC  C0 4B 81 1D 8C 15 C8 E5
 +D: Parport hacker
 +D: Implemented a workaround for some interrupt buggy printers
 +D: Author of pscan that helps to fix lp/parport bugs
 +D: Author of lil (Linux Interrupt Latency benchmark)
 +D: Fixed the shm swap deallocation at swapoff time (try_to_unuse message)
 +D: VM hacker
 +D: Various other kernel hacks
 +S: Via Cicalini 26
 +S: Imola 40026
 +S: Italy
 +
 +N: Derek Atkins
 +E: warlord@MIT.EDU
 +D: Linux-AFS Port, random kernel hacker,
 +D: VFS fixes (new notify_change in particular)
 +D: Moving all VFS access checks into the file systems
 +S: MIT Room E15-341
 +S: 20 Ames Street
 +S: Cambridge, Massachusetts 02139
 +S: USA
 +
 +N: Michel Aubry
 +E: giovanni <giovanni@sudfr.com>
 +D: Aladdin 1533/1543(C) chipset IDE
 +D: VIA MVP-3/TX Pro III chipset IDE
 +
 +N: Jens Axboe
 +E: axboe@suse.de
 +D: Linux CD-ROM maintainer, DVD support
 +D: elevator + block layer rewrites
 +D: highmem I/O support
 +D: misc hacking on IDE, SCSI, block drivers, etc
 +S: Peter Bangs Vej 258, 2TH
 +S: 2500 Valby
 +S: Denmark
 +
 +N: John Aycock
 +E: aycock@cpsc.ucalgary.ca
 +D: Adaptec 274x driver
 +S: Department of Computer Science
 +S: University of Calgary
 +S: Calgary, Alberta
 +S: Canada
 +
 +N: Miles Bader
 +E: miles@gnu.org
 +D: v850 port (uClinux)
 +S: NEC Corporation
 +S: 1753 Shimonumabe, Nakahara-ku
 +S: Kawasaki 211-8666
 +S: Japan
 +
 +N: Ralf Baechle
 +E: ralf@gnu.org
 +P: 1024/AF7B30C1 CF 97 C2 CC 6D AE A7 FE  C8 BA 9C FC 88 DE 32 C3
 +D: Linux/MIPS port
 +D: Linux/68k hacker
 +S: Hauptstrasse 19
 +S: 79837 St. Blasien
 +S: Germany
 +
 +N: Krishna Balasubramanian
 +E: balasub@cis.ohio-state.edu
 +D: Wrote SYS V IPC (part of standard kernel since 0.99.10)
 +
 +N: Dario Ballabio
 +E: ballabio_dario@emc.com
 +E: dario.ballabio@tiscalinet.it
 +E: dario.ballabio@inwind.it
 +D: Author and maintainer of the Ultrastor 14F/34F SCSI driver
 +D: Author and maintainer of the EATA ISA/EISA/PCI SCSI driver
 +S: EMC Corporation
 +S: Milano
 +S: Italy
 +
 +N: Paul Bame
 +E: bame@debian.org
 +E: bame@puffin.external.hp.com
 +E: paul_bame@hp.com
 +W: http://www.parisc-linux.org
 +D: PA-RISC 32 and 64-bit early boot, firmware interface, interrupts, misc
 +S: MS42
 +S: Hewlett-Packard
 +S: 3404 E Harmony Rd
 +S: Fort Collins, CO 80525
 +
 +N: Arindam Banerji
 +E: axb@cse.nd.edu
 +D: Contributed ESDI driver routines needed to port LINUX to the PS/2 MCA.
 +S: Department of Computer Science & Eng.
 +S: University of Notre Dame
 +S: Notre Dame, Indiana
 +S: USA
 +
 +N: Greg Banks
 +E: gnb@alphalink.com.au
 +D: IDT77105 ATM network driver
 +D: some SuperH port work
 +D: some trivial futzing with kconfig
 +
 +N: James Banks
 +E: james@sovereign.org
 +D: TLAN network driver
 +D: Logitech Busmouse driver
 +
 +N: Krzysztof G. Baranowski
 +E: kgb@manjak.knm.org.pl
 +P: 1024/FA6F16D1 96 D1 1A CF 5F CA 69 EC  F9 4F 36 1F 6D 60 7B DA
 +D: Maintainer of the System V file system.
 +D: System V fs update for 2.1.x dcache.
 +D: Forward ported a couple of SCSI drivers.
 +D: Various bugfixes.
 +S: ul. Koscielna 12a
 +S: 62-300 Wrzesnia
 +S: Poland
 +
 +N: Fred Barnes
 +E: frmb2@ukc.ac.uk
 +D: Various parport/ppdev hacks and fixes
 +S: Computing Lab, The University
 +S: Canterbury, KENT
 +S: CT2 7NF
 +S: England
 +
 +N: Paul Barton-Davis
 +E: pbd@op.net
 +D: Driver for WaveFront soundcards (Turtle Beach Maui, Tropez, Tropez+)
 +D: Various bugfixes and changes to sound drivers
 +S: USA 
 +
 +N: Carlos Henrique Bauer
 +E: chbauer@acm.org
 +E: bauer@atlas.unisinos.br
 +D: Some new sysctl entries for the parport driver.
 +D: New sysctl function for handling unsigned longs
 +S: Universidade do Vale do Rio dos Sinos - UNISINOS
 +S: DSI/IDASI
 +S: Av. Unisinos, 950
 +S: 93022000 Sao Leopoldo RS
 +S: Brazil
 +
 +N: Peter Bauer
 +E: 100136.3530@compuserve.com
 +D: Driver for depca-ethernet-board
 +S: 69259 Wilhemsfeld
 +S: Rainweg 15
 +S: Germany
 +
 +N: Fred Baumgarten
 +E: dc6iq@insl1.etec.uni-karlsruhe.de
 +E: dc6iq@adacom.org
 +E: dc6iq@db0ais.#hes.deu.eu (packet radio)
 +D: NET-2 & netstat(8)
 +S: Soevener Strasse 11
 +S: 53773 Hennef
 +S: Germany
 +
 +N: Donald Becker
 +E: becker@cesdis.gsfc.nasa.gov
 +D: General low-level networking hacker
 +D: Most of the ethercard drivers
 +D: Original author of the NFS server
 +S: USRA Center of Excellence in Space Data and Information Sciences
 +S: Code 930.5, Goddard Space Flight Center
 +S: Greenbelt, Maryland 20771
 +S: USA
 +
 +N: Adam Belay
 +E: ambx1@neo.rr.com
 +D: Linux Plug and Play Support
 +S: USA
 +
 +N: Daniele Bellucci
 +E: bellucda@tiscali.it
 +D: Various Janitor work.
 +W: http://web.tiscali.it/bellucda
 +S: Via Delle Palme, 9
 +S: Terni 05100
 +S: Italy
 +
 +N: Krzysztof Benedyczak
 +E: golbi@mat.uni.torun.pl
 +W: http://www.mat.uni.torun.pl/~golbi
 +D: POSIX message queues fs (with M. Wronski)
 +S: ul. Podmiejska 52
 +S: Radunica
 +S: 83-000 Pruszcz Gdanski
 +S: Poland
 +
 +N: Randolph Bentson
 +E: bentson@grieg.seaslug.org
 +W: http://www.aa.net/~bentson/
 +P: 1024/39ED5729 5C A8 7A F4 B2 7A D1 3E  B5 3B 81 CF 47 30 11 71
 +D: Author of driver for Cyclom-Y and Cyclades-Z async mux
 +S: 2322 37th Ave SW
 +S: Seattle, Washington 98126-2010
 +S: USA
 +
 +N: Stephen R. van den Berg (AKA BuGless)
 +E: berg@pool.informatik.rwth-aachen.de
 +D: General kernel, gcc, and libc hacker
 +D: Specialisation: tweaking, ensuring portability, tweaking, cleaning,
 +D: tweaking and occasionally debugging :-)
 +S: Bouwensstraat 22
 +S: 6369 BG Simpelveld
 +S: The Netherlands
 +
 +N: Peter Berger
 +E: pberger@brimson.com
 +W: http://www.brimson.com
 +D: Author/maintainer of Digi AccelePort USB driver
 +S: 1549 Hiironen Rd.
 +S: Brimson, MN  55602
 +S: USA
 +
 +N: Hennus Bergman
 +P: 1024/77D50909 76 99 FD 31 91 E1 96 1C  90 BB 22 80 62 F6 BD 63
 +D: Author and maintainer of the QIC-02 tape driver
 +S: The Netherlands
 +
 +N: Tomas Berndtsson
 +E: tomas@nocrew.org
 +W: http://tomas.nocrew.org/
 +D: dsp56k device driver
 +
 +N: Ross Biro
 +E: bir7@leland.Stanford.Edu
 +D: Original author of the Linux networking code
 +
 +N: Anton Blanchard
 +E: anton@samba.org
 +W: http://samba.org/~anton/
 +P: 1024/8462A731 4C 55 86 34 44 59 A7 99  2B 97 88 4A 88 9A 0D 97
 +D: sun4 port, Sparc hacker
 +
 +N: Hugh Blemings
 +E: hugh@misc.nu
 +W: http://misc.nu/hugh/
 +D: Author and maintainer of the Keyspan USB to Serial drivers
 +S: Po Box 234
 +S: Belconnen ACT 2616
 +S: Australia
 +
 +N: Philip Blundell
 +E: philb@gnu.org
 +D: Linux/ARM hacker
 +D: Device driver hacker (eexpress, 3c505, c-qcam, ...)
 +D: m68k port to HP9000/300
 +D: AUN network protocols
 +D: Co-architect of the parallel port sharing system
 +D: IPv6 netfilter
 +S: FutureTV Labs Ltd
 +S: Brunswick House, 61-69 Newmarket Rd, Cambridge CB5 8EG
 +S: United Kingdom
 +
 +N: Thomas Bogend�rfer
 +E: tsbogend@alpha.franken.de
 +D: PCnet32 driver, SONIC driver, JAZZ_ESP driver
 +D: newport abscon driver, g364 framebuffer driver
 +D: strace for Linux/Alpha
 +D: Linux/MIPS hacker
 +S: Schafhofstr. 40
 +S: 90556 Cadolzburg
 +S: Germany
 +
 +N: Bill Bogstad
 +E: bogstad@pobox.com
 +D: wrote /proc/self hack, minor samba & dosemu patches
 +
 +N: Axel Boldt
 +E: axel@uni-paderborn.de
 +W: http://math-www.uni-paderborn.de/~axel/
 +D: Configuration help text support
 +D: Linux CD and Support Giveaway List
 +
 +N: Erik Inge Bols�
 +E: knan@mo.himolde.no
 +D: Misc kernel hacks
 +
 +N: Andreas E. Bombe
 +E: andreas.bombe@munich.netsurf.de
 +W: http://home.pages.de/~andreas.bombe/
 +P: 1024/04880A44 72E5 7031 4414 2EB6 F6B4  4CBD 1181 7032 0488 0A44
 +D: IEEE 1394 subsystem rewrite and maintainer
 +D: Texas Instruments PCILynx IEEE 1394 driver
 +
 +N: Al Borchers
 +E: alborchers@steinerpoint.com
 +D: Author/maintainer of Digi AccelePort USB driver
 +D: work on usbserial and keyspan_pda drivers
 +S: 4912 Zenith Ave. S.
 +S: Minneapolis, MN  55410
 +S: USA
 +
 +N: Marc Boucher
 +E: marc@mbsi.ca
 +P: CA 67 A5 1A 38 CE B6 F2  D5 83 51 03 D2 9C 30 9E  CE D2 DD 65
 +D: Netfilter core
 +D: IP policy routing by mark
 +D: Various fixes (mostly networking)
 +S: Montreal, Quebec
 +S: Canada
 +
 +N: Zolt�n B�sz�rm�nyi
 +E: zboszor@mail.externet.hu
 +D: MTRR emulation with Cyrix style ARR registers, Athlon MTRR support
 +
 +N: John Boyd
 +E: boyd@cis.ohio-state.edu
 +D: Co-author of wd7000 SCSI driver
 +S: 101 Curl Drive #591
 +S: Columbus, Ohio 43210
 +S: USA
 +
 +N: Peter Braam
 +E: braam@clusterfs.com
 +W: http://www.clusterfs.com/
 +D: Coda & InterMezzo filesystems
 +S: 181 McNeil
 +S: Canmore, AB
 +S: Canada, T1W 2R9
 +
 +N: Ryan Bradetich
 +E: rbradetich@uswest.net
 +D: Linux/PA-RISC hacker
 +S: 1200 Goldenrod Dr.
 +S: Nampa, Idaho 83686
 +
 +N: Derrick J. Brashear
 +E: shadow@dementia.org
 +W: http://www.dementia.org/~shadow
 +P: 512/71EC9367 C5 29 0F BC 83 51 B9 F0  BC 05 89 A0 4F 1F 30 05
 +D: Author of Sparc CS4231 audio driver, random Sparc work
 +S: 403 Gilmore Avenue
 +S: Trafford, Pennsylvania 15085
 +S: USA
 +
 +N: Dag Brattli
 +E: dagb@cs.uit.no
 +W: http://www.cs.uit.no/~dagb
 +D: IrDA Subsystem
 +S: 19. Wellington Road
 +S: Lancaster, LA1 4DN
 +S: UK, England
 +
 +N: Lars Brinkhoff
 +E: lars@nocrew.org
 +W: http://lars.nocrew.org/
 +D: dsp56k device driver
 +D: ptrace proxy in user mode kernel port
 +S: Kopmansg 2
 +S: 411 13  Goteborg
 +S: Sweden
 +
 +N: Dominik Brodowski
 +E: linux@brodo.de
 +W: http://www.brodo.de/
 +P: 1024D/725B37C6  190F 3E77 9C89 3B6D BECD  46EE 67C3 0308 725B 37C6
 +D: parts of CPUFreq code, ACPI bugfixes
 +S: Tuebingen, Germany
 +
 +N: Andries Brouwer
 +E: aeb@cwi.nl
 +D: random Linux hacker
 +S: Bessemerstraat 21
 +S: Amsterdam
 +S: The Netherlands
 +
 +N: Zach Brown
 +E: zab@zabbo.net
 +D: maestro pci sound
 +
 +N: Gary Brubaker
 +E: xavyer@ix.netcom.com
 +D: USB Serial Empeg Empeg-car Mark I/II Driver
 +
 +N: Matthias Bruestle
 +E: m@mbsks.franken.de
 +D: REINER SCT cyberJack pinpad/e-com USB chipcard reader driver
 +S: Germany
 +
 +N: Adrian Bunk
 +E: bunk@stusta.de
 +P: 1024D/4F12B400  B29C E71E FE19 6755 5C8A  84D4 99FC EA98 4F12 B400
 +D: misc kernel hacking and testing
 +S: Grasmeierstrasse 11
 +S: 80805 Muenchen
 +S: Germany
 +
 +N: Ray Burr
 +E: ryb@nightmare.com
 +D: Original author of Amiga FFS filesystem
 +S: Orlando, Florida
 +S: USA
 +
 +N: Lennert Buytenhek
 +E: buytenh@gnu.org
 +D: Rewrite of the ethernet bridging code
 +S: Ravenhorst 58B
 +S: 2317 AK Leiden
 +S: The Netherlands
 +
 +N: Michael Callahan
 +E: callahan@maths.ox.ac.uk
 +D: PPP for Linux
 +S: The Mathematical Institute
 +S: 25-29 St Giles
 +S: Oxford
 +S: United Kingdom
 +
 +N: Luiz Fernando N. Capitulino
 +E: lcapitulino@terra.com.br
 +E: lcapitulino@prefeitura.sp.gov.br
 +W: http://www.telecentros.sp.gov.br
 +D: Little fixes and a lot of janitorial work
 +S: E-GOV Telecentros SP
 +S: Brazil
 +
 +N: Remy Card
 +E: Remy.Card@masi.ibp.fr
 +E: Remy.Card@linux.org
 +D: Extended file system [defunct] designer and developer
 +D: Second extended file system designer and developer
 +S: Institut Blaise Pascal
 +S: 4 Place Jussieu
 +S: 75252 Paris Cedex 05
 +S: France
 +
 +N: Ulf Carlsson
 +D: SGI Indy audio (HAL2) drivers
 +E: ulfc@bun.falkenberg.se
 +
 +N: Ed Carp
 +E: ecarp@netcom.com
 +D: uucp, elm, pine, pico port
 +D: cron, at(1) developer
 +S: 48287 Sawleaf
 +S: Fremont, California 94539
 +S: USA
 +
 +N: Florent Chabaud
 +E: florent.chabaud@polytechnique.org
 +D: software suspend
 +S: SGDN/DCSSI/SDS/LTI
 +S: 58, Bd Latour-Maubourg
 +S: 75700 Paris 07 SP
 +S: France
 +
 +N: Gordon Chaffee
 +E: chaffee@cs.berkeley.edu
 +W: http://bmrc.berkeley.edu/people/chaffee/
 +D: vfat, fat32, joliet, native language support
 +S: 3700 Warwick Road
 +S: Fremont, California 94555
 +S: USA
 +
 +N: Chih-Jen Chang
 +E: chihjenc@scf.usc.edu
 +E: chihjen@iis.sinica.edu.tw
 +D: IGMP(Internet Group Management Protocol) version 2
 +S: 3F, 65 Tajen street
 +S: Tamsui town, Taipei county,
 +S: Taiwan 251
 +S: Republic of China
 +
 +N: Michael Elizabeth Chastain
 +E: mec@shout.net
 +D: Configure, Menuconfig, xconfig
 +
 +N: Raymond Chen
 +E: raymondc@microsoft.com
 +D: Author of Configure script
 +S: 14509 NE 39th Street #1096
 +S: Bellevue, Washington 98007
 +S: USA
 +
 +N: Christopher L. Cheney
 +E: ccheney@debian.org
 +E: ccheney@cheney.cx
 +W: http://www.cheney.cx
 +P: 1024D/8E384AF2 2D31 1927 87D7 1F24 9FF9  1BC5 D106 5AB3 8E38 4AF2
 +D: Vista Imaging usb webcam driver
 +S: 314 Prince of Wales
 +S: Conroe, TX 77304
 +S: USA
 +
 +N: Stuart Cheshire
 +E: cheshire@cs.stanford.edu
 +D: Author of Starmode Radio IP (STRIP) driver
 +D: Originator of design for new combined interrupt handlers
 +S: William Gates Department
 +S: Stanford University
 +S: Stanford, California 94305
 +S: USA
 +
 +N: Randolph Chung
 +E: tausq@debian.org
 +D: Linux/PA-RISC hacker
 +S: Los Altos, CA 94022
 +S: USA
 +
 +N: Juan Jose Ciarlante
]
]

234/2 2026/08/07 06:13 llm fixes-finder
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 33809
							output: 37
							thoughts: 218
						

Thoughts:
**Initial Investigation of the Git Import for `gadgetfs_bind` and `gadgetfs_unbind`**

Alright, so the first commit, `1da177e4c3f4`, that’s the starting point. I need to understand if `gadgetfs_unbind` was present from the very beginning, and how it relates to `gadgetfs_bind`. My first thought was to just check the full content of `gadgetfs_bind` in that commit. I glanced at the output, but realized I only got a snippet, so I'll need to go deeper.

Actually, now I recall from the `git-show` output that `gadgetfs_unbind` was indeed included, and it was in the error handling for `ENOMEM`. It’s looking like:

```c
static int gadgetfs_bind(struct usb_gadget *gadget)
{
// ...
enomem:
	gadgetfs_unbind (gadget);
	return -ENOMEM;
}
```

However, I'm not seeing the complete picture of `gadgetfs_bind`. This means the snippet isn’t sufficient to fully understand the context. So, I need to be absolutely sure. Let's `grep` for `gadgetfs_bind` within the `1da177e4c3f4` commit, specifically within `drivers/usb/gadget/inode.c`. That should give me the complete definition and surrounding code. Let's see what we find.



235/2 2026/08/07 06:13 tool git-show
0m Args:
map[Commit:1da177e4c3f4:drivers/usb/gadget/inode.c]

Results:
map[Output:
Full output is too long, showing 1000 out of 2110 lines.

[/*
  * inode.c -- user mode filesystem api for usb gadget controllers
  *
  * Copyright (C) 2003-2004 David Brownell
  * Copyright (C) 2003 Agilent Technologies
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
 
 // #define	DEBUG 			/* data to help fault diagnosis */
 // #define	VERBOSE		/* extra debug messages (success too) */
 
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/fs.h>
 #include <linux/pagemap.h>
 #include <linux/uts.h>
 #include <linux/wait.h>
 #include <linux/compiler.h>
 #include <asm/uaccess.h>
 #include <linux/slab.h>
 
 #include <linux/device.h>
 #include <linux/moduleparam.h>
 
 #include <linux/usb_gadgetfs.h>
 #include <linux/usb_gadget.h>
 
 
 /*
  * The gadgetfs API maps each endpoint to a file descriptor so that you
  * can use standard synchronous read/write calls for I/O.  There's some
  * O_NONBLOCK and O_ASYNC/FASYNC style i/o support.  Example usermode
  * drivers show how this works in practice.  You can also use AIO to
  * eliminate I/O gaps between requests, to help when streaming data.
  *
  * Key parts that must be USB-specific are protocols defining how the
  * read/write operations relate to the hardware state machines.  There
  * are two types of files.  One type is for the device, implementing ep0.
  * The other type is for each IN or OUT endpoint.  In both cases, the
  * user mode driver must configure the hardware before using it.
  *
  * - First, dev_config() is called when /dev/gadget/$CHIP is configured
  *   (by writing configuration and device descriptors).  Afterwards it
  *   may serve as a source of device events, used to handle all control
  *   requests other than basic enumeration.
  *
  * - Then either immediately, or after a SET_CONFIGURATION control request,
  *   ep_config() is called when each /dev/gadget/ep* file is configured
  *   (by writing endpoint descriptors).  Afterwards these files are used
  *   to write() IN data or to read() OUT data.  To halt the endpoint, a
  *   "wrong direction" request is issued (like reading an IN endpoint).
  *
  * Unlike "usbfs" the only ioctl()s are for things that are rare, and maybe
  * not possible on all hardware.  For example, precise fault handling with
  * respect to data left in endpoint fifos after aborted operations; or
  * selective clearing of endpoint halts, to implement SET_INTERFACE.
  */
 
 #define	DRIVER_DESC	"USB Gadget filesystem"
 #define	DRIVER_VERSION	"24 Aug 2004"
 
 static const char driver_desc [] = DRIVER_DESC;
 static const char shortname [] = "gadgetfs";
 
 MODULE_DESCRIPTION (DRIVER_DESC);
 MODULE_AUTHOR ("David Brownell");
 MODULE_LICENSE ("GPL");
 
 
 /*----------------------------------------------------------------------*/
 
 #define GADGETFS_MAGIC		0xaee71ee7
 #define DMA_ADDR_INVALID	(~(dma_addr_t)0)
 
 /* /dev/gadget/$CHIP represents ep0 and the whole device */
 enum ep0_state {
 	/* DISBLED is the initial state.
 	 */
 	STATE_DEV_DISABLED = 0,
 
 	/* Only one open() of /dev/gadget/$CHIP; only one file tracks
 	 * ep0/device i/o modes and binding to the controller.  Driver
 	 * must always write descriptors to initialize the device, then
 	 * the device becomes UNCONNECTED until enumeration.
 	 */
 	STATE_OPENED,
 
 	/* From then on, ep0 fd is in either of two basic modes:
 	 * - (UN)CONNECTED: read usb_gadgetfs_event(s) from it
 	 * - SETUP: read/write will transfer control data and succeed;
 	 *   or if "wrong direction", performs protocol stall
 	 */
 	STATE_UNCONNECTED,
 	STATE_CONNECTED,
 	STATE_SETUP,
 
 	/* UNBOUND means the driver closed ep0, so the device won't be
 	 * accessible again (DEV_DISABLED) until all fds are closed.
 	 */
 	STATE_DEV_UNBOUND,
 };
 
 /* enough for the whole queue: most events invalidate others */
 #define	N_EVENT			5
 
 struct dev_data {
 	spinlock_t			lock;
 	atomic_t			count;
 	enum ep0_state			state;
 	struct usb_gadgetfs_event	event [N_EVENT];
 	unsigned			ev_next;
 	struct fasync_struct		*fasync;
 	u8				current_config;
 
 	/* drivers reading ep0 MUST handle control requests (SETUP)
 	 * reported that way; else the host will time out.
 	 */
 	unsigned			usermode_setup : 1,
 					setup_in : 1,
 					setup_can_stall : 1,
 					setup_out_ready : 1,
 					setup_out_error : 1,
 					setup_abort : 1;
 
 	/* the rest is basically write-once */
 	struct usb_config_descriptor	*config, *hs_config;
 	struct usb_device_descriptor	*dev;
 	struct usb_request		*req;
 	struct usb_gadget		*gadget;
 	struct list_head		epfiles;
 	void				*buf;
 	wait_queue_head_t		wait;
 	struct super_block		*sb;
 	struct dentry			*dentry;
 
 	/* except this scratch i/o buffer for ep0 */
 	u8				rbuf [256];
 };
 
 static inline void get_dev (struct dev_data *data)
 {
 	atomic_inc (&data->count);
 }
 
 static void put_dev (struct dev_data *data)
 {
 	if (likely (!atomic_dec_and_test (&data->count)))
 		return;
 	/* needs no more cleanup */
 	BUG_ON (waitqueue_active (&data->wait));
 	kfree (data);
 }
 
 static struct dev_data *dev_new (void)
 {
 	struct dev_data		*dev;
 
 	dev = kmalloc (sizeof *dev, GFP_KERNEL);
 	if (!dev)
 		return NULL;
 	memset (dev, 0, sizeof *dev);
 	dev->state = STATE_DEV_DISABLED;
 	atomic_set (&dev->count, 1);
 	spin_lock_init (&dev->lock);
 	INIT_LIST_HEAD (&dev->epfiles);
 	init_waitqueue_head (&dev->wait);
 	return dev;
 }
 
 /*----------------------------------------------------------------------*/
 
 /* other /dev/gadget/$ENDPOINT files represent endpoints */
 enum ep_state {
 	STATE_EP_DISABLED = 0,
 	STATE_EP_READY,
 	STATE_EP_DEFER_ENABLE,
 	STATE_EP_ENABLED,
 	STATE_EP_UNBOUND,
 };
 
 struct ep_data {
 	struct semaphore		lock;
 	enum ep_state			state;
 	atomic_t			count;
 	struct dev_data			*dev;
 	/* must hold dev->lock before accessing ep or req */
 	struct usb_ep			*ep;
 	struct usb_request		*req;
 	ssize_t				status;
 	char				name [16];
 	struct usb_endpoint_descriptor	desc, hs_desc;
 	struct list_head		epfiles;
 	wait_queue_head_t		wait;
 	struct dentry			*dentry;
 	struct inode			*inode;
 };
 
 static inline void get_ep (struct ep_data *data)
 {
 	atomic_inc (&data->count);
 }
 
 static void put_ep (struct ep_data *data)
 {
 	if (likely (!atomic_dec_and_test (&data->count)))
 		return;
 	put_dev (data->dev);
 	/* needs no more cleanup */
 	BUG_ON (!list_empty (&data->epfiles));
 	BUG_ON (waitqueue_active (&data->wait));
 	BUG_ON (down_trylock (&data->lock) != 0);
 	kfree (data);
 }
 
 /*----------------------------------------------------------------------*/
 
 /* most "how to use the hardware" policy choices are in userspace:
  * mapping endpoint roles (which the driver needs) to the capabilities
  * which the usb controller has.  most of those capabilities are exposed
  * implicitly, starting with the driver name and then endpoint names.
  */
 
 static const char *CHIP;
 
 /*----------------------------------------------------------------------*/
 
 /* NOTE:  don't use dev_printk calls before binding to the gadget
  * at the end of ep0 configuration, or after unbind.
  */
 
 /* too wordy: dev_printk(level , &(d)->gadget->dev , fmt , ## args) */
 #define xprintk(d,level,fmt,args...) \
 	printk(level "%s: " fmt , shortname , ## args)
 
 #ifdef DEBUG
 #define DBG(dev,fmt,args...) \
 	xprintk(dev , KERN_DEBUG , fmt , ## args)
 #else
 #define DBG(dev,fmt,args...) \
 	do { } while (0)
 #endif /* DEBUG */
 
 #ifdef VERBOSE
 #define VDEBUG	DBG
 #else
 #define VDEBUG(dev,fmt,args...) \
 	do { } while (0)
 #endif /* DEBUG */
 
 #define ERROR(dev,fmt,args...) \
 	xprintk(dev , KERN_ERR , fmt , ## args)
 #define WARN(dev,fmt,args...) \
 	xprintk(dev , KERN_WARNING , fmt , ## args)
 #define INFO(dev,fmt,args...) \
 	xprintk(dev , KERN_INFO , fmt , ## args)
 
 
 /*----------------------------------------------------------------------*/
 
 /* SYNCHRONOUS ENDPOINT OPERATIONS (bulk/intr/iso)
  *
  * After opening, configure non-control endpoints.  Then use normal
  * stream read() and write() requests; and maybe ioctl() to get more
  * precise FIFO status when recovering from cancelation.
  */
 
 static void epio_complete (struct usb_ep *ep, struct usb_request *req)
 {
 	struct ep_data	*epdata = ep->driver_data;
 
 	if (!req->context)
 		return;
 	if (req->status)
 		epdata->status = req->status;
 	else
 		epdata->status = req->actual;
 	complete ((struct completion *)req->context);
 }
 
 /* tasklock endpoint, returning when it's connected.
  * still need dev->lock to use epdata->ep.
  */
 static int
 get_ready_ep (unsigned f_flags, struct ep_data *epdata)
 {
 	int	val;
 
 	if (f_flags & O_NONBLOCK) {
 		if (down_trylock (&epdata->lock) != 0)
 			goto nonblock;
 		if (epdata->state != STATE_EP_ENABLED) {
 			up (&epdata->lock);
 nonblock:
 			val = -EAGAIN;
 		} else
 			val = 0;
 		return val;
 	}
 
 	if ((val = down_interruptible (&epdata->lock)) < 0)
 		return val;
 newstate:
 	switch (epdata->state) {
 	case STATE_EP_ENABLED:
 		break;
 	case STATE_EP_DEFER_ENABLE:
 		DBG (epdata->dev, "%s wait for host\n", epdata->name);
 		if ((val = wait_event_interruptible (epdata->wait, 
 				epdata->state != STATE_EP_DEFER_ENABLE
 				|| epdata->dev->state == STATE_DEV_UNBOUND
 				)) < 0)
 			goto fail;
 		goto newstate;
 	// case STATE_EP_DISABLED:		/* "can't happen" */
 	// case STATE_EP_READY:			/* "can't happen" */
 	default:				/* error! */
 		pr_debug ("%s: ep %p not available, state %d\n",
 				shortname, epdata, epdata->state);
 		// FALLTHROUGH
 	case STATE_EP_UNBOUND:			/* clean disconnect */
 		val = -ENODEV;
 fail:
 		up (&epdata->lock);
 	}
 	return val;
 }
 
 static ssize_t
 ep_io (struct ep_data *epdata, void *buf, unsigned len)
 {
 	DECLARE_COMPLETION (done);
 	int value;
 
 	spin_lock_irq (&epdata->dev->lock);
 	if (likely (epdata->ep != NULL)) {
 		struct usb_request	*req = epdata->req;
 
 		req->context = &done;
 		req->complete = epio_complete;
 		req->buf = buf;
 		req->length = len;
 		value = usb_ep_queue (epdata->ep, req, GFP_ATOMIC);
 	} else
 		value = -ENODEV;
 	spin_unlock_irq (&epdata->dev->lock);
 
 	if (likely (value == 0)) {
 		value = wait_event_interruptible (done.wait, done.done);
 		if (value != 0) {
 			spin_lock_irq (&epdata->dev->lock);
 			if (likely (epdata->ep != NULL)) {
 				DBG (epdata->dev, "%s i/o interrupted\n",
 						epdata->name);
 				usb_ep_dequeue (epdata->ep, epdata->req);
 				spin_unlock_irq (&epdata->dev->lock);
 
 				wait_event (done.wait, done.done);
 				if (epdata->status == -ECONNRESET)
 					epdata->status = -EINTR;
 			} else {
 				spin_unlock_irq (&epdata->dev->lock);
 
 				DBG (epdata->dev, "endpoint gone\n");
 				epdata->status = -ENODEV;
 			}
 		}
 		return epdata->status;
 	}
 	return value;
 }
 
 
 /* handle a synchronous OUT bulk/intr/iso transfer */
 static ssize_t
 ep_read (struct file *fd, char __user *buf, size_t len, loff_t *ptr)
 {
 	struct ep_data		*data = fd->private_data;
 	void			*kbuf;
 	ssize_t			value;
 
 	if ((value = get_ready_ep (fd->f_flags, data)) < 0)
 		return value;
 
 	/* halt any endpoint by doing a "wrong direction" i/o call */
 	if (data->desc.bEndpointAddress & USB_DIR_IN) {
 		if ((data->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
 				== USB_ENDPOINT_XFER_ISOC)
 			return -EINVAL;
 		DBG (data->dev, "%s halt\n", data->name);
 		spin_lock_irq (&data->dev->lock);
 		if (likely (data->ep != NULL))
 			usb_ep_set_halt (data->ep);
 		spin_unlock_irq (&data->dev->lock);
 		up (&data->lock);
 		return -EBADMSG;
 	}
 
 	/* FIXME readahead for O_NONBLOCK and poll(); careful with ZLPs */
 
 	value = -ENOMEM;
 	kbuf = kmalloc (len, SLAB_KERNEL);
 	if (unlikely (!kbuf))
 		goto free1;
 
 	value = ep_io (data, kbuf, len);
 	VDEBUG (data->dev, "%s read %d OUT, status %d\n",
 		data->name, len, value);
 	if (value >= 0 && copy_to_user (buf, kbuf, value))
 		value = -EFAULT;
 
 free1:
 	up (&data->lock);
 	kfree (kbuf);
 	return value;
 }
 
 /* handle a synchronous IN bulk/intr/iso transfer */
 static ssize_t
 ep_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
 {
 	struct ep_data		*data = fd->private_data;
 	void			*kbuf;
 	ssize_t			value;
 
 	if ((value = get_ready_ep (fd->f_flags, data)) < 0)
 		return value;
 
 	/* halt any endpoint by doing a "wrong direction" i/o call */
 	if (!(data->desc.bEndpointAddress & USB_DIR_IN)) {
 		if ((data->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
 				== USB_ENDPOINT_XFER_ISOC)
 			return -EINVAL;
 		DBG (data->dev, "%s halt\n", data->name);
 		spin_lock_irq (&data->dev->lock);
 		if (likely (data->ep != NULL))
 			usb_ep_set_halt (data->ep);
 		spin_unlock_irq (&data->dev->lock);
 		up (&data->lock);
 		return -EBADMSG;
 	}
 
 	/* FIXME writebehind for O_NONBLOCK and poll(), qlen = 1 */
 
 	value = -ENOMEM;
 	kbuf = kmalloc (len, SLAB_KERNEL);
 	if (!kbuf)
 		goto free1;
 	if (copy_from_user (kbuf, buf, len)) {
 		value = -EFAULT;
 		goto free1;
 	}
 
 	value = ep_io (data, kbuf, len);
 	VDEBUG (data->dev, "%s write %d IN, status %d\n",
 		data->name, len, value);
 free1:
 	up (&data->lock);
 	kfree (kbuf);
 	return value;
 }
 
 static int
 ep_release (struct inode *inode, struct file *fd)
 {
 	struct ep_data		*data = fd->private_data;
 
 	/* clean up if this can be reopened */
 	if (data->state != STATE_EP_UNBOUND) {
 		data->state = STATE_EP_DISABLED;
 		data->desc.bDescriptorType = 0;
 		data->hs_desc.bDescriptorType = 0;
 	}
 	put_ep (data);
 	return 0;
 }
 
 static int ep_ioctl (struct inode *inode, struct file *fd,
 		unsigned code, unsigned long value)
 {
 	struct ep_data		*data = fd->private_data;
 	int			status;
 
 	if ((status = get_ready_ep (fd->f_flags, data)) < 0)
 		return status;
 
 	spin_lock_irq (&data->dev->lock);
 	if (likely (data->ep != NULL)) {
 		switch (code) {
 		case GADGETFS_FIFO_STATUS:
 			status = usb_ep_fifo_status (data->ep);
 			break;
 		case GADGETFS_FIFO_FLUSH:
 			usb_ep_fifo_flush (data->ep);
 			break;
 		case GADGETFS_CLEAR_HALT:
 			status = usb_ep_clear_halt (data->ep);
 			break;
 		default:
 			status = -ENOTTY;
 		}
 	} else
 		status = -ENODEV;
 	spin_unlock_irq (&data->dev->lock);
 	up (&data->lock);
 	return status;
 }
 
 /*----------------------------------------------------------------------*/
 
 /* ASYNCHRONOUS ENDPOINT I/O OPERATIONS (bulk/intr/iso) */
 
 struct kiocb_priv {
 	struct usb_request	*req;
 	struct ep_data		*epdata;
 	void			*buf;
 	char __user		*ubuf;
 	unsigned		actual;
 };
 
 static int ep_aio_cancel(struct kiocb *iocb, struct io_event *e)
 {
 	struct kiocb_priv	*priv = iocb->private;
 	struct ep_data		*epdata;
 	int			value;
 
 	local_irq_disable();
 	epdata = priv->epdata;
 	// spin_lock(&epdata->dev->lock);
 	kiocbSetCancelled(iocb);
 	if (likely(epdata && epdata->ep && priv->req))
 		value = usb_ep_dequeue (epdata->ep, priv->req);
 	else
 		value = -EINVAL;
 	// spin_unlock(&epdata->dev->lock);
 	local_irq_enable();
 
 	aio_put_req(iocb);
 	return value;
 }
 
 static ssize_t ep_aio_read_retry(struct kiocb *iocb)
 {
 	struct kiocb_priv	*priv = iocb->private;
 	ssize_t			status = priv->actual;
 
 	/* we "retry" to get the right mm context for this: */
 	status = copy_to_user(priv->ubuf, priv->buf, priv->actual);
 	if (unlikely(0 != status))
 		status = -EFAULT;
 	else
 		status = priv->actual;
 	kfree(priv->buf);
 	kfree(priv);
 	aio_put_req(iocb);
 	return status;
 }
 
 static void ep_aio_complete(struct usb_ep *ep, struct usb_request *req)
 {
 	struct kiocb		*iocb = req->context;
 	struct kiocb_priv	*priv = iocb->private;
 	struct ep_data		*epdata = priv->epdata;
 
 	/* lock against disconnect (and ideally, cancel) */
 	spin_lock(&epdata->dev->lock);
 	priv->req = NULL;
 	priv->epdata = NULL;
 	if (NULL == iocb->ki_retry
 			|| unlikely(0 == req->actual)
 			|| unlikely(kiocbIsCancelled(iocb))) {
 		kfree(req->buf);
 		kfree(priv);
 		iocb->private = NULL;
 		/* aio_complete() reports bytes-transferred _and_ faults */
 		if (unlikely(kiocbIsCancelled(iocb)))
 			aio_put_req(iocb);
 		else
 			aio_complete(iocb,
 				req->actual ? req->actual : req->status,
 				req->status);
 	} else {
 		/* retry() won't report both; so we hide some faults */
 		if (unlikely(0 != req->status))
 			DBG(epdata->dev, "%s fault %d len %d\n",
 				ep->name, req->status, req->actual);
 
 		priv->buf = req->buf;
 		priv->actual = req->actual;
 		kick_iocb(iocb);
 	}
 	spin_unlock(&epdata->dev->lock);
 
 	usb_ep_free_request(ep, req);
 	put_ep(epdata);
 }
 
 static ssize_t
 ep_aio_rwtail(
 	struct kiocb	*iocb,
 	char		*buf,
 	size_t		len,
 	struct ep_data	*epdata,
 	char __user	*ubuf
 )
 {
 	struct kiocb_priv	*priv = (void *) &iocb->private;
 	struct usb_request	*req;
 	ssize_t			value;
 
 	priv = kmalloc(sizeof *priv, GFP_KERNEL);
 	if (!priv) {
 		value = -ENOMEM;
 fail:
 		kfree(buf);
 		return value;
 	}
 	iocb->private = priv;
 	priv->ubuf = ubuf;
 
 	value = get_ready_ep(iocb->ki_filp->f_flags, epdata);
 	if (unlikely(value < 0)) {
 		kfree(priv);
 		goto fail;
 	}
 
 	iocb->ki_cancel = ep_aio_cancel;
 	get_ep(epdata);
 	priv->epdata = epdata;
 	priv->actual = 0;
 
 	/* each kiocb is coupled to one usb_request, but we can't
 	 * allocate or submit those if the host disconnected.
 	 */
 	spin_lock_irq(&epdata->dev->lock);
 	if (likely(epdata->ep)) {
 		req = usb_ep_alloc_request(epdata->ep, GFP_ATOMIC);
 		if (likely(req)) {
 			priv->req = req;
 			req->buf = buf;
 			req->length = len;
 			req->complete = ep_aio_complete;
 			req->context = iocb;
 			value = usb_ep_queue(epdata->ep, req, GFP_ATOMIC);
 			if (unlikely(0 != value))
 				usb_ep_free_request(epdata->ep, req);
 		} else
 			value = -EAGAIN;
 	} else
 		value = -ENODEV;
 	spin_unlock_irq(&epdata->dev->lock);
 
 	up(&epdata->lock);
 
 	if (unlikely(value)) {
 		kfree(priv);
 		put_ep(epdata);
 	} else
 		value = -EIOCBQUEUED;
 	return value;
 }
 
 static ssize_t
 ep_aio_read(struct kiocb *iocb, char __user *ubuf, size_t len, loff_t o)
 {
 	struct ep_data		*epdata = iocb->ki_filp->private_data;
 	char			*buf;
 
 	if (unlikely(epdata->desc.bEndpointAddress & USB_DIR_IN))
 		return -EINVAL;
 	buf = kmalloc(len, GFP_KERNEL);
 	if (unlikely(!buf))
 		return -ENOMEM;
 	iocb->ki_retry = ep_aio_read_retry;
 	return ep_aio_rwtail(iocb, buf, len, epdata, ubuf);
 }
 
 static ssize_t
 ep_aio_write(struct kiocb *iocb, const char __user *ubuf, size_t len, loff_t o)
 {
 	struct ep_data		*epdata = iocb->ki_filp->private_data;
 	char			*buf;
 
 	if (unlikely(!(epdata->desc.bEndpointAddress & USB_DIR_IN)))
 		return -EINVAL;
 	buf = kmalloc(len, GFP_KERNEL);
 	if (unlikely(!buf))
 		return -ENOMEM;
 	if (unlikely(copy_from_user(buf, ubuf, len) != 0)) {
 		kfree(buf);
 		return -EFAULT;
 	}
 	return ep_aio_rwtail(iocb, buf, len, epdata, NULL);
 }
 
 /*----------------------------------------------------------------------*/
 
 /* used after endpoint configuration */
 static struct file_operations ep_io_operations = {
 	.owner =	THIS_MODULE,
 	.llseek =	no_llseek,
 
 	.read =		ep_read,
 	.write =	ep_write,
 	.ioctl =	ep_ioctl,
 	.release =	ep_release,
 
 	.aio_read =	ep_aio_read,
 	.aio_write =	ep_aio_write,
 };
 
 /* ENDPOINT INITIALIZATION
  *
  *     fd = open ("/dev/gadget/$ENDPOINT", O_RDWR)
  *     status = write (fd, descriptors, sizeof descriptors)
  *
  * That write establishes the endpoint configuration, configuring
  * the controller to process bulk, interrupt, or isochronous transfers
  * at the right maxpacket size, and so on.
  *
  * The descriptors are message type 1, identified by a host order u32
  * at the beginning of what's written.  Descriptor order is: full/low
  * speed descriptor, then optional high speed descriptor.
  */
 static ssize_t
 ep_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
 {
 	struct ep_data		*data = fd->private_data;
 	struct usb_ep		*ep;
 	u32			tag;
 	int			value;
 
 	if ((value = down_interruptible (&data->lock)) < 0)
 		return value;
 
 	if (data->state != STATE_EP_READY) {
 		value = -EL2HLT;
 		goto fail;
 	}
 
 	value = len;
 	if (len < USB_DT_ENDPOINT_SIZE + 4)
 		goto fail0;
 
 	/* we might need to change message format someday */
 	if (copy_from_user (&tag, buf, 4)) {
 		goto fail1;
 	}
 	if (tag != 1) {
 		DBG(data->dev, "config %s, bad tag %d\n", data->name, tag);
 		goto fail0;
 	}
 	buf += 4;
 	len -= 4;
 
 	/* NOTE:  audio endpoint extensions not accepted here;
 	 * just don't include the extra bytes.
 	 */
 
 	/* full/low speed descriptor, then high speed */
 	if (copy_from_user (&data->desc, buf, USB_DT_ENDPOINT_SIZE)) {
 		goto fail1;
 	}
 	if (data->desc.bLength != USB_DT_ENDPOINT_SIZE
 			|| data->desc.bDescriptorType != USB_DT_ENDPOINT)
 		goto fail0;
 	if (len != USB_DT_ENDPOINT_SIZE) {
 		if (len != 2 * USB_DT_ENDPOINT_SIZE)
 			goto fail0;
 		if (copy_from_user (&data->hs_desc, buf + USB_DT_ENDPOINT_SIZE,
 					USB_DT_ENDPOINT_SIZE)) {
 			goto fail1;
 		}
 		if (data->hs_desc.bLength != USB_DT_ENDPOINT_SIZE
 				|| data->hs_desc.bDescriptorType
 					!= USB_DT_ENDPOINT) {
 			DBG(data->dev, "config %s, bad hs length or type\n",
 					data->name);
 			goto fail0;
 		}
 	}
 	value = len;
 
 	spin_lock_irq (&data->dev->lock);
 	if (data->dev->state == STATE_DEV_UNBOUND) {
 		value = -ENOENT;
 		goto gone;
 	} else if ((ep = data->ep) == NULL) {
 		value = -ENODEV;
 		goto gone;
 	}
 	switch (data->dev->gadget->speed) {
 	case USB_SPEED_LOW:
 	case USB_SPEED_FULL:
 		value = usb_ep_enable (ep, &data->desc);
 		if (value == 0)
 			data->state = STATE_EP_ENABLED;
 		break;
 #ifdef	HIGHSPEED
 	case USB_SPEED_HIGH:
 		/* fails if caller didn't provide that descriptor... */
 		value = usb_ep_enable (ep, &data->hs_desc);
 		if (value == 0)
 			data->state = STATE_EP_ENABLED;
 		break;
 #endif
 	default:
 		DBG (data->dev, "unconnected, %s init deferred\n",
 				data->name);
 		data->state = STATE_EP_DEFER_ENABLE;
 	}
 	if (value == 0)
 		fd->f_op = &ep_io_operations;
 gone:
 	spin_unlock_irq (&data->dev->lock);
 	if (value < 0) {
 fail:
 		data->desc.bDescriptorType = 0;
 		data->hs_desc.bDescriptorType = 0;
 	}
 	up (&data->lock);
 	return value;
 fail0:
 	value = -EINVAL;
 	goto fail;
 fail1:
 	value = -EFAULT;
 	goto fail;
 }
 
 static int
 ep_open (struct inode *inode, struct file *fd)
 {
 	struct ep_data		*data = inode->u.generic_ip;
 	int			value = -EBUSY;
 
 	if (down_interruptible (&data->lock) != 0)
 		return -EINTR;
 	spin_lock_irq (&data->dev->lock);
 	if (data->dev->state == STATE_DEV_UNBOUND)
 		value = -ENOENT;
 	else if (data->state == STATE_EP_DISABLED) {
 		value = 0;
 		data->state = STATE_EP_READY;
 		get_ep (data);
 		fd->private_data = data;
 		VDEBUG (data->dev, "%s ready\n", data->name);
 	} else
 		DBG (data->dev, "%s state %d\n",
 			data->name, data->state);
 	spin_unlock_irq (&data->dev->lock);
 	up (&data->lock);
 	return value;
 }
 
 /* used before endpoint configuration */
 static struct file_operations ep_config_operations = {
 	.owner =	THIS_MODULE,
 	.llseek =	no_llseek,
 
 	.open =		ep_open,
 	.write =	ep_config,
 	.release =	ep_release,
 };
 
 /*----------------------------------------------------------------------*/
 
 /* EP0 IMPLEMENTATION can be partly in userspace.
  *
  * Drivers that use this facility receive various events, including
  * control requests the kernel doesn't handle.  Drivers that don't
  * use this facility may be too simple-minded for real applications.
  */
 
 static inline void ep0_readable (struct dev_data *dev)
 {
 	wake_up (&dev->wait);
 	kill_fasync (&dev->fasync, SIGIO, POLL_IN);
 }
 
 static void clean_req (struct usb_ep *ep, struct usb_request *req)
 {
 	struct dev_data		*dev = ep->driver_data;
 
 	if (req->buf != dev->rbuf) {
 		usb_ep_free_buffer (ep, req->buf, req->dma, req->length);
 		req->buf = dev->rbuf;
 		req->dma = DMA_ADDR_INVALID;
 	}
 	req->complete = epio_complete;
 	dev->setup_out_ready = 0;
 }
 
 static void ep0_complete (struct usb_ep *ep, struct usb_request *req)
 {
 	struct dev_data		*dev = ep->driver_data;
 	int			free = 1;
 
 	/* for control OUT, data must still get to userspace */
 	if (!dev->setup_in) {
 		dev->setup_out_error = (req->status != 0);
 		if (!dev->setup_out_error)
 			free = 0;
 		dev->setup_out_ready = 1;
 		ep0_readable (dev);
 	} else if (dev->state == STATE_SETUP)
 		dev->state = STATE_CONNECTED;
 
 	/* clean up as appropriate */
 	if (free && req->buf != &dev->rbuf)
 		clean_req (ep, req);
 	req->complete = epio_complete;
 }
 
 static int setup_req (struct usb_ep *ep, struct usb_request *req, u16 len)
 {
 	struct dev_data	*dev = ep->driver_data;
 
 	if (dev->setup_out_ready) {
 		DBG (dev, "ep0 request busy!\n");
 		return -EBUSY;
 	}
 	if (len > sizeof (dev->rbuf))
 		req->buf = usb_ep_alloc_buffer (ep, len, &req->dma, GFP_ATOMIC);
 	if (req->buf == 0) {
 		req->buf = dev->rbuf;
 		return -ENOMEM;
 	}
 	req->complete = ep0_complete;
 	req->length = len;
 	return 0;
 }
 
 static ssize_t
 ep0_read (struct file *fd, char __user *buf, size_t len, loff_t *ptr)
 {
 	struct dev_data			*dev = fd->private_data;
 	ssize_t				retval;
 	enum ep0_state			state;
 
 	spin_lock_irq (&dev->lock);
 
 	/* report fd mode change before acting on it */
 	if (dev->setup_abort) {
 		dev->setup_abort = 0;
 		retval = -EIDRM;
 		goto done;
 	}
 
 	/* control DATA stage */
 	if ((state = dev->state) == STATE_SETUP) {
 
 		if (dev->setup_in) {		/* stall IN */
 			VDEBUG(dev, "ep0in stall\n");
 			(void) usb_ep_set_halt (dev->gadget->ep0);
 			retval = -EL2HLT;
 			dev->state = STATE_CONNECTED;
 
 		} else if (len == 0) {		/* ack SET_CONFIGURATION etc */
 			struct usb_ep		*ep = dev->gadget->ep0;
 			struct usb_request	*req = dev->req;
 
 			if ((retval = setup_req (ep, req, 0)) == 0)
 				retval = usb_ep_queue (ep, req, GFP_ATOMIC);
 			dev->state = STATE_CONNECTED;
 
 			/* assume that was SET_CONFIGURATION */
 			if (dev->current_config) {
 				unsigned power;
 #ifdef	HIGHSPEED
 				if (dev->gadget->speed == USB_SPEED_HIGH)
 					power = dev->hs_config->bMaxPower;
 				else
 #endif
 					power = dev->config->bMaxPower;
 				usb_gadget_vbus_draw(dev->gadget, 2 * power);
 			}
 
 		} else {			/* collect OUT data */
 			if ((fd->f_flags & O_NONBLOCK) != 0
 					&& !dev->setup_out_ready) {
 				retval = -EAGAIN;
 				goto done;
 			}
 			spin_unlock_irq (&dev->lock);
 			retval = wait_event_interruptible (dev->wait,
 					dev->setup_out_ready != 0);
]
]

236/2 2026/08/07 06:13 llm fixes-finder
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 44688
							output: 40
							thoughts: 185
						

Thoughts:
**Investigating the GadgetFS Unbind Vulnerability**

Alright, let's get down to brass tacks. I'm dealing with a potentially nasty slab-use-after-free issue, and the context points to `drivers/usb/gadget/legacy/inode.c`. Since I don't have the whole file readily available, my initial instinct is to use `git-blame` on that specific file, pinpointing the commit *before* the fix. That should give me the clearest picture of the code as it stood. Alternatively, `git-log -G"gadgetfs_unbind"` is a quick and dirty way to trace the introduction of that function.

Hold on a second, the bug description is pretty explicit: it's a reference count underflow in the error handling of `gadgetfs_bind()`. If a fault injection causes a memory allocation failure during the binding process, `gadgetfs_bind()` incorrectly calls `gadgetfs_unbind()`, dropping a reference to the device before it's actually been properly acquired.

Given this, I want to quickly verify if the `gadgetfs_unbind` function was part of the `gadgetfs_bind` implementation from the beginning.



237/2 2026/08/07 06:13 tool git-log
10m Error:
log-in to see details

Args:
map[CodeRegexp:gadgetfs_unbind SourcePath:drivers/usb/gadget/legacy/inode.c]

Results:
map[Output:]

238/2 2026/08/07 06:23 llm fixes-finder
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 45207
							output: 35
							thoughts: 70
						

Thoughts:
Here's my summary, as though I'm thinking through this process:

**Diving into the GadgetFS Bindings**

Okay, so I need to understand what's going on with `gadgetfs_bind` in this specific commit, `1da177e4c3f4`. The most efficient way to get a focused view of the relevant code is to directly extract the section that defines the function. I can use `git show` to grab the content of `drivers/usb/gadget/inode.c` as it existed in that commit. Then, a quick `grep` will get me the surrounding lines containing `gadgetfs_bind`. I'll grab a few lines of context around the `gadgetfs_bind` occurrences, both before and after, to understand its immediate surrounding logic. Specifically, I'll take a view of the code from the beginning of the function and 5 lines prior, to 20 lines after its first usage. This should give me a pretty clear picture of how `gadgetfs_bind` is used, its parameters, and what other functions it interacts with within this specific commit. Let's see what that looks like...



239/2 2026/08/07 06:23 tool grepper
0m Error:
log-in to see details

Args:
map[Expression:gadgetfs_bind PathPrefix:drivers/usb/gadget/inode.c]

Results:
map[Output:]

240/2 2026/08/07 06:23 llm fixes-finder
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 45579
							output: 42
							thoughts: 49
						

Thoughts:
Okay, here's my interpretation of those thoughts, tailored for an expert audience, as if they were my own:

**Initial Strategy Assessment for Finding Code History**

Right, so I'm looking for the history, the changes, behind some specific code within that USB gadget driver, specifically `drivers/usb/gadget/legacy/inode.c`. My first instinct was to leverage `grepper`, but then it hits me: that's going to be local, isn't it? Just searching the *current* working tree. Not what I want. I need to delve into the full history of that file.

So, I'm thinking, `git log` is the way to go. Given the targeted file, I can either use `-L` with specific lines to get a more focused view of change history, which is going to be my preferred option given the need for specificity. Alternatively, I could just `git blame` the entire file. That *could* work, but might be too noisy depending on the size of the file and how much churn it's seen over time. `-L` seems a more targeted and therefore efficient route to understand the code's evolution within this driver.



241/2 2026/08/07 06:23 tool git-blame
0m Args:
map[End:1710 File:drivers/usb/gadget/legacy/inode.c Start:1690]

Results:
map[Output:^1da177e4c3f4 drivers/usb/gadget/inode.c 1690) 	dev->req->complete = epio_complete;
^1da177e4c3f4 drivers/usb/gadget/inode.c 1691) 
^1da177e4c3f4 drivers/usb/gadget/inode.c 1692) 	if (activate_ep_files (dev) < 0)
^1da177e4c3f4 drivers/usb/gadget/inode.c 1693) 		goto enomem;
^1da177e4c3f4 drivers/usb/gadget/inode.c 1694) 
^1da177e4c3f4 drivers/usb/gadget/inode.c 1695) 	INFO (dev, "bound to %s driver\n", gadget->name);
7489d14943181 drivers/usb/gadget/inode.c 1696) 	spin_lock_irq(&dev->lock);
7489d14943181 drivers/usb/gadget/inode.c 1697) 	dev->state = STATE_DEV_UNCONNECTED;
7489d14943181 drivers/usb/gadget/inode.c 1698) 	spin_unlock_irq(&dev->lock);
^1da177e4c3f4 drivers/usb/gadget/inode.c 1699) 	get_dev (dev);
^1da177e4c3f4 drivers/usb/gadget/inode.c 1700) 	return 0;
^1da177e4c3f4 drivers/usb/gadget/inode.c 1701) 
^1da177e4c3f4 drivers/usb/gadget/inode.c 1702) enomem:
^1da177e4c3f4 drivers/usb/gadget/inode.c 1703) 	gadgetfs_unbind (gadget);
^1da177e4c3f4 drivers/usb/gadget/inode.c 1704) 	return -ENOMEM;
^1da177e4c3f4 drivers/usb/gadget/inode.c 1705) }
^1da177e4c3f4 drivers/usb/gadget/inode.c 1706) 
^1da177e4c3f4 drivers/usb/gadget/inode.c 1707) static void
^1da177e4c3f4 drivers/usb/gadget/inode.c 1708) gadgetfs_disconnect (struct usb_gadget *gadget)
^1da177e4c3f4 drivers/usb/gadget/inode.c 1709) {
^1da177e4c3f4 drivers/usb/gadget/inode.c 1710) 	struct dev_data		*dev = get_gadget_data (gadget);
]

242/2 2026/08/07 06:23 llm fixes-finder
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 46720
							output: 42
							thoughts: 193
						

Thoughts:
**Analyzing the GadgetFS Bug Root**

Okay, so I'm digging into this `gadgetfs` issue, and the first thing that jumps out is that `gadgetfs_unbind` was present *way* back in the initial commit, `1da177e4c3f4`. Hmm, that means if the bug relates to `gadgetfs_unbind`, then the bug itself probably originated with that initial code. No need to look for a later regression, which is handy.

Now, let's refresh our understanding of the problem. It seems the core of the issue is a KASAN slab-use-after-free, triggered by an underflow in the reference count within `gadgetfs_bind()`'s error handling. Apparently, a forced memory allocation failure during the binding process leads to an incorrect call to `gadgetfs_unbind()`, where the device reference is incorrectly dropped.

The question now becomes: *does* `gadgetfs_unbind` always drop a reference to the device? That's the crux. If we can confirm that, then we're well on our way to understanding why this is happening.



243/2 2026/08/07 06:23 tool git-blame
0m Args:
map[End:1730 File:drivers/usb/gadget/legacy/inode.c Start:1711]

Results:
map[Output:001428e4871d6 drivers/usb/gadget/inode.c        1711) 	unsigned long		flags;
^1da177e4c3f4 drivers/usb/gadget/inode.c        1712) 
001428e4871d6 drivers/usb/gadget/inode.c        1713) 	spin_lock_irqsave (&dev->lock, flags);
7489d14943181 drivers/usb/gadget/inode.c        1714) 	if (dev->state == STATE_DEV_UNCONNECTED)
07cb7f23d07aa drivers/usb/gadget/inode.c        1715) 		goto exit;
7489d14943181 drivers/usb/gadget/inode.c        1716) 	dev->state = STATE_DEV_UNCONNECTED;
^1da177e4c3f4 drivers/usb/gadget/inode.c        1717) 
^1da177e4c3f4 drivers/usb/gadget/inode.c        1718) 	INFO (dev, "disconnected\n");
^1da177e4c3f4 drivers/usb/gadget/inode.c        1719) 	next_event (dev, GADGETFS_DISCONNECT);
^1da177e4c3f4 drivers/usb/gadget/inode.c        1720) 	ep0_readable (dev);
07cb7f23d07aa drivers/usb/gadget/inode.c        1721) exit:
001428e4871d6 drivers/usb/gadget/inode.c        1722) 	spin_unlock_irqrestore (&dev->lock, flags);
^1da177e4c3f4 drivers/usb/gadget/inode.c        1723) }
^1da177e4c3f4 drivers/usb/gadget/inode.c        1724) 
^1da177e4c3f4 drivers/usb/gadget/inode.c        1725) static void
^1da177e4c3f4 drivers/usb/gadget/inode.c        1726) gadgetfs_suspend (struct usb_gadget *gadget)
^1da177e4c3f4 drivers/usb/gadget/inode.c        1727) {
^1da177e4c3f4 drivers/usb/gadget/inode.c        1728) 	struct dev_data		*dev = get_gadget_data (gadget);
f16443a034c7a drivers/usb/gadget/legacy/inode.c 1729) 	unsigned long		flags;
^1da177e4c3f4 drivers/usb/gadget/inode.c        1730) 
]

244/2 2026/08/07 06:24 llm fixes-finder
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 47961
							output: 42
							thoughts: 14
						

Thoughts:
Here's my thought process, as if I were considering this function:

**Analyzing `gadgetfs_unbind`**

Okay, let's see, I need to focus on `gadgetfs_unbind`. This is where the cleanup likely happens when a file system is unmounted or a device is detached, right? I'll need to understand how resources are released, any potential locking issues, and any potential for leaks. I imagine this function is crucial for preventing dangling pointers and ensuring data integrity during unmount. Specifically, I'll be looking for any signs of memory not being freed, file descriptors not being closed properly, or threads not being joined. I should also check if it handles error conditions gracefully, especially if an unbind operation is interrupted. The devil's always in the details, so I need to pay close attention to the order of operations and how the system interacts with the underlying storage and device drivers. Let's dig in.



245/2 2026/08/07 06:24 tool git-blame
0m Args:
map[End:1690 File:drivers/usb/gadget/legacy/inode.c Start:1600]

Results:
map[Output:^1da177e4c3f4 drivers/usb/gadget/inode.c        1600) 
bf4afc53b77ae drivers/usb/gadget/legacy/inode.c 1601) 		data = kzalloc_obj(*data);
^1da177e4c3f4 drivers/usb/gadget/inode.c        1602) 		if (!data)
0ae4ea8092e12 drivers/usb/gadget/inode.c        1603) 			goto enomem0;
^1da177e4c3f4 drivers/usb/gadget/inode.c        1604) 		data->state = STATE_EP_DISABLED;
a79df50bbad3b drivers/usb/gadget/inode.c        1605) 		mutex_init(&data->lock);
^1da177e4c3f4 drivers/usb/gadget/inode.c        1606) 		init_waitqueue_head (&data->wait);
^1da177e4c3f4 drivers/usb/gadget/inode.c        1607) 
bd3cf1a9396e6 drivers/usb/gadget/legacy/inode.c 1608) 		strscpy(data->name, ep->name);
8d66db50b2ac9 drivers/usb/gadget/legacy/inode.c 1609) 		refcount_set (&data->count, 1);
^1da177e4c3f4 drivers/usb/gadget/inode.c        1610) 		data->dev = dev;
^1da177e4c3f4 drivers/usb/gadget/inode.c        1611) 		get_dev (dev);
^1da177e4c3f4 drivers/usb/gadget/inode.c        1612) 
^1da177e4c3f4 drivers/usb/gadget/inode.c        1613) 		data->ep = ep;
^1da177e4c3f4 drivers/usb/gadget/inode.c        1614) 		ep->driver_data = data;
^1da177e4c3f4 drivers/usb/gadget/inode.c        1615) 
^1da177e4c3f4 drivers/usb/gadget/inode.c        1616) 		data->req = usb_ep_alloc_request (ep, GFP_KERNEL);
^1da177e4c3f4 drivers/usb/gadget/inode.c        1617) 		if (!data->req)
0ae4ea8092e12 drivers/usb/gadget/inode.c        1618) 			goto enomem1;
^1da177e4c3f4 drivers/usb/gadget/inode.c        1619) 
b65e3b11e9236 drivers/usb/gadget/legacy/inode.c 1620) 		err = gadgetfs_create_file (dev->sb, data->name,
d4461a602cf39 drivers/usb/gadget/legacy/inode.c 1621) 				data, &ep_io_operations);
b65e3b11e9236 drivers/usb/gadget/legacy/inode.c 1622) 		if (err)
0ae4ea8092e12 drivers/usb/gadget/inode.c        1623) 			goto enomem2;
^1da177e4c3f4 drivers/usb/gadget/inode.c        1624) 		list_add_tail (&data->epfiles, &dev->epfiles);
^1da177e4c3f4 drivers/usb/gadget/inode.c        1625) 	}
^1da177e4c3f4 drivers/usb/gadget/inode.c        1626) 	return 0;
^1da177e4c3f4 drivers/usb/gadget/inode.c        1627) 
0ae4ea8092e12 drivers/usb/gadget/inode.c        1628) enomem2:
0ae4ea8092e12 drivers/usb/gadget/inode.c        1629) 	usb_ep_free_request (ep, data->req);
0ae4ea8092e12 drivers/usb/gadget/inode.c        1630) enomem1:
0ae4ea8092e12 drivers/usb/gadget/inode.c        1631) 	put_dev (dev);
0ae4ea8092e12 drivers/usb/gadget/inode.c        1632) 	kfree (data);
0ae4ea8092e12 drivers/usb/gadget/inode.c        1633) enomem0:
441b62c1edb98 drivers/usb/gadget/inode.c        1634) 	DBG (dev, "%s enomem\n", __func__);
^1da177e4c3f4 drivers/usb/gadget/inode.c        1635) 	destroy_ep_files (dev);
^1da177e4c3f4 drivers/usb/gadget/inode.c        1636) 	return -ENOMEM;
^1da177e4c3f4 drivers/usb/gadget/inode.c        1637) }
^1da177e4c3f4 drivers/usb/gadget/inode.c        1638) 
^1da177e4c3f4 drivers/usb/gadget/inode.c        1639) static void
^1da177e4c3f4 drivers/usb/gadget/inode.c        1640) gadgetfs_unbind (struct usb_gadget *gadget)
^1da177e4c3f4 drivers/usb/gadget/inode.c        1641) {
^1da177e4c3f4 drivers/usb/gadget/inode.c        1642) 	struct dev_data		*dev = get_gadget_data (gadget);
^1da177e4c3f4 drivers/usb/gadget/inode.c        1643) 
441b62c1edb98 drivers/usb/gadget/inode.c        1644) 	DBG (dev, "%s\n", __func__);
^1da177e4c3f4 drivers/usb/gadget/inode.c        1645) 
^1da177e4c3f4 drivers/usb/gadget/inode.c        1646) 	spin_lock_irq (&dev->lock);
^1da177e4c3f4 drivers/usb/gadget/inode.c        1647) 	dev->state = STATE_DEV_UNBOUND;
520b72fc64deb drivers/usb/gadget/legacy/inode.c 1648) 	while (dev->udc_usage > 0) {
520b72fc64deb drivers/usb/gadget/legacy/inode.c 1649) 		spin_unlock_irq(&dev->lock);
520b72fc64deb drivers/usb/gadget/legacy/inode.c 1650) 		usleep_range(1000, 2000);
520b72fc64deb drivers/usb/gadget/legacy/inode.c 1651) 		spin_lock_irq(&dev->lock);
520b72fc64deb drivers/usb/gadget/legacy/inode.c 1652) 	}
^1da177e4c3f4 drivers/usb/gadget/inode.c        1653) 	spin_unlock_irq (&dev->lock);
^1da177e4c3f4 drivers/usb/gadget/inode.c        1654) 
^1da177e4c3f4 drivers/usb/gadget/inode.c        1655) 	destroy_ep_files (dev);
^1da177e4c3f4 drivers/usb/gadget/inode.c        1656) 	gadget->ep0->driver_data = NULL;
^1da177e4c3f4 drivers/usb/gadget/inode.c        1657) 	set_gadget_data (gadget, NULL);
^1da177e4c3f4 drivers/usb/gadget/inode.c        1658) 
^1da177e4c3f4 drivers/usb/gadget/inode.c        1659) 	/* we've already been disconnected ... no i/o is active */
^1da177e4c3f4 drivers/usb/gadget/inode.c        1660) 	if (dev->req)
^1da177e4c3f4 drivers/usb/gadget/inode.c        1661) 		usb_ep_free_request (gadget->ep0, dev->req);
441b62c1edb98 drivers/usb/gadget/inode.c        1662) 	DBG (dev, "%s done\n", __func__);
^1da177e4c3f4 drivers/usb/gadget/inode.c        1663) 	put_dev (dev);
^1da177e4c3f4 drivers/usb/gadget/inode.c        1664) }
^1da177e4c3f4 drivers/usb/gadget/inode.c        1665) 
^1da177e4c3f4 drivers/usb/gadget/inode.c        1666) static struct dev_data		*the_device;
^1da177e4c3f4 drivers/usb/gadget/inode.c        1667) 
ffe0b33506250 drivers/usb/gadget/inode.c        1668) static int gadgetfs_bind(struct usb_gadget *gadget,
ffe0b33506250 drivers/usb/gadget/inode.c        1669) 		struct usb_gadget_driver *driver)
^1da177e4c3f4 drivers/usb/gadget/inode.c        1670) {
^1da177e4c3f4 drivers/usb/gadget/inode.c        1671) 	struct dev_data		*dev = the_device;
^1da177e4c3f4 drivers/usb/gadget/inode.c        1672) 
^1da177e4c3f4 drivers/usb/gadget/inode.c        1673) 	if (!dev)
^1da177e4c3f4 drivers/usb/gadget/inode.c        1674) 		return -ESRCH;
^1da177e4c3f4 drivers/usb/gadget/inode.c        1675) 	if (0 != strcmp (CHIP, gadget->name)) {
00274921a052d drivers/usb/gadget/inode.c        1676) 		pr_err("%s expected %s controller not %s\n",
^1da177e4c3f4 drivers/usb/gadget/inode.c        1677) 			shortname, CHIP, gadget->name);
^1da177e4c3f4 drivers/usb/gadget/inode.c        1678) 		return -ENODEV;
^1da177e4c3f4 drivers/usb/gadget/inode.c        1679) 	}
^1da177e4c3f4 drivers/usb/gadget/inode.c        1680) 
^1da177e4c3f4 drivers/usb/gadget/inode.c        1681) 	set_gadget_data (gadget, dev);
^1da177e4c3f4 drivers/usb/gadget/inode.c        1682) 	dev->gadget = gadget;
^1da177e4c3f4 drivers/usb/gadget/inode.c        1683) 	gadget->ep0->driver_data = dev;
^1da177e4c3f4 drivers/usb/gadget/inode.c        1684) 
^1da177e4c3f4 drivers/usb/gadget/inode.c        1685) 	/* preallocate control response and buffer */
^1da177e4c3f4 drivers/usb/gadget/inode.c        1686) 	dev->req = usb_ep_alloc_request (gadget->ep0, GFP_KERNEL);
^1da177e4c3f4 drivers/usb/gadget/inode.c        1687) 	if (!dev->req)
^1da177e4c3f4 drivers/usb/gadget/inode.c        1688) 		goto enomem;
^1da177e4c3f4 drivers/usb/gadget/inode.c        1689) 	dev->req->context = NULL;
^1da177e4c3f4 drivers/usb/gadget/inode.c        1690) 	dev->req->complete = epio_complete;
]

246/2 2026/08/07 06:24 llm fixes-finder
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 51686
							output: 53
							thoughts: 1595
						

Thoughts:
**Refcount Underflow in gadgetfs_bind/unbind: A Root Cause Analysis**

Okay, here's what I've figured out: it looks like there's a serious refcount underflow issue in the gadgetfs driver, specifically in how `gadgetfs_bind` and `gadgetfs_unbind` interact. I can see that `gadgetfs_unbind` calls `put_dev(dev)` unconditionally at line 1663. Now, `gadgetfs_bind` calls `get_dev(dev)` at line 1699, but *only* on a successful bind.

Here's the problem: if `gadgetfs_bind` fails, say, during the `usb_ep_alloc_request` or `activate_ep_files` calls, it jumps to the `enomem` label and then calls `gadgetfs_unbind`. The crucial point is that `get_dev(dev)` *wasn't* called in the error path. So, `gadgetfs_unbind` ends up calling `put_dev(dev)` on a reference that was never taken in the first place, leading to a refcount underflow.

I need to confirm this is indeed the root cause of the issue, and that the code's behavior hasn't changed.

I checked the initial commit of the code, `1da177e4c3f41524e886b7f1b8a0c1fc7321cac2`, and verified the functions' code:
*   In `1da177e4c3f4` at line 1699, `get_dev(dev)` occurs right before `return 0;`.
*   And `enomem:` is at line 1702, which calls `gadgetfs_unbind(gadget);`.
*   At line 1663 of `1da177e4c3f4` `gadgetfs_unbind` calls `put_dev(dev);`.

Therefore the issue was present since the beginning of git history.

I double-checked to ensure that `gadgetfs_bind` and `gadgetfs_unbind` have always been this way since the original commit, and yes, it's the exact same problem: `gadgetfs_unbind` unconditionally calls `put_dev(dev)`, while `gadgetfs_bind` only calls `get_dev(dev)` on success. If `gadgetfs_bind` fails (e.g., if `usb_ep_alloc_request` fails or `activate_ep_files` fails), it jumps to `enomem` and calls `gadgetfs_unbind`, which then calls `put_dev(dev)` and drops a reference that was never taken.

I also checked to see if any other commit could have introduced the problem or any changes that could alter the refcounting process. But no, the basic structure has been there from the start.

So, this refcount underflow has been baked in since the initial commit, `1da177e4c3f41524e886b7f1b8a0c1fc7321cac2`, which is what I'll report. It's a fundamental error in how the error handling interacts with the refcounting.



247/2 2026/08/07 06:24 tool set-results
0m Args:
map[FixesHash:1da177e4c3f41524e886b7f1b8a0c1fc7321cac2]

Results:
map[FixesHash:1da177e4c3f41524e886b7f1b8a0c1fc7321cac2]

248/1 2026/08/07 06:24 action format-fixes
0m Results:
map[Fixes:map[AuthorEmail:torvalds@ppc970.osdl.org AuthorName:Linus Torvalds Hash:1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Title:Linux-2.6.12-rc2]]

249/1 2026/08/07 06:24 action get-maintainers
0m Results:
map[Recipients:[map[Email:brauner@kernel.org Name:Christian Brauner To:false] map[Email:gregkh@linuxfoundation.org Name:Greg Kroah-Hartman To:true] map[Email:jack@suse.cz Name:Jan Kara To:false] map[Email:kees@kernel.org Name:Kees Cook To:false] map[Email:linux-kernel@vger.kernel.org Name: To:false] map[Email:linux-usb@vger.kernel.org Name: To:true] map[Email:mjguzik@gmail.com Name:Mateusz Guzik To:false] map[Email:viro@zeniv.linux.org.uk Name:Al Viro To:false] map[Email:torvalds@ppc970.osdl.org Name:Linus Torvalds To:true]]]

250/1 2026/08/07 06:24 action get-recent-commits
0m Results:
map[RecentCommits:Convert 'alloc_obj' family to use the new default GFP_KERNEL argument
treewide: Replace kmalloc with kmalloc_obj for non-scalar types
convert gadgetfs
gadgetfs: switch to simple_remove_by_name()
fs: rename generic_delete_inode() and generic_drop_inode()
functionfs, gadgetfs: use simple_recursive_removal()
USB: gadget: Replace deprecated strncpy() with strscpy()
USB: gadget: Use str_enable_disable-like helpers
[tree-wide] finally take no_llseek out
legacy: convert to new timestamp accessors
usb: gadgetfs: return USB_GADGET_DELAYED_STATUS from setup()
usb: convert to ctime accessor functions
usb: gadgetfs: Fix ep_read_iter to handle ITER_UBUF
USB: gadgetfs: Fix race between mounting and unmounting
gadgetfs: ep_io - wait until IRQ finishes
USB: gadget: Rename usb_gadget_probe_driver()
usb: gadget: eliminate anonymous module_init & module_exit
headers/prep: usb: gadget: Fix namespace collision
usb: gadget: clear related members when goto fail
usb: gadget: don't release an existing dev->buf
]

251/1 2026/08/07 06:24 agent description-generator
0m Model:
best-expensive

Instruction:
You are an experienced Linux kernel developer tasked with writing a commit description for
a kernel bug fixing commit. The description should start with a one-line summary,
and then include description of the bug being fixed, and how it's fixed by the provided patch.
The one-line summary should describe the change being made, rather than mention the tool that
detected the bug.

The description must not contain lines starting with '#' because they will dropped by git as comments.
The description must not contain lines starting with '--' or '---' (including inline code diffs)
because they may confuse git/patch utilities.

Your final reply should contain only the text of the commit description.


The one-line summary must be not longer than 72 characters.

IMPORTANT: Do not wrap lines manually (e.g., at 80 characters); we will reformat the text
automatically, so keep paragraphs as single lines without newlines.

Generally try to phrase the description without mentioning syzkaller
(avoid phrases like "the bug was triggered by syzkaller" or "the bug was triggered by fuzzer", etc).
How the bug was triggered is generally an irrelevant detail.
Any bug triggered by a fuzzer can also be triggered by a malicious user, or a buggy program.

If the crash is reported by a sanitizer (e.g., KASAN, KMSAN, lockdep), include the relevant
parts of the sanitizer output to illustrate the problem. Exclude less relevant sections,
as the stack trace can be very long. Describe the execution path that leads to the manifestation
of the kernel bug.



Prefer calling several tools at the same time to save round-trips.

Prompt:
The crash that corresponds to the bug is:

udc dummy_udc.0: failed to start USB Gadget filesystem: -12
gadgetfs gadget.0: probe with driver gadgetfs failed with error -12
gadgetfs: bound to dummy_udc driver
==================================================================
BUG: KASAN: slab-use-after-free in instrument_atomic_read_write include/linux/instrumented.h:112 [inline]
BUG: KASAN: slab-use-after-free in atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:400 [inline]
BUG: KASAN: slab-use-after-free in __refcount_sub_and_test include/linux/refcount.h:389 [inline]
BUG: KASAN: slab-use-after-free in __refcount_dec_and_test include/linux/refcount.h:432 [inline]
BUG: KASAN: slab-use-after-free in refcount_dec_and_test include/linux/refcount.h:450 [inline]
BUG: KASAN: slab-use-after-free in put_dev drivers/usb/gadget/legacy/inode.c:165 [inline]
BUG: KASAN: slab-use-after-free in gadgetfs_kill_sb+0x46/0x110 drivers/usb/gadget/legacy/inode.c:2104
Write of size 4 at addr ffff88811638c080 by task syz-executor169/5848

CPU: 0 UID: 0 PID: 5848 Comm: syz-executor169 Not tainted syzkaller #1 PREEMPT_{RT,(full)} 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 print_address_description+0x55/0x1e0 mm/kasan/report.c:378
 print_report+0x58/0x70 mm/kasan/report.c:482
 kasan_report+0x117/0x150 mm/kasan/report.c:595
 check_region_inline mm/kasan/generic.c:-1 [inline]
 kasan_check_range+0x264/0x2c0 mm/kasan/generic.c:200
 instrument_atomic_read_write include/linux/instrumented.h:112 [inline]
 atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:400 [inline]
 __refcount_sub_and_test include/linux/refcount.h:389 [inline]
 __refcount_dec_and_test include/linux/refcount.h:432 [inline]
 refcount_dec_and_test include/linux/refcount.h:450 [inline]
 put_dev drivers/usb/gadget/legacy/inode.c:165 [inline]
 gadgetfs_kill_sb+0x46/0x110 drivers/usb/gadget/legacy/inode.c:2104
 deactivate_locked_super+0xbc/0x130 fs/super.c:477
 cleanup_mnt+0x3d3/0x460 fs/namespace.c:1317
 task_work_run+0x1d9/0x270 kernel/task_work.c:233
 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
 __exit_to_user_mode_loop kernel/entry/common.c:70 [inline]
 exit_to_user_mode_loop+0x1fa/0x730 kernel/entry/common.c:101
 __exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline]
 syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:230 [inline]
 syscall_exit_to_user_mode include/linux/entry-common.h:318 [inline]
 do_syscall_64+0x353/0x580 arch/x86/entry/syscall_64.c:100
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f5f0e505027
Code: a2 c7 05 54 b0 08 00 00 00 00 00 eb 96 e8 a1 08 00 00 90 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 c7 c2 d8 ff ff ff f7 d8 64 89 02 b8
RSP: 002b:00007ffcdf2b0288 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6
RAX: 0000000000000000 RBX: 0000000000000003 RCX: 00007f5f0e505027
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00007f5f0e55f05e
RBP: 00007f5f0e55f05e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f5f0e55f623
R13: 00007ffcdf2b03e0 R14: 00007f5f0e561510 R15: 00007f5f0e5614e8
 </TASK>

Allocated by task 5848:
 kasan_save_stack mm/kasan/common.c:57 [inline]
 kasan_save_track+0x3e/0x80 mm/kasan/common.c:78
 poison_kmalloc_redzone mm/kasan/common.c:398 [inline]
 __kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:415
 kasan_kmalloc include/linux/kasan.h:263 [inline]
 __kmalloc_cache_noprof+0x3d2/0x6b0 mm/slub.c:5489
 _kmalloc_noprof include/linux/slab.h:988 [inline]
 _kzalloc_noprof include/linux/slab.h:1309 [inline]
 dev_new drivers/usb/gadget/legacy/inode.c:176 [inline]
 gadgetfs_fill_super+0x27b/0x7a0 drivers/usb/gadget/legacy/inode.c:2054
 vfs_get_super fs/super.c:1273 [inline]
 get_tree_single+0xc0/0x150 fs/super.c:1300
 vfs_get_tree+0x92/0x2a0 fs/super.c:1700
 fc_mount fs/namespace.c:1198 [inline]
 do_new_mount_fc fs/namespace.c:3765 [inline]
 do_new_mount+0x319/0xdc0 fs/namespace.c:3841
 do_mount fs/namespace.c:4174 [inline]
 __do_sys_mount fs/namespace.c:4390 [inline]
 __se_sys_mount+0x31d/0x420 fs/namespace.c:4367
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Freed by task 5848:
 kasan_save_stack mm/kasan/common.c:57 [inline]
 kasan_save_track+0x3e/0x80 mm/kasan/common.c:78
 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:584
 poison_slab_object mm/kasan/common.c:253 [inline]
 __kasan_slab_free+0x5c/0x80 mm/kasan/common.c:285
 kasan_slab_free include/linux/kasan.h:235 [inline]
 slab_free_hook mm/slub.c:2677 [inline]
 slab_free mm/slub.c:6377 [inline]
 kfree+0x1c5/0x6c0 mm/slub.c:6692
 put_dev drivers/usb/gadget/legacy/inode.c:169 [inline]
 dev_release+0x173/0x210 drivers/usb/gadget/legacy/inode.c:1215
 __fput+0x42a/0xa80 fs/file_table.c:512
 fput_close_sync+0x11f/0x240 fs/file_table.c:617
 __do_sys_close fs/open.c:1511 [inline]
 __se_sys_close fs/open.c:1496 [inline]
 __x64_sys_close+0x7e/0x110 fs/open.c:1496
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

The buggy address belongs to the object at ffff88811638c000
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 128 bytes inside of
 freed 1024-byte region [ffff88811638c000, ffff88811638c400)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff88811638d000 pfn:0x116388
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0x100000000000240(workingset|head|node=0|zone=2)
page_type: f5(slab)
raw: 0100000000000240 ffff888100041dc0 ffffea00044a8a10 ffffea00043da810
raw: ffff88811638d000 000000080010000f 00000000f5000000 0000000000000000
head: 0100000000000240 ffff888100041dc0 ffffea00044a8a10 ffffea00043da810
head: ffff88811638d000 000000080010000f 00000000f5000000 0000000000000000
head: 0100000000000003 fffffffffffffe01 00000000ffffffff 00000000ffffffff
head: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000008
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5581, tgid 5581 (syz-executor), ts 49160475111, free_ts 0
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x1f9/0x250 mm/page_alloc.c:1859
 prep_new_page mm/page_alloc.c:1867 [inline]
 get_page_from_freelist+0x262a/0x26a0 mm/page_alloc.c:3946
 __alloc_frozen_pages_noprof+0x18d/0x380 mm/page_alloc.c:5304
 alloc_slab_page mm/slub.c:3266 [inline]
 allocate_slab+0x79/0x5e0 mm/slub.c:3380
 new_slab mm/slub.c:3426 [inline]
 refill_objects+0x2d8/0x350 mm/slub.c:7310
 refill_sheaf mm/slub.c:2804 [inline]
 __pcs_replace_empty_main+0x330/0x690 mm/slub.c:4675
 alloc_from_pcs mm/slub.c:4773 [inline]
 slab_alloc_node mm/slub.c:4905 [inline]
 __kmalloc_cache_noprof+0x468/0x6b0 mm/slub.c:5485
 _kmalloc_noprof include/linux/slab.h:988 [inline]
 _kzalloc_noprof include/linux/slab.h:1309 [inline]
 rxrpc_service_prealloc+0x9f/0x130 net/rxrpc/call_accept.c:167
 rxrpc_listen+0x1b7/0x360 net/rxrpc/af_rxrpc.c:237
 afs_open_socket+0x2fa/0x3f0 fs/afs/rxrpc.c:107
 afs_net_init+0x6ce/0x8f0 fs/afs/main.c:116
 ops_init+0x35d/0x5d0 net/core/net_namespace.c:137
 setup_net+0x118/0x350 net/core/net_namespace.c:446
 copy_net_ns+0x4f9/0x720 net/core/net_namespace.c:579
 create_new_namespaces+0x3f0/0x6b0 kernel/nsproxy.c:132
 unshare_nsproxy_namespaces+0x149/0x190 kernel/nsproxy.c:234
page_owner free stack trace missing

Memory state around the buggy address:
 ffff88811638bf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88811638c000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88811638c080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff88811638c100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88811638c180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================




The explanation of the root cause of the bug is:

The root cause of this KASAN slab-use-after-free is a reference count underflow in the error handling path of `gadgetfs_bind()`. 

When fault injection forces a memory allocation failure during the binding process, `gadgetfs_bind()` incorrectly calls `gadgetfs_unbind()`, which drops a reference to the device (`dev`) that was never actually taken.

### Detailed Sequence of Events

1. **Initialization and Open:**
   When the gadgetfs superblock is created, `dev_new()` allocates the `dev_data` structure (`dev`) and initializes its refcount to 1. When the user opens the `/tmp/gadgetfs/ep0` file, `gadget_dev_open()` is called, which increments the refcount to 2 via `get_dev(dev)`.

2. **Driver Registration and Binding:**
   The user writes configuration data to `ep0`, invoking `dev_config()`. This function calls `usb_gadget_register_driver(&gadgetfs_driver)`, which registers the driver and attempts to bind it to the UDC, eventually calling `gadgetfs_bind()`.

3. **Fault Injection and Refcount Underflow:**
   In `gadgetfs_bind()`, memory allocations are performed (e.g., `usb_ep_alloc_request()` or inside `activate_ep_files()`). If fault injection causes one of these to fail, the code jumps to the `enomem` label:
   ```c
   // drivers/usb/gadget/legacy/inode.c : gadgetfs_bind()
   
   	dev->req = usb_ep_alloc_request (gadget->ep0, GFP_KERNEL);
   	if (!dev->req)
   		goto enomem;
   ...
   	if (activate_ep_files (dev) < 0)
   		goto enomem;
   ...
   	get_dev (dev); // <--- Reference is only taken on SUCCESS
   	return 0;
   
   enomem:
   	gadgetfs_unbind (gadget);
   	return -ENOMEM;
   ```
   The `enomem` path calls `gadgetfs_unbind()`, which performs cleanup and unconditionally calls `put_dev(dev)`. Because `get_dev(dev)` is only called at the very end of `gadgetfs_bind()` on success, `gadgetfs_unbind()` drops a reference that was never acquired. The refcount incorrectly drops from 2 to 1.

4. **Probe Failure Ignored:**
   The `-ENOMEM` error propagates up to the driver core. However, `__driver_attach()` intentionally ignores probe failures and returns `0`. Because `gadgetfs_driver` does not set `match_existing_only = true`, `usb_gadget_register_driver_owner()` also returns `0` (success).

5. **Closing ep0 and Freeing:**
   Seeing a success return value, `dev_config()` sets `dev->gadget_registered = true`. 
   Later, the reproducer closes the `ep0` file descriptor, triggering `dev_release()`. `dev_release()` cleans up and calls `put_dev(dev)`. The refcount drops from 1 to 0, and `dev` is prematurely freed.

6. **The Use-After-Free:**
   Finally, the reproducer unmounts the filesystem, which invokes `gadgetfs_kill_sb()`. 
   ```c
   // drivers/usb/gadget/legacy/inode.c : gadgetfs_kill_sb()
   
   	if (the_device) {
   		put_dev (the_device); // <--- UAF here
   		the_device = NULL;
   	}
   ```
   `gadgetfs_kill_sb()` attempts to drop the initial reference by calling `put_dev(the_device)`. Since `the_device` points to the `dev` structure that was already freed in step 5, this triggers the KASAN slab-use-after-free.

### Suggested Fix

`gadgetfs_bind()` should not call `gadgetfs_unbind()` in its error path, as `gadgetfs_unbind()` is designed to tear down a fully bound gadget (and thus expects the extra reference to exist). Instead, `gadgetfs_bind()` should manually clean up the specific state it altered before the failure occurred.

```c
 enomem:
-	gadgetfs_unbind (gadget);
+	if (dev->req) {
+		usb_ep_free_request (gadget->ep0, dev->req);
+		dev->req = NULL;
+	}
+	gadget->ep0->driver_data = NULL;
+	set_gadget_data (gadget, NULL);
+	dev->gadget = NULL;
 	return -ENOMEM;
```
*(Note: `activate_ep_files()` already perfectly cleans up after itself on failure, so no additional teardown is needed for it in `gadgetfs_bind()`'s error path).*

The diff of the bug fix is:

diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c
index d87a8ab51..365f9ab4d 100644
--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -1700,7 +1700,13 @@ static int gadgetfs_bind(struct usb_gadget *gadget,
 	return 0;
 
 enomem:
-	gadgetfs_unbind (gadget);
+	if (dev->req) {
+		usb_ep_free_request(gadget->ep0, dev->req);
+		dev->req = NULL;
+	}
+	gadget->ep0->driver_data = NULL;
+	dev->gadget = NULL;
+	set_gadget_data(gadget, NULL);
 	return -ENOMEM;
 }
 


Additional description of the patch:

I have applied a fix to resolve the KASAN slab-use-after-free bug in `gadgetfs_kill_sb()`.

### Cause of the Bug
The root cause is a reference count underflow in the error handling path of `gadgetfs_bind()`. When `gadgetfs_bind()` encounters an error (e.g., memory allocation failure during `usb_ep_alloc_request()` or `activate_ep_files()`), it jumps to the `enomem` label and calls `gadgetfs_unbind()`. 

However, `gadgetfs_unbind()` is designed to tear down a fully initialized and bound gadget. It unconditionally drops a device reference by calling `put_dev(dev)`. Since `gadgetfs_bind()` only acquires this reference (`get_dev(dev)`) at the very end of the function upon complete success, calling `gadgetfs_unbind()` in the error path drops a reference that was never taken. This leads to a premature free of the `dev` structure when the `ep0` file is closed, and subsequently a use-after-free when the filesystem is unmounted and `gadgetfs_kill_sb()` tries to drop the initial reference.

### The Fix
To fix this, we must stop calling the full teardown function `gadgetfs_unbind()` from the `gadgetfs_bind()` error path. Instead, we should manually and locally clean up only the specific state that was successfully altered before the failure occurred.

I replaced the call to `gadgetfs_unbind(gadget)` in the `enomem` label with localized cleanup:
1. Freeing `dev->req` if it was allocated, and setting it to `NULL`.
2. Clearing the pointers that were set earlier in the function (`gadget->ep0->driver_data`, `dev->gadget`, and `set_gadget_data(gadget, NULL)`).

Note that if `activate_ep_files()` fails, it already perfectly cleans up after itself by calling `destroy_ep_files()`, so no additional teardown is needed for it in `gadgetfs_bind()`'s error path.

This aligns with the historical pattern in the USB gadget subsystem of avoiding unified teardown functions on error paths in favor of manual, reverse-order cleanup of partially initialized objects.

Here are summaries of recent commits that touched the same files.
Format the summary line consistently with these, look how prefixes
are specified, letter capitalization, style, etc. 

Convert 'alloc_obj' family to use the new default GFP_KERNEL argument
treewide: Replace kmalloc with kmalloc_obj for non-scalar types
convert gadgetfs
gadgetfs: switch to simple_remove_by_name()
fs: rename generic_delete_inode() and generic_drop_inode()
functionfs, gadgetfs: use simple_recursive_removal()
USB: gadget: Replace deprecated strncpy() with strscpy()
USB: gadget: Use str_enable_disable-like helpers
[tree-wide] finally take no_llseek out
legacy: convert to new timestamp accessors
usb: gadgetfs: return USB_GADGET_DELAYED_STATUS from setup()
usb: convert to ctime accessor functions
usb: gadgetfs: Fix ep_read_iter to handle ITER_UBUF
USB: gadgetfs: Fix race between mounting and unmounting
gadgetfs: ep_io - wait until IRQ finishes
USB: gadget: Rename usb_gadget_probe_driver()
usb: gadget: eliminate anonymous module_init & module_exit
headers/prep: usb: gadget: Fix namespace collision
usb: gadget: clear related members when goto fail
usb: gadget: don't release an existing dev->buf


Reply:
usb: gadgetfs: fix reference count underflow in gadgetfs_bind()

A KASAN slab-use-after-free bug was found in gadgetfs_kill_sb():

BUG: KASAN: slab-use-after-free in put_dev
drivers/usb/gadget/legacy/inode.c:165 [inline]
BUG: KASAN: slab-use-after-free in gadgetfs_kill_sb+0x46/0x110
drivers/usb/gadget/legacy/inode.c:2104
Write of size 4 at addr ffff88811638c080 by task syz-executor169/5848

CPU: 0 UID: 0 PID: 5848 Comm: syz-executor169 Not tainted
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS
1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 print_address_description+0x55/0x1e0 mm/kasan/report.c:378
 print_report+0x58/0x70 mm/kasan/report.c:482
 kasan_report+0x117/0x150 mm/kasan/report.c:595
 check_region_inline mm/kasan/generic.c:-1 [inline]
 kasan_check_range+0x264/0x2c0 mm/kasan/generic.c:200
 instrument_atomic_read_write include/linux/instrumented.h:112 [inline]
 atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:400
 [inline]
 __refcount_sub_and_test include/linux/refcount.h:389 [inline]
 __refcount_dec_and_test include/linux/refcount.h:432 [inline]
 refcount_dec_and_test include/linux/refcount.h:450 [inline]
 put_dev drivers/usb/gadget/legacy/inode.c:165 [inline]
 gadgetfs_kill_sb+0x46/0x110 drivers/usb/gadget/legacy/inode.c:2104
 deactivate_locked_super+0xbc/0x130 fs/super.c:477
 cleanup_mnt+0x3d3/0x460 fs/namespace.c:1317
 task_work_run+0x1d9/0x270 kernel/task_work.c:233

The root cause is a reference count underflow in the error handling path of
gadgetfs_bind(). When gadgetfs_bind() encounters an error (e.g., memory
allocation failure), it jumps to the enomem label and calls
gadgetfs_unbind(). However, gadgetfs_unbind() is designed to tear down a
fully initialized and bound gadget, and unconditionally drops a device
reference by calling put_dev(dev). Since gadgetfs_bind() only acquires this
reference (get_dev(dev)) at the very end of the function upon complete
success, calling gadgetfs_unbind() in the error path drops a reference that
was never taken.

This leads to a premature free of the dev structure when the ep0 file is
closed, and subsequently a use-after-free when the filesystem is unmounted
and gadgetfs_kill_sb() tries to drop the initial reference.

To fix this, stop calling the full teardown function gadgetfs_unbind() from
the gadgetfs_bind() error path. Instead, manually and locally clean up only
the specific state that was successfully altered before the failure
occurred.

252/2 2026/08/07 06:24 llm description-generator
0m Model:
gemini-3.1-pro-preview

Tokens:
							input: 10458
							output: 900
							thoughts: 2538
						

Thoughts:
**Commit Message: Fixing a Reference Count Underflow in gadgetfs_bind()**

Okay, so here's the deal. I've got a patch to fix a gnarly KASAN slab-use-after-free bug, triggered in `gadgetfs_kill_sb()`. The relevant KASAN report looks like this:

```
BUG: KASAN: slab-use-after-free in put_dev drivers/usb/gadget/legacy/inode.c:165 [inline]
BUG: KASAN: slab-use-after-free in gadgetfs_kill_sb+0x46/0x110 drivers/usb/gadget/legacy/inode.c:2104
Write of size 4 at addr ffff88811638c080 by task syz-executor169/5848

CPU: 0 UID: 0 PID: 5848 Comm: syz-executor169 Not tainted
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 print_address_description+0x55/0x1e0 mm/kasan/report.c:378
 print_report+0x58/0x70 mm/kasan/report.c:482
 kasan_report+0x117/0x150 mm/kasan/report.c:595
 check_region_inline mm/kasan/generic.c:-1 [inline]
 kasan_check_range+0x264/0x2c0 mm/kasan/generic.c:200
 instrument_atomic_read_write include/linux/instrumented.h:112 [inline]
 atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:400 [inline]
 __refcount_sub_and_test include/linux/refcount.h:389 [inline]
 __refcount_dec_and_test include/linux/refcount.h:432 [inline]
 refcount_dec_and_test include/linux/refcount.h:450 [inline]
 put_dev drivers/usb/gadget/legacy/inode.c:165 [inline]
 gadgetfs_kill_sb+0x46/0x110 drivers/usb/gadget/legacy/inode.c:2104
 deactivate_locked_super+0xbc/0x130 fs/super.c:477
 cleanup_mnt+0x3d3/0x460 fs/namespace.c:1317
 task_work_run+0x1d9/0x270 kernel/task_work.c:233
```

The root of this problem lies in a reference count underflow within the error handling of `gadgetfs_bind()`. Specifically, if `gadgetfs_bind()` encounters an error, let's say a memory allocation failure, it calls `gadgetfs_unbind()`. However, `gadgetfs_unbind()`'s job is to fully tear down a properly bound gadget, and it unconditionally decrements the device's reference count via `put_dev(dev)`. The corresponding `get_dev(dev)` is only called at the very end of `gadgetfs_bind()` – upon success. Thus, the error path is dropping a reference that was never acquired.

This is what leads to a premature free of the `dev` structure when the `ep0` file is closed. Later, it causes a use-after-free when the filesystem is unmounted and `gadgetfs_kill_sb()` attempts to decrement the initial reference.

The fix is straightforward: Instead of using `gadgetfs_unbind()` in the error path, I've replaced it with a more localized cleanup. Now, when `gadgetfs_bind()` fails, it only cleans up the specific bits of state that were altered before the error arose, avoiding the premature `put_dev()`. I believe this approach is much cleaner and avoids the problem entirely.



LLM Calls Summary:
Total Calls Total Tokens Avg Tokens Total Duration (Seconds) Avg Duration (Seconds)
Tool Calls Summary:
Total Calls Total Duration (Seconds) Avg Duration (Seconds)