All of lore.kernel.org
 help / color / mirror / Atom feed
* pull-request: can 2016-10-31
@ 2016-10-31 20:36 Marc Kleine-Budde
  2016-10-31 20:36 ` [PATCH 1/2] can: sja1000: plx_pci: Add support for Moxa CAN devices Marc Kleine-Budde
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2016-10-31 20:36 UTC (permalink / raw)
  To: netdev; +Cc: davem, linux-can, kernel

Hello David,

this is a pull request of two patches for the upcoming v4.9 release.

The first patch is by Lukas Resch for the sja1000 plx_pci driver that adds
support for Moxa CAN devices. The second patch is by Oliver Hartkopp and fixes
a potential kernel panic in the CAN broadcast manager.

regards,
Marc

---

The following changes since commit 46d0847cdd4a3fc1920e56827b9189b9a105d362:

  mlxsw: spectrum: Fix incorrect reuse of MID entries (2016-10-31 15:34:43 -0400)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can.git tags/linux-can-fixes-for-4.9-20161031

for you to fetch changes up to deb507f91f1adbf64317ad24ac46c56eeccfb754:

  can: bcm: fix warning in bcm_connect/proc_register (2016-10-31 20:48:19 +0100)

----------------------------------------------------------------
linux-can-fixes-for-4.9-20161031

----------------------------------------------------------------
Lukas Resch (1):
      can: sja1000: plx_pci: Add support for Moxa CAN devices

Oliver Hartkopp (1):
      can: bcm: fix warning in bcm_connect/proc_register

 drivers/net/can/sja1000/plx_pci.c | 18 ++++++++++++++++++
 net/can/bcm.c                     | 32 +++++++++++++++++++++++---------
 2 files changed, 41 insertions(+), 9 deletions(-)



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] can: sja1000: plx_pci: Add support for Moxa CAN devices
  2016-10-31 20:36 pull-request: can 2016-10-31 Marc Kleine-Budde
@ 2016-10-31 20:36 ` Marc Kleine-Budde
  2016-10-31 20:36 ` [PATCH 2/2] can: bcm: fix warning in bcm_connect/proc_register Marc Kleine-Budde
  2016-11-01  1:01 ` pull-request: can 2016-10-31 David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2016-10-31 20:36 UTC (permalink / raw)
  To: netdev
  Cc: davem, linux-can, kernel, Lukas Resch, Christoph Zehentner,
	Marc Kleine-Budde

From: Lukas Resch <l.resch@incubedit.com>

This patch adds support for Moxa CAN devices.

