All of lore.kernel.org
 help / color / mirror / Atom feed
* [v2] USB: serial: mos7720: fix mos_parport refcount imbalance on error path
@ 2019-03-20 11:04 Lin Yi
  0 siblings, 0 replies; 2+ messages in thread
From: Lin Yi @ 2019-03-20 11:04 UTC (permalink / raw)
  To: linux-usb; +Cc: johan, gregkh, csong, zhiyunq, ljian236, yiqiuping

Johan said that move the kref_get() and mos_parport assignment to the
end of urbtrack initialisation is a better way, so move it. and
mos_parport do not used until urbtrack initialisation.

Signed-off-by: Lin Yi <teroincn@163.com>
---
 drivers/usb/serial/mos7720.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index fc52ac7..18110225 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -366,8 +366,6 @@ static int write_parport_reg_nonblock(struct mos7715_parport *mos_parport,
 	if (!urbtrack)
 		return -ENOMEM;
 
-	kref_get(&mos_parport->ref_count);
-	urbtrack->mos_parport = mos_parport;
 	urbtrack->urb = usb_alloc_urb(0, GFP_ATOMIC);
 	if (!urbtrack->urb) {
 		kfree(urbtrack);
@@ -388,6 +386,8 @@ static int write_parport_reg_nonblock(struct mos7715_parport *mos_parport,
 			     usb_sndctrlpipe(usbdev, 0),
 			     (unsigned char *)urbtrack->setup,
 			     NULL, 0, async_complete, urbtrack);
+	kref_get(&mos_parport->ref_count);
+	urbtrack->mos_parport = mos_parport;
 	kref_init(&urbtrack->ref_count);
 	INIT_LIST_HEAD(&urbtrack->urblist_entry);
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [v2] USB: serial: mos7720: fix mos_parport refcount imbalance on error path
@ 2019-03-20 13:18 Johan Hovold
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hovold @ 2019-03-20 13:18 UTC (permalink / raw)
  To: Lin Yi; +Cc: linux-usb, johan, gregkh, csong, zhiyunq, ljian236, yiqiuping

On Wed, Mar 20, 2019 at 07:04:56PM +0800, Lin Yi wrote:
> Johan said that move the kref_get() and mos_parport assignment to the
> end of urbtrack initialisation is a better way, so move it. and
> mos_parport do not used until urbtrack initialisation.
> 
> Signed-off-by: Lin Yi <teroincn@163.com>
> ---

Thanks for the v2. Now applied with a Fixes and Cc-stable tag and a
slightly updated commit message in order to make it more self-contained:

	https://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial.git/commit/?h=usb-linus&id=2908b076f5198d231de62713cb2b633a3a4b95ac

Johan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-20 13:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-20 11:04 [v2] USB: serial: mos7720: fix mos_parport refcount imbalance on error path Lin Yi
2019-03-20 13:18 Johan Hovold

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.