From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.218.53 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796209801; b=tu6budnusKeFuIIKahSGa8t+ycMjidzoCrWBTp9JhjNtPZ61fd5VjjcM3daDBv/Qc3jn IuRAV2nBtH6TMcBHNTQz5aClAvpUKanpgy67IziV8hiIJ5Na7dOdxwLui9oA36q4SRxj8 fvqQpARWv0ebLiS8AbYzKLmN8fbO2Vgs1vx5kYVtPabmbrxjpJGfgmhJj+7EqPVfcMODL 3yKyUR5Yg97Td3mOzoz4fr0uyhpuhFe47AwSk4qai8W5xN7WLqfHgqEYYbNhWeaiWkmWT Ozh9Vp1/eDXJ6lPq8FlXecWY84De41LaGLoYPTaXm5LwG4SxMFh6NyDd6ygKKDpgywA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796209801; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc:References: Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=GLYrHA1uoQUtTJgM3/TYIUg4w9ePXfgLxgWylqwOZWk=; b=0U2/UDdFs4ay/SJkB37f6ONxPQnt4Bk5uDF4zGdrOJYL40664830+JjZ9pnfcm/EJQeE CBFLP9VZ9qMfxnLtt7dVUwBxky2lH4owcfdWThOiU1H/3S7o9DgDzIkow4RUTZXBBbYEc XF9HwgbxxmFO90kaqC8fDUxejbrLyBn0Kcov0YEV8HDAzKq6Ex0wpg21pl1XHLguzSm70 mq4xNzIXXieVjyBTH3z0qdGhHtIRiopE9NDv705t+dWFGOZSH4PVakn+dmtizxdJPj3vN oinfHhjfqFiMZaB1YfmiZw613+Xa0BlxbWpFlFhTdjJwWHs7LpYxgtYj+bhFfouLhZA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=d2ZCMtSB; arc=none smtp.remote-ip=209.85.218.53 Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DFF82606A322 for ; Wed, 2 Dec 2026 11:10:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DFF82606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=d2ZCMtSB Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-c50933bdf4bso2415421366b.1 for ; Wed, 02 Dec 2026 03:10:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796209799; x=1796814599; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=GLYrHA1uoQUtTJgM3/TYIUg4w9ePXfgLxgWylqwOZWk=; b=d2ZCMtSBAS3vXZwy6gUadlaoxmLyq+g19BdvspooScSh1IAchYmNuvC38MSgqyUzim Il5q/FzER9cC/vcHVHdLT9NJ9nJfekuxCCNU6qq3nd7xfWffAhkNtaHutL9O+KxnvlLW ISaC1gdjh6nC9+Plfa6Qf0h7frhW36sl2OdR9/FpZhk2nasucppBBnq850pK4ip7dQSA zFoIjvCQ8KdpU/qeyUWyJPePASRYvz2mM1NVH3dYLfNBvV1UjsDZwDoqeDEhuwVESSMp hsWK7OUwA6EsyS/Sek/eWtV2WewTTj0opuMoTZ24ZcPHo8xohh6nfu21rFCWlOX3HnYd GgNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796209799; x=1796814599; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=GLYrHA1uoQUtTJgM3/TYIUg4w9ePXfgLxgWylqwOZWk=; b=DWxe6YODnwkiUfq9pqHcfYezHG87APqH/8uWt6nYwrhWKoqEQ3MBQ1NQEvwuadp69/ YXE6u5k5FkNV8vkX/DNAHgRPBUlNH3IyHw5i+M2QiGc7W9vJArDXktVfXSWDL0SE7uwJ VZ+Free6IRbLedy8wMqykJpK/mjd1obnAllpb+La5p8WANlpqj/P7XOf82TrZKiVb0fk i7ipKhmakwfg05GBbHgZKfEyCZlEQ9aDkpdptwnF3sy3pRbtn96lCX7mlt9Dz53+yx1U tio8es99zqbMhsOoL3pnRmoRNRRe/nUXzyhPwwbIDcuzNB3HYmAhA158ZSBRZuP6iZNp xAsQ== X-Forwarded-Encrypted: i=1; AL+hErGrwbKYD/0eMHxnDyKSdwkXMhySoCbObtoN6uskUrnvOvNfa971Dsn1tbIjJvdeft2D32L3SAn9Y0sikxI=@vger.kernel.org X-Gm-Message-State: APuU4Z+6yzzzEOyR67ZejPRLL6cYi/n4CCQdUX8QakIupXUVTuht+o1L IYmSJ26BAF4tDWDLdKUbcV7tatsSG0NzjmpExWJR+qCnYb/jkhPrrYX1 X-Gm-Gg: AZFdTZcy3s7iyMS1MpvAlcDkshnGlyxULQ/JExyOw7uWR+s1aUYXRZd/JH8gLBie9qb Nz462cuPcC3Kz+lCcO1kgXPygT7LEWNdX67mM5iAKYxe+usIi5MSp0TY7TJGX3A5YbnODCyoDnd QJpRI4XHEPEFqCtqn7vgPRuPa0ae5VQFPHzr3zvpQvjMgjMraDJfHcLyTJIZJh2Jz3RTeIX/iXC QNyXLgUnVjMl7qG4M623gRFS1xIxH2Co/7R6EAAFhRi+o9HQTDl/lPL6PH7wmuJ1WyExV8K8BuA sCKf81adkkfIRrzJ4NYjc1dxojb3eMZGLasqQ+DKIQbQQK3O/Kp1Hi0rTuWJ2/NRM9uwQrR6kfO 06KRqhELJ+w113NXeqGivED5oAnUx/S+lGtLFRETycvwcTHWedkMezmhDH86cKpHqNrPof4sSPq TXDtAb/PkY3YQWqwh/LRjExL8XAeMdbJEgF60ZubyBf+PeYLCT0l9bZLFDoDVv+yc1DhOC4n96a 77OaFvl5Va3pLn4Ngv3WXDCxPnmaEOCE5AWt5HkmbK70cf/Q/KYuGDoFXPhcH/cwUs0Vdo/KxiR 9wYTpTIWoqfDH51e1WBGinJnGCpCR4VfRSw2q4m5zVglBYVFjUhfrxyv6BbZSE4VUFbLQ0nnpzQ l1IeWDrG4D8jdjnPzC5rhTgLTKiRrz/8O7SnQjljO7HMT03gk9NRPUO4BGyDR0eISfw16I9La12 NvPeNTyK/ib8T0YD2bX/ao3Cdu0uXNuPuh5134JRzuUWxCHKN8L+XbEXt3isNNAhWgSzPmRTP1P ycEeQ2jDWI= X-Received: by 2002:a17:906:99c9:b0:c48:a838:c17e with SMTP id a640c23a62f3a-c5131848f19mr3136196366b.14.1796209799112; Wed, 02 Dec 2026 03:09:59 -0800 (PST) Received: from [192.168.100.100] (87-205-15-91.static.ip.netia.com.pl. [87.205.15.91]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c513ae8ce16sm1314920966b.37.2026.12.02.03.09.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Dec 2026 03:09:58 -0800 (PST) Message-ID: <58f4675d-7cb0-4517-8837-427c8ac78880@gmail.com> Date: Wed, 2 Dec 2026 12:09:58 +0100 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] media: dvb-core: avoid dropping device ref on frontend open failure To: Yousef Alhouseen , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, syzbot+40339ea82afa8184ad5d@syzkaller.appspotmail.com References: <20260628091844.37577-1-alhouseenyousef@gmail.com> Content-Language: en-US From: Krystian Kaniewski In-Reply-To: <20260628091844.37577-1-alhouseenyousef@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 6/28/26 11:18, Yousef Alhouseen wrote: Hi Yousef, On Sun, Jun 28, 2026 at 11:18:44AM +0200, Yousef Alhouseen wrote: > dvb_device_open() takes a device reference before calling the frontend > open callback and drops that reference itself if the callback fails. > However, the frontend error path calls dvb_generic_release(), which drops > the same reference while merely trying to undo the user counters changed > by dvb_generic_open(). The same double put is behind the older syzbot report "KASAN: slab-use-after-free Read in dvb_device_open", open since December 2024. With vidtv it can be hit on demand: open the frontend read-write while another thread keeps sending the opener a caught signal, so that dvb_frontend_start() returns -EINTR after dvb_generic_open() has succeeded. On v7.4-rc4 with the syzbot config, the second such failure frees the frontend's dvb_device while dvb_minors[] still points to it, and the next open gives exactly the syzbot report. Failing the kthread_create_info allocation with fail-nth does the same through -ENOMEM, and a single failure followed by an unbind of vidtv ends in a use-after-free in dvb_media_device_free(). The syzbot program itself gets -EINTR on every frontend open, which is why it hits the bug within seconds. I can post the small test program if that helps. With this patch on v7.4-rc4 (it still applies, with an offset after the dvb_frontend_open() split), 200 interrupted opens and repeated -ENOMEM failures leave the device usable, a second writer still gets -EBUSY, unbinding vidtv after a failed open is clean, and the syzbot C and syz reproducers of the older report run cleanly. Two remarks on the tags. The double put on this path exists only since a2dd235df435 ("media: dvbdev: drop refcount on error path in dvb_device_open()"). With 0fc044b2b5e2 alone the dvb_generic_release() call balanced the reference taken in dvb_device_open(), so I think the Fixes tag should name a2dd235df435 instead. And the same patch can close the older report: Reported-by: syzbot+1eb177ecc3943b883f0a@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=1eb177ecc3943b883f0a Tested-by: Krystian Kaniewski Thanks, -- Krystian Kaniewski