From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oa1-f71.google.com (mail-oa1-f71.google.com [209.85.160.71]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 97BF63815E4 for ; Thu, 6 Aug 2026 04:28:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.71 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785990526; cv=none; b=P8Y6wIEpNuwZboU0X0U4FuBlq9ho2h7LJ2XgqHReVTdkhKi97/XeeHl0GIljKZBSVaZ1c0P48y1oQPTFxc4I3xmX6Rt9N+g4k7L1yxqpmL6PLx6mDGuaHNJJqzuLBvQC5hcbFlChit8RuosnAbyLd+n9GBe291RgEFHLJmcFPns= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785990526; c=relaxed/simple; bh=HV0dkjdzOb/Ms/9NxGUH8PneDCJNLXEW+18B6uPxn5U=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=s8Qa0l4tH8gBrrvIReeKYj4Pc8dRZr0hkd9eOiUqdJdtQHsMWp9yoBGdu0A+ov5e7KKQn+TqtKOUYNLFub2nTrOTgBBn+QWZNmXnsAmxv+xQLT1c5X+INAoNd4VBB/53beNAVJdu9exUg19wbAsPdmOv58pDEVrwKCw+Y0h4C0Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.160.71 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com Received: by mail-oa1-f71.google.com with SMTP id 586e51a60fabf-451d8064053so1464868fac.0 for ; Wed, 05 Aug 2026 21:28:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785990523; x=1786595323; h=content-type:to:from:subject:message-id:in-reply-to:date :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=VDagwaFt5KmIisr8LSL8yGznnj4rMvupgISLtcogvPw=; b=SsWZRV4sI92Bhjf2QBQpAR3AnxqlNaD0QhwH9l4eYZkNQE27+i99GGbFJ4lS1T2W02 n9wJgiogln31ay9bCq93QgLSYhjL2R6vU+SfZvFaVRZx29t6XpJ5Z2lJOJaMFzWhLNT4 YkYwfO+TstafUicXsFWz6cUnH1OpjFYMDTjOtg5HH81jbelbDCDkodK7I5J6Imhi3m87 C18TD91uMAhcNVi2TM/HmATPK8PlnsCORA9eB0BOAaEfJyUkxY5QPUvUOQXrvwS2A2/+ 21ZjThBnHU65Lff33qQs5iiBhVuKSWdqc4SwTutthLVw74zt/ylGknIYj3CiRT/MHcu5 yXZg== X-Gm-Message-State: AOJu0Yz566ma7vW2aJR9GYGJ6Vo9GcxPBTljzz7xlk6ijk8x9UcTf5D3 u3kMfaTEPblofJNEAyM+uIjH4VyCGoCIgDdOMjEroXzITIE3UBMmwNU24zu+FKdrfm4k+K0MaAS 0JXtM4gq9oWocFeZAWO/mD4SGg4fe8mADu6o86MgIKL/ZnkCEngbzin59p6k= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a05:6820:2205:b0:6ae:4767:a503 with SMTP id 006d021491bc7-6ae97025ffemr5642987eaf.34.1785990523490; Wed, 05 Aug 2026 21:28:43 -0700 (PDT) Date: Wed, 05 Aug 2026 21:28:43 -0700 In-Reply-To: <6a73cea2.01d0871a.3a0d52.000c.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <6a740d7b.5aeeccc9.207e63.000d.GAE@google.com> Subject: Forwarded: [PATCH] Input: sur40 - fix use-after-free in sur40_open() From: syzbot To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Type: text/plain; charset="UTF-8" For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com. *** Subject: [PATCH] Input: sur40 - fix use-after-free in sur40_open() Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master If any of the registration steps after input_register_device() fail (v4l2_device_register(), vb2_queue_init(), ctrl handler setup, video_register_device()), the error path frees sur40 via input_free_device() + kfree() without ever calling input_unregister_device(). Since the input device was already registered, it remains live and openable, so a racing open() (e.g. from udevd) can dereference the freed sur40 via sur40_open(). Split the unwind so that once input_register_device() has succeeded, the failure path properly calls input_unregister_device() before freeing sur40 and its buffer. Reported-by: syzbot+683f6c071b5abfc266c1@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=683f6c071b5abfc266c1 Signed-off-by: Deepanshu Kartikey --- drivers/input/touchscreen/sur40.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c index 77ec2c94b91f..4b3a4d5386e4 100644 --- a/drivers/input/touchscreen/sur40.c +++ b/drivers/input/touchscreen/sur40.c @@ -808,6 +808,10 @@ static int sur40_probe(struct usb_interface *interface, video_unregister_device(&sur40->vdev); err_unreg_v4l2: v4l2_device_unregister(&sur40->v4l2); + input_unregister_device(input); + kfree(sur40->bulk_in_buffer); + kfree(sur40); + return error; err_free_buffer: kfree(sur40->bulk_in_buffer); err_free_input: -- 2.43.0