Return-Path: From: Fugang Duan To: Johan Hedberg , "b38611@freescale.com" CC: "marcel@holtmann.org" , "johannes.berg@intel.com" , "jslaby@suse.cz" , "linux-bluetooth@vger.kernel.org" Subject: RE: [PATCH] Bluetooth: add hdev check to avoid passing null pointer Date: Thu, 21 Jan 2016 09:06:08 +0000 Message-ID: References: <1453351558-7726-1-git-send-email-b38611@freescale.com> <20160121084310.GA4046@t440s> In-Reply-To: <20160121084310.GA4046@t440s> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 List-ID: From: Johan Hedberg Sent: Thursday, January 21, 2= 016 4:43 PM > To: b38611@freescale.com > Cc: marcel@holtmann.org; johannes.berg@intel.com; jslaby@suse.cz; linux- > bluetooth@vger.kernel.org; Fugang Duan > Subject: Re: [PATCH] Bluetooth: add hdev check to avoid passing null poin= ter >=20 > Hi Fuang, >=20 > On Thu, Jan 21, 2016, Fugang Duan wrote: > > Function hci_mgmt_cmd() may pass hdev with null pointer to > > hci_mgmt_handler->func() like below code: > > err =3D handler->func(sk, hdev, cp, len); > > > > Add hdev check to avoid passing null pointer. > > > > Signed-off-by: Fugang Duan > > --- > > net/bluetooth/hci_sock.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index > > 1298d72..7fdfc80 100644 > > --- a/net/bluetooth/hci_sock.c > > +++ b/net/bluetooth/hci_sock.c > > @@ -1186,6 +1186,8 @@ static int hci_mgmt_cmd(struct hci_mgmt_chan > > *chan, struct sock *sk, > > > > if (hdev && chan->hdev_init) > > chan->hdev_init(sk, hdev); > > + else if (!hdev) > > + goto done; >=20 > Why are you resending this? Did you see my response to your earlier > submission? >=20 > Johan Sorry, maybe I missed some mail and guessed I didn't send the previous mai= l successfully. =20 Let's check my mailbox=20 Regards, Andy