Page MenuHomeFreeBSD

netmap: Fix driver name handling
ClosedPublic

Authored by markj on Wed, Aug 5, 5:37 PM.

Details

Summary

if_initname() requires the caller to ensure that the lifetime of the
interface's name buffer contains that of the ifnet itself.
netmap_vi_create() wasn't respecting that; we were instead passing the
stack-allocated buffer provided by the ioctl handler.

While here, add a check to avoid assuming that the caller-provided
buffer is nul-terminated.

Reported by: syzkaller

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj requested review of this revision.Wed, Aug 5, 5:37 PM

Thanks, but if netmap owns the allocated string (rather than ifnet), shouldn't we deallocate that on deallocation of the netmap_vp_adapter?

This revision is now accepted and ready to land.Thu, Aug 6, 7:05 AM

Free the name buffer in nm_vi_destroy()

This revision now requires review to proceed.Thu, Aug 6, 1:55 PM
This revision is now accepted and ready to land.Fri, Aug 7, 1:34 PM
This revision was automatically updated to reflect the committed changes.