summaryrefslogtreecommitdiff
path: root/drivers/nfc
AgeCommit message (Collapse)Author
11 daysMerge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski
Merge in late fixes in preparation for the net-next PR. Conflicts: drivers/dpll/dpll_core.c drivers/dpll/dpll_netlink.c 33f016b23a219 ("dpll: fix NULL deref in dpll_device_ops() during teardown race") b1d0c412088e3 ("dpll: add STATE_CONNECTED_OVERRIDE pin capability") https://lore.kernel.org/aoR9YYY2P5--3x0N@sirena.org.uk https://lore.kernel.org/aoR9VmKllVGwmQn_@sirena.org.uk No adjacent changes. Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-11nfc: st95hf: switch to using sleeping variants of gpiod APIDmitry Torokhov
The driver does not use gpiod API calls in an atomic context. Switch to gpiod_set_value_cansleep() calls to allow using the driver with GPIO controllers that might need process context to operate. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Link: https://patch.msgid.link/amPsnh9wDIG2CeSi@google.com Signed-off-by: David Heidelberg <david@ixit.cz>
2026-08-11nfc: Unify style of usb_device_id arraysUwe Kleine-König (The Capable Hub)
The usual coding style is to skip the comma after a initializer iff the closing } is on the same line. Also there is usually no empty line between the array and the MODULE_DEVICE_TABLE() macro. Adapt two drivers accordingly to match this common style. Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/8a186cb0376deb3d4f4264e6ed351562b79bb53d.1783091699.git.u.kleine-koenig@baylibre.com Signed-off-by: David Heidelberg <david@ixit.cz>
2026-08-11nfc: Unify style of spi_device_id arraysUwe Kleine-König (The Capable Hub)
Unify the style of the list terminator in spi_device_id arrays, that is use a single space between { and }. This is the most common and generally recommended style for these. Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/78d632098fd42dbf2846cb89d66ec83bb9e1de99.1783091699.git.u.kleine-koenig@baylibre.com Signed-off-by: David Heidelberg <david@ixit.cz>
2026-08-11nfc: Initialize spi_device_idarrays using member namesUwe Kleine-König (The Capable Hub)
While being less compact, using named initializers allows to more easily see which members of the structs are assigned which value without having to lookup the declaration of the struct. And it's also more robust against changes to the struct definition. The mentioned robustness is relevant for a planned change to struct spi_device_id that replaces .driver_data by an anonymous union. This patch doesn't modify the compiled arrays, only their representation in source form benefits. Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/308a0d43ef042566ca595f1afa803cac592a4643.1783091699.git.u.kleine-koenig@baylibre.com Signed-off-by: David Heidelberg <david@ixit.cz>
2026-08-11nfc: Drop unused assignment of spi_device_id driver dataUwe Kleine-König (The Capable Hub)
The drivers explicitly set the .driver_data member of struct spi_device_id to zero without relying on that value. Drop these unused assignments. This patch doesn't modify the compiled arrays, only their representation in source form benefits. Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/c645d5855d26307d6164122412335533febbf8b9.1783091699.git.u.kleine-koenig@baylibre.com Signed-off-by: David Heidelberg <david@ixit.cz>
2026-08-11nfc: Unify style of of_device_id arraysUwe Kleine-König (The Capable Hub)
The most common style treewide is: - A single space in the list terminator and no trailing , - No comma after a named initializers iff the closing } is on the same line Adapt the of_device_id arrays accordingly. Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> Reviewed-by: Ian Ray <ian.ray@gehealthcare.com> Link: https://patch.msgid.link/583375dcd834f5edf6241b09cdd75ad4f32af668.1783091699.git.u.kleine-koenig@baylibre.com Signed-off-by: David Heidelberg <david@ixit.cz>
2026-08-11nfc: Drop __maybe_unused from of_device_id tablesUwe Kleine-König (The Capable Hub)
Referencing these arrays in MODULE_DEVICE_TABLE() is enough to convince the compiler that they are used even if the drivers are built-in (since 5ab23c7923a1 ("modpost: Create modalias for builtin modules"). So the __maybe_unused marking can be removed without introducing a compiler warning. Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/031ea0ae38838df3261f844eb13e9841769b49a7.1783091699.git.u.kleine-koenig@baylibre.com Signed-off-by: David Heidelberg <david@ixit.cz>
2026-08-11nfc: Initialize mei_cl_device_idarrays using member namesUwe Kleine-König (The Capable Hub)
While being less compact, using named initializers allows to more easily see which members of the structs are assigned which value without having to lookup the declaration of the struct. And it's also more robust against changes to the struct definition. The mentioned robustness is relevant for a planned change to struct mei_cl_device_id that replaces .driver_data by an anonymous union. This patch doesn't modify the compiled arrays, only their representation in source form benefits. Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/cdc9bbac2e0743550970e565f57996c8a833446f.1783091699.git.u.kleine-koenig@baylibre.com Signed-off-by: David Heidelberg <david@ixit.cz>
2026-08-11nfc: pn544: Drop empty line between i2c_device_id array and ↵Uwe Kleine-König (The Capable Hub)
MODULE_DEVICE_TABLE() Usually there is no empty line between a module device table and the respective MODULE_DEVICE_TABLE(): $ git grep -h -B1 ^MODULE_DEVICE_TABLE v7.1-rc1 | sort | uniq -c | sort -n ... 1388 8129 }; 9784 -- (The `--` is part of grep output to separate the matches with their context from each other, that's not the most usual line before MODULE_DEVICE_TABLE(...).) Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/7562d0062948a474957d8d733c0e8a70de502624.1783091699.git.u.kleine-koenig@baylibre.com Signed-off-by: David Heidelberg <david@ixit.cz>
2026-08-11nfc: Unify style of acpi_device_id arraysUwe Kleine-König (The Capable Hub)
Unify the style of the list terminator in acpi_device_id arrays, that is use a single space between { and }. This is the most common and generally recommended style for these. Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/30cd94a6821917f16daffdce5fabf145432c13eb.1783091699.git.u.kleine-koenig@baylibre.com Signed-off-by: David Heidelberg <david@ixit.cz>
2026-08-11nfc: Initialize acpi_device_id arrays using member namesUwe Kleine-König (The Capable Hub)
While being less compact, using named initializers allows to more easily see which members of the structs are assigned which value without having to lookup the declaration of the struct. And it's also more robust against changes to the struct definition. The mentioned robustness is relevant for a planned change to struct acpi_device_id that replaces .driver_data by an anonymous union. This patch doesn't modify the compiled arrays, only their representation in source form benefits. The former was confirmed with x86 and arm64 builds. Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> Reviewed-by: Ian Ray <ian.ray@gehealthcare.com> Link: https://patch.msgid.link/5f60cd3e9831aac3995ed1a1b074ca1ae32e5286.1783091699.git.u.kleine-koenig@baylibre.com Signed-off-by: David Heidelberg <david@ixit.cz>
2026-08-11nfc: Drop unused assignment of acpi_device_id driver dataUwe Kleine-König (The Capable Hub)
The drivers explicitly set the .driver_data member of struct acpi_device_id to zero without relying on that value. Drop these unused assignments. This patch doesn't modify the compiled arrays, only their representation in source form benefits. Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/c77f6376214001297f28d3ec48f0a853985f1847.1783091699.git.u.kleine-koenig@baylibre.com Signed-off-by: David Heidelberg <david@ixit.cz>
2026-08-11nfc: Drop __maybe_unused from acpi_device_id tablesUwe Kleine-König (The Capable Hub)
Referencing these arrays in MODULE_DEVICE_TABLE() is enough to convince the compiler that they are used even if the drivers are built-in (since 5ab23c7923a1 ("modpost: Create modalias for builtin modules"). So the __maybe_unused marking can be removed without introducing a compiler warning. Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/4c25d7a7f81d5117cd5d0de4a9f06ed0552e8793.1783091699.git.u.kleine-koenig@baylibre.com Signed-off-by: David Heidelberg <david@ixit.cz>
2026-08-11nfc: nxp-nci: Add remove on IRQ errorGriffin Kroah-Hartman
Add a call to nxp_nci_remove() in nxp_nci_i2c_probe() when the request_threaded_irq() fails. Previously, IRQ resources were not being freed upon error. Assisted-by: gkh_clanker_2000 Cc: David Heidelberg <david@ixit.cz> Cc: Carl Lee <carl.lee@amd.com> Cc: Jakub Kicinski <kuba@kernel.org> Cc: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Cc: Ian Ray <ian.ray@gehealthcare.com> Cc: "Uwe Kleine-König (The Capable Hub)" <u.kleine-koenig@baylibre.com> Signed-off-by: Griffin Kroah-Hartman <griffin@kroah.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Ian Ray <ian.ray@gehealthcare.com> Link: https://patch.msgid.link/2026070726-observer-fang-9716@gregkh Signed-off-by: David Heidelberg <david@ixit.cz>
2026-08-11nfc: mrvl: spi: Unregister dev on allocation failGriffin Kroah-Hartman
Call nfcmrvl_nci_unregister_dev() if nci_spi_allocate_spi() fails, unwrapping the previous call to nfcmrvl_nci_register_dev() during the nfcmrvl_spi_probe() function. Assisted-by: gkh-clanker-2000 Cc: David Heidelberg <david@ixit.cz> Signed-off-by: Griffin Kroah-Hartman <griffin@kroah.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://patch.msgid.link/2026070716-crucial-slouchy-b8a9@gregkh Signed-off-by: David Heidelberg <david@ixit.cz>
2026-08-11nfc: trf7970a: Use NULL when no response is expectedLinmao Li
When a command's timeout is zero, no response is expected, and the TX interrupt handler completes the command by passing ERR_PTR(0) to the digital callback. ERR_PTR(0) evaluates to NULL, so no errno is encoded here. Use NULL directly to avoid suggesting that this is an error-pointer path. Signed-off-by: Linmao Li <lilinmao@kylinos.cn> Link: https://patch.msgid.link/20260706075743.564658-1-lilinmao@kylinos.cn Signed-off-by: David Heidelberg <david@ixit.cz>
2026-08-11nfc: pn533: fix memcpy overflow warningRosen Penev
error: call to ‘__read_overflow2_field’ declared with attribute warning: detected read beyond size of field (2nd parameter); maybe use struct_group()? [-Werror=attribute-warning] As suggested, add a struct_group and memcpy that. Also replace 9 with sizeof for clarify. Signed-off-by: Rosen Penev <rosenp@gmail.com> Link: https://patch.msgid.link/20260608050034.5679-1-rosenp@gmail.com Signed-off-by: David Heidelberg <david@ixit.cz>
2026-08-11nfc: microread: validate target discovery payload lengthsPengpeng Hou
microread_target_discovered() parses target discovery payloads from skb->data according to the HCI gate. The fixed field offsets and UID copies were checked only against the destination nfc_target buffers, not against the actual skb length. Validate that each gate-specific payload contains the fixed fields and UID bytes before reading or copying them. Fixes: cfad1ba87150 ("NFC: Initial support for Inside Secure microread") Cc: stable@vger.kernel.org Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn> Link: https://patch.msgid.link/20260723103508.1-microread-v2-pengpeng@iscas.ac.cn Signed-off-by: David Heidelberg <david@ixit.cz>
2026-08-11nfc: pn533: purge fragmented skbs during cleanupXu Rao
pn53x_common_clean() purges resp_q before freeing the common PN533 state, but it leaves fragment_skb untouched. The fragmentation helpers queue transmit fragments there while sending large initiator or target-mode frames, and those skbs remain owned by the driver until they are sent or discarded. If the device is removed while fragments are still queued, the common cleanup path frees the PN533 state without releasing the queued fragment skbs, leaking them. Purge fragment_skb during cleanup alongside resp_q. Fixes: 963a82e07d4e ("NFC: pn533: Split large Tx frames in chunks") Cc: stable@vger.kernel.org Signed-off-by: Xu Rao <raoxu@uniontech.com> Link: https://patch.msgid.link/2D896607CAE4408E+20260720021444.3362044-1-raoxu@uniontech.com Signed-off-by: David Heidelberg <david@ixit.cz>
2026-08-11nfc: st21nfca: validate ATR_REQ length against the received frameDoruk Tan Ozturk
st21nfca_tm_recv_atr_req() checks that the received ATR_REQ frame is at least ST21NFCA_ATR_REQ_MIN_SIZE and that the self-declared atr_req->length is at least sizeof(struct st21nfca_atr_req), but never checks that atr_req->length does not exceed the actual received length (skb->len). st21nfca_tm_send_atr_res() then trusts the declared length: gb_len = atr_req->length - sizeof(struct st21nfca_atr_req); ... memcpy(atr_res->gbi, atr_req->gbi, gb_len); so an RF peer that sends a short frame but sets atr_req->length larger than the frame makes gb_len exceed the general bytes actually present, and the memcpy reads out of bounds past the received skb. Those bytes are placed in the ATR_RES and sent back to the peer (kernel-memory disclosure to a proximity attacker); a larger declared length is an out-of-bounds read (DoS). Reject frames whose declared length exceeds the received length. The adjacent nfc_tm_activated() path in the same function already derives its general-bytes length from skb->len rather than the declared field. Found by 0sec (https://0sec.ai) using automated source analysis; the missing bound is evident from source. Compile-tested. Fixes: 1892bf844ea0 ("NFC: st21nfca: Adding P2P support to st21nfca in Initiator & Target mode") Cc: stable@vger.kernel.org Assisted-by: 0sec:claude-opus-4-8 Signed-off-by: Doruk Tan Ozturk <doruk@0sec.ai> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20260711071301.58071-1-doruk@0sec.ai Signed-off-by: David Heidelberg <david@ixit.cz>
2026-08-11nfc: pn533: hold a reference to the request skb during send_frameYinhao Hu
__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. Fixes: 9815c7cf22da ("NFC: pn533: Separate physical layer from the core implementation") Signed-off-by: Yinhao Hu <dddddd@hust.edu.cn> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20260626073434.3977525-1-dddddd@hust.edu.cn Signed-off-by: David Heidelberg <david@ixit.cz>
2026-08-11nfc: fdp: bound the device-reported read length and fix an skb leakBryam Vargas
fdp_nci_i2c_read() takes the next packet length from two device-supplied bytes and never validates it. The value is a u16 used as the i2c_master_recv() count into a 261-byte on-stack buffer: a malicious, counterfeit or malfunctioning controller (or an i2c bus interposer) can drive it far past the buffer for a stack out-of-bounds write that clobbers the canary and return address, or below the minimum frame size (directly, or by truncating the computed sum) so the header/LRC strip and the next length read run past a short receive. Reject a length outside [FDP_NCI_I2C_MIN_PAYLOAD, FDP_NCI_I2C_MAX_PAYLOAD], as a corrupted packet already is, and force resynchronization. The same loop allocates one data skb per iteration and assumes a length packet followed by a data packet; a device that sends two data packets in one call leaks the first skb when the second allocation overwrites it. Free a previously allocated skb before allocating the next. Fixes: a06347c04c13 ("NFC: Add Intel Fields Peak NFC solution driver") Cc: stable@vger.kernel.org Suggested-by: Simon Horman <horms@kernel.org> Signed-off-by: Bryam Vargas <hexlabsecurity@proton.me> Link: https://patch.msgid.link/20260616-b4-disp-b1f8ab4c-v2-1-2d1fe5955325@proton.me Signed-off-by: David Heidelberg <david@ixit.cz>
2026-07-03Replace <linux/mod_devicetable.h> by more specific <linux/device-id/*.h> (c ↵Uwe Kleine-König (The Capable Hub)
files) Replace the #include of <linux/mod_devicetable.h> by the more specific <linux/device-id/*.h> where applicable. For most cases the include can be dropped completely, only a few drivers need one or two headers added. Acked-by: Danilo Krummrich <dakr@kernel.org> Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Acked-by: Bjorn Helgaas <bhelgaas@google.com> Link: https://patch.msgid.link/1a3f2007c5c5dcf555c09a4035ce3ae8ef1b6c49.1782808461.git.u.kleine-koenig@baylibre.com Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
2026-06-11nfc: Use named initializers for struct i2c_device_idUwe Kleine-König (The Capable Hub)
While being less compact, using named initializers allows to more easily see which members of the structs are assigned which value without having to lookup the declaration of the struct. And it's also more robust against changes to the struct definition. While touching all these arrays, unify usage of whitespace in the list terminator. This patch doesn't modify the compiled arrays, only their representation in source form benefits. The former was confirmed with x86 and arm64 builds. Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Link: https://patch.msgid.link/20260518133311.644160-2-u.kleine-koenig@baylibre.com Signed-off-by: David Heidelberg <david@ixit.cz>
2026-06-11nfc: nxp-nci: treat -ENXIO in IRQ thread as no data availableCarl Lee
The I2C read operation in the IRQ thread may return -ENXIO when the controller has not yet provided data after asserting IRQ. IRQ assertion does not guarantee that data is immediately available on the I2C bus. In such cases, the read request may be NACKed, resulting in -ENXIO. Treat this condition as "no data available yet" and log it at debug level instead of reporting it as a read failure. This avoids misleading error messages during normal operation. Signed-off-by: Carl Lee <carl.lee@amd.com> Link: https://patch.msgid.link/20260526-nfc-nxp-nci-treat-enxio-as-no-data-available-yet-v1-1-305bb11b9147@amd.com Signed-off-by: David Heidelberg <david@ixit.cz>
2026-06-11nfc: nxp-nci: Add ISO15693 supportCarl Lee
NXP NCI controllers such as PN7150 support ISO15693 Type 5 tags, but the driver does not currently advertise this protocol. Add NFC_PROTO_ISO15693_MASK so that ISO15693 tags can be detected through the Linux NFC stack. Signed-off-by: Carl Lee <carl.lee@amd.com> Link: https://patch.msgid.link/20260512-nfc-nxp-nci-add-iso15693-support-v1-1-3394e5b9dba9@amd.com Signed-off-by: David Heidelberg <david@ixit.cz>
2026-06-11nfc: trf7970a: fix comment typosMiles Krause
Fix a few spelling mistakes in comments. Signed-off-by: Miles Krause <mileskrause5200@gmail.com> Link: https://patch.msgid.link/20260501003548.6838-1-mileskrause5200@gmail.com Signed-off-by: David Heidelberg <david@ixit.cz>
2026-05-18nfc: nxp-nci: i2c: use rising-edge IRQ on ACPI systemsCarl Lee
Some ACPI-based platforms report incorrect IRQ trigger types (e.g. IRQF_TRIGGER_HIGH), which can lead to interrupt storms. Use the historically working rising-edge trigger on ACPI systems to avoid this regression. Device Tree-based systems continue to use the firmware-provided trigger type. Fixes: 57be33f85e36 ("nfc: nxp-nci: remove interrupt trigger type") Signed-off-by: Carl Lee <carl.lee@amd.com> Tested-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca> Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca> Tested-by: Luca Stefani <luca.stefani.ge1@gmail.com> Link: https://patch.msgid.link/20260516-nfc-nxp-nci-i2c-restore-irq-trigger-fallback-v3-1-37ba4b6e9086@amd.com Signed-off-by: David Heidelberg <david@ixit.cz>
2026-04-27NFC: trf7970a: Ignore antenna noise when checking for RF fieldPaul Geurts
The main channel Received Signal Strength Indicator (RSSI) measurement is used to determine whether an RF field is present or not. RSSI != 0 is interpreted as an RF Field is present. This does not take RF noise and measurement inaccuracy into account, and results in false positives in the field. Define a noise level and make sure the RF field is only interpreted as present when the RSSI is above the noise level. Fixes: 851ee3cbf850 ("NFC: trf7970a: Don't turn on RF if there is already an RF field") Signed-off-by: Paul Geurts <paul.geurts@prodrive-technologies.com> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Reviewed-by: Mark Greer <mgreer@animalcreek.com> Link: https://patch.msgid.link/20260422100930.581237-1-paul.geurts@prodrive-technologies.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-04-09Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski
Cross-merge networking fixes after downstream PR (net-7.0-rc8). Conflicts: net/ipv6/seg6_iptunnel.c c3812651b522f ("seg6: separate dst_cache for input and output paths in seg6 lwtunnel") 78723a62b969a ("seg6: add per-route tunnel source address") https://lore.kernel.org/adZhwtOYfo-0ImSa@sirena.org.uk net/ipv4/icmp.c fde29fd934932 ("ipv4: icmp: fix null-ptr-deref in icmp_build_probe()") d98adfbdd5c01 ("ipv4: drop ipv6_stub usage and use direct function calls") https://lore.kernel.org/adO3dccqnr6j-BL9@sirena.org.uk Adjacent changes: drivers/net/ethernet/stmicro/stmmac/chain_mode.c 51f4e090b9f8 ("net: stmmac: fix integer underflow in chain mode") 6b4286e05508 ("net: stmmac: rename STMMAC_GET_ENTRY() -> STMMAC_NEXT_ENTRY()") Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-04-09nfc: pn533: allocate rx skb before consuming bytesPengpeng Hou
pn532_receive_buf() reports the number of accepted bytes to the serdev core. The current code consumes bytes into recv_skb and may already hand a complete frame to pn533_recv_frame() before allocating a fresh receive buffer. If that alloc_skb() fails, the callback returns 0 even though it has already consumed bytes, and it leaves recv_skb as NULL for the next receive callback. That breaks the receive_buf() accounting contract and can also lead to a NULL dereference on the next skb_put_u8(). Allocate the receive skb lazily before consuming the next byte instead. If allocation fails, return the number of bytes already accepted. Fixes: c656aa4c27b1 ("nfc: pn533: add UART phy driver") Cc: stable@vger.kernel.org Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn> Link: https://patch.msgid.link/20260405094003.3-pn533-v2-pengpeng@iscas.ac.cn Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-04-03nfc: s3fwrn5: allocate rx skb before consuming bytesPengpeng Hou
s3fwrn82_uart_read() reports the number of accepted bytes to the serdev core. The current code consumes bytes into recv_skb and may already deliver a complete frame before allocating a fresh receive buffer. If that alloc_skb() fails, the callback returns 0 even though it has already consumed bytes, and it leaves recv_skb as NULL for the next receive callback. That breaks the receive_buf() accounting contract and can also lead to a NULL dereference on the next skb_put_u8(). Allocate the receive skb lazily before consuming the next byte instead. If allocation fails, return the number of bytes already accepted. Fixes: 3f52c2cb7e3a ("nfc: s3fwrn5: Support a UART interface") Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn> Link: https://patch.msgid.link/20260402042148.65236-1-pengpeng@iscas.ac.cn Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-04-02Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski
Cross-merge networking fixes after downstream PR (net-7.0-rc7). Conflicts: net/vmw_vsock/af_vsock.c b18c83388874 ("vsock: initialize child_ns_mode_locked in vsock_net_init()") 0de607dc4fd8 ("vsock: add G2H fallback for CIDs not owned by H2G transport") Adjacent changes: drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c ceee35e5674a ("bnxt_en: Refactor some basic ring setup and adjustment logic") 57cdfe0dc70b ("bnxt_en: Resize RSS contexts on channel count change") drivers/net/wireless/intel/iwlwifi/mld/mac80211.c 4d56037a02bd ("wifi: iwlwifi: mld: block EMLSR during TDLS connections") 687a95d204e7 ("wifi: iwlwifi: mld: correctly set wifi generation data") drivers/net/wireless/intel/iwlwifi/mld/scan.h b6045c899e37 ("wifi: iwlwifi: mld: Refactor scan command handling") ec66ec6a5a8f ("wifi: iwlwifi: mld: Fix MLO scan timing") drivers/net/wireless/intel/iwlwifi/mvm/fw.c 078df640ef05 ("wifi: iwlwifi: mld: add support for iwl_mcc_allowed_ap_type_cmd v 2") 323156c3541e ("wifi: iwlwifi: mvm: don't send a 6E related command when not supported") Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-03-31nfc: port100: refactor endpoint lookupJohan Hovold
Use the common USB helpers for looking up bulk and interrupt endpoints (and determining endpoint numbers) instead of open coding. Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://patch.msgid.link/20260330103655.1672331-4-johan@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-03-31nfc: pn533: refactor endpoint lookupJohan Hovold
Use the common USB helpers for looking up bulk and interrupt endpoints (and determining endpoint numbers) instead of open coding. Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://patch.msgid.link/20260330103655.1672331-3-johan@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-03-31nfc: nfcmrvl: refactor endpoint lookupJohan Hovold
Use the common USB helper for looking up bulk and interrupt endpoints instead of open coding. Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://patch.msgid.link/20260330103655.1672331-2-johan@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-03-31NFC: pn533: bound the UART receive bufferPengpeng Hou
pn532_receive_buf() appends every incoming byte to dev->recv_skb and only resets the buffer after pn532_uart_rx_is_frame() recognizes a complete frame. A continuous stream of bytes without a valid PN532 frame header therefore keeps growing the skb until skb_put_u8() hits the tail limit. Drop the accumulated partial frame once the fixed receive buffer is full so malformed UART traffic cannot grow the skb past PN532_UART_SKB_BUFF_LEN. Fixes: c656aa4c27b1 ("nfc: pn533: add UART phy driver") Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn> Link: https://patch.msgid.link/20260326142033.82297-1-pengpeng@iscas.ac.cn Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-03-23nfc: microread: Drop unused includeAndy Shevchenko
This driver includes the legacy header <linux/gpio.h> but does not use any symbols from it. Drop the inclusion. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20260320215230.3236005-1-andriy.shevchenko@linux.intel.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-03-19Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski
Cross-merge networking fixes after downstream PR (net-7.0-rc5). net/netfilter/nft_set_rbtree.c 598adea720b97 ("netfilter: revert nft_set_rbtree: validate open interval overlap") 3aea466a43998 ("netfilter: nft_set_rbtree: don't disable bh when acquiring tree lock") https://lore.kernel.org/abgaQBpeGstdN4oq@sirena.org.uk No adjacent changes. Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-03-18NFC: nxp-nci: allow GPIOs to sleepIan Ray
Allow the firmware and enable GPIOs to sleep. This fixes a `WARN_ON' and allows the driver to operate GPIOs which are connected to I2C GPIO expanders. -- >8 -- kernel: WARNING: CPU: 3 PID: 2636 at drivers/gpio/gpiolib.c:3880 gpiod_set_value+0x88/0x98 -- >8 -- Fixes: 43201767b44c ("NFC: nxp-nci: Convert to use GPIO descriptor") Cc: stable@vger.kernel.org Signed-off-by: Ian Ray <ian.ray@gehealthcare.com> Link: https://patch.msgid.link/20260317085337.146545-1-ian.ray@gehealthcare.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-03-09Merge tag 'ib-gpio-remove-of-gpio-h-for-v7.1' of ↵Jakub Kicinski
git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux into mbox Bartosz Golaszewski says: ==================== Immutable branch between GPIO and net Convert remaining users of of_gpio.h to using GPIO descriptors and remove the header. * tag 'ib-gpio-remove-of-gpio-h-for-v7.1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: gpio: remove of_get_named_gpio() and <linux/of_gpio.h> nfc: nfcmrvl: convert to gpio descriptors nfc: s3fwrn5: convert to gpio descriptors ==================== Link: https://patch.msgid.link/20260309093153.10446-1-bartosz.golaszewski@oss.qualcomm.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-03-09nfc: nfcmrvl: convert to gpio descriptorsJialu Xu
Replace the legacy of_get_named_gpio() / gpio_request_one() / gpio_set_value() API with the descriptor-based devm_gpiod_get_optional() / gpiod_set_value() API from <linux/gpio/consumer.h>, removing the dependency on <linux/of_gpio.h>. The "reset-n-io" property rename quirk already exists in gpiolib-of.c (added in commit 9c2cc7171e08), so no additional quirk is needed. Signed-off-by: Jialu Xu <xujialu@vimux.org> Reviewed-by: Linus Walleij <linusw@kernel.org> Link: https://patch.msgid.link/DD684946FD7EE161+20260307030623.3495092-4-xujialu@vimux.org Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-03-09nfc: s3fwrn5: convert to gpio descriptorsJialu Xu
Replace the legacy of_get_named_gpio() / gpio_request_one() / gpio_set_value() API with the descriptor-based devm_gpiod_get() / gpiod_set_value() API from <linux/gpio/consumer.h>, removing the dependency on <linux/of_gpio.h>. This removes the s3fwrn5_i2c_parse_dt() and s3fwrn82_uart_parse_dt() functions since devm_gpiod_get() handles both DT lookup and resource management. The gpio_en and gpio_fw_wake fields in struct phy_common are changed from int to struct gpio_desc *. Add rename quirks in gpiolib-of.c for the deprecated "s3fwrn5,en-gpios" and "s3fwrn5,fw-gpios" properties to maintain backward compatibility with old device trees. Signed-off-by: Jialu Xu <xujialu@vimux.org> Reviewed-by: Linus Walleij <linusw@kernel.org> Link: https://patch.msgid.link/94FF47746A92BD6B+20260307030623.3495092-2-xujialu@vimux.org Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-03-06nfc: port100: drop redundant device referenceJohan Hovold
Driver core holds a reference to the USB interface and its parent USB device while the interface is bound to a driver and there is no need to take additional references unless the structures are needed after disconnect. Drop the redundant device reference to reduce cargo culting, make it easier to spot drivers where an extra reference is needed, and reduce the risk of memory leaks when drivers fail to release it. Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://patch.msgid.link/20260305111019.18030-3-johan@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-03-06nfc: pn533: drop redundant device referenceJohan Hovold
Driver core holds a reference to the USB interface and its parent USB device while the interface is bound to a driver and there is no need to take additional references unless the structures are needed after disconnect. Drop the redundant device reference to reduce cargo culting, make it easier to spot drivers where an extra reference is needed, and reduce the risk of memory leaks when drivers fail to release it. Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://patch.msgid.link/20260305111019.18030-2-johan@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-03-03NFC: s3fwrn5: Replace strcpy() with strscpy()Tomasz Unger
Replace strcpy() with strscpy() which limits the copy to the size of the destination buffer. Since fw_info->fw_name is an array with a fixed, declared size, the two-argument variant of strscpy() is used - the compiler deduces the buffer size automatically. This is a defensive cleanup replacing the deprecated strcpy() with the preferred strscpy(). Signed-off-by: Tomasz Unger <tomasz.unger@yahoo.pl> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Link: https://patch.msgid.link/20260302100908.26399-1-tomasz.unger@yahoo.pl Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-03-03NFC: nfcmrvl: Replace strcpy() with strscpy()Tomasz Unger
Replace strcpy() with strscpy() which limits the copy to the size of the destination buffer. Since fw_dnld->name is an array, the two-argument variant of strscpy() is used - the compiler deduces the buffer size automatically. This is a defensive cleanup replacing the deprecated strcpy() with the preferred strscpy(). Signed-off-by: Tomasz Unger <tomasz.unger@yahoo.pl> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20260301144345.218628-1-tomasz.unger@yahoo.pl Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-03-03NFC: nxp-nci: Replace strcpy() with strscpy()Tomasz Unger
Replace strcpy() with strscpy() which limits the copy to the size of the destination buffer. Since fw_info->name is an array, the two-argument variant of strscpy() is used - the compiler deduces the buffer size automatically. This is a defensive cleanup replacing the deprecated strcpy() with the preferred strscpy(). Signed-off-by: Tomasz Unger <tomasz.unger@yahoo.pl> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20260301135633.214497-1-tomasz.unger@yahoo.pl Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-03-03NFC: pn544: i2c: Replace strcpy() with strscpy()Tomasz Unger
Replace strcpy() with strscpy() which limits the copy to the size of the destination buffer. Since phy->firmware_name is an array, the two-argument variant of strscpy() is used - the compiler deduces the buffer size automatically. This is a defensive cleanup. As pointed out by Jakub Kicinski <kuba@kernel.org>, firmware_name is already bounded to NFC_FIRMWARE_NAME_MAXSIZE via nla_strscpy() in net/nfc/netlink.c before reaching this driver, so no actual buffer overflow is possible. Signed-off-by: Tomasz Unger <tomasz.unger@yahoo.pl> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20260301121254.174354-1-tomasz.unger@yahoo.pl Signed-off-by: Jakub Kicinski <kuba@kernel.org>