Signed-off-by: Lukas Resch <l.resch@incubedit.com>
Signed-off-by: Christoph Zehentner <c.zehentner@incubedit.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/sja1000/plx_pci.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/net/can/sja1000/plx_pci.c b/drivers/net/can/sja1000/plx_pci.c
index 3eb7430dffbf..f8ff25c8ee2e 100644
--- a/drivers/net/can/sja1000/plx_pci.c
+++ b/drivers/net/can/sja1000/plx_pci.c
@@ -142,6 +142,9 @@ struct plx_pci_card {
 #define CTI_PCI_VENDOR_ID		0x12c4
 #define CTI_PCI_DEVICE_ID_CRG001	0x0900
 
+#define MOXA_PCI_VENDOR_ID		0x1393
+#define MOXA_PCI_DEVICE_ID		0x0100
+
 static void plx_pci_reset_common(struct pci_dev *pdev);
 static void plx9056_pci_reset_common(struct pci_dev *pdev);
 static void plx_pci_reset_marathon_pci(struct pci_dev *pdev);
@@ -258,6 +261,14 @@ static struct plx_pci_card_info plx_pci_card_info_elcus = {
 	/* based on PLX9030 */
 };
 
+static struct plx_pci_card_info plx_pci_card_info_moxa = {
+	"MOXA", 2,
+	PLX_PCI_CAN_CLOCK, PLX_PCI_OCR, PLX_PCI_CDR,
+	{0, 0x00, 0x00}, { {0, 0x00, 0x80}, {1, 0x00, 0x80} },
+	&plx_pci_reset_common
+	 /* based on PLX9052 */
+};
+
 static const struct pci_device_id plx_pci_tbl[] = {
 	{
 		/* Adlink PCI-7841/cPCI-7841 */
@@ -357,6 +368,13 @@ static const struct pci_device_id plx_pci_tbl[] = {
 		0, 0,
 		(kernel_ulong_t)&plx_pci_card_info_elcus
 	},
+	{
+		/* moxa */
+		MOXA_PCI_VENDOR_ID, MOXA_PCI_DEVICE_ID,
+		PCI_ANY_ID, PCI_ANY_ID,
+		0, 0,
+		(kernel_ulong_t)&plx_pci_card_info_moxa
+	},
 	{ 0,}
 };
 MODULE_DEVICE_TABLE(pci, plx_pci_tbl);
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] can: bcm: fix warning in bcm_connect/proc_register
  2016-10-31 20:36 pull-request: can 2016-10-31 Marc Kleine-Budde
  2016-10-31 20:36 ` [PATCH 1/2] can: sja1000: plx_pci: Add support for Moxa CAN devices Marc Kleine-Budde
@ 2016-10-31 20:36 ` Marc Kleine-Budde
  2016-11-01  1:01 ` pull-request: can 2016-10-31 David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2016-10-31 20:36 UTC (permalink / raw)
  To: netdev
  Cc: davem, linux-can, kernel, Oliver Hartkopp, linux-stable,
	Marc Kleine-Budde

From: Oliver Hartkopp <socketcan@hartkopp.net>

Andrey Konovalov reported an issue with proc_register in bcm.c.
As suggested by Cong Wang this patch adds a lock_sock() protection and
a check for unsuccessful proc_create_data() in bcm_connect().

Reference: http://marc.info/?l=linux-netdev&m=147732648731237

Reported-by: Andrey Konovalov <andreyknvl@google.com>
Suggested-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Acked-by: Cong Wang <xiyou.wangcong@gmail.com>
Tested-by: Andrey Konovalov <andreyknvl@google.com>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 net/can/bcm.c | 32 +++++++++++++++++++++++---------
 1 file changed, 23 insertions(+), 9 deletions(-)

diff --git a/net/can/bcm.c b/net/can/bcm.c
index 8e999ffdf28b..8af9d25ff988 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -1549,24 +1549,31 @@ static int bcm_connect(struct socket *sock, struct sockaddr *uaddr, int len,
 	struct sockaddr_can *addr = (struct sockaddr_can *)uaddr;
 	struct sock *sk = sock->sk;
 	struct bcm_sock *bo = bcm_sk(sk);
+	int ret = 0;
 
 	if (len < sizeof(*addr))
 		return -EINVAL;
 
-	if (bo->bound)
-		return -EISCONN;
+	lock_sock(sk);
+
+	if (bo->bound) {
+		ret = -EISCONN;
+		goto fail;
+	}
 
 	/* bind a device to this socket */
 	if (addr->can_ifindex) {
 		struct net_device *dev;
 
 		dev = dev_get_by_index(&init_net, addr->can_ifindex);
-		if (!dev)
-			return -ENODEV;
-
+		if (!dev) {
+			ret = -ENODEV;
+			goto fail;
+		}
 		if (dev->type != ARPHRD_CAN) {
 			dev_put(dev);
-			return -ENODEV;
+			ret = -ENODEV;
+			goto fail;
 		}
 
 		bo->ifindex = dev->ifindex;
@@ -1577,17 +1584,24 @@ static int bcm_connect(struct socket *sock, struct sockaddr *uaddr, int len,
 		bo->ifindex = 0;
 	}
 
-	bo->bound = 1;
-
 	if (proc_dir) {
 		/* unique socket address as filename */
 		sprintf(bo->procname, "%lu", sock_i_ino(sk));
 		bo->bcm_proc_read = proc_create_data(bo->procname, 0644,
 						     proc_dir,
 						     &bcm_proc_fops, sk);
+		if (!bo->bcm_proc_read) {
+			ret = -ENOMEM;
+			goto fail;
+		}
 	}
 
-	return 0;
+	bo->bound = 1;
+
+fail:
+	release_sock(sk);
+
+	return ret;
 }
 
 static int bcm_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
-- 
2.10.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: pull-request: can 2016-10-31
  2016-10-31 20:36 pull-request: can 2016-10-31 Marc Kleine-Budde
  2016-10-31 20:36 ` [PATCH 1/2] can: sja1000: plx_pci: Add support for Moxa CAN devices Marc Kleine-Budde
  2016-10-31 20:36 ` [PATCH 2/2] can: bcm: fix warning in bcm_connect/proc_register Marc Kleine-Budde
@ 2016-11-01  1:01 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2016-11-01  1:01 UTC (permalink / raw)
  To: mkl; +Cc: netdev, linux-can, kernel

From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Mon, 31 Oct 2016 21:36:18 +0100

> this is a pull request of two patches for the upcoming v4.9 release.
> 
> The first patch is by Lukas Resch for the sja1000 plx_pci driver that adds
> support for Moxa CAN devices. The second patch is by Oliver Hartkopp and fixes
> a potential kernel panic in the CAN broadcast manager.

Pulled, thanks Marc.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-11-01  1:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-31 20:36 pull-request: can 2016-10-31 Marc Kleine-Budde
2016-10-31 20:36 ` [PATCH 1/2] can: sja1000: plx_pci: Add support for Moxa CAN devices Marc Kleine-Budde
2016-10-31 20:36 ` [PATCH 2/2] can: bcm: fix warning in bcm_connect/proc_register Marc Kleine-Budde
2016-11-01  1:01 ` pull-request: can 2016-10-31 David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.