All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: Re: [PATCH] Bluetooth: Fix potential NULL dereference
@ 2015-05-14  6:13 JAGANATH KANAKKASSERY
  2015-05-14  6:34 ` Marcel Holtmann
  0 siblings, 1 reply; 6+ messages in thread
From: JAGANATH KANAKKASSERY @ 2015-05-14  6:13 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth

SGkgTWFyY2VsLA0KDQo+PiBhZGRyIGNhbiBiZSBOVUxMIGFuZCBpdCBzaG91bGQgbm90IGJlIGRl
cmVmZXJlbmNlZCBiZWZvcmUgTlVMTCBjaGVja2luZy4NCj4+IA0KPj4gU2lnbmVkLW9mZi1ieTog
SmFnYW5hdGggS2FuYWtrYXNzZXJ5IDxqYWdhbmF0aC5rQHNhbXN1bmcuY29tPg0KPj4gLS0tDQo+
DQo+aWYgd2Ugc3RhcnQgY2hhbmdpbmcgdGhpbmdzIGhlcmUsIHRoZW4gd2UgYmV0dGVyIGNoYW5n
ZSB0aGUgY29kZSBpbnRvIHNvbWV0aGluZyB0aGF0IGFsbCB0aGUgb3RoZXIgc29ja2V0IGhhbmRs
aW5nIGNvZGUgaXMgZG9pbmcgYW55d2F5PnkuIFNvIGRvIHRoZSBtaW4gY29tcGFyaXNvbiBhbmQg
Y29weSB0aGUgZGF0YSBpbnRvIGEgbG9jYWwgY29weSBvZiB0aGUgc29ja2FkZHJfcmMuDQo+DQo+
QW5kIG9uIGEgc2lkZSBub3RlLCBJIHdvbmRlciBpZiBhZGRyIGNhbiBhY3R1YWxseSBiZSBOVUxM
LiBJdCBtaWdodCBiZSBpbnRlcmVzdGluZyB0byBjaGVjayB0aGUgZ2VuZXJpYyBzb2NrZXQgY29k
ZSBpZiB0aGlzIHJlYWxseSBjYW4gaGFwcGU+biBpZiB5b3UgcHJvdmlkZSBubyBhZGRyZXNzIHN0
cnVjdHVyZSB0byB0aGUgYmluZCgpIHN5c3RlbSBjYWxsIG9yIGlmIHRoaXMgZ2V0cyBmaWx0ZXJl
ZCBvdXQgYnkgdGhlIGNvcmUgc29ja2V0IGNvZGUuDQoNCkkgY2hlY2tlZCBnZW5lcmljIHNvY2tl
dCBjb2RlIGFuZCBpdCBsb29rcyBsaWtlIGFkZHIgd2lsbCBuZXZlciBiZSBOVUxMIHdoZW4gdXNl
ciBzcGFjZSBjYWxscyBiaW5kLg0KQnV0IHRoaXMgY2FuIGJlIGNhbGxlZCBmcm9tIGtlcm5lbF9i
aW5kKCkgYWxzbyB3aGljaCBJIHRoaW5rIHdpbGwgbmV2ZXIgYmUgY2FsbGVkIGZvciBSRkNPTU0u
DQpTbyB0aGlzIHBhdGNoIGlzIG5vdCByZXF1aXJlZD8gDQoNClRoYW5rcywNCkphZ2FuYXRo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Bluetooth: Fix potential NULL dereference
  2015-05-14  6:13 Re: [PATCH] Bluetooth: Fix potential NULL dereference JAGANATH KANAKKASSERY
@ 2015-05-14  6:34 ` Marcel Holtmann
  2015-06-06 15:35   ` chanyeol
  0 siblings, 1 reply; 6+ messages in thread
From: Marcel Holtmann @ 2015-05-14  6:34 UTC (permalink / raw)
  To: jaganath.k; +Cc: linux-bluetooth

Hi Jaganath,

>>> addr can be NULL and it should not be dereferenced before NULL checking.
>>> 
>>> Signed-off-by: Jaganath Kanakkassery <jaganath.k@samsung.com>
>>> ---
>> 
>> if we start changing things here, then we better change the code into something that all the other socket handling code is doing anyway>y. So do the min comparison and copy the data into a local copy of the sockaddr_rc.
>> 
>> And on a side note, I wonder if addr can actually be NULL. It might be interesting to check the generic socket code if this really can happe>n if you provide no address structure to the bind() system call or if this gets filtered out by the core socket code.
> 
> I checked generic socket code and it looks like addr will never be NULL when user space calls bind.
> But this can be called from kernel_bind() also which I think will never be called for RFCOMM.
> So this patch is not required? 

that is what I thought. However converting it to the same handling using min and copying into local storage might be a good idea. The more pieces in HCI, L2CAP, SCO and RFCOMM sockets that are similar, the better.

Regards

Marcel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Bluetooth: Fix potential NULL dereference
  2015-05-14  6:34 ` Marcel Holtmann
