Skip to content

Commit f3bc432

Browse files
AlanSterngregkh
authored andcommitted
USB: core: Change %pK for __user pointers to %px
Commit 2f96478 ("USB: core: replace %p with %pK") used the %pK format specifier for a bunch of __user pointers. But as the 'K' in the specifier indicates, it is meant for kernel pointers. The reason for the %pK specifier is to avoid leaks of kernel addresses, but when the pointer is to an address in userspace the security implications are minimal. In particular, no kernel information is leaked. This patch changes the __user %pK specifiers (used in a bunch of debugging output lines) to %px, which will always print the actual address with no mangling. (Notably, there is no printk format specifier particularly intended for __user pointers.) Fixes: 2f96478 ("USB: core: replace %p with %pK") CC: Vamsi Krishna Samavedam <vskrishn@codeaurora.org> CC: <stable@vger.kernel.org> Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Link: https://lore.kernel.org/r/20201119170228.GB576844@rowland.harvard.edu Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 184eead commit f3bc432

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

drivers/usb/core/devio.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -482,11 +482,11 @@ static void snoop_urb(struct usb_device *udev,
482482

483483
if (userurb) { /* Async */
484484
if (when == SUBMIT)
485-
dev_info(&udev->dev, "userurb %pK, ep%d %s-%s, "
485+
dev_info(&udev->dev, "userurb %px, ep%d %s-%s, "
486486
"length %u\n",
487487
userurb, ep, t, d, length);
488488
else
489-
dev_info(&udev->dev, "userurb %pK, ep%d %s-%s, "
489+
dev_info(&udev->dev, "userurb %px, ep%d %s-%s, "
490490
"actual_length %u status %d\n",
491491
userurb, ep, t, d, length,
492492
timeout_or_status);
@@ -1997,7 +1997,7 @@ static int proc_reapurb(struct usb_dev_state *ps, void __user *arg)
19971997
if (as) {
19981998
int retval;
19991999

2000-
snoop(&ps->dev->dev, "reap %pK\n", as->userurb);
2000+
snoop(&ps->dev->dev, "reap %px\n", as->userurb);
20012001
retval = processcompl(as, (void __user * __user *)arg);
20022002
free_async(as);
20032003
return retval;
@@ -2014,7 +2014,7 @@ static int proc_reapurbnonblock(struct usb_dev_state *ps, void __user *arg)
20142014

20152015
as = async_getcompleted(ps);
20162016
if (as) {
2017-
snoop(&ps->dev->dev, "reap %pK\n", as->userurb);
2017+
snoop(&ps->dev->dev, "reap %px\n", as->userurb);
20182018
retval = processcompl(as, (void __user * __user *)arg);
20192019
free_async(as);
20202020
} else {
@@ -2142,7 +2142,7 @@ static int proc_reapurb_compat(struct usb_dev_state *ps, void __user *arg)
21422142
if (as) {
21432143
int retval;
21442144

2145-
snoop(&ps->dev->dev, "reap %pK\n", as->userurb);
2145+
snoop(&ps->dev->dev, "reap %px\n", as->userurb);
21462146
retval = processcompl_compat(as, (void __user * __user *)arg);
21472147
free_async(as);
21482148
return retval;
@@ -2159,7 +2159,7 @@ static int proc_reapurbnonblock_compat(struct usb_dev_state *ps, void __user *ar
21592159

21602160
as = async_getcompleted(ps);
21612161
if (as) {
2162-
snoop(&ps->dev->dev, "reap %pK\n", as->userurb);
2162+
snoop(&ps->dev->dev, "reap %px\n", as->userurb);
21632163
retval = processcompl_compat(as, (void __user * __user *)arg);
21642164
free_async(as);
21652165
} else {
@@ -2624,7 +2624,7 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
26242624
#endif
26252625

26262626
case USBDEVFS_DISCARDURB:
2627-
snoop(&dev->dev, "%s: DISCARDURB %pK\n", __func__, p);
2627+
snoop(&dev->dev, "%s: DISCARDURB %px\n", __func__, p);
26282628
ret = proc_unlinkurb(ps, p);
26292629
break;
26302630

0 commit comments

Comments
 (0)