remarkable-linux/net
Wei Yongjun 7cc08b55fc [SCTP]: Fix kernel panic while received AUTH chunk with BAD shared key identifier
If SCTP-AUTH is enabled, received AUTH chunk with BAD shared key 
identifier will cause kernel panic.

Test as following:
step1: enabled /proc/sys/net/sctp/auth_enable
step 2:  connect  to SCTP server with auth capable. Association is 
established between endpoints. Then send a AUTH chunk with a bad 
shareid, SCTP server will kernel panic after received that AUTH chunk.

SCTP client                   SCTP server
  INIT         ---------->  
    (with auth capable)
               <----------    INIT-ACK
                              (with auth capable)
  COOKIE-ECHO  ---------->
               <----------    COOKIE-ACK
  AUTH         ---------->


AUTH chunk is like this:
  AUTH chunk
    Chunk type: AUTH (15)
    Chunk flags: 0x00
    Chunk length: 28
    Shared key identifier: 10
    HMAC identifier: SHA-1 (1)
    HMAC: 0000000000000000000000000000000000000000

The assignment of NULL to key can safely be removed, since key_for_each 
(which is just list_for_each_entry under the covers does an initial 
assignment to key anyway).

If the endpoint_shared_keys list is empty, or if the key_id being 
requested does not exist, the function as it currently stands returns 
the actuall list_head (in this case endpoint_shared_keys.  Since that 
list_head isn't surrounded by an actuall data structure, the last 
iteration through list_for_each_entry will do a container_of on key, and 
we wind up returning a bogus pointer, instead of NULL, as we should.

> Neil Horman wrote:
>> On Tue, Jan 22, 2008 at 05:29:20PM +0900, Wei Yongjun wrote:
>>
>> FWIW, Ack from me.  The assignment of NULL to key can safely be 
>> removed, since
>> key_for_each (which is just list_for_each_entry under the covers does 
>> an initial
>> assignment to key anyway).
>> If the endpoint_shared_keys list is empty, or if the key_id being 
>> requested does
>> not exist, the function as it currently stands returns the actuall 
>> list_head (in
>> this case endpoint_shared_keys.  Since that list_head isn't 
>> surrounded by an
>> actuall data structure, the last iteration through 
>> list_for_each_entry will do a
>> container_of on key, and we wind up returning a bogus pointer, 
>> instead of NULL,
>> as we should.  Wei's patch corrects that.
>>
>> Regards
>> Neil
>>
>> Acked-by: Neil Horman <nhorman@tuxdriver.com>
>>
>
> Yep, the patch is correct.
>
> Acked-by: Vlad Yasevich <vladislav.yasevich@hp.com>
>
> -vlad
>

Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-02-05 03:03:06 -08:00
..
9p virtio: explicit enable_cb/disable_cb rather than callback return. 2008-02-04 23:49:58 +11:00
802 [TR] net/802/tr.c: sysctl_tr_rif_timeout static 2008-01-31 19:28:31 -08:00
8021q [VLAN]: set_rx_mode support for unicast address list 2008-01-31 19:28:24 -08:00
appletalk
atm [NETNS]: Add namespace parameter to ip_route_output_key. 2008-01-28 15:11:07 -08:00
ax25 [AX25]: Kill ax25_bind() user triggable printk. 2008-01-31 19:27:06 -08:00
bluetooth [BLUETOOTH]: Fix bugs in previous conn add/del workqueue changes. 2008-01-31 19:28:33 -08:00
bridge [NETFILTER]: ebtables: mark matches, targets and watchers __read_mostly 2008-01-31 19:27:34 -08:00
can
core Merge git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus 2008-02-04 08:00:54 -08:00
dccp [SOCK] proto: Add hashinfo member to struct proto 2008-02-03 04:28:52 -08:00
decnet [NETNS]: FIB rules API cleanup. 2008-01-28 15:08:13 -08:00
econet
ethernet
ieee80211 ieee80211: beacon->capability is little-endian 2008-01-28 15:08:48 -08:00
ipv4 [IPV4]: Formatting fix for /proc/net/fib_trie. 2008-02-05 02:58:45 -08:00
ipv6 [SOCK] proto: Add hashinfo member to struct proto 2008-02-03 04:28:52 -08:00
ipx
irda [IrDA]: LMP discovery timer not started by default 2008-01-28 15:10:54 -08:00
iucv
key [PATCH] switch audit_get_loginuid() to task_struct * 2008-02-01 14:04:59 -05:00
lapb
llc
mac80211 mac80211: fix initialisation error path 2008-02-01 16:15:40 -05:00
netfilter [NETFILTER]: Ipv6-related xt_hashlimit compilation fix. 2008-01-31 19:28:36 -08:00
netlabel NetLabel: Add auditing to the static labeling mechanism 2008-01-30 08:17:29 +11:00
netlink [PATCH] switch audit_get_loginuid() to task_struct * 2008-02-01 14:04:59 -05:00
netrom
packet
rfkill typo fix in net/rfkill/rfkill.c 2008-02-03 17:55:45 +02:00
rose
rxrpc [AF_RXRPC]: constify function pointer tables 2008-01-31 19:27:18 -08:00
sched [NET_SCHED]: Add #ifdef CONFIG_NET_EMATCH in net/sched/cls_flow.c (latest git broken build) 2008-02-05 02:56:48 -08:00
sctp [SCTP]: Fix kernel panic while received AUTH chunk with BAD shared key identifier 2008-02-05 03:03:06 -08:00
sunrpc SUNRPC: RPC program information is stored in unsigned integers 2008-02-01 17:01:31 -05:00
tipc
unix
wanrouter
wireless WEXT: remove unused variable 2008-01-28 15:10:48 -08:00
x25 [AX25]: Beautify x25_init() version printk. 2008-01-31 19:27:06 -08:00
xfrm [PATCH] switch audit_get_loginuid() to task_struct * 2008-02-01 14:04:59 -05:00
compat.c
Kconfig
Makefile
nonet.c
socket.c
sysctl_net.c
TUNABLE