Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Feb 2014 11:41:13 -0500
From:      Ryan Stone <rysto32@gmail.com>
To:        "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>
Subject:   Races in ichsmb(9) when accessed from a multithreaded process
Message-ID:  <CAFMmRNxLWcxV2dYdr8R9ihrSgy4Fma9YELBmResU2KrQEQd6XA@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
ichsmb.c has the following rather worrisome comment:

* This driver assumes that the generic SMBus code will ensure that
* at most one process at a time calls into the SMBus methods below.

However, when I look at the code is sys/dev/smbus, I see nothing that
actually guarantees this if two threads in the same process call
ioctls on the same file descriptor.  It does call smbus_request_bus,
but mostly that just calls down into the smbus implementation (in this
case ichsmb) with SMBUS_CALLBACK.  ichsmb always just acks the
request, so no actual locking ends up occurring.

Is it intended that smb(9) clients be required to do their own
locking?  It seems to me that that is way more fragile than it needs
to be.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFMmRNxLWcxV2dYdr8R9ihrSgy4Fma9YELBmResU2KrQEQd6XA>