[NET] compat ifconf: fix limits

A recent change to compat. dev_ifconf() in fs/compat_ioctl.c
causes ifconf data to be truncated 1 entry too early when copying it
to userspace. The correct amount of data (length) is returned,
but the final entry is empty (zero, not filled in).
The for-loop 'i' check should use <= to allow the final struct
ifreq32 to be copied. I also used the ifconf-corruption program
in kernel bugzilla #4746 to make sure that this change does not
re-introduce the corruption.

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by Randy Dunlap and committed by David S. Miller 1efa3c05 2ec5e3a8

+1 -1
+1 -1
fs/compat_ioctl.c
··· 446 446 ifr = ifc.ifc_req; 447 447 ifr32 = compat_ptr(ifc32.ifcbuf); 448 448 for (i = 0, j = 0; 449 - i + sizeof (struct ifreq32) < ifc32.ifc_len && j < ifc.ifc_len; 449 + i + sizeof (struct ifreq32) <= ifc32.ifc_len && j < ifc.ifc_len; 450 450 i += sizeof (struct ifreq32), j += sizeof (struct ifreq)) { 451 451 if (copy_in_user(ifr32, ifr, sizeof (struct ifreq32))) 452 452 return -EFAULT;