Skip to contentSkip to conversation

IEEE 802.15.4 last-minute fixes v3

GIT PULL New Dmitry Eremin-Solenikov 3 participants 5 messages Aug 6, 2009 2 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

I hope in this try I don't make any mistakes...

The following changes since commit 0bf52b981770cbf006323bab5177f2858a196766:
Ingo Molnar (1):
net: Fix spinlock use in alloc_netdev_mq()

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/lowpan/lowpan.git for-linus

Dmitry Eremin-Solenikov (2):
af_ieee802154: fix ioctl processing
af_ieee802154: provide dummy get/setsockopt

 net/ieee802154/af_ieee802154.c |    8 +++++---
 net/ieee802154/dgram.c         |   14 ++++++++++++++
 net/ieee802154/raw.c           |   14 ++++++++++++++
 3 files changed, 33 insertions(+), 3 deletions(-)
#1 lore raw

PATCH 1/2 af_ieee802154: fix ioctl processing

fix two errors in ioctl processing:
1) if the ioctl isn't supported one should return -ENOIOCTLCMD
2) don't call ndo_do_ioctl if the device doesn't provide it

---
 net/ieee802154/af_ieee802154.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
net/ieee802154/af_ieee802154.c +5 -3
index 3bb6bdb..af66180 100644
@@ -136,7 +136,7 @@ static int ieee802154_dev_ioctl(struct sock *sk, struct ifreq __user *arg,
 		unsigned int cmd)
 {
 	struct ifreq ifr;
-	int ret = -EINVAL;
+	int ret = -ENOIOCTLCMD;
 	struct net_device *dev;
 
 	if (copy_from_user(&ifr, arg, sizeof(struct ifreq)))
@@ -146,8 +146,10 @@ static int ieee802154_dev_ioctl(struct sock *sk, struct ifreq __user *arg,
 
 	dev_load(sock_net(sk), ifr.ifr_name);
 	dev = dev_get_by_name(sock_net(sk), ifr.ifr_name);
-	if (dev->type == ARPHRD_IEEE802154 ||
-	    dev->type == ARPHRD_IEEE802154_PHY)
+
+	if ((dev->type == ARPHRD_IEEE802154 ||
+	     dev->type == ARPHRD_IEEE802154_PHY) &&
+	    dev->netdev_ops->ndo_do_ioctl)
 		ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, cmd);
 
 	if (!ret && copy_to_user(arg, &ifr, sizeof(struct ifreq)))
Signature · 1 line
1.6.3.3
#2 lore raw

PATCH 2/2 af_ieee802154: provide dummy get/setsockopt

Provide dummt get/setsockopt implementations to stop these syscalls from oopsing on our sockets.

---
 net/ieee802154/dgram.c |   14 ++++++++++++++
 net/ieee802154/raw.c   |   14 ++++++++++++++
 2 files changed, 28 insertions(+), 0 deletions(-)
net/ieee802154/dgram.c +14 -0
index 14d3984..ba8b214 100644
@@ -377,6 +377,18 @@ int ieee802154_dgram_deliver(struct net_device *dev, struct sk_buff *skb)
 	return ret;
 }
 
+static int dgram_getsockopt(struct sock *sk, int level, int optname,
+		    char __user *optval, int __user *optlen)
+{
+	return -EOPNOTSUPP;
+}
+
+static int dgram_setsockopt(struct sock *sk, int level, int optname,
+		    char __user *optval, int __user optlen)
+{
+	return -EOPNOTSUPP;
+}
+
 struct proto ieee802154_dgram_prot = {
 	.name		= "IEEE-802.15.4-MAC",
 	.owner		= THIS_MODULE,
@@ -391,5 +403,7 @@ struct proto ieee802154_dgram_prot = {
 	.connect	= dgram_connect,
 	.disconnect	= dgram_disconnect,
 	.ioctl		= dgram_ioctl,
+	.getsockopt	= dgram_getsockopt,
+	.setsockopt	= dgram_setsockopt,
 };
 
net/ieee802154/raw.c +14 -0
index fca44d5..9315977 100644
@@ -238,6 +238,18 @@ void ieee802154_raw_deliver(struct net_device *dev, struct sk_buff *skb)
 	read_unlock(&raw_lock);
 }
 
+static int raw_getsockopt(struct sock *sk, int level, int optname,
+		    char __user *optval, int __user *optlen)
+{
+	return -EOPNOTSUPP;
+}
+
+static int raw_setsockopt(struct sock *sk, int level, int optname,
+		    char __user *optval, int __user optlen)
+{
+	return -EOPNOTSUPP;
+}
+
 struct proto ieee802154_raw_prot = {
 	.name		= "IEEE-802.15.4-RAW",
 	.owner		= THIS_MODULE,
@@ -250,5 +262,7 @@ struct proto ieee802154_raw_prot = {
 	.unhash		= raw_unhash,
 	.connect	= raw_connect,
 	.disconnect	= raw_disconnect,
+	.getsockopt	= raw_getsockopt,
+	.setsockopt	= raw_setsockopt,
 };
 
Signature · 1 line
1.6.3.3

A message that is not in the archive (sent off-list or not yet received): 1249561586-26927-1-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#4 lore raw

From: Dmitry Eremin-Solenikov <[email protected]>
Date: Thu, 6 Aug 2009 16:26:24 +0400

Quoted 5 lines

git://git.kernel.org/pub/scm/linux/kernel/git/lowpan/lowpan.git for-linus

Dmitry Eremin-Solenikov (2):
af_ieee802154: fix ioctl processing
af_ieee802154: provide dummy get/setsockopt

Pulled, thanks.

I'm currently waiting for Linus to pull in a locking fix from Ingo Molnar from my tree, and I don't want things to "magically" appear in a tree I've already asked him to pull from.

So I'll push these changes back out once he's taken that fix from Ingo.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july

A message that is not in the archive (sent off-list or not yet received): 20090806.132327.210162548.davem-fT/PcQaiUtIeIZ0/[email protected]

#6 lore raw
Quoted 9 lines · David Miller

From: Dmitry Eremin-Solenikov <[email protected]>
Date: Thu, 6 Aug 2009 16:26:24 +0400

Quoted 5 lines

git://git.kernel.org/pub/scm/linux/kernel/git/lowpan/lowpan.git for-linus

Dmitry Eremin-Solenikov (2):
af_ieee802154: fix ioctl processing
af_ieee802154: provide dummy get/setsockopt

Quoted 8 lines

Pulled, thanks.

I'm currently waiting for Linus to pull in a locking fix from Ingo Molnar from my tree, and I don't want things to "magically" appear in a tree I've already asked him to pull from.

So I'll push these changes back out once he's taken that fix from Ingo.

Fine with me, thank you! Sorry for all the problems with this request :)

Signature · 9 lines
With best wishes
Dmitry


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july