From: Marcel Holtmann <marcel@holtmann.org>
To: Vladimir Davydov <vdavydov@parallels.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Network Development <netdev@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
"Gustavo F. Padovan" <gustavo@padovan.org>,
Johan Hedberg <johan.hedberg@gmail.com>,
Linux Bluetooth mailing list <linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCH] bluetooth: never linger on process exit
Date: Thu, 17 Jul 2014 12:16:53 +0200 [thread overview]
Message-ID: <8B552C8E-08D7-4536-92CD-130AF58B1E9D@holtmann.org> (raw)
In-Reply-To: <1405412728-4706-1-git-send-email-vdavydov@parallels.com>
Hi Vladimir,
> If the current process is exiting, lingering on socket close will make
> it unkillable, so we should avoid it.
>
> Reproducer:
>
> #include <sys/types.h>
> #include <sys/socket.h>
>
> #define BTPROTO_L2CAP 0
> #define BTPROTO_SCO 2
> #define BTPROTO_RFCOMM 3
>
> int main()
> {
> int fd;
> struct linger ling;
>
> fd = socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
> //or: fd = socket(PF_BLUETOOTH, SOCK_DGRAM, BTPROTO_L2CAP);
> //or: fd = socket(PF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_SCO);
>
> ling.l_onoff = 1;
> ling.l_linger = 1000000000;
> setsockopt(fd, SOL_SOCKET, SO_LINGER, &ling, sizeof(ling));
>
> return 0;
> }
>
> Signed-off-by: Vladimir Davydov <vdavydov@parallels.com>
> Cc: Marcel Holtmann <marcel@holtmann.org>
> Cc: Gustavo Padovan <gustavo@padovan.org>
> Cc: Johan Hedberg <johan.hedberg@gmail.com>
> ---
> net/bluetooth/l2cap_sock.c | 3 ++-
> net/bluetooth/rfcomm/sock.c | 3 ++-
> net/bluetooth/sco.c | 6 ++++--
> 3 files changed, 8 insertions(+), 4 deletions(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel
prev parent reply other threads:[~2014-07-17 10:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-15 8:25 Vladimir Davydov
2014-07-17 10:05 ` Marcel Holtmann
2014-07-17 10:16 ` Marcel Holtmann [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8B552C8E-08D7-4536-92CD-130AF58B1E9D@holtmann.org \
--to=marcel@holtmann.org \
--cc=davem@davemloft.net \
--cc=gustavo@padovan.org \
--cc=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=vdavydov@parallels.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®