usb: gadget: u_ether: fix out-of-bounds read in get_ether_addr
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v5 Latest2 patches 1 replyIn review
- v42 patches 2 repliesSuperseded
- v32 patches 2 repliesSuperseded
Earlier versions · 2
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v2 | 2 patches | 5 replies | Superseded | |
| v1 | 1 patch | 1 reply | Superseded |
Changes in v5 from the cover letter
- no driver code change; the C diff of both patches is byte identical to v4, only documentation and the commit messages changed
- 1/2: reword the parse_mac_pton() kernel-doc: @s must be at least MAC_ADDR_STR_LEN characters long, and only the first MAC_ADDR_STR_LEN characters are checked, the rest ignored
- 2/2: describe the configfs behaviour change accurately: a rejected address makes the store fail with -EINVAL and keep its previous value, while only the legacy module parameters fall back to a random address
- 2/2: name all five functions that reach the parser (ECM, EEM, NCM, RNDIS, subset) and document the accepted formats in their configfs ABI files
- 2/2: restore a Fixes: tag pointing at 1da177e4c3f4 ("Linux-2.6.12-rc2"), the start of the official git era, keeping the commit that really introduced the loop named in prose
- 2/2: say "checks the minimum length" where v4 said "checks the length"
Patches in v5 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | lib/net_utils: allow mac_pton() to take a custom delimiterinclude/ lib/ | +22 | 0 replies | |
| 2/2 | usb: gadget: u_ether: fix out-of-bounds read in get_ether_addrDocumentation/ Documentation/ Documentation/ +4 more | +42 | 1 reply |
Reviews trailers per patch
All 2 patches have a Reviewed-by or Acked-by.
| Patch | Andy Shevchenko |
|---|---|
| 1/2 | R-b |
| 2/2 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v5 0/2] usb: gadget: u_ether: fix out-of-bounds read in get_ether_addr
Rework of
[PATCH v4] usb: gadget: u_ether: fix out-of-bounds read in get_ether_addr
https://lore.kernel.org/all/[email protected]/
following Andy's review of v4: 1/2 prepares a parse_mac_pton() helper in lib/net_utils.c, 2/2 uses it in get_ether_addr().
The two patches belong to different trees: 1/2 touches lib/ and should go via netdev or -mm, 2/2 is for the USB tree. 2/2 depends on 1/2, so it can only be applied once 1/2 has reached Linus' tree.
Changes since v4:
- no driver code change; the C diff of both patches is byte identical to v4, only documentation and the commit messages changed
- 1/2: reword the parse_mac_pton() kernel-doc: @s must be at least MAC_ADDR_STR_LEN characters long, and only the first MAC_ADDR_STR_LEN characters are checked, the rest ignored
- 2/2: describe the configfs behaviour change accurately: a rejected address makes the store fail with -EINVAL and keep its previous value, while only the legacy module parameters fall back to a random address
- 2/2: name all five functions that reach the parser (ECM, EEM, NCM, RNDIS, subset) and document the accepted formats in their configfs ABI files
- 2/2: restore a Fixes: tag pointing at 1da177e4c3f4 ("Linux-2.6.12-rc2"), the start of the official git era, keeping the commit that really introduced the loop named in prose
- 2/2: say "checks the minimum length" where v4 said "checks the length"
Changes since v3:
- no code change at all, only the log of 2/2 changed
- 1/2: unchanged
- 2/2: pick up Andy's Reviewed-by
- 2/2: name 331a2d82bcaf ("[PATCH] USB: ethernet/rndis gadget address params") from v2.6.7 as the commit that introduced the loop
Changes since v2:
- 1/2: pick up Andy's Reviewed-by, no code change
- 2/2: keep the separator-less notation "aabbccddeeff" working by falling back to hex2bin() when parse_mac_pton() does not match
- 2/2: spell out in the log which notations stop being accepted
Changes since v1:
- rework the fix on top of parse_mac_pton() as suggested by Andy instead of open coding the bounds checks in get_ether_addr()
- add the KASAN report and the malformed address example
- select GENERIC_NET_UTILS for USB_U_ETHER
One user visible effect remains: the Cisco notation "aabb.ccdd.eeff" and irregular groupings such as "123456:789abc" are no longer parsed. The legacy module parameters then fall back to a random address and log a warning, while a configfs store fails with -EINVAL and keeps the previous value. Details are in the log of 2/2.
Liu Chao (2):
lib/net_utils: allow mac_pton() to take a custom delimiter
usb: gadget: u_ether: fix out-of-bounds read in get_ether_addr
.../ABI/testing/configfs-usb-gadget-ecm | 7 ++++++- .../ABI/testing/configfs-usb-gadget-eem | 7 +++++++ .../ABI/testing/configfs-usb-gadget-ncm | 6 ++++++ .../ABI/testing/configfs-usb-gadget-rndis | 7 +++++++ .../ABI/testing/configfs-usb-gadget-subset | 7 +++++++ drivers/usb/gadget/Kconfig | 1 + drivers/usb/gadget/function/u_ether.c | 18 ++++++++---------- include/linux/hex.h | 7 ++++++- lib/net_utils.c | 19 ++++++++++++++++--- 9 files changed, 64 insertions(+), 15 deletions(-)
base-commit: a5ebb76233b79db01e82e061173cb73c6d2b5c6b
Signature · 1 line
2.50.1