Thread (3 messages) flat view 3 messages, 2 authors, 2021-09-07

Re: [PATCH] USB: cdc-acm: fix minor-number release

From: Johan Hovold <johan@kernel.org>
Date: 2021-09-07 08:19:24
Also in: lkml, stable

On Mon, Sep 06, 2021 at 03:02:43PM +0200, Oliver Neukum wrote:
On 06.09.21 14:43, Johan Hovold wrote:
quoted
@@ -1323,8 +1324,10 @@ static int acm_probe(struct usb_interface *intf,
 	usb_get_intf(acm->control); /* undone in destruct() */
 
 	minor = acm_alloc_minor(acm);
-	if (minor < 0)
+	if (minor < 0) {
+		acm->minor = ACM_TTY_MINORS;
 		goto err_put_port;
Congratulations for catching that one.
Heh, thanks.
May I request to improve understandability of the code that you give
the constant a distinct name for this purpose? Something like

ACM_MINOR_POISON or ACM_INVALID_MINOR

so that normal people can understand the fixed code?
Sure, I'll use ACM_MINOR_INVALID.

Johan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help