[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190130.101013.1464226067584735951.davem@davemloft.net>
Date: Wed, 30 Jan 2019 10:10:13 -0800 (PST)
From: David Miller <davem@...emloft.net>
To: yuehaibing@...wei.com
Cc: isdn@...ux-pingi.de, gustavo@...eddedor.com, bigeasy@...utronix.de,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH -next] mISDN: hfcsusb: Fix potential NULL pointer
dereference
From: YueHaibing <yuehaibing@...wei.com>
Date: Wed, 30 Jan 2019 18:19:02 +0800
> There is a potential NULL pointer dereference in case
> kzalloc() fails and returns NULL.
>
> Fixes: 69f52adb2d53 ("mISDN: Add HFC USB driver")
> Signed-off-by: YueHaibing <yuehaibing@...wei.com>
> ---
> drivers/isdn/hardware/mISDN/hfcsusb.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/isdn/hardware/mISDN/hfcsusb.c b/drivers/isdn/hardware/mISDN/hfcsusb.c
> index 124ff53..5660d5a 100644
> --- a/drivers/isdn/hardware/mISDN/hfcsusb.c
> +++ b/drivers/isdn/hardware/mISDN/hfcsusb.c
> @@ -263,6 +263,8 @@ hfcsusb_ph_info(struct hfcsusb *hw)
> int i;
>
> phi = kzalloc(struct_size(phi, bch, dch->dev.nrbchan), GFP_ATOMIC);
> + if (!phi)
> + return;
If we fail with an error and do not perform the operation we were requested to
make, we must return an error to the caller, and the caller must do something
reasonable with that error (perhaps return it to it's caller) and so on and
so forth.
Powered by blists - more mailing lists