From: YueHaibing <yuehaibing@huawei.com>
To: Guillaume Nault <gnault@redhat.com>
Cc: <davem@davemloft.net>, <paulus@samba.org>,
<linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>
Subject: Re: [PATCH] ppp: deflate: Fix possible crash in deflate_init
Date: Tue, 14 May 2019 22:42:54 +0800 [thread overview]
Message-ID: <f276c92f-f112-ed47-30c6-d41211804eb7@huawei.com> (raw)
In-Reply-To: <20190514140547.GA25993@linux.home>
On 2019/5/14 22:05, Guillaume Nault wrote:
> On Tue, May 14, 2019 at 03:43:00PM +0800, YueHaibing wrote:
>>
>> If ppp_deflate fails to register in deflate_init,
>> module initialization failed out, however
>> ppp_deflate_draft may has been regiestred and not
>> unregistered before return.
>> Then the seconed modprobe will trigger crash like this.
>>
>> Reported-by: Hulk Robot <hulkci@huawei.com>
>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
>> ---
>> drivers/net/ppp/ppp_deflate.c | 14 +++++++++-----
>> 1 file changed, 9 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/net/ppp/ppp_deflate.c b/drivers/net/ppp/ppp_deflate.c
>> index b5edc7f..2829efe 100644
>> --- a/drivers/net/ppp/ppp_deflate.c
>> +++ b/drivers/net/ppp/ppp_deflate.c
>> @@ -610,12 +610,16 @@ static void z_incomp(void *arg, unsigned char *ibuf, int icnt)
>>
>> static int __init deflate_init(void)
>> {
>> - int answer = ppp_register_compressor(&ppp_deflate);
>> - if (answer == 0)
>> - printk(KERN_INFO
>> - "PPP Deflate Compression module registered\n");
>> + int answer;
>> +
>> + answer = ppp_register_compressor(&ppp_deflate);
>> + if (answer)
>> + return answer;
>> +
>> + pr_info("PPP Deflate Compression module registered\n");
>> ppp_register_compressor(&ppp_deflate_draft);
>> - return answer;
>> +
>> + return 0;
>> }
>>
> I'd be cleaner to also check for ppp_deflate_draft registration failure
> IMHO (and print the log line only if both compressors get registered
> successfully).
Ok, will send v2 to do that, thanks!
>
> .
>
next prev parent reply other threads:[~2019-05-14 14:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-14 7:43 YueHaibing
2019-05-14 14:05 ` Guillaume Nault
2019-05-14 14:42 ` YueHaibing [this message]
2019-05-14 14:55 ` [PATCH v2] " YueHaibing
2019-05-14 15:34 ` Guillaume Nault
2019-05-14 22:42 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f276c92f-f112-ed47-30c6-d41211804eb7@huawei.com \
--to=yuehaibing@huawei.com \
--cc=davem@davemloft.net \
--cc=gnault@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®