В ядре Linux была устранена следующая уязвимость: nfc: pn533: hold a reference to the request skb Во время send_frame __pn533_send_async() публикует команду, а затем вызывает dev->phy_ops->send_frame(). Как только dev->cmd установлен, входящий кадр может быть сопоставлен с этой командой: I2C с резьбой IRQ запускает pn533_recv_frame(), который ставит в очередь cmd_complete_work, а pn533_send_async_complete() освобождает cmd->req с consume_skb(). На транспорте I2C pn533_i2c_send_frame() по-прежнему отсылает тот же skb после возвращения i2c_master_send(), поэтому завершение, которое гоняет отправку, может освободить skb, пока транспорт все еще использует его.
Запрос skb принадлежит объекту команды и может быть освобожден путем завершения команды в любое время после публикации dev->cmd, поэтому путь отправки транспорта не должен предполагать, что он остается живым. Держите временную ссылку на запрос skb через вызов send_frame (), чтобы транспорт всегда видел живой skb, даже если завершение загоняет отправку. Добавьте помощник pn533_send_cmd_frame () и используйте его из всех трех путей отправки.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: nfc: pn533: hold a reference to the request skb during send_frame __pn533_send_async() publishes the command and then calls dev->phy_ops->send_frame(). Once dev->cmd is set, an incoming frame can be matched to this command: the I2C threaded IRQ runs pn533_recv_frame(), which queues cmd_complete_work, and pn533_send_async_complete() frees cmd->req with consume_skb(). On the I2C transport, pn533_i2c_send_frame() still dereferences the same skb after i2c_master_send() returns, so a completion that races the send can free the skb while the transport is still using it. The request skb is owned by the command object and may be freed by command completion at any time after dev->cmd is published, so the transport send path must not assume it stays alive. Hold a temporary reference to the request skb across the send_frame() call so the transport always sees a live skb even if completion races the send. Add a pn533_send_cmd_frame() helper and use it from all three send paths.