Commit 17671b2f authored by Alan Stern's avatar Alan Stern Committed by Jiri Slaby

USB: usbfs: don't leak kernel data in siginfo

commit f0c2b681 upstream.

When a signal is delivered, the information in the siginfo structure
is copied to userspace.  Good security practice dicatates that the
unused fields in this structure should be initialized to 0 so that
random kernel stack data isn't exposed to the user.  This patch adds
such an initialization to the two places where usbfs raises signals.
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Reported-by: default avatarDave Mielke <dave@mielke.cc>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
parent a8e48840
...@@ -501,6 +501,7 @@ static void async_completed(struct urb *urb) ...@@ -501,6 +501,7 @@ static void async_completed(struct urb *urb)
as->status = urb->status; as->status = urb->status;
signr = as->signr; signr = as->signr;
if (signr) { if (signr) {
memset(&sinfo, 0, sizeof(sinfo));
sinfo.si_signo = as->signr; sinfo.si_signo = as->signr;
sinfo.si_errno = as->status; sinfo.si_errno = as->status;
sinfo.si_code = SI_ASYNCIO; sinfo.si_code = SI_ASYNCIO;
...@@ -2229,6 +2230,7 @@ static void usbdev_remove(struct usb_device *udev) ...@@ -2229,6 +2230,7 @@ static void usbdev_remove(struct usb_device *udev)
wake_up_all(&ps->wait); wake_up_all(&ps->wait);
list_del_init(&ps->list); list_del_init(&ps->list);
if (ps->discsignr) { if (ps->discsignr) {
memset(&sinfo, 0, sizeof(sinfo));
sinfo.si_signo = ps->discsignr; sinfo.si_signo = ps->discsignr;
sinfo.si_errno = EPIPE; sinfo.si_errno = EPIPE;
sinfo.si_code = SI_ASYNCIO; sinfo.si_code = SI_ASYNCIO;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment