mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Varadarajan, Kiruthika" <Kiruthika.Varadarajan@harman.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Felipe Balbi <balbi@ti.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"kiruthikanv@gmail.com" <kiruthikanv@gmail.com>
Subject: RE: [EXTERNAL] Re: Kernel patch  in USB 4.4.138 Version
Date: Tue, 18 Jun 2019 11:34:32 +0000	[thread overview]
Message-ID: <07d0eff017c84006a87aa46af54e1ded@HICGWSMB01.ad.harman.com> (raw)
In-Reply-To: <20190618094737.GB10451@kroah.com>

[-- Attachment #1: Type: text/plain, Size: 938 bytes --]

Hi Greg,
 Now I ran checkpatch and this patch is against kernel version 5.1.
 Checkpatch run is clean. Could you check my patch now.

Thanks and Regards,
Kiruthika. NV

-----Original Message-----
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> 
Sent: Tuesday, June 18, 2019 3:18 PM
To: Varadarajan, Kiruthika <Kiruthika.Varadarajan@harman.com>
Cc: Felipe Balbi <balbi@ti.com>; linux-usb@vger.kernel.org; linux-kernel@vger.kernel.org; kiruthikanv@gmail.com
Subject: Re: [EXTERNAL] Re: Kernel patch in USB 4.4.138 Version

On Tue, Jun 18, 2019 at 08:43:56AM +0000, Varadarajan, Kiruthika wrote:
> Hi Greg,
>  Please ignore my previous email and here is the patch on top of 4.4.x stable version.
>  Could you please review the attached patch.

Also, always use scripts/checkpatch.pl on your patch, it has a number of obvious coding style issues that prevent it from being accepted by anyone.

thanks,

greg k-h

[-- Attachment #2: USB-Fix-race-between-gether_disconnect-and-rx_submit.patch --]
[-- Type: application/octet-stream, Size: 1605 bytes --]

From 897fb2d0653b481b83d77685e4b20be702027afc Mon Sep 17 00:00:00 2001
From: kvaradarajan <Kiruthika.Varadarajan@harman.com>
Date: Tue, 18 Jun 2019 11:29:49 +0000
Subject: [PATCH]  USB: Fix race between gether_disconnect and rx_submit

  On spin lock release in rx_submit, gether_disconnect get
  a chance to run, it makes port_usb NULL, rx_submit access
  NULL port USB, hence null pointer crash.

  Fixed by releasing the lock in rx_submit after port_usb
  is used.

Signed-off-by: KVaradarajan <Kiruthika.Varadarajan@harman.com>
---
 drivers/usb/gadget/function/u_ether.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c
index 737bd77..76cf1e4 100644
--- a/drivers/usb/gadget/function/u_ether.c
+++ b/drivers/usb/gadget/function/u_ether.c
@@ -186,11 +186,11 @@ static void defer_kevent(struct eth_dev *dev, int flag)
 		out = dev->port_usb->out_ep;
 	else
 		out = NULL;
-	spin_unlock_irqrestore(&dev->lock, flags);
 
-	if (!out)
+	if (!out) {
+		spin_unlock_irqrestore(&dev->lock, flags);
 		return -ENOTCONN;
-
+	}
 
 	/* Padding up to RX_EXTRA handles minor disagreements with host.
 	 * Normally we use the USB "terminate on short read" convention;
@@ -215,6 +215,7 @@ static void defer_kevent(struct eth_dev *dev, int flag)
 	if (dev->port_usb->is_fixed)
 		size = max_t(size_t, size, dev->port_usb->fixed_out_len);
 
+	spin_unlock_irqrestore(&dev->lock, flags);
 	skb = __netdev_alloc_skb(dev->net, size + NET_IP_ALIGN, gfp_flags);
 	if (skb == NULL) {
 		DBG(dev, "no rx skb\n");
-- 
1.9.1


  reply	other threads:[~2019-06-18 11:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <6e521b173bd24197930c764dc5fe9ad1@HICGWSMB01.ad.harman.com>
2019-06-07 13:58 ` Greg Kroah-Hartman
2019-06-18  8:36   ` [EXTERNAL] " Varadarajan, Kiruthika
2019-06-18  8:43   ` Varadarajan, Kiruthika
2019-06-18  8:55     ` Felipe Balbi
2019-06-18  9:46     ` Greg Kroah-Hartman
2019-06-18  9:47     ` Greg Kroah-Hartman
2019-06-18 11:34       ` Varadarajan, Kiruthika [this message]
2019-06-18 11:36         ` Greg Kroah-Hartman

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=07d0eff017c84006a87aa46af54e1ded@HICGWSMB01.ad.harman.com \
    --to=kiruthika.varadarajan@harman.com \
    --cc=balbi@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kiruthikanv@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®