From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8065C23D7E3; Wed, 22 Apr 2026 07:03:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.38.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776841388; cv=none; b=U5tcrG5l5CqCz842LQ+9vceXDu8uC4W0rRH21tGDi16uUV9Pdyib5WIY2TrLt/xSTldDzu8+astZFAJfKBFhoDQVdPHNKxXr4UOGxmB155wsj9ZS4i1fo85tXUX/ShNwnuA2gwJHkoJXKsJVTLRGgDQfJiBmV7xs6mmv+dZ71+Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776841388; c=relaxed/simple; bh=souXIlQv8+iFw9zCxKwZUGD1h7PhrwEDbv7Rj5/8daE=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=iiLpIRKBcgT3DRGYG7PRD7VFWFId1/dgxliOaOB/cya4oQbwmeiLzbXesvweRgJgui9m8CRT4jOMBL+6cmzfISTJxvzlyBcJ6cu+S6DoOulcYyY6LoUvTmrVrIgp2KqJ8rOdpUh1cT1W0K4TU9WuQ0qlkbAhcv4fepjmCEPDinU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=permerror header.from=sipsolutions.net; spf=none smtp.mailfrom=sipsolutions.net; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b=wJX1KPQc; arc=none smtp.client-ip=168.119.38.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=permerror header.from=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="wJX1KPQc" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=MIME-Version:Content-Transfer-Encoding: Content-Type:References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=YHNRGC1hGWc6m3ZzcDaW9en/CqZpzjUfDH3bqt0lyZw=; t=1776841386; x=1778050986; b=wJX1KPQc6S5TmpHv74CjYS8ePA1kWs2754l/HFA8cNMxh+/ t2IJLZaDzfXl4m7uUUiGhFvmB0HZRxIn+bayT+rl58kKcQA+i9vWYCHPROwENAPbqozqjSMZbzr3C sJSQSR4XmDVGhzYM2Yl67UgnIKc/R9ubqJbEwXvxp5IvaoG5d4WqsVeBz2sB/Zs7Kjb7DrqvWzog3 2K7qLYpUdhQ1ne9nERw3IwuK+Q6eqp8O2N5PcCUpWSCO8MjbYZ5BPeHwz0tavEtUyQA+meSDW70Ua dFMWnKOzMXmKuF3GkYK23cauUwdyWBJhAZQvbWljqbZ09NRCUcscEah/u4uQHaMQ==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.98.2) (envelope-from ) id 1wFRbx-000000067S7-1ywB; Wed, 22 Apr 2026 09:03:01 +0200 Message-ID: <2fd57f98e3149ba56c83994a9181e92a0104cfe3.camel@sipsolutions.net> Subject: Re: [PATCH] um: vector: fix NULL pointer derefs in queue-less transports From: Johannes Berg To: Michael Bommarito , richard@nod.at, anton.ivanov@cambridgegreys.com Cc: linux-um@lists.infradead.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Date: Wed, 22 Apr 2026 09:03:00 +0200 In-Reply-To: <20260410203028.3717914-1-michael.bommarito@gmail.com> References: <20260410203028.3717914-1-michael.bommarito@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.3 (3.58.3-1.fc43) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-malware-bazaar: not-scanned Sorry, I didn't pay much attention to this before... On Fri, 2026-04-10 at 16:30 -0400, Michael Bommarito wrote: > TAP transport sets neither VECTOR_RX nor VECTOR_TX, so > vector_net_open() never allocates rx_queue or tx_queue. HYBRID sets > VECTOR_RX but not VECTOR_TX, so tx_queue is NULL there too. >=20 > vector_reset_stats(), vector_poll(), vector_get_ethtool_stats(), and > vector_get_ringparam() unconditionally deref these queue pointers, > causing a NULL pointer crash on SMP or with any lock debugging option. >=20 > Guard all queue pointer accesses with NULL checks. I see how that fixes the crash, but maybe you could write a few words on why it's still correct? > - spin_lock(&vp->tx_queue->head_lock); > - spin_lock(&vp->rx_queue->head_lock); > + if (vp->tx_queue) > + spin_lock(&vp->tx_queue->head_lock); > + if (vp->rx_queue) > + spin_lock(&vp->rx_queue->head_lock); > memcpy(tmp_stats, &vp->estats, sizeof(struct vector_estats)); I could imagine for example this memcpy() observing a torn write or something like that and getting strange results out? Or is that just not a thing because UML is (still) mostly non-SMP? Also I think there are related issues that wouldn't show up for a broken configuration, such as if create_queue() fails to allocate memory and we get an inconsistency between tx_queue / rx_queue pointers and VECTOR_TX / VECTOR_RX flags? Though I'll admit that seems highly unlikely. johannes