1. 11 2月, 2007 34 次提交
  2. 10 2月, 2007 2 次提交
  3. 09 2月, 2007 4 次提交
    • J
      [IPX]: Fix NULL pointer dereference on ipx unload · 1539b98b
      Jiri Bohac 提交于
      Fixes a null pointer dereference when unloading the ipx module.
      
      On initialization of the ipx module, registering certain packet
      types can fail. When this happens, unloading the module later
      dereferences NULL pointers.  This patch fixes that. Please apply.
      Signed-off-by: NJiri Bohac <jbohac@suse.cz>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1539b98b
    • D
      [NET]: Fix net/socket.c warnings. · 4387ff75
      David S. Miller 提交于
      GCC (correctly) says:
      
      net/socket.c: In function ‘sys_sendto’:
      net/socket.c:1510: warning: ‘err’ may be used uninitialized in this function
      net/socket.c: In function ‘sys_recvfrom’:
      net/socket.c:1571: warning: ‘err’ may be used uninitialized in this function
      
      sock_from_file() either returns filp->private_data or it
      sets *err and returns NULL.
      
      Callers return "err" on NULL, but filp->private_data could
      be NULL.
      
      Some minor rearrangements of error handling in sys_sendto
      and sys_recvfrom solves the issue.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4387ff75
    • E
      [NET]: cleanup sock_from_file() · 23bb80d2
      Eric Dumazet 提交于
      I believe dead code from sock_from_file() can be cleaned up.
      
      All sockets are now built using sock_attach_fd(), that puts the 'sock' pointer 
      into file->private_data and &socket_file_ops into file->f_op
      
      I could not find a place where file->private_data could be set to NULL, 
      keeping opened the file.
      
      So to get 'sock' from a 'file' pointer, either :
      
      - This is a socket file (f_op == &socket_file_ops), and we can directly get 
      'sock' from private_data.
      - This is not a socket, we return -ENOTSOCK and dont even try to find a socket 
      via dentry/inode :)
      Signed-off-by: NEric Dumazet <dada1@cosmosbay.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      23bb80d2
    • E
      [NET]: change layout of ehash table · dbca9b27
      Eric Dumazet 提交于
      ehash table layout is currently this one :
      
      First half of this table is used by sockets not in TIME_WAIT state
      Second half of it is used by sockets in TIME_WAIT state.
      
      This is non optimal because of for a given hash or socket, the two chain heads 
      are located in separate cache lines.
      Moreover the locks of the second half are never used.
      
      If instead of this halving, we use two list heads in inet_ehash_bucket instead 
      of only one, we probably can avoid one cache miss, and reduce ram usage, 
      particularly if sizeof(rwlock_t) is big (various CONFIG_DEBUG_SPINLOCK, 
      CONFIG_DEBUG_LOCK_ALLOC settings). So we still halves the table but we keep 
      together related chains to speedup lookups and socket state change.
      
      In this patch I did not try to align struct inet_ehash_bucket, but a future 
      patch could try to make this structure have a convenient size (a power of two 
      or a multiple of L1_CACHE_SIZE).
      I guess rwlock will just vanish as soon as RCU is plugged into ehash :) , so 
      maybe we dont need to scratch our heads to align the bucket...
      
      Note : In case struct inet_ehash_bucket is not a power of two, we could 
      probably change alloc_large_system_hash() (in case it use __get_free_pages()) 
      to free the unused space. It currently allocates a big zone, but the last 
      quarter of it could be freed. Again, this should be a temporary 'problem'.
      
      Patch tested on ipv4 tcp only, but should be OK for IPV6 and DCCP.
      Signed-off-by: NEric Dumazet <dada1@cosmosbay.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      dbca9b27