WSL2-Linux-Kernel/net/decnet
Johannes Berg 50c2936634 decnet: fix DN_IFREQ_SIZE
Digging through the ioctls with Al because of the previous
patches, we found that on 64-bit decnet's dn_dev_ioctl()
is wrong, because struct ifreq::ifr_ifru is actually 24
bytes (not 16 as expected from struct sockaddr) due to the
ifru_map and ifru_settings members.

Clearly, decnet expects the ioctl to be called with a struct
like
  struct ifreq_dn {
    char ifr_name[IFNAMSIZ];
    struct sockaddr_dn ifr_addr;
  };

since it does
  struct ifreq *ifr = ...;
  struct sockaddr_dn *sdn = (struct sockaddr_dn *)&ifr->ifr_addr;

This means that DN_IFREQ_SIZE is too big for what it wants on
64-bit, as it is
  sizeof(struct ifreq) - sizeof(struct sockaddr) +
  sizeof(struct sockaddr_dn)

This assumes that sizeof(struct sockaddr) is the size of ifr_ifru
but that isn't true.

Fix this to use offsetof(struct ifreq, ifr_ifru).

This indeed doesn't really matter much - the result is that we
copy in/out 8 bytes more than we should on 64-bit platforms. In
case the "struct ifreq_dn" lands just on the end of a page though
it might lead to faults.

As far as I can tell, it has been like this forever, so it seems
very likely that nobody cares.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-01-27 23:11:55 -08:00
..
netfilter decnet: whitespace fixes 2018-07-24 14:10:42 -07:00
Kconfig decnet: whitespace fixes 2018-07-24 14:10:42 -07:00
Makefile decnet: whitespace fixes 2018-07-24 14:10:42 -07:00
README Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
TODO decnet: whitespace fixes 2018-07-24 14:10:42 -07:00
af_decnet.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2018-12-27 13:04:52 -08:00
dn_dev.c decnet: fix DN_IFREQ_SIZE 2019-01-27 23:11:55 -08:00
dn_fib.c decnet: whitespace fixes 2018-07-24 14:10:42 -07:00
dn_neigh.c proc: introduce proc_create_net{,_data} 2018-05-16 07:24:30 +02:00
dn_nsp_in.c decnet: whitespace fixes 2018-07-24 14:10:42 -07:00
dn_nsp_out.c decnet: whitespace fixes 2018-07-24 14:10:42 -07:00
dn_route.c mm: convert totalram_pages and totalhigh_pages variables to atomic 2018-12-28 12:11:47 -08:00
dn_rules.c decnet: whitespace fixes 2018-07-24 14:10:42 -07:00
dn_table.c net: decnet: dn_table: mark expected switch fall-through 2017-11-11 19:10:06 +09:00
dn_timer.c treewide: setup_timer() -> timer_setup() 2017-11-21 15:57:07 -08:00
sysctl_net_decnet.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00

README

                       Linux DECnet Project
                      ======================

The documentation for this kernel subsystem is available in the
Documentation/networking subdirectory of this distribution and also
on line at http://www.chygwyn.com/DECnet/

Steve Whitehouse <SteveW@ACM.org>