lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHb8M2BeUym+7vc5tnS1jmyr4DXa9QiQNojxJXDZa11JVXR-sQ@mail.gmail.com>
Date:	Mon, 19 May 2014 18:39:27 +0900
From:	DaeSeok Youn <daeseok.youn@...il.com>
To:	Dan Carpenter <dan.carpenter@...cle.com>
Cc:	Lidza Louina <lidza.louina@...il.com>,
	Greg KH <gregkh@...uxfoundation.org>,
	Mark Hounschell <markh@...pro.net>,
	driverdev-devel@...uxdriverproject.org,
	devel <devel@...verdev.osuosl.org>,
	linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH V3] staging: dgap: implement error handling in dgap_tty_register()

2014-05-19 17:02 GMT+09:00 Dan Carpenter <dan.carpenter@...cle.com>:
> Nice, but it needs a couple style improvements below.
>
> On Mon, May 19, 2014 at 11:10:30AM +0900, Daeseok Youn wrote:
>> +     brd->dgap_major_serial_registered = TRUE;
>> +     dgap_boards_by_major[brd->serial_driver->major] = brd;
>> +     brd->dgap_serial_major = brd->serial_driver->major;
>> +
>>       brd->dgap_major_transparent_print_registered = TRUE;
>>       dgap_boards_by_major[brd->print_driver->major] = brd;
>>       brd->dgap_transparent_print_major = brd->print_driver->major;
>>
>>       return rc;
>
>         return 0;
OK. I will remove "int rc = 0" line and change "return rc" to "return 0"

>
>> +
>> +unregister_serial_drv:
>> +     tty_unregister_driver(brd->serial_driver);
>> +free_print_ttys:
>> +     kfree(brd->print_driver->ttys);
>> +     brd->print_driver->ttys = NULL;
>
> This label isn't needed.  Just goto free_print_drv, because that will
> free the brd->print_driver->ttys in destruct_tty_driver().
> I do like how you noticed the double free and avoided it by setting
> brd->serial_driver->ttys to NULL, so your patch doesn't introduce a
> double free bug.
Yes, just goto free_print_drv.

Thanks for review.

Regards,
Daeseok Youn
>
>> +free_print_drv:
>> +     put_tty_driver(brd->print_driver);
>> +free_serial_ttys:
>> +     kfree(brd->serial_driver->ttys);
>> +     brd->serial_driver->ttys = NULL;
>
> Same for this.
>
>> +free_serial_drv:
>> +     put_tty_driver(brd->serial_driver);
>> +
>> +     return rc;
>
> regards,
> dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