From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (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 A77B3435EEA for ; Thu, 9 Jul 2026 13:59:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783605586; cv=none; b=r5YVpu/+uLLKgP02UrAISuJ+MBt6C0k5u/Hjp9N3vO5KZvlQZKnXL61eAqXqFvTA+VRmAIomtQT2NkrRoGA0KuE2PuoKl7rsS+sl4ke/UztlePT/ttCy//uEzg3SJ03ht8wVbahNlT3UMjwnUmbiltGAY+08rGyefDRwBaMAyso= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783605586; c=relaxed/simple; bh=ppZAxB+RxuuVZH1TspNRNz4wP15E4S6F1OfFlo11GcQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=T8e2/Qih6rwG8x0uL0IHl2KfP1XXKYFQDdocWHm0G2K6ABvwCMkSgHRDCxuua8yufrl22KpDeQdASjDjo85s3hmg2W4+IX0RcWVPyno2kXV8f4jgZiLat12swy54heUN1KjM+7YRUW784S0JKfwkNxlAx6pHnIVyc7KpI87s5gk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=NJbjj3Nx; arc=none smtp.client-ip=209.85.221.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="NJbjj3Nx" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-4720f3bf164so487415f8f.1 for ; Thu, 09 Jul 2026 06:59:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1783605583; x=1784210383; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=MEnc/Z3kgY1BWUmjmbSGpXgxAOpzfRkvSdRKefdYCMU=; b=NJbjj3NxHFsa0VFyqz6EAATw79hB0SiOJWH1hPD3pnEJb3oqNl33N7a9JUkCUNzpdb HQzvghfg0YC5MoypxP6sMqqrSRMyDQRoEWGc2YwmwFTk6vZgHYGZj9RcE73Mzpw/HtPK AQKcUMA6UN0zv2/H3M8H/6e3c+ZrtyX0Gh/geOynhaw4pJt4PPAK48Dhz5bmu9WVjIIj oeDVZ6VjpGob0mmsDz0uh1FSvxF5nQtwei0Dw2qKzNLbPEGxGfB4PqWotiut4EWbHVMN 3pGmNyvmdcSOKe5TQ8jl1xOM2l+CGrJji5WE4VERjerAjfOmvvzRnn5lY6RdHt9/dFfR rsLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783605583; x=1784210383; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=MEnc/Z3kgY1BWUmjmbSGpXgxAOpzfRkvSdRKefdYCMU=; b=hheNvblxwFW146hgmRGnV9ihP4Y6YRI8L+5FqhxFFAdrxq/QHFq52q8h6Ky9meNu6T L03Qa0vTna64w051WkTQ+9CoorAZGmsUsWdOLmwgUrxW8NBYdRo8SshcHmWl2pwEIWOE KyTdQlqCr04xoNFpyzVi+y0zgELmpCLtAkgBhy+z4TGBjcviaiiJbn6Vi4tFdagAPwZy W34E8r6kqZ8AlENq62fRjeEdXJ8qUxAc5YG9h5RaYQC6v98A3avF8dHy0cfCH8fCjHNN y6KJSW6/+lfqo4tnoIuL/RjBJU1MFUlbThXuzvQYao4SEN8xfcqFIH2AxvXiBYGiZsYm mHxw== X-Forwarded-Encrypted: i=1; AHgh+Rr7E3giFY6BftxcmiOdNygnNgQNilpxZR7HTDDoRnTwVcBrjzVE4OXxJK95kMno1QLjjKVuhvdFtlAPCCw=@vger.kernel.org X-Gm-Message-State: AOJu0YyEEdXexd774L+gPYG2R0UVoMCuADAKo/q4/pBvjWMUcK4svKOP uuEVld3pyxJDJtrOrB/l0DJ4zPsLBk29DsSLrXetXC8pY6UedXlDTiMPiSfTIOQBooI= X-Gm-Gg: AfdE7cnRe1rPMxrLQwpBRJvXypCIS8qWtql0NFEaQ9owSW7de0cRZO/0N0WwiWCHhwi Fbm1gtHpCOhU+oDRosXn2Wms+hMn6OW16vi4LZ8vHCZc1eHNqAyglONRlSFY7nw1q/T5o5aS1oj SEbiiwrfctenRJHZrmMvy45G631rnu3S+Rtg6Dh0swuYhdlb3lPX9l8nfgA7dqX8Ysf5hegerjw QEDYmBuLqmrAz+UF6z7ymS8mPF5n+qaAVKHPY2vg5SHksWBYq+NsoFoCm30e1EGmh7/PlmgYLp5 t068aKK/nRknaXZRu93yE6L//NrMkeaAVvz7YEU1zwp2/DPTr3ZWFeQNvMxFBnj8I+Z9A71684N 8tI2pGFLVFoW58Vv9Tcygi3BY/o+zdgma/nFDxzK0vy8NwSYeW8CEJVVrNZWBEjD+Jg3UDyd5Sc h3bJNgrnJ9CIdVTYc= X-Received: by 2002:a05:6000:310c:b0:473:66e2:37d4 with SMTP id ffacd0b85a97d-47df7575697mr3372869f8f.27.1783605583081; Thu, 09 Jul 2026 06:59:43 -0700 (PDT) Received: from pathway.suse.cz ([176.114.240.130]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47a9de1e785sm51561861f8f.8.2026.07.09.06.59.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2026 06:59:42 -0700 (PDT) Date: Thu, 9 Jul 2026 15:59:40 +0200 From: Petr Mladek To: John Ogness Cc: Sergey Senozhatsky , Steven Rostedt , linux-kernel@vger.kernel.org, Sashiko Subject: Re: [PATCH printk] printk: Fix possible console use-after-free Message-ID: References: <20260703141521.202813-1-john.ogness@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260703141521.202813-1-john.ogness@linutronix.de> On Fri 2026-07-03 16:20:31, John Ogness wrote: > When emitting a record via legacy printing, it is possible that a handover > to another legacy printing context occurs. When a context has performed a > handover, the console SRCU read lock is released and the pointer to the > console struct might now be invalid. Therefore, after calling > nbcon_legacy_emit_next_record() or console_emit_next_record(), it is > necessary to check if a handover occurred _before_ further @con usage. > > Sashiko pointed out that console_flush_one_record() was not doing this. > > In console_flush_one_record(), after emitting a record, move the further > usage of @con after the handover check. > > Fixes: c158834b223f ("printk: nbcon: Use nbcon consoles in console_flush_all()") > Reported-by: Sashiko > Closes: https://lore.kernel.org/lkml/20260630170903.099D61F000E9@smtp.kernel.org > Signed-off-by: John Ogness JFYI, the patch has been committed into printk/linux.git, branch for-7.3-trivial. Best Regards, Petr