mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
net: reject a netdev that implements only one hwtstamp NDO
ndo_hwtstamp_get and ndo_hwtstamp_set only make sense as a pair. A driver providing just one gets no complaint today, and the mismatch turns up in user space, where a set can succeed while the matching get fails. Catch it at registration instead. Suggested-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de> Link: https://patch.msgid.link/20261002094211.2350702-4-nb@tipi-net.de Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
05fe748456
commit
810a662abc
|
|
@ -11462,6 +11462,11 @@ static int netdev_check_ops(struct net_device *dev)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!ops->ndo_hwtstamp_get != !ops->ndo_hwtstamp_set) {
|
||||
netdev_WARN(dev, "driver implements only one hwtstamp NDO\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (netdev_need_ops_lock(dev) && ops->ndo_set_rx_mode &&
|
||||
!ops->ndo_set_rx_mode_async) {
|
||||
netdev_WARN(dev, "ops-locked drivers should use ndo_set_rx_mode_async\n");
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user