linux/net/atm
Stefan Hajnoczi c685293aa3 net/atm: sk_err_soft must be positive
The sk_err and sk_err_soft fields are positive errno values and
userspace applications rely on this when using getsockopt(SO_ERROR).

ATM code places an -errno into sk_err_soft in sigd_send() and returns it
from svc_addparty()/svc_dropparty().

Although I am not familiar with ATM code I came to this conclusion
because:

1. sigd_send() msg->type cases as_okay and as_error both have:

   sk->sk_err = -msg->reply;

   while the as_addparty and as_dropparty cases have:

   sk->sk_err_soft = msg->reply;

   This is the source of the inconsistency.

2. svc_addparty() returns an -errno and assumes sk_err_soft is also an
   -errno:

       if (flags & O_NONBLOCK) {
           error = -EINPROGRESS;
           goto out;
       }
       ...
       error = xchg(&sk->sk_err_soft, 0);
   out:
       release_sock(sk);
       return error;

   This shows that sk_err_soft is indeed being treated as an -errno.

This patch ensures that sk_err_soft is always a positive errno.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-05-23 13:51:10 -07:00
..
addr.c
addr.h
atm_misc.c
atm_sysfs.c
br2684.c br2684: Remove unnecessary formatting macros b1 and bs 2015-07-31 15:25:52 -07:00
clip.c atm: deal with setting entry before mkip was called 2015-09-17 22:13:32 -07:00
common.c net: Generalise wq_has_sleeper helper 2015-11-30 14:47:33 -05:00
common.h net: Pass kern from net_proto_family.create to sk_alloc 2015-05-11 10:50:17 -04:00
ioctl.c
Kconfig
lec_arpc.h
lec.c treewide: replace dev->trans_start update with helper 2016-05-04 14:16:49 -04:00
lec.h
Makefile
mpc.c
mpc.h net: atm: constify in_cache_ops and eg_cache_ops structures 2015-11-23 15:49:29 -05:00
mpoa_caches.c net: atm: constify in_cache_ops and eg_cache_ops structures 2015-11-23 15:49:29 -05:00
mpoa_caches.h
mpoa_proc.c treewide: Fix typo in printk messages 2015-03-06 23:04:40 +01:00
pppoatm.c
proc.c
protocols.h
pvc.c net: Pass kern from net_proto_family.create to sk_alloc 2015-05-11 10:50:17 -04:00
raw.c
resources.c
resources.h
signaling.c net/atm: sk_err_soft must be positive 2016-05-23 13:51:10 -07:00
signaling.h
svc.c net/atm: sk_err_soft must be positive 2016-05-23 13:51:10 -07:00