From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f70.google.com (mail-ot1-f70.google.com [209.85.210.70]) (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 B30B963CB for ; Wed, 22 Apr 2026 05:45:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.70 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776836754; cv=none; b=t+szq9vzFYGdWBVNRXHw11iGQ9vk5aXTTWh/F6y1O5UG+YkaPFF1AseN6XwhEcPnLKAbjvaXC3oW2YX3ZfLP4QChe0HniajSALRUSLVn0rlFqoxva5VXFUofwp1McJW7K/zPuU00WVwzpPsWYkvgp8+MbvjlGBIXBxpYDQVAS8A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776836754; c=relaxed/simple; bh=LyX93VtaNL8KXm2v47EhvWdI8nyE22lsIRwxTNjDF7w=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=A+64vZescXf1dIbkjM/Y+F1GpxYOuy1fJnNUVHbRxExRIWLTnjouqVnjpD2Cl0bD79HS0aJ/woDjRHAYdan07nOxLTt1/kSgrSGlt9VutEdjpNz22TKb7r9CQN3A0vOHr9WR+vOXSYYS8NGgYQAkOPEHP3O3WcryBGqtoC/Jdmc= 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.210.70 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-ot1-f70.google.com with SMTP id 46e09a7af769-7dc4bfa79aaso7208871a34.3 for ; Tue, 21 Apr 2026 22:45:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776836751; x=1777441551; h=to:from:subject:message-id:in-reply-to:date:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=QpDnz9JXua58/JpLjwRKqqc/AhcQkRdgsZMWcXlYjOU=; b=do3K86PM7zsDdKK17Z81v889r2GhvpvlUwjH00Kggr2e9cuAcE05CKwrwiXcRq4Xwj k6I0/jmg8gIZFv2InDFTIvP+qdfJq0F0qa/G5na6rfVOPDamqZJJ0P5fjkuZcY1Jjutm F0LWXdSengq66CF+AeeLV+w1eGRLseUAzBqZE6V0BMsVX/O0P50tA3B0oZubPwn6U2B6 TRC/vPP/sOHsoOLOhV5docAVy2iv77n8eZL1IFEtRPnKfyKJ9xR43Uglk1CfdO9yeeXw T/FwK4+i54yKb2gyLjgsxIceP9Q8y/+0We0eRxjgj3UJfSC5YoJu1tDRtbKRxSlV9lGa tAnw== X-Gm-Message-State: AOJu0YwyDUoDGJuOshXFGrfhbbcmy8yS1zn8LTDNTxLUgTMQI3lK0oZM FFGvpStFUogeMXkp2pWOx3+ZwRyMCyDeRmdQl7ouGwzkAFXqCQseZBzN8l/URGsfCX51YlCzIMB ChNkJXIS58yhXS5gFXAb9ZCmtZWalDaw7UOuHVYXrsDpov/+sQookpKyreMY= 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:1519:b0:685:a06a:89d9 with SMTP id 006d021491bc7-69462ee34a1mr12037488eaf.36.1776836751714; Tue, 21 Apr 2026 22:45:51 -0700 (PDT) Date: Tue, 21 Apr 2026 22:45:51 -0700 In-Reply-To: <69e69c55.050a0220.24bfd3.0029.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <69e8608f.a00a0220.17a17.0027.GAE@google.com> Subject: Forwarded: [PATCH] media: rtl2832: fix use-after-free in rtl2832_remove() 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] media: rtl2832: fix use-after-free in rtl2832_remove() Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master cancel_delayed_work_sync() is called before i2c_mux_del_adapters() in rtl2832_remove(). If i2c_mux_del_adapters() triggers any I2C transfers through the mux adapter, rtl2832_deselect() will be called which reschedules i2c_gate_work via schedule_delayed_work(). This re-arms the timer after it was cancelled, causing a use-after-free when kfree(dev) is called and the timer later fires on freed memory. Fix this by moving cancel_delayed_work_sync() to after i2c_mux_del_adapters(), ensuring the cancellation is the last operation before kfree(dev). Reported-by: syzbot+019ced393ab913002b75@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=019ced393ab913002b75 Signed-off-by: Deepanshu Kartikey --- drivers/media/dvb-frontends/rtl2832.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/media/dvb-frontends/rtl2832.c b/drivers/media/dvb-frontends/rtl2832.c index d8e1546aea5e..ce3326feaa7d 100644 --- a/drivers/media/dvb-frontends/rtl2832.c +++ b/drivers/media/dvb-frontends/rtl2832.c @@ -821,6 +821,9 @@ static int rtl2832_deselect(struct i2c_mux_core *muxc, u32 chan_id) { struct rtl2832_dev *dev = i2c_mux_priv(muxc); + pr_err("rtl2832_deselect called from: %pS\n", + __builtin_return_address(0)); + schedule_delayed_work(&dev->i2c_gate_work, usecs_to_jiffies(100)); return 0; } @@ -1113,12 +1116,18 @@ static void rtl2832_remove(struct i2c_client *client) { struct rtl2832_dev *dev = i2c_get_clientdata(client); + pr_err("rtl2832_remove: before cancel\n"); + dev_dbg(&client->dev, "\n"); cancel_delayed_work_sync(&dev->i2c_gate_work); + pr_err("rtl2832_remove: before i2c_mux_del_adapters\n"); + i2c_mux_del_adapters(dev->muxc); + pr_err("rtl2832_remove: before kfree\n"); + regmap_exit(dev->regmap); kfree(dev); -- 2.43.0