linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: hso: check for return value in hso_serial_common_create()
@ 2020-07-28  6:42 Rustam Kovhaev
  2020-07-28  7:11 ` Greg KH
  2020-07-28 20:02 ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Rustam Kovhaev @ 2020-07-28  6:42 UTC (permalink / raw)
  To: davem, kuba; +Cc: Rustam Kovhaev, gregkh, linux-usb, netdev, linux-kernel

in case of an error tty_register_device_attr() returns ERR_PTR(),
add IS_ERR() check

Reported-and-tested-by: syzbot+67b2bd0e34f952d0321e@syzkaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?extid=67b2bd0e34f952d0321e
Signed-off-by: Rustam Kovhaev <rkovhaev@gmail.com>
---
 drivers/net/usb/hso.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index 5f123a8cf68e..d2fdb5430d27 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -2261,12 +2261,14 @@ static int hso_serial_common_create(struct hso_serial *serial, int num_urbs,
 
 	minor = get_free_serial_index();
 	if (minor < 0)
-		goto exit;
+		goto exit2;
 
 	/* register our minor number */
 	serial->parent->dev = tty_port_register_device_attr(&serial->port,
 			tty_drv, minor, &serial->parent->interface->dev,
 			serial->parent, hso_serial_dev_groups);
+	if (IS_ERR(serial->parent->dev))
+		goto exit2;
 
 	/* fill in specific data for later use */
 	serial->minor = minor;
@@ -2311,6 +2313,7 @@ static int hso_serial_common_create(struct hso_serial *serial, int num_urbs,
 	return 0;
 exit:
 	hso_serial_tty_unregister(serial);
+exit2:
 	hso_serial_common_free(serial);
 	return -1;
 }
-- 
2.27.0


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

* Re: [PATCH] usb: hso: check for return value in hso_serial_common_create()
  2020-07-28  6:42 [PATCH] usb: hso: check for return value in hso_serial_common_create() Rustam Kovhaev
@ 2020-07-28  7:11 ` Greg KH
  2020-07-28 20:02 ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: Greg KH @ 2020-07-28  7:11 UTC (permalink / raw)
  To: Rustam Kovhaev; +Cc: davem, kuba, linux-usb, netdev, linux-kernel

On Mon, Jul 27, 2020 at 11:42:17PM -0700, Rustam Kovhaev wrote:
> in case of an error tty_register_device_attr() returns ERR_PTR(),
> add IS_ERR() check
> 
> Reported-and-tested-by: syzbot+67b2bd0e34f952d0321e@syzkaller.appspotmail.com
> Link: https://syzkaller.appspot.com/bug?extid=67b2bd0e34f952d0321e
> Signed-off-by: Rustam Kovhaev <rkovhaev@gmail.com>

Looks good, thanks!

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

* Re: [PATCH] usb: hso: check for return value in hso_serial_common_create()
  2020-07-28  6:42 [PATCH] usb: hso: check for return value in hso_serial_common_create() Rustam Kovhaev
  2020-07-28  7:11 ` Greg KH
@ 2020-07-28 20:02 ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2020-07-28 20:02 UTC (permalink / raw)
  To: rkovhaev; +Cc: kuba, gregkh, linux-usb, netdev, linux-kernel

From: Rustam Kovhaev <rkovhaev@gmail.com>
Date: Mon, 27 Jul 2020 23:42:17 -0700

> in case of an error tty_register_device_attr() returns ERR_PTR(),
> add IS_ERR() check
> 
> Reported-and-tested-by: syzbot+67b2bd0e34f952d0321e@syzkaller.appspotmail.com
> Link: https://syzkaller.appspot.com/bug?extid=67b2bd0e34f952d0321e
> Signed-off-by: Rustam Kovhaev <rkovhaev@gmail.com>

Applied, thank you.

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

* Re: [PATCH] usb: hso: check for return value in hso_serial_common_create()
  2020-07-28 13:19 Markus Elfring
@ 2020-07-28 15:30 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2020-07-28 15:30 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Rustam Kovhaev, linux-usb, netdev, kernel-janitors, linux-kernel,
	Dan Carpenter, David S. Miller, Jakub Kicinski,
	syzbot+67b2bd0e34f952d0321e

On Tue, Jul 28, 2020 at 03:19:00PM +0200, Markus Elfring wrote:
> > in case of an error tty_register_device_attr() returns ERR_PTR(),
> > add IS_ERR() check
> 
> I suggest to improve this change description a bit.
> 
> Will the tag “Fixes” become helpful for the commit message?
> 
> 
> …
> > +++ b/drivers/net/usb/hso.c
> …
> > @@ -2311,6 +2313,7 @@  static int hso_serial_common_create(struct hso_serial *serial, int num_urbs,
> >  	return 0;
> >  exit:
> >  	hso_serial_tty_unregister(serial);
> > +exit2:
> >  	hso_serial_common_free(serial);
> >  	return -1;
> >  }
> 
> Can other labels (like “unregister_serial” and “free_serial”) be preferred here?
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?id=92ed301919932f777713b9172e525674157e983d#n485
> 
> Regards,
> Markus

Hi,

This is the semi-friendly patch-bot of Greg Kroah-Hartman.

Markus, you seem to have sent a nonsensical or otherwise pointless
review comment to a patch submission on a Linux kernel developer mailing
list.  I strongly suggest that you not do this anymore.  Please do not
bother developers who are actively working to produce patches and
features with comments that, in the end, are a waste of time.

Patch submitter, please ignore Markus's suggestion; you do not need to
follow it at all.  The person/bot/AI that sent it is being ignored by
almost all Linux kernel maintainers for having a persistent pattern of
behavior of producing distracting and pointless commentary, and
inability to adapt to feedback.  Please feel free to also ignore emails
from them.

thanks,

greg k-h's patch email bot

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

* Re: [PATCH] usb: hso: check for return value in hso_serial_common_create()
@ 2020-07-28 13:19 Markus Elfring
  2020-07-28 15:30 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Elfring @ 2020-07-28 13:19 UTC (permalink / raw)
  To: Rustam Kovhaev, linux-usb, netdev
  Cc: kernel-janitors, linux-kernel, Dan Carpenter, David S. Miller,
	Greg Kroah-Hartman, Jakub Kicinski, syzbot+67b2bd0e34f952d0321e

> in case of an error tty_register_device_attr() returns ERR_PTR(),
> add IS_ERR() check

I suggest to improve this change description a bit.

Will the tag “Fixes” become helpful for the commit message?


…
> +++ b/drivers/net/usb/hso.c
> @@ -2311,6 +2313,7 @@  static int hso_serial_common_create(struct hso_serial *serial, int num_urbs,
>  	return 0;
>  exit:
>  	hso_serial_tty_unregister(serial);
> +exit2:
>  	hso_serial_common_free(serial);
>  	return -1;
>  }

Can other labels (like “unregister_serial” and “free_serial”) be preferred here?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?id=92ed301919932f777713b9172e525674157e983d#n485

Regards,
Markus

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

end of thread, other threads:[~2020-07-28 20:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-28  6:42 [PATCH] usb: hso: check for return value in hso_serial_common_create() Rustam Kovhaev
2020-07-28  7:11 ` Greg KH
2020-07-28 20:02 ` David Miller
2020-07-28 13:19 Markus Elfring
2020-07-28 15:30 ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).