isdn/gigaset: avoid cs->dev null pointer dereference
PATCH 1/1 isdn/gigaset: avoid cs->dev null pointer dereference
When gigaset_initbcs() is called, cs->dev is not initialized yet. If dev_alloc_skb() failed in this function, NULL poinster dereference will happen at dev_warn().
drivers/isdn/gigaset/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/isdn/gigaset/common.c +1 -1
@@ -579,7 +579,7 @@ static struct bc_state *gigaset_initbcs( }else if ((bcs->skb =dev_alloc_skb (SBUFSIZE +HW_HDR_LEN )) !=NULL )skb_reserve (bcs->skb,HW_HDR_LEN );else { -dev_warn (cs->dev,"could not allocate skb\n" ); +gig_dbg (DEBUG_INIT ,"could not allocate skb\n" ); bcs->inputstate |= INS_skip_frame; }
[Argh. Kaum ist man mal ein paar Tage weg ...]
Am 28.10.2006 20:45 schrieb Akinobu Mita:
drivers/isdn/gigaset/common.c static struct bc_state *gigaset_initbcs( · line 584
Quoted 10 lines
drivers/isdn/gigaset/common.c +1
-1@@ -579,7 +579,7 @@ static struct bc_state *gigaset_initbcs( }else if ((bcs->skb =dev_alloc_skb (SBUFSIZE +HW_HDR_LEN )) !=NULL )skb_reserve (bcs->skb,HW_HDR_LEN );else { -dev_warn (cs->dev,"could not allocate skb\n" ); +gig_dbg (DEBUG_INIT ,"could not allocate skb\n" ); bcs->inputstate |= INS_skip_frame; }
I'm not quite happy with that patch. (Nor, for that matter, with the speed it was pushed into mainline, without waiting even a few days for comments from the maintainers of the code in question.) Not being able to allocate that skb seriously impairs functionality of the driver. It should be reported on production systems too, not just on debug builds.
In short: NAK. Please revert, and replace by the following:
From: Tilman Schmidt <[email protected]>
Avoid usage of uninitialized cs->dev in gigaset_initbcs().
---
drivers/isdn/gigaset/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/isdn/gigaset/common.c +1 -1
@@ -616,7 +616,7 @@ static struct bc_state *gigaset_initbcs( }else if ((bcs->skb =dev_alloc_skb (SBUFSIZE +HW_HDR_LEN )) !=NULL )skb_reserve (bcs->skb,HW_HDR_LEN );else { -dev_warn (cs->dev,"could not allocate skb\n" ); +warn ("could not allocate skb" ); bcs->inputstate |= INS_skip_frame; }
Signature · 4 lines
Tilman Schmidt E-Mail: [email protected] Bonn, Germany Diese Nachricht besteht zu 100% aus wiederverwerteten Bits. Ungeoeffnet mindestens haltbar bis: (siehe Rueckseite)