From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (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 BF73B17DE36; Wed, 22 Jan 2025 20:16:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737576974; cv=none; b=assRdOwnuskl29z+TWYyeTMYwhdfNFCbqFI//IjMuP8bZLAYeFs/gRmrEIu55h8E27OGvsYxJmULM9cPWf3c5VzlzCaryJOTr9/QHl1J8lKU+js0icokggAoHXGvD0d+mTY9DGo3Uw3Jtxo2WszIUmlohY43kbnWqckKX7KPeKk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737576974; c=relaxed/simple; bh=mrELf360ddFSXfr/6Kk6zfUpfHKhnGtGQt3ND1h8iMU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XIBPT2b0H1ZD5rRiI4PNZicWyuebDEumBAuq2gEouoTXmSoM2FbFRm5hVBc/gKcU8IO7zP6Pt3AjSk6n2ks9ilY/ZuVDI8ar0LyR6Fzw6bfbsKsVNWJO+P1jvun/YE5f76NetSjas9LFM56wWc9OWAZkIb39FqssxbniQfIfCes= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=pqXTxbUL; arc=none smtp.client-ip=156.67.10.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="pqXTxbUL" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Transfer-Encoding:Content-Disposition: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:From: Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Content-Disposition: In-Reply-To:References; bh=FEP6BDE1bCKHh4jPC1RgeOE19jluOGsto4pWRvxO/C8=; b=pq XTxbULKsHW0HSkTfNZQOynnfhy1DREsZqv2i2BouP7qnWKKsvjH8AQ2N8FV0vO6Dp77VZKCyxDRhP cGFoC96kAsN9o7vHiZVueHf2RFMintRDf/zB1vPaD2dN0XKvrcWTIBX4ow8FS4VtucVcRn1CRioIq 20xYp1rdTnu9uFU=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1tah8g-007397-TJ; Wed, 22 Jan 2025 21:15:50 +0100 Date: Wed, 22 Jan 2025 21:15:50 +0100 From: Andrew Lunn To: Thomas =?iso-8859-1?Q?Wei=DFschuh?= Cc: Richard Cochran , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , John Stultz , Arnd Bergmann , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH net] ptp: Ensure info->enable callback is always set Message-ID: References: <20250122-ptp-enable-v1-1-979d3d24591d@weissschuh.net> 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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20250122-ptp-enable-v1-1-979d3d24591d@weissschuh.net> On Wed, Jan 22, 2025 at 07:39:31PM +0100, Thomas Weißschuh wrote: > The ioctl and sysfs handlers unconditionally call the ->enable callback. > Not all drivers implement that callback, leading to NULL dereferences. > Example of affected drivers: ptp_s390.c, ptp_vclock.c and ptp_mock.c. > + if (!ptp->info->enable) > + ptp->info->enable = ptp_enable; Is it possible that a driver has defined info as a const, and placed it into read only memory? It is generally good practice to make structures of ops read only to prevent some forms of attack. Andrew