@ 2015-06-06 15:35   ` chanyeol
  2015-06-06 15:46     ` Marcel Holtmann
  0 siblings, 1 reply; 6+ messages in thread
From: chanyeol @ 2015-06-06 15:35 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: jaganath.k, linux-bluetooth

Hi Marcel,

On Thu, 2015-05-14 at 08:34 +0200, Marcel Holtmann wrote:
> Hi Jaganath,
> 
> > > > addr can be NULL and it should not be dereferenced before NULL 
> > > > checking.
> > > > 
> > > > Signed-off-by: Jaganath Kanakkassery <jaganath.k@samsung.com>
> > > > ---
> > > 
> > > if we start changing things here, then we better change the code 
> > > into something that all the other socket handling code is doing 
> > > anyway>y. So do the min comparison and copy the data into a local 
> > > copy of the sockaddr_rc.
> > > 
> > > And on a side note, I wonder if addr can actually be NULL. It 
> > > might be interesting to check the generic socket code if this 
> > > really can happe>n if you provide no address structure to the 
> > > bind() system call or if this gets filtered out by the core 
> > > socket code.
> > 
> > I checked generic socket code and it looks like addr will never be 
> > NULL when user space calls bind.
> > But this can be called from kernel_bind() also which I think will 
> > never be called for RFCOMM.
> > So this patch is not required? 
> 
> that is what I thought. However converting it to the same handling 
> using min and copying into local storage might be a good idea.
Could you tell us why this is good idea? I failed to find it in git
history/mailing list.

In addition to RFCOMM connect that you mentioned, I found out SCO
connect/bind still use the old style in Bluetooth unlikely HCI,L2CAP.

Regards
Chanyeol

>  The more pieces in HCI, L2CAP, SCO and RFCOMM sockets that are 
> similar, the better.
> 
> Regards
> 
> Marcel
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux
> -bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Bluetooth: Fix potential NULL dereference
  2015-06-06 15:35   ` chanyeol
@ 2015-06-06 15:46     ` Marcel Holtmann
  0 siblings, 0 replies; 6+ messages in thread
From: Marcel Holtmann @ 2015-06-06 15:46 UTC (permalink / raw)
  To: chanyeol; +Cc: JAGANATH KANAKKASSERY, linux-bluetooth

Hi Chanyeol,

>>>>> addr can be NULL and it should not be dereferenced before NULL 
>>>>> checking.
>>>>> 
>>>>> Signed-off-by: Jaganath Kanakkassery <jaganath.k@samsung.com>
>>>>> ---
>>>> 
>>>> if we start changing things here, then we better change the code 
>>>> into something that all the other socket handling code is doing 
>>>> anyway>y. So do the min comparison and copy the data into a local 
>>>> copy of the sockaddr_rc.
>>>> 
>>>> And on a side note, I wonder if addr can actually be NULL. It 
>>>> might be interesting to check the generic socket code if this 
>>>> really can happe>n if you provide no address structure to the 
>>>> bind() system call or if this gets filtered out by the core 
>>>> socket code.
>>> 
>>> I checked generic socket code and it looks like addr will never be 
>>> NULL when user space calls bind.
>>> But this can be called from kernel_bind() also which I think will 
>>> never be called for RFCOMM.
>>> So this patch is not required? 
>> 
>> that is what I thought. However converting it to the same handling 
>> using min and copying into local storage might be a good idea.
> Could you tell us why this is good idea? I failed to find it in git
> history/mailing list.
> 
> In addition to RFCOMM connect that you mentioned, I found out SCO
> connect/bind still use the old style in Bluetooth unlikely HCI,L2CAP.

it avoids any kind of leakage and allows for an easy extension of the socket data structures if we ever have to.

Regards

Marcel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Re: [PATCH] Bluetooth: Fix potential NULL dereference
  2015-05-15  5:37 JAGANATH KANAKKASSERY
@ 2015-06-02  8:28 ` Jaganath K
  0 siblings, 0 replies; 6+ messages in thread
From: Jaganath K @ 2015-06-02  8:28 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth

[-- Attachment #1: Type: text/plain, Size: 1360 bytes --]

Ping.


On Fri, May 15, 2015 at 11:07 AM, JAGANATH KANAKKASSERY <
jaganath.k@samsung.com> wrote:

> Hi Marcel,
>
> >>>> addr can be NULL and it should not be dereferenced before NULL
> checking.
> >>>>
> >>>> Signed-off-by: Jaganath Kanakkassery <jaganath.k@samsung.com>
> >>>> ---
> >> >
> >> >if we start changing things here, then we better change the code into
> something that all the other socket handling code is doing anyway>y. So do
> the min comparison and copy the data into a local copy of the sockaddr_rc.
> >>>
> >>> And on a side note, I wonder if addr can actually be NULL. It might be
> interesting to check the generic socket code if this really can happe>n if
> you provide no address structure to the bind() system call or if this gets
> filtered out by the core socket code.
> >>
> >> I checked generic socket code and it looks like addr will never be NULL
> when user space calls bind.
> >> But this can be called from kernel_bind() also which I think will never
> be called for RFCOMM.
> >> So this patch is not required?
> >
> >that is what I thought. However converting it to the same handling using
> min and copying into local storage might be a good idea. The more pieces in
> HCI, L2CAP, SCO and RFCOMM sockets that are similar, the better.
>
> I have raised v1 with the changes you suggested, Plz check it.
>
> Thanks,
> Jaganath

[-- Attachment #2: Type: text/html, Size: 1928 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Re: [PATCH] Bluetooth: Fix potential NULL dereference
@ 2015-05-15  5:37 JAGANATH KANAKKASSERY
  2015-06-02  8:28 ` Jaganath K
  0 siblings, 1 reply; 6+ messages in thread
From: JAGANATH KANAKKASSERY @ 2015-05-15  5:37 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth

SGkgTWFyY2VsLA0KDQo+Pj4+IGFkZHIgY2FuIGJlIE5VTEwgYW5kIGl0IHNob3VsZCBub3QgYmUg
ZGVyZWZlcmVuY2VkIGJlZm9yZSBOVUxMIGNoZWNraW5nLg0KPj4+PiANCj4+Pj4gU2lnbmVkLW9m
Zi1ieTogSmFnYW5hdGggS2FuYWtrYXNzZXJ5IDxqYWdhbmF0aC5rQHNhbXN1bmcuY29tPg0KPj4+
PiAtLS0NCj4+ID4NCj4+ID5pZiB3ZSBzdGFydCBjaGFuZ2luZyB0aGluZ3MgaGVyZSwgdGhlbiB3
ZSBiZXR0ZXIgY2hhbmdlIHRoZSBjb2RlIGludG8gc29tZXRoaW5nIHRoYXQgYWxsIHRoZSBvdGhl
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W9yZSBwaWVjZXMgaW4gSENJLCBMMkNB
UCwgU0NPIGFuZCBSRkNPTU0gc29ja2V0cyB0aGF0IGFyZSBzaW1pbGFyLCB0aGUgYmV0dGVyLg0K
DQpJIGhhdmUgcmFpc2VkIHYxIHdpdGggdGhlIGNoYW5nZXMgeW91IHN1Z2dlc3RlZCwgUGx6IGNo
ZWNrIGl0Lg0KDQpUaGFua3MsDQpKYWdhbmF0aA==



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-06-06 15:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-14  6:13 Re: [PATCH] Bluetooth: Fix potential NULL dereference JAGANATH KANAKKASSERY
2015-05-14  6:34 ` Marcel Holtmann
2015-06-06 15:35   ` chanyeol
2015-06-06 15:46     ` Marcel Holtmann
2015-05-15  5:37 JAGANATH KANAKKASSERY
2015-06-02  8:28 ` Jaganath K

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.