lkml.org 
[lkml]   [2019]   [Mar]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] appletalk: Correctly handle return value of register_snap_client
From
Date
On 2019/3/7 2:17, David Miller wrote:
> From: Yue Haibing <yuehaibing@huawei.com>
> Date: Wed, 6 Mar 2019 15:27:40 +0800
>
>> @@ -879,15 +879,17 @@ static struct notifier_block aarp_notifier = {
>>
>> static unsigned char aarp_snap_id[] = { 0x00, 0x00, 0x00, 0x80, 0xF3 };
>>
>> -void __init aarp_proto_init(void)
>> +int __init aarp_proto_init(void)
>> {
>> aarp_dl = register_snap_client(aarp_snap_id, aarp_rcv);
>> - if (!aarp_dl)
>> - printk(KERN_CRIT "Unable to register AARP with SNAP.\n");
>> + if (!aarp_dl) {
>> + pr_crit("Unable to register AARP with SNAP.\n");
>> + return -ENOMEM;
>> + }
>> timer_setup(&aarp_timer, aarp_expire_timeout, 0);
>> aarp_timer.expires = jiffies + sysctl_aarp_expiry_time;
>> add_timer(&aarp_timer);
>> - register_netdevice_notifier(&aarp_notifier);
>> + return register_netdevice_notifier(&aarp_notifier);
>> }
>>
>
> Your error paths in the caller of aarp_proto_init() do not handle the case
> where aarp_dl is created by register_netdevice_notifier() fails. You have
> to unregister aarp_dl if it is non-NULL.

Thanks, will fix this.

>
> So your out_dev label path needs to handle aarp_dl if non-NULL.
>
> Probably best is to jump to out_aarp: instead and make aarp_cleanup_module
> able to handle partial cleanups.
>
> .
>

\
 
 \ /
  Last update: 2019-03-07 03:10    [W:0.035 / U:25.440 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site