From: Bin Liu <b-liu@ti.com> To: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: <linux-usb@vger.kernel.org>, <stable@vger.kernel.org>, Bin Liu <b-liu@ti.com> Subject: [PATCH 2/2] usb: musb: trace: fix NULL pointer dereference in musb_g_tx() Date: Mon, 30 Apr 2018 11:20:54 -0500 [thread overview] Message-ID: <1525105254-2852-3-git-send-email-b-liu@ti.com> (raw) In-Reply-To: <1525105254-2852-1-git-send-email-b-liu@ti.com> The usb_request pointer could be NULL in musb_g_tx(), where the tracepoint call would trigger the NULL pointer dereference failure when parsing the members of the usb_request pointer. Move the tracepoint call to where the usb_request pointer is already checked to solve the issue. Fixes: fc78003e5345a("usb: musb: gadget: add usb-request tracepoints") Cc: stable@vger.kernel.org # v4.8+ Signed-off-by: Bin Liu <b-liu@ti.com> --- drivers/usb/musb/musb_gadget.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index e564695c6c8d..71c5835ea9cd 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c @@ -417,7 +417,6 @@ void musb_g_tx(struct musb *musb, u8 epnum) req = next_request(musb_ep); request = &req->request; - trace_musb_req_tx(req); csr = musb_readw(epio, MUSB_TXCSR); musb_dbg(musb, "<== %s, txcsr %04x", musb_ep->end_point.name, csr); @@ -456,6 +455,8 @@ void musb_g_tx(struct musb *musb, u8 epnum) u8 is_dma = 0; bool short_packet = false; + trace_musb_req_tx(req); + if (dma && (csr & MUSB_TXCSR_DMAENAB)) { is_dma = 1; csr |= MUSB_TXCSR_P_WZC_BITS; -- 1.9.1
WARNING: multiple messages have this Message-ID (diff)
From: Bin Liu <b-liu@ti.com> To: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: linux-usb@vger.kernel.org, stable@vger.kernel.org, Bin Liu <b-liu@ti.com> Subject: [2/2] usb: musb: trace: fix NULL pointer dereference in musb_g_tx() Date: Mon, 30 Apr 2018 11:20:54 -0500 [thread overview] Message-ID: <1525105254-2852-3-git-send-email-b-liu@ti.com> (raw) The usb_request pointer could be NULL in musb_g_tx(), where the tracepoint call would trigger the NULL pointer dereference failure when parsing the members of the usb_request pointer. Move the tracepoint call to where the usb_request pointer is already checked to solve the issue. Fixes: fc78003e5345a("usb: musb: gadget: add usb-request tracepoints") Cc: stable@vger.kernel.org # v4.8+ Signed-off-by: Bin Liu <b-liu@ti.com> --- drivers/usb/musb/musb_gadget.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index e564695c6c8d..71c5835ea9cd 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c @@ -417,7 +417,6 @@ void musb_g_tx(struct musb *musb, u8 epnum) req = next_request(musb_ep); request = &req->request; - trace_musb_req_tx(req); csr = musb_readw(epio, MUSB_TXCSR); musb_dbg(musb, "<== %s, txcsr %04x", musb_ep->end_point.name, csr); @@ -456,6 +455,8 @@ void musb_g_tx(struct musb *musb, u8 epnum) u8 is_dma = 0; bool short_packet = false; + trace_musb_req_tx(req); + if (dma && (csr & MUSB_TXCSR_DMAENAB)) { is_dma = 1; csr |= MUSB_TXCSR_P_WZC_BITS;
next prev parent reply other threads:[~2018-04-30 16:20 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-04-30 16:20 [PATCH 0/2] musb fixes for v4.17-rc4 Bin Liu 2018-04-30 16:20 ` [PATCH 1/2] usb: musb: host: fix potential NULL pointer dereference Bin Liu 2018-04-30 16:20 ` [1/2] " Bin Liu 2018-04-30 16:42 ` [PATCH 1/2] " Greg Kroah-Hartman 2018-04-30 16:42 ` [1/2] " Greg Kroah-Hartman 2018-04-30 18:11 ` [PATCH 1/2] " Bin Liu 2018-04-30 18:11 ` [1/2] " Bin Liu 2018-04-30 18:24 ` [PATCH 1/2] " Greg Kroah-Hartman 2018-04-30 18:24 ` [1/2] " Greg Kroah-Hartman 2018-04-30 18:41 ` [PATCH 1/2] " Bin Liu 2018-04-30 18:41 ` [1/2] " Bin Liu 2018-04-30 16:20 ` Bin Liu [this message] 2018-04-30 16:20 ` [2/2] usb: musb: trace: fix NULL pointer dereference in musb_g_tx() Bin Liu
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1525105254-2852-3-git-send-email-b-liu@ti.com \ --to=b-liu@ti.com \ --cc=gregkh@linuxfoundation.org \ --cc=linux-usb@vger.kernel.org \ --cc=stable@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.