Page MenuHomeFreeBSD

pfilctl: initialize pio_nheads for PFILIOC_LISTHEADS ioctl
Needs ReviewPublic

Authored by rew on Apr 24 2022, 6:17 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Apr 22, 6:57 AM
Unknown Object (File)
Feb 17 2024, 10:26 PM
Unknown Object (File)
Jan 10 2024, 9:00 PM
Unknown Object (File)
Dec 26 2023, 8:51 PM
Unknown Object (File)
Dec 20 2023, 5:34 AM
Unknown Object (File)
Dec 15 2023, 4:37 AM
Unknown Object (File)
Nov 4 2023, 3:50 AM
Unknown Object (File)
Oct 3 2023, 1:32 PM
Subscribers

Details

Reviewers
glebius
Summary

When pfilctl hooks is called with no hooks present:

% pfilctl hooks
pfilctl: ioctl(PFILIOC_LISTHEADS): Bad address

If pio_nheads or pio_nhooks is not initialized, pfilioc_listheads()
thinks the caller wants the heads/hooks copied out. However, in this
case, the caller is only expecting the number of heads/hooks returned
and hasn't prepared the buffer that pfilioc_listheads() is trying to
copyout to, causing the bad address error.

Looking at pfilioc_listheads() in sys/net/pfil.c, should the semantics
be to return the number of heads/hooks when either pio_nheads or
pio_nhooks is zero?

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 45343
Build 42231: arc lint + arc unit