Re: [PATCH 1/2] af_bluetooth: Fix recvmsg return value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Denis,

> If recvmsg is called with a destination buffer that is too small to
> receive the contents of skb in its entirety, the return value from
> recvmsg was inconsistent with common SOCK_SEQPACKET or SOCK_DGRAM
> semantics.
> 
> If destination buffer provided by userspace is too small (e.g. len <
> copied), then MSG_TRUNC flag is set and copied is returned.  Instead, it
> should return the length of the message, which is consistent with how
> other datagram based sockets act.  Quoting 'man recv':
> 
> "All  three calls return the length of the message on successful comple‐
> tion.  If a message is too long to fit in the supplied  buffer,  excess
> bytes  may  be discarded depending on the type of socket the message is
> received from."
> 
> and
> 
> "MSG_TRUNC (since Linux 2.2)
> 
>    For   raw   (AF_PACKET),   Internet   datagram   (since    Linux
>    2.4.27/2.6.8),  netlink  (since Linux 2.6.22), and UNIX datagram
>    (since Linux 3.4) sockets: return the real length of the packet
>    or datagram, even when it was longer than the passed buffer."
> 
> Signed-off-by: Denis Kenzior <denkenz@xxxxxxxxx>
> ---
> net/bluetooth/af_bluetooth.c | 5 +++++
> 1 file changed, 5 insertions(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux