Skip to content
Snippets Groups Projects
  1. Jan 19, 2014
  2. Dec 06, 2013
  3. Nov 21, 2013
    • Hannes Frederic Sowa's avatar
      net: rework recvmsg handler msg_name and msg_namelen logic · f3d33426
      Hannes Frederic Sowa authored
      
      This patch now always passes msg->msg_namelen as 0. recvmsg handlers must
      set msg_namelen to the proper size <= sizeof(struct sockaddr_storage)
      to return msg_name to the user.
      
      This prevents numerous uninitialized memory leaks we had in the
      recvmsg handlers and makes it harder for new code to accidentally leak
      uninitialized memory.
      
      Optimize for the case recvfrom is called with NULL as address. We don't
      need to copy the address at all, so set it to NULL before invoking the
      recvmsg handler. We can do so, because all the recvmsg handlers must
      cope with the case a plain read() is called on them. read() also sets
      msg_name to NULL.
      
      Also document these changes in include/linux/net.h as suggested by David
      Miller.
      
      Changes since RFC:
      
      Set msg->msg_name = NULL if user specified a NULL in msg_name but had a
      non-null msg_namelen in verify_iovec/verify_compat_iovec. This doesn't
      affect sendto as it would bail out earlier while trying to copy-in the
      address. It also more naturally reflects the logic by the callers of
      verify_iovec.
      
      With this change in place I could remove "
      if (!uaddr || msg_sys->msg_namelen == 0)
      	msg->msg_name = NULL
      ".
      
      This change does not alter the user visible error logic as we ignore
      msg_namelen as long as msg_name is NULL.
      
      Also remove two unnecessary curly brackets in ___sys_recvmsg and change
      comments to netdev style.
      
      Cc: David Miller <davem@davemloft.net>
      Suggested-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f3d33426
  4. Nov 19, 2013
  5. Nov 14, 2013
  6. Oct 20, 2013
  7. Oct 04, 2013
  8. Jul 20, 2013
  9. Jul 16, 2013
  10. Jun 13, 2013
  11. May 20, 2013
    • Chen Gang's avatar
      net: irda: using kzalloc() instead of kmalloc() to avoid strncpy() issue. · ff0102ee
      Chen Gang authored
      
      'discovery->data.info' length is 22, NICKNAME_MAX_LEN is 21, so the
      strncpy() will always left the last byte of 'discovery->data.info'
      uninitialized.
      
      When 'text' length is longer than 21 (NICKNAME_MAX_LEN), if still left
      the last byte of 'discovery->data.info' uninitialized, the next
      strlen() will cause issue.
      
      Also 'discovery->data' is 'struct irda_device_info' which defined in
      "include/uapi/...", it may copy to user mode, so need whole initialized.
      
      All together, need use kzalloc() instead of kmalloc() to initialize all
      members firstly.
      
      Signed-off-by: default avatarChen Gang <gang.chen@asianux.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ff0102ee
  12. Apr 25, 2013
  13. Apr 19, 2013
    • Dan Carpenter's avatar
      irda: small read past the end of array in debug code · e15465e1
      Dan Carpenter authored
      
      The "reason" can come from skb->data[] and it hasn't been capped so it
      can be from 0-255 instead of just 0-6.  For example in irlmp_state_dtr()
      the code does:
      
      	reason = skb->data[3];
      	...
      	irlmp_disconnect_indication(self, reason, skb);
      
      Also LMREASON has a couple other values which don't have entries in the
      irlmp_reasons[] array.  And 0xff is a valid reason as well which means
      "unknown".
      
      So far as I can see we don't actually care about "reason" except for in
      the debug code.
      
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e15465e1
  14. Apr 12, 2013
  15. Apr 08, 2013
  16. Apr 07, 2013
  17. Mar 20, 2013
  18. Mar 19, 2013
  19. Mar 06, 2013
  20. Feb 27, 2013
  21. Feb 04, 2013
  22. Jan 28, 2013
    • Dan Carpenter's avatar
      irda: buffer overflow in irnet_ctrl_read() · 4bf613c6
      Dan Carpenter authored
      
      The comments here say that the /* Max event is 61 char */ but in 2003 we
      changed the event format and now the max event size is 75.  The longest
      event is:
      
      	"Discovered %08x (%s) behind %08x {hints %02X-%02X}\n",
               12345678901    23  456789012    34567890    1    2 3
      	            +8    +21        +8          +2   +2     +1
               = 75 characters.
      
      There was a check to return -EOVERFLOW if the user gave us a "count"
      value that was less than 64.  Raising it to 75 might break backwards
      compatability.  Instead I removed the check and now it returns a
      truncated string if "count" is too low.
      
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4bf613c6
  23. Jan 19, 2013
    • Joe Millenbach's avatar
      tty: Added a CONFIG_TTY option to allow removal of TTY · 4f73bc4d
      Joe Millenbach authored
      
      The option allows you to remove TTY and compile without errors. This
      saves space on systems that won't support TTY interfaces anyway.
      bloat-o-meter output is below.
      
      The bulk of this patch consists of Kconfig changes adding "depends on
      TTY" to various serial devices and similar drivers that require the TTY
      layer.  Ideally, these dependencies would occur on a common intermediate
      symbol such as SERIO, but most drivers "select SERIO" rather than
      "depends on SERIO", and "select" does not respect dependencies.
      
      bloat-o-meter output comparing our previous minimal to new minimal by
      removing TTY.  The list is filtered to not show removed entries with awk
      '$3 != "-"' as the list was very long.
      
      add/remove: 0/226 grow/shrink: 2/14 up/down: 6/-35356 (-35350)
      function                                     old     new   delta
      chr_dev_init                                 166     170      +4
      allow_signal                                  80      82      +2
      static.__warned                              143     142      -1
      disallow_signal                               63      62      -1
      __set_special_pids                            95      94      -1
      unregister_console                           126     121      -5
      start_kernel                                 546     541      -5
      register_console                             593     588      -5
      copy_from_user                                45      40      -5
      sys_setsid                                   128     120      -8
      sys_vhangup                                   32      19     -13
      do_exit                                     1543    1526     -17
      bitmap_zero                                   60      40     -20
      arch_local_irq_save                          137     117     -20
      release_task                                 674     652     -22
      static.spin_unlock_irqrestore                308     260     -48
      
      Signed-off-by: default avatarJoe Millenbach <jmillenbach@gmail.com>
      Reviewed-by: default avatarJamey Sharp <jamey@minilop.net>
      Reviewed-by: default avatarJosh Triplett <josh@joshtriplett.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4f73bc4d
  24. Jan 16, 2013
  25. Jan 03, 2013
  26. Nov 28, 2012
  27. Nov 16, 2012
    • Jiri Slaby's avatar
      TTY: call tty_port_destroy in the rest of drivers · 191c5f10
      Jiri Slaby authored
      
      After commit "TTY: move tty buffers to tty_port", the tty buffers are
      not freed in some drivers. This is because tty_port_destructor is not
      called whenever a tty_port is freed. This was an assumption I counted
      with but was unfortunately untrue. So fix the drivers to fulfil this
      assumption.
      
      To be sure, the TTY buffers (and later some stuff) are gone along with
      the tty_port, we have to call tty_port_destroy at tear-down places.
      This is mostly where the structure containing a tty_port is freed.
      This patch does exactly that -- put tty_port_destroy at those places.
      
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      191c5f10
  28. Oct 05, 2012
  29. Oct 04, 2012
  30. Sep 10, 2012
  31. Sep 05, 2012
  32. Aug 14, 2012
  33. Jul 17, 2012
Loading