linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jukka Rissanen <jukka.rissanen@linux.intel.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH v4 1/5] Bluetooth: Refactor l2cap_sock_sendmsg() to copy user buffer
Date: Mon, 02 Jun 2014 15:23:54 +0300	[thread overview]
Message-ID: <1401711834.2400.42.camel@jrissane-mobl.ger.corp.intel.com> (raw)
In-Reply-To: <0270C2F3-6860-47E6-9068-7D1AD91F9F9F@holtmann.org>

Hi Marcel,

On ma, 2014-06-02 at 14:09 +0200, Marcel Holtmann wrote:
> Hi Jukka,
> 
> > The l2cap_chan_send() is changed to use kernel memory directly,
> > so this function must read the user buffer before sending the
> > message.
> > 
> > The change is done as the 6LoWPAN also uses l2cap_chan_send()
> > and in order to minimize the amount of code changes, we must
> > copy the user buffer in sock handling code.
> > 
> > Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
> > ---
> > include/net/bluetooth/l2cap.h |  4 +--
> > net/bluetooth/a2mp.c          | 12 +------
> > net/bluetooth/l2cap_core.c    | 81 ++++++++++++++++++++++++-------------------
> > net/bluetooth/l2cap_sock.c    | 14 +++++++-
> > 4 files changed, 61 insertions(+), 50 deletions(-)
> > 
> > diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
> > index 4abdcb2..d9506e0 100644
> > --- a/include/net/bluetooth/l2cap.h
> > +++ b/include/net/bluetooth/l2cap.h
> > @@ -872,8 +872,8 @@ struct l2cap_chan *l2cap_chan_create(void);
> > void l2cap_chan_close(struct l2cap_chan *chan, int reason);
> > int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
> > 		       bdaddr_t *dst, u8 dst_type);
> > -int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len,
> > -								u32 priority);
> > +int l2cap_chan_send(struct l2cap_chan *chan, void *buf, size_t len,
> > +		    u32 priority, unsigned int flags);
> 
> sorry for not seeing this earlier. Can this be const void *buf or do we have an issue with casting otherwise?

It can and no need to cast. I prepare v5 using const void *buf.


> > -static inline int l2cap_skbuff_fromiovec(struct l2cap_chan *chan,
> > -					 struct msghdr *msg, int len,
> > -					 int count, struct sk_buff *skb)
> > +static inline int l2cap_copy_into_skbuff(struct l2cap_chan *chan,
> > +					 void *buf, int len,
> > +					 unsigned int flags, int count,
> > +					 struct sk_buff *skb)
> > {
> 
> Same here, can this be const void *buf?
> 

Ditto.



Cheers,
Jukka



  reply	other threads:[~2014-06-02 12:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-02 10:08 [PATCH v4 0/5] Bluetooth LE 6LoWPAN using CoC Jukka Rissanen
2014-06-02 10:08 ` [PATCH v4 1/5] Bluetooth: Refactor l2cap_sock_sendmsg() to copy user buffer Jukka Rissanen
2014-06-02 12:09   ` Marcel Holtmann
2014-06-02 12:23     ` Jukka Rissanen [this message]
2014-06-02 10:08 ` [PATCH v4 2/5] Bluetooth: 6LoWPAN: Use connected oriented channel instead of fixed one Jukka Rissanen
2014-06-02 12:20   ` Marcel Holtmann
2014-06-02 10:08 ` [PATCH v4 3/5] Bluetooth: 6LoWPAN: Create a kernel module Jukka Rissanen
2014-06-02 10:08 ` [PATCH v4 4/5] Bluetooth: 6LoWPAN: Count module usage Jukka Rissanen
2014-06-02 10:08 ` [PATCH v4 5/5] Bluetooth: 6LoWPAN: Remove network devices when unloading Jukka Rissanen

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=1401711834.2400.42.camel@jrissane-mobl.ger.corp.intel.com \
    --to=jukka.rissanen@linux.intel.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.org \
    /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;
as well as URLs for NNTP newsgroup(s).