Skip to content

Commit f4aa6ca

Browse files
t-8chgregkh
authored andcommitted
usb: core: Don't use %pK through printk
This is a revert of commit 2f96478 ("USB: core: replace %p with %pK"). When the formatting was changed from %p to %pK that was a security improvement, as %p would leak raw pointer values to the kernel log. Since commit ad67b74 ("printk: hash addresses printed with %p") the regular %p has been improved to avoid this issue. On the other hand, restricted pointers ("%pK") were never meant to be used through printk(). They can unintentionally still leak raw pointers or acquire sleeping looks in atomic contexts. Switch back to regular %p again. Link: https://lore.kernel.org/lkml/20250113171731-dc10e3c1-da64-4af0-b767-7c7070468023@linutronix.de/ Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Link: https://lore.kernel.org/r/20250310-restricted-pointers-usb-v2-1-a7598e2d47d1@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 8c75f3e commit f4aa6ca

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

drivers/usb/core/hcd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,7 +1609,7 @@ int usb_hcd_unlink_urb (struct urb *urb, int status)
16091609
if (retval == 0)
16101610
retval = -EINPROGRESS;
16111611
else if (retval != -EIDRM && retval != -EBUSY)
1612-
dev_dbg(&udev->dev, "hcd_unlink_urb %pK fail %d\n",
1612+
dev_dbg(&udev->dev, "hcd_unlink_urb %p fail %d\n",
16131613
urb, retval);
16141614
usb_put_dev(udev);
16151615
}
@@ -1786,7 +1786,7 @@ void usb_hcd_flush_endpoint(struct usb_device *udev,
17861786
/* kick hcd */
17871787
unlink1(hcd, urb, -ESHUTDOWN);
17881788
dev_dbg (hcd->self.controller,
1789-
"shutdown urb %pK ep%d%s-%s\n",
1789+
"shutdown urb %p ep%d%s-%s\n",
17901790
urb, usb_endpoint_num(&ep->desc),
17911791
is_in ? "in" : "out",
17921792
usb_ep_type_string(usb_endpoint_type(&ep->desc)));

drivers/usb/core/urb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
376376
if (!urb || !urb->complete)
377377
return -EINVAL;
378378
if (urb->hcpriv) {
379-
WARN_ONCE(1, "URB %pK submitted while active\n", urb);
379+
WARN_ONCE(1, "URB %p submitted while active\n", urb);
380380
return -EBUSY;
381381
}
382382

0 commit comments

Comments
 (0)