Netdev List
 help / color / mirror / Atom feed
* RE: [PATCH] [bpf] xdp_redirect_cpu_user: Fix null pointer dereference
From: John Fastabend @ 2020-06-16  7:07 UTC (permalink / raw)
  To: Gaurav Singh, gaurav1086, Alexei Starovoitov, Daniel Borkmann,
	Martin KaFai Lau, Song Liu, Yonghong Song, Andrii Nakryiko,
	John Fastabend, KP Singh, David S. Miller, Jakub Kicinski,
	Jesper Dangaard Brouer,
	(open list:BPF \(Safe dynamic programs and tools\)),
	open list:BPF (Safe dynamic programs and tools),
	(open list:BPF \(Safe dynamic programs and tools\) open list)
In-Reply-To: <20200614190434.31321-1-gaurav1086@gmail.com>

Gaurav Singh wrote:
> Memset() on the pointer right after malloc() can cause
> a null pointer dereference if it failed to allocate memory.
> Fix this by replacing malloc/memset with a single calloc().
> 
> Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
> ---
>  samples/bpf/xdp_redirect_cpu_user.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/samples/bpf/xdp_redirect_cpu_user.c b/samples/bpf/xdp_redirect_cpu_user.c
> index f3468168982e..2ae7a9a1d950 100644
> --- a/samples/bpf/xdp_redirect_cpu_user.c
> +++ b/samples/bpf/xdp_redirect_cpu_user.c
> @@ -207,11 +207,8 @@ static struct datarec *alloc_record_per_cpu(void)
>  {
>  	unsigned int nr_cpus = bpf_num_possible_cpus();
>  	struct datarec *array;
> -	size_t size;
>  
> -	size = sizeof(struct datarec) * nr_cpus;
> -	array = malloc(size);
> -	memset(array, 0, size);
> +	array = calloc(nr_cpus, sizeof(struct datarec));
>  	if (!array) {
>  		fprintf(stderr, "Mem alloc error (nr_cpus:%u)\n", nr_cpus);
>  		exit(EXIT_FAIL_MEM);
> @@ -222,11 +219,9 @@ static struct datarec *alloc_record_per_cpu(void)
>  static struct stats_record *alloc_stats_record(void)
>  {
>  	struct stats_record *rec;
> -	int i, size;
> +	int i;
>  
> -	size = sizeof(*rec) + n_cpus * sizeof(struct record);
> -	rec = malloc(size);
> -	memset(rec, 0, size);
> +	rec = calloc(n_cpus + 1, sizeof(struct record));
>  	if (!rec) {
>  		fprintf(stderr, "Mem alloc error\n");
>  		exit(EXIT_FAIL_MEM);
> -- 
> 2.17.1
> 

Acked-by: John Fastabend <john.fastabend@gmail.com>

^ permalink raw reply

* RE: [PATCH] [bpf] xdp_monitor_user: Fix null pointer dereference
From: John Fastabend @ 2020-06-16  7:05 UTC (permalink / raw)
  To: Gaurav Singh, gaurav1086, Alexei Starovoitov, Daniel Borkmann,
	Martin KaFai Lau, Song Liu, Yonghong Song, Andrii Nakryiko,
	John Fastabend, KP Singh, David S. Miller, Jakub Kicinski,
	Jesper Dangaard Brouer,
	(open list:BPF \(Safe dynamic programs and tools\)),
	open list:BPF (Safe dynamic programs and tools),
	(open list:BPF \(Safe dynamic programs and tools\) open list)
In-Reply-To: <20200614184102.30992-1-gaurav1086@gmail.com>

Gaurav Singh wrote:
> Memset() on the pointer right after malloc() can cause
> a null pointer dereference if it failed to allocate memory.
> Fix this by replacing malloc/memset with a single calloc().
> 
> Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
> ---
>  samples/bpf/xdp_monitor_user.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/samples/bpf/xdp_monitor_user.c b/samples/bpf/xdp_monitor_user.c
> index dd558cbb2309..ef53b93db573 100644
> --- a/samples/bpf/xdp_monitor_user.c
> +++ b/samples/bpf/xdp_monitor_user.c
> @@ -509,11 +509,8 @@ static void *alloc_rec_per_cpu(int record_size)
>  {
>  	unsigned int nr_cpus = bpf_num_possible_cpus();
>  	void *array;
> -	size_t size;
>  
> -	size = record_size * nr_cpus;
> -	array = malloc(size);
> -	memset(array, 0, size);
> +	array = calloc(nr_cpus, record_size);
>  	if (!array) {
>  		fprintf(stderr, "Mem alloc error (nr_cpus:%u)\n", nr_cpus);
>  		exit(EXIT_FAIL_MEM);
> @@ -528,8 +525,7 @@ static struct stats_record *alloc_stats_record(void)
>  	int i;
>  
>  	/* Alloc main stats_record structure */
> -	rec = malloc(sizeof(*rec));
> -	memset(rec, 0, sizeof(*rec));
> +	rec = calloc(1, sizeof(*rec));
>  	if (!rec) {
>  		fprintf(stderr, "Mem alloc error\n");
>  		exit(EXIT_FAIL_MEM);
> -- 
> 2.17.1
> 

Acked-by: John Fastabend <john.fastabend@gmail.com>

^ permalink raw reply

* RE: [PATCH bpf 1/2] bpf: bpf_probe_read_kernel_str() has to return amount of data read on success
From: John Fastabend @ 2020-06-16  7:01 UTC (permalink / raw)
  To: Andrii Nakryiko, bpf, netdev, ast, daniel
  Cc: andrii.nakryiko, kernel-team, Andrii Nakryiko, Christoph Hellwig
In-Reply-To: <20200616050432.1902042-1-andriin@fb.com>

Andrii Nakryiko wrote:
> During recent refactorings, bpf_probe_read_kernel_str() started returning 0 on
> success, instead of amount of data successfully read. This majorly breaks
> applications relying on bpf_probe_read_kernel_str() and bpf_probe_read_str()
> and their results. Fix this by returning actual number of bytes read.
> 
> Cc: Christoph Hellwig <hch@lst.de>
> Fixes: 8d92db5c04d1 ("bpf: rework the compat kernel probe handling")
> Signed-off-by: Andrii Nakryiko <andriin@fb.com>
> ---
>  kernel/trace/bpf_trace.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
> index e729c9e587a0..a3ac7de98baa 100644
> --- a/kernel/trace/bpf_trace.c
> +++ b/kernel/trace/bpf_trace.c
> @@ -241,7 +241,7 @@ bpf_probe_read_kernel_str_common(void *dst, u32 size, const void *unsafe_ptr)
>  	if (unlikely(ret < 0))
>  		goto fail;
>  
> -	return 0;
> +	return ret;
>  fail:
>  	memset(dst, 0, size);
>  	return ret;
> -- 
> 2.24.1
> 

Acked-by: John Fastabend <john.fastabend@gmail.com>

^ permalink raw reply

* [PATCH 02/02] net: phy: marvell: Add Marvell 88E1548 support
From: Maxim Kochetkov @ 2020-06-16  7:01 UTC (permalink / raw)
  To: netdev; +Cc: andrew, f.fainelli, hkallweit1, linux

Add Marvell 88E1548 support
Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru>
---
  drivers/net/phy/marvell.c   | 24 ++++++++++++++++++++++++
  include/linux/marvell_phy.h |  1 +
  2 files changed, 25 insertions(+)

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 4cc4e25fed2d..f0d4ca87e4bc 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -2481,6 +2481,29 @@ static struct phy_driver marvell_drivers[] = {
  		.get_tunable = m88e1540_get_tunable,
  		.set_tunable = m88e1540_set_tunable,
  	},
+	{
+		.phy_id = MARVELL_PHY_ID_88E1548,
+		.phy_id_mask = MARVELL_PHY_ID_MASK,
+		.name = "Marvell 88E1548P",
+		.probe = m88e1510_probe,
+		.features = PHY_GBIT_FIBRE_FEATURES,
+		.config_init = &marvell_config_init,
+		.config_aneg = &m88e1510_config_aneg,
+		.read_status = &marvell_read_status,
+		.ack_interrupt = &marvell_ack_interrupt,
+		.config_intr = &marvell_config_intr,
+		.did_interrupt = &m88e1121_did_interrupt,
+		.resume = &genphy_resume,
+		.suspend = &genphy_suspend,
+		.read_page = marvell_read_page,
+		.write_page = marvell_write_page,
+		.get_sset_count = marvell_get_sset_count,
+		.get_strings = marvell_get_strings,
+		.get_stats = marvell_get_stats,
+		.get_tunable = m88e1540_get_tunable,
+		.set_tunable = m88e1540_set_tunable,
+	},
+
  };

  module_phy_driver(marvell_drivers);
@@ -2502,6 +2525,7 @@ static struct mdio_device_id __maybe_unused 
marvell_tbl[] = {
  	{ MARVELL_PHY_ID_88E3016, MARVELL_PHY_ID_MASK },
  	{ MARVELL_PHY_ID_88E6390, MARVELL_PHY_ID_MASK },
  	{ MARVELL_PHY_ID_88E1340, MARVELL_PHY_ID_MASK },
+	{ MARVELL_PHY_ID_88E1548, MARVELL_PHY_ID_MASK },
  	{ }
  };

diff --git a/include/linux/marvell_phy.h b/include/linux/marvell_phy.h
index 39e8c382defb..3d8249c3e31d 100644
--- a/include/linux/marvell_phy.h
+++ b/include/linux/marvell_phy.h
@@ -20,6 +20,7 @@
  #define MARVELL_PHY_ID_88E1510		0x01410dd0
  #define MARVELL_PHY_ID_88E1540		0x01410eb0
  #define MARVELL_PHY_ID_88E1545		0x01410ea0
+#define MARVELL_PHY_ID_88E1548		0x01410ec0
  #define MARVELL_PHY_ID_88E3016		0x01410e60
  #define MARVELL_PHY_ID_88X3310		0x002b09a0
  #define MARVELL_PHY_ID_88E2110		0x002b09b0
-- 
2.25.1

^ permalink raw reply related

* [PATCH 01/02] net: phy: marvell: Add Marvell 88E1340 support
From: Maxim Kochetkov @ 2020-06-16  7:01 UTC (permalink / raw)
  To: netdev; +Cc: andrew, f.fainelli, hkallweit1, linux

Add Marvell 88E1340 support
Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru>
---
  drivers/net/phy/marvell.c   | 23 +++++++++++++++++++++++
  include/linux/marvell_phy.h |  1 +
  2 files changed, 24 insertions(+)

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 7fc8e10c5f33..4cc4e25fed2d 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -2459,6 +2459,28 @@ static struct phy_driver marvell_drivers[] = {
  		.get_tunable = m88e1540_get_tunable,
  		.set_tunable = m88e1540_set_tunable,
  	},
+	{
+		.phy_id = MARVELL_PHY_ID_88E1340,
+		.phy_id_mask = MARVELL_PHY_ID_MASK,
+		.name = "Marvell 88E1340",
+		.probe = m88e1510_probe,
+		/* PHY_GBIT_FEATURES */
+		.config_init = &marvell_config_init,
+		.config_aneg = &m88e1510_config_aneg,
+		.read_status = &marvell_read_status,
+		.ack_interrupt = &marvell_ack_interrupt,
+		.config_intr = &marvell_config_intr,
+		.did_interrupt = &m88e1121_did_interrupt,
+		.resume = &genphy_resume,
+		.suspend = &genphy_suspend,
+		.read_page = marvell_read_page,
+		.write_page = marvell_write_page,
+		.get_sset_count = marvell_get_sset_count,
+		.get_strings = marvell_get_strings,
+		.get_stats = marvell_get_stats,
+		.get_tunable = m88e1540_get_tunable,
+		.set_tunable = m88e1540_set_tunable,
+	},
  };

  module_phy_driver(marvell_drivers);
@@ -2479,6 +2501,7 @@ static struct mdio_device_id __maybe_unused 
marvell_tbl[] = {
  	{ MARVELL_PHY_ID_88E1545, MARVELL_PHY_ID_MASK },
  	{ MARVELL_PHY_ID_88E3016, MARVELL_PHY_ID_MASK },
  	{ MARVELL_PHY_ID_88E6390, MARVELL_PHY_ID_MASK },
+	{ MARVELL_PHY_ID_88E1340, MARVELL_PHY_ID_MASK },
  	{ }
  };

diff --git a/include/linux/marvell_phy.h b/include/linux/marvell_phy.h
index af6b11d4d673..39e8c382defb 100644
--- a/include/linux/marvell_phy.h
+++ b/include/linux/marvell_phy.h
@@ -15,6 +15,7 @@
  #define MARVELL_PHY_ID_88E1149R		0x01410e50
  #define MARVELL_PHY_ID_88E1240		0x01410e30
  #define MARVELL_PHY_ID_88E1318S		0x01410e90
+#define MARVELL_PHY_ID_88E1340		0x01410dc0
  #define MARVELL_PHY_ID_88E1116R		0x01410e40
  #define MARVELL_PHY_ID_88E1510		0x01410dd0
  #define MARVELL_PHY_ID_88E1540		0x01410eb0
-- 
2.25.1

^ permalink raw reply related

* Re: [PATCH 1/2] e1000e: Do not wake up the system via WOL if device wakeup is disabled
From: Chen Yu @ 2020-06-16  7:01 UTC (permalink / raw)
  To: Brown, Aaron F
  Cc: Kirsher, Jeffrey T, David S. Miller, Jakub Kicinski,
	Kok, Auke-jan H, Jeff Garzik, intel-wired-lan@lists.osuosl.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Brown, Len,
	Rafael J. Wysocki, Shevchenko, Andriy, Neftin, Sasha,
	Lifshits, Vitaly, Stable@vger.kernel.org
In-Reply-To: <SN6PR11MB2896298A90B37CEA0DC5A750BC9C0@SN6PR11MB2896.namprd11.prod.outlook.com>

On Tue, Jun 16, 2020 at 02:51:27AM +0800, Brown, Aaron F wrote:
> > From: Chen Yu <yu.c.chen@intel.com>
> > Sent: Thursday, May 21, 2020 10:59 AM
> > To: Kirsher, Jeffrey T <jeffrey.t.kirsher@intel.com>; David S. Miller
> > <davem@davemloft.net>; Jakub Kicinski <kuba@kernel.org>; Kok, Auke-jan H
> > <auke-jan.h.kok@intel.com>; Jeff Garzik <jeff@garzik.org>
> > Cc: intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org; linux-
> > kernel@vger.kernel.org; Brown, Len <len.brown@intel.com>; Rafael J. Wysocki
> > <rjw@rjwysocki.net>; Shevchenko, Andriy <andriy.shevchenko@intel.com>;
> > Neftin, Sasha <sasha.neftin@intel.com>; Lifshits, Vitaly
> > <vitaly.lifshits@intel.com>; Chen, Yu C <yu.c.chen@intel.com>;
> > Stable@vger.kernel.org
> > Subject: [PATCH 1/2] e1000e: Do not wake up the system via WOL if device
> > wakeup is disabled
> >
> > Currently the system will be woken up via WOL(Wake On Lan) even if the
> > device wakeup ability has been disabled via sysfs:
> >  cat /sys/devices/pci0000:00/0000:00:1f.6/power/wakeup
> >  disabled
> >
> > The system should not be woken up if the user has explicitly
> > disabled the wake up ability for this device.
> >
> > This patch clears the WOL ability of this network device if the
> > user has disabled the wake up ability in sysfs.
> >
> > Fixes: bc7f75fa9788 ("[E1000E]: New pci-express e1000 driver")
> > Reported-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > Cc: <Stable@vger.kernel.org>
> > Signed-off-by: Chen Yu <yu.c.chen@intel.com>
> > ---
> >  drivers/net/ethernet/intel/e1000e/netdev.c | 14 ++++++++++----
> >  1 file changed, 10 insertions(+), 4 deletions(-)
> >
> Tested-by: Aaron Brown <aaron.f.brown@intel.com>
> 
Thanks for testing, Aaron.

Best,
Chenyu

^ permalink raw reply

* [PATCH net-next 3/3] mptcp: add MP_FASTCLOSE suboption handling
From: Geliang Tang @ 2020-06-16  6:47 UTC (permalink / raw)
  To: Mat Martineau, Matthieu Baerts, David S. Miller, Jakub Kicinski
  Cc: Geliang Tang, netdev, mptcp, linux-kernel
In-Reply-To: <9bb5cb494f4ac53845f2d233409073d8e71d0e4f.1592289629.git.geliangtang@gmail.com>

Add handling for sending and receiving MP_FASTCLOSE suboption.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
 net/mptcp/options.c  | 16 ++++++++++++++++
 net/mptcp/protocol.h |  2 ++
 2 files changed, 18 insertions(+)

diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index 82b3d7c566b4..a99b3989fec1 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -297,6 +297,15 @@ static void mptcp_parse_option(const struct sk_buff *skb,
 		pr_debug("MP_FAIL: data_seq=%lld", mp_opt->data_seq);
 		break;
 
+	case MPTCPOPT_MP_FASTCLOSE:
+		if (opsize != TCPOLEN_MPTCP_FASTCLOSE)
+			break;
+
+		ptr += 2;
+		mp_opt->rcvr_key = get_unaligned_be64(ptr);
+		pr_debug("MP_FASTCLOSE: rcvr_key=%lld", mp_opt->rcvr_key);
+		break;
+
 	default:
 		break;
 	}
@@ -993,6 +1002,13 @@ void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts)
 		put_unaligned_be64(mpext->data_seq, ptr);
 	}
 
+	if (OPTION_MPTCP_FASTCLOSE & opts->suboptions) {
+		*ptr++ = mptcp_option(MPTCPOPT_MP_FASTCLOSE,
+				      TCPOLEN_MPTCP_FASTCLOSE,
+				      0, 0);
+		put_unaligned_be64(opts->rcvr_key, ptr);
+	}
+
 	if (OPTION_MPTCP_MPJ_SYN & opts->suboptions) {
 		*ptr++ = mptcp_option(MPTCPOPT_MP_JOIN,
 				      TCPOLEN_MPTCP_MPJ_SYN,
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index e6ae0a73716b..a8faab61e7af 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -25,6 +25,7 @@
 #define OPTION_MPTCP_RM_ADDR	BIT(8)
 #define OPTION_MPTCP_PRIO	BIT(9)
 #define OPTION_MPTCP_FAIL	BIT(10)
+#define OPTION_MPTCP_FASTCLOSE	BIT(11)
 
 /* MPTCP option subtypes */
 #define MPTCPOPT_MP_CAPABLE	0
@@ -62,6 +63,7 @@
 #define TCPOLEN_MPTCP_RM_ADDR_BASE	4
 #define TCPOLEN_MPTCP_PRIO		3
 #define TCPOLEN_MPTCP_FAIL		12
+#define TCPOLEN_MPTCP_FASTCLOSE		12
 
 /* MPTCP MP_JOIN flags */
 #define MPTCPOPT_BACKUP		BIT(0)
-- 
2.17.1


^ permalink raw reply related

* Re: [PATCH bpf 1/2] bpf: bpf_probe_read_kernel_str() has to return amount of data read on success
From: Christoph Hellwig @ 2020-06-16  6:54 UTC (permalink / raw)
  To: Andrii Nakryiko
  Cc: bpf, netdev, ast, daniel, andrii.nakryiko, kernel-team,
	Christoph Hellwig
In-Reply-To: <20200616050432.1902042-1-andriin@fb.com>

On Mon, Jun 15, 2020 at 10:04:30PM -0700, Andrii Nakryiko wrote:
> During recent refactorings, bpf_probe_read_kernel_str() started returning 0 on
> success, instead of amount of data successfully read. This majorly breaks
> applications relying on bpf_probe_read_kernel_str() and bpf_probe_read_str()
> and their results. Fix this by returning actual number of bytes read.
> 
> Cc: Christoph Hellwig <hch@lst.de>
> Fixes: 8d92db5c04d1 ("bpf: rework the compat kernel probe handling")
> Signed-off-by: Andrii Nakryiko <andriin@fb.com>

Looks good, thanks for fixing this up:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply

* [PATCH net-next 2/3] mptcp: add MP_FAIL suboption handling
From: Geliang Tang @ 2020-06-16  6:47 UTC (permalink / raw)
  To: Mat Martineau, Matthieu Baerts, David S. Miller, Jakub Kicinski
  Cc: Geliang Tang, netdev, mptcp, linux-kernel
In-Reply-To: <f86a2f6f241b7f7a49fec17b3428ae5a0fadc93e.1592289629.git.geliangtang@gmail.com>

Add handling for sending and receiving MP_FAIL suboption.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
 net/mptcp/options.c  | 18 ++++++++++++++++++
 net/mptcp/protocol.h |  2 ++
 2 files changed, 20 insertions(+)

diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index cc3039f0ac43..82b3d7c566b4 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -288,6 +288,15 @@ static void mptcp_parse_option(const struct sk_buff *skb,
 		pr_debug("MP_PRIO: backup=%d", mp_opt->backup);
 		break;
 
+	case MPTCPOPT_MP_FAIL:
+		if (opsize != TCPOLEN_MPTCP_FAIL)
+			break;
+
+		ptr += 2;
+		mp_opt->data_seq = get_unaligned_be64(ptr);
+		pr_debug("MP_FAIL: data_seq=%lld", mp_opt->data_seq);
+		break;
+
 	default:
 		break;
 	}
@@ -975,6 +984,15 @@ void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts)
 				      opts->backup, 0);
 	}
 
+	if (OPTION_MPTCP_FAIL & opts->suboptions) {
+		struct mptcp_ext *mpext = &opts->ext_copy;
+
+		*ptr++ = mptcp_option(MPTCPOPT_MP_FAIL,
+				      TCPOLEN_MPTCP_FAIL,
+				      0, 0);
+		put_unaligned_be64(mpext->data_seq, ptr);
+	}
+
 	if (OPTION_MPTCP_MPJ_SYN & opts->suboptions) {
 		*ptr++ = mptcp_option(MPTCPOPT_MP_JOIN,
 				      TCPOLEN_MPTCP_MPJ_SYN,
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index 623c9a1c4343..e6ae0a73716b 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -24,6 +24,7 @@
 #define OPTION_MPTCP_ADD_ADDR6	BIT(7)
 #define OPTION_MPTCP_RM_ADDR	BIT(8)
 #define OPTION_MPTCP_PRIO	BIT(9)
+#define OPTION_MPTCP_FAIL	BIT(10)
 
 /* MPTCP option subtypes */
 #define MPTCPOPT_MP_CAPABLE	0
@@ -60,6 +61,7 @@
 #define TCPOLEN_MPTCP_PORT_LEN		2
 #define TCPOLEN_MPTCP_RM_ADDR_BASE	4
 #define TCPOLEN_MPTCP_PRIO		3
+#define TCPOLEN_MPTCP_FAIL		12
 
 /* MPTCP MP_JOIN flags */
 #define MPTCPOPT_BACKUP		BIT(0)
-- 
2.17.1


^ permalink raw reply related

* [PATCH net-next 1/3] mptcp: add MP_PRIO suboption handling
From: Geliang Tang @ 2020-06-16  6:47 UTC (permalink / raw)
  To: Mat Martineau, Matthieu Baerts, David S. Miller, Jakub Kicinski
  Cc: Geliang Tang, netdev, mptcp, linux-kernel
In-Reply-To: <cover.1592289629.git.geliangtang@gmail.com>

Add handling for sending and receiving MP_PRIO suboption.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
 net/mptcp/options.c  | 14 ++++++++++++++
 net/mptcp/protocol.h |  5 +++++
 2 files changed, 19 insertions(+)

diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index 490b92534afc..cc3039f0ac43 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -280,6 +280,14 @@ static void mptcp_parse_option(const struct sk_buff *skb,
 		pr_debug("RM_ADDR: id=%d", mp_opt->rm_id);
 		break;
 
+	case MPTCPOPT_MP_PRIO:
+		if (opsize != TCPOLEN_MPTCP_PRIO)
+			break;
+
+		mp_opt->backup = (*ptr++) & MPTCP_PRIO_BACKUP;
+		pr_debug("MP_PRIO: backup=%d", mp_opt->backup);
+		break;
+
 	default:
 		break;
 	}
@@ -961,6 +969,12 @@ void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts)
 				      0, opts->rm_id);
 	}
 
+	if (OPTION_MPTCP_PRIO & opts->suboptions) {
+		*ptr++ = mptcp_option(MPTCPOPT_MP_PRIO,
+				      TCPOLEN_MPTCP_PRIO,
+				      opts->backup, 0);
+	}
+
 	if (OPTION_MPTCP_MPJ_SYN & opts->suboptions) {
 		*ptr++ = mptcp_option(MPTCPOPT_MP_JOIN,
 				      TCPOLEN_MPTCP_MPJ_SYN,
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index db56535dfc29..623c9a1c4343 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -23,6 +23,7 @@
 #define OPTION_MPTCP_ADD_ADDR	BIT(6)
 #define OPTION_MPTCP_ADD_ADDR6	BIT(7)
 #define OPTION_MPTCP_RM_ADDR	BIT(8)
+#define OPTION_MPTCP_PRIO	BIT(9)
 
 /* MPTCP option subtypes */
 #define MPTCPOPT_MP_CAPABLE	0
@@ -58,6 +59,7 @@
 #define TCPOLEN_MPTCP_ADD_ADDR6_BASE_PORT	22
 #define TCPOLEN_MPTCP_PORT_LEN		2
 #define TCPOLEN_MPTCP_RM_ADDR_BASE	4
+#define TCPOLEN_MPTCP_PRIO		3
 
 /* MPTCP MP_JOIN flags */
 #define MPTCPOPT_BACKUP		BIT(0)
@@ -84,6 +86,9 @@
 #define MPTCP_ADDR_IPVERSION_4	4
 #define MPTCP_ADDR_IPVERSION_6	6
 
+/* MPTCP MP_PRIO flags */
+#define MPTCP_PRIO_BACKUP	BIT(0)
+
 /* MPTCP socket flags */
 #define MPTCP_DATA_READY	0
 #define MPTCP_SEND_SPACE	1
-- 
2.17.1


^ permalink raw reply related

* [PATCH net-next 0/3] add MP_PRIO, MP_FAIL and MP_FASTCLOSE suboptions handling
From: Geliang Tang @ 2020-06-16  6:47 UTC (permalink / raw)
  To: Mat Martineau, Matthieu Baerts, David S. Miller, Jakub Kicinski
  Cc: Geliang Tang, netdev, mptcp, linux-kernel

Add handling for sending and receiving the MP_PRIO, MP_FAIL, and
MP_FASTCLOSE suboptions.

Geliang Tang (3):
  mptcp: add MP_PRIO suboption handling
  mptcp: add MP_FAIL suboption handling
  mptcp: add MP_FASTCLOSE suboption handling

 net/mptcp/options.c  | 48 ++++++++++++++++++++++++++++++++++++++++++++
 net/mptcp/protocol.h |  9 +++++++++
 2 files changed, 57 insertions(+)

-- 
2.17.1


^ permalink raw reply

* Re: [PATCH 4/5] Huawei BMA: Adding Huawei BMA driver: cdev_veth_drv
From: kernel test robot @ 2020-06-16  6:48 UTC (permalink / raw)
  To: yunaixin03610, netdev; +Cc: kbuild-all, yunaixin
In-Reply-To: <20200616020528.1389-1-yunaixin03610@163.com>

[-- Attachment #1: Type: text/plain, Size: 13525 bytes --]

Hi,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.8-rc1 next-20200616]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/yunaixin03610-163-com/Adding-Huawei-BMA-drivers/20200616-102318
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git a5dc8300df75e8b8384b4c82225f1e4a0b4d9b55
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>, old ones prefixed by <<):

In file included from drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:16:
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.h:250:2: error: unknown type name '__kernel_time_t'
250 |  __kernel_time_t init_time;
|  ^~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:55:6: warning: no previous prototype for 'dump_global_info' [-Wmissing-prototypes]
55 | void dump_global_info(void)
|      ^~~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:93:6: warning: no previous prototype for 'edma_veth_free_tx_resources' [-Wmissing-prototypes]
93 | void edma_veth_free_tx_resources(struct edma_rxtx_q_s *ptx_queue)
|      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:109:6: warning: no previous prototype for 'edma_veth_free_all_tx_resources' [-Wmissing-prototypes]
109 | void edma_veth_free_all_tx_resources(struct edma_eth_dev_s *edma_eth)
|      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:118:5: warning: no previous prototype for 'edma_veth_setup_tx_resources' [-Wmissing-prototypes]
118 | int edma_veth_setup_tx_resources(struct edma_rxtx_q_s *ptx_queue)
|     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:142:5: warning: no previous prototype for 'edma_veth_setup_all_tx_resources' [-Wmissing-prototypes]
142 | int edma_veth_setup_all_tx_resources(struct edma_eth_dev_s *edma_eth)
|     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:186:5: warning: no previous prototype for 'edma_veth_setup_rx_resources' [-Wmissing-prototypes]
186 | int edma_veth_setup_rx_resources(struct edma_rxtx_q_s *prx_queue)
|     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:210:5: warning: no previous prototype for 'edma_veth_setup_all_rx_resources' [-Wmissing-prototypes]
210 | int edma_veth_setup_all_rx_resources(struct edma_eth_dev_s *edma_eth)
|     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:253:6: warning: no previous prototype for 'edma_veth_free_rx_resources' [-Wmissing-prototypes]
253 | void edma_veth_free_rx_resources(struct edma_rxtx_q_s *prx_queue)
|      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:270:6: warning: no previous prototype for 'edma_veth_free_all_rx_resources' [-Wmissing-prototypes]
270 | void edma_veth_free_all_rx_resources(struct edma_eth_dev_s *edma_eth)
|      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:279:5: warning: no previous prototype for 'edma_veth_setup_all_rxtx_queue' [-Wmissing-prototypes]
279 | int edma_veth_setup_all_rxtx_queue(struct edma_eth_dev_s *edma_eth)
|     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:363:6: warning: no previous prototype for 'edma_veth_dump' [-Wmissing-prototypes]
363 | void edma_veth_dump(void)
|      ^~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:392:5: warning: no previous prototype for 'edma_veth_setup_resource' [-Wmissing-prototypes]
392 | int edma_veth_setup_resource(struct edma_eth_dev_s *edma_eth)
|     ^~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:418:5: warning: no previous prototype for 'edma_veth_free_rxtx_queue' [-Wmissing-prototypes]
418 | int edma_veth_free_rxtx_queue(struct edma_eth_dev_s *edma_eth)
|     ^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:457:6: warning: no previous prototype for 'edma_veth_free_resource' [-Wmissing-prototypes]
457 | void edma_veth_free_resource(struct edma_eth_dev_s *edma_eth)
|      ^~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:469:5: warning: no previous prototype for 'edma_veth_send_one_pkt' [-Wmissing-prototypes]
469 | int edma_veth_send_one_pkt(struct edma_cut_packet_node_s *cut_packet_node)
|     ^~~~~~~~~~~~~~~~~~~~~~
In file included from drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:16:
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c: In function 'edma_veth_cut_tx_packet_send':
>> drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.h:258:17: warning: format '%u' expects argument of type 'unsigned int', but argument 6 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
258 |   netdev_err(0, "[%s,%d] -> " fmt "n",          |                 ^~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:592:3: note: in expansion of macro 'LOG'
592 |   LOG(DLOG_DEBUG, "length: %u/%u", length, len);
|   ^~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:592:32: note: format string is defined here
592 |   LOG(DLOG_DEBUG, "length: %u/%u", length, len);
|                               ~^
|                                |
|                                unsigned int
|                               %lu
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c: At top level:
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:776:5: warning: no previous prototype for 'edma_veth_recv_pkt' [-Wmissing-prototypes]
776 | int edma_veth_recv_pkt(struct edma_rxtx_q_s *prx_queue,
|     ^~~~~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:858:6: warning: no previous prototype for 'edma_task_do_packet_recv' [-Wmissing-prototypes]
858 | void edma_task_do_packet_recv(unsigned long data)
|      ^~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:883:5: warning: no previous prototype for '__dmacmp_err_deal_2' [-Wmissing-prototypes]
883 | int __dmacmp_err_deal_2(struct edma_rxtx_q_s *prxtx_queue, u32 type)
|     ^~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:916:5: warning: no previous prototype for 'edma_veth_check_dma_status' [-Wmissing-prototypes]
916 | int edma_veth_check_dma_status(struct edma_rxtx_q_s *prxtx_queue, u32 type)
|     ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:937:5: warning: no previous prototype for '__check_dmacmp_H_2' [-Wmissing-prototypes]
937 | int __check_dmacmp_H_2(struct edma_rxtx_q_s *prxtx_queue, u32 type)
|     ^~~~~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:1017:5: warning: no previous prototype for '__checkspace_H_2' [-Wmissing-prototypes]
1017 | int __checkspace_H_2(struct edma_rxtx_q_s *prxtx_queue, u32 type, u32 *pcnt)
|     ^~~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:1091:5: warning: no previous prototype for '__make_dmalistbd_h2b_H_2' [-Wmissing-prototypes]
1091 | int __make_dmalistbd_h2b_H_2(struct edma_rxtx_q_s *prxtx_queue, u32 cnt)
|     ^~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:1173:5: warning: no previous prototype for '__make_dmalistbd_b2h_H_2' [-Wmissing-prototypes]
1173 | int __make_dmalistbd_b2h_H_2(struct edma_rxtx_q_s *prxtx_queue, u32 cnt)
|     ^~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:1253:5: warning: no previous prototype for '__start_dmalist_H_2' [-Wmissing-prototypes]
1253 | int __start_dmalist_H_2(struct edma_rxtx_q_s *prxtx_queue, u32 type, u32 cnt)
|     ^~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:1297:5: warning: no previous prototype for 'check_dma_queue_fault_2' [-Wmissing-prototypes]
1297 | int check_dma_queue_fault_2(struct edma_rxtx_q_s *prxtx_queue,
|     ^~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:1327:5: warning: no previous prototype for '__dma_rxtx_H_2' [-Wmissing-prototypes]
1327 | int __dma_rxtx_H_2(struct edma_rxtx_q_s *prxtx_queue, u32 type)
|     ^~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:1394:6: warning: no previous prototype for 'edma_task_do_data_transmit' [-Wmissing-prototypes]
1394 | void edma_task_do_data_transmit(unsigned long data)
|      ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:1431:5: warning: no previous prototype for 'edma_tasklet_setup' [-Wmissing-prototypes]
1431 | int edma_tasklet_setup(struct edma_eth_dev_s *dev, u8 **rx_buf,
|     ^~~~~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:1479:6: warning: no previous prototype for 'edma_tasklet_free' [-Wmissing-prototypes]
1479 | void edma_tasklet_free(struct edma_eth_dev_s *dev, u8 **rx_buf,
|      ^~~~~~~~~~~~~~~~~
In file included from drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.h:31,
from drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:16:
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c: In function 'edma_cdev_init':
drivers/net/ethernet/huawei/bma/cdev_veth_drv/../edma_drv/bma_include.h:109:19: error: storage size of 'uptime' isn't known
109 |   struct timespec uptime;         |                   ^~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:1600:2: note: in expansion of macro 'GET_SYS_SECONDS'
1600 |  GET_SYS_SECONDS(g_eth_edmaprivate.init_time);
|  ^~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/../edma_drv/bma_include.h:110:3: error: implicit declaration of function 'get_monotonic_boottime' [-Werror=implicit-function-declaration]
110 |   get_monotonic_boottime(&uptime);         |   ^~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:1600:2: note: in expansion of macro 'GET_SYS_SECONDS'
1600 |  GET_SYS_SECONDS(g_eth_edmaprivate.init_time);
|  ^~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/../edma_drv/bma_include.h:109:19: warning: unused variable 'uptime' [-Wunused-variable]
109 |   struct timespec uptime;         |                   ^~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:1600:2: note: in expansion of macro 'GET_SYS_SECONDS'
1600 |  GET_SYS_SECONDS(g_eth_edmaprivate.init_time);
|  ^~~~~~~~~~~~~~~
In file included from drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:16:
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c: In function 'cdev_copy_packet_to_user':
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.h:258:17: warning: format '%ld' expects argument of type 'long int', but argument 6 has type 'unsigned int' [-Wformat=]
258 |   netdev_err(0, "[%s,%d] -> " fmt "n",          |                 ^~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:1667:2: note: in expansion of macro 'LOG'
1667 |  LOG(DLOG_DEBUG,
|  ^~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:1668:36: note: format string is defined here
1668 |      "User needs %ld bytes, pos: %ld, total len: %u, left: %ld.",
|                                  ~~^
|                                    |
|                                    long int
|                                  %d
In file included from drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:16:
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.h:258:17: warning: format '%ld' expects argument of type 'long int', but argument 6 has type 'unsigned int' [-Wformat=]
258 |   netdev_err(0, "[%s,%d] -> " fmt "n",          |                 ^~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:1699:2: note: in expansion of macro 'LOG'
1699 |  LOG(DLOG_DEBUG,
|  ^~~
drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c:1700:33: note: format string is defined here
1700 |      "Copied bytes: %ld, pos: %ld, buf len: %lu, free_packet: %d.",
|                               ~~^
|                                 |

vim +258 drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.h

   254	
   255	#ifndef LOG
   256	#define LOG(level, fmt, ...) do {\
   257		if (debug >= (level)) {\
 > 258			netdev_err(0, "[%s,%d] -> " fmt "\n", \
   259				   __func__, __LINE__, ##__VA_ARGS__); \
   260		} \
   261	} while (0)
   262	#endif
   263	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 74660 bytes --]

^ permalink raw reply

* Re: [PATCH 2/5] Huawei BMA: Adding Huawei BMA driver: host_cdev_drv
From: kernel test robot @ 2020-06-16  5:54 UTC (permalink / raw)
  To: yunaixin03610, netdev; +Cc: kbuild-all, yunaixin
In-Reply-To: <20200615145906.1013-3-yunaixin03610@163.com>

[-- Attachment #1: Type: text/plain, Size: 8129 bytes --]

Hi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.8-rc1 next-20200616]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/yunaixin03610-163-com/Adding-Huawei-BMA-drivers/20200616-102318
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git a5dc8300df75e8b8384b4c82225f1e4a0b4d9b55
config: i386-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
reproduce (this is a W=1 build):
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>, old ones prefixed by <<):

drivers/net/ethernet/huawei/bma/cdev_drv/bma_cdev.c: In function 'cdev_param_get_statics':
>> drivers/net/ethernet/huawei/bma/cdev_drv/bma_cdev.c:97:2: error: unknown type name '__kernel_time_t'; did you mean '__kernel_timer_t'?
97 |  __kernel_time_t running_time = 0;
|  ^~~~~~~~~~~~~~~
|  __kernel_timer_t
In file included from drivers/net/ethernet/huawei/bma/cdev_drv/bma_cdev.c:23:
>> drivers/net/ethernet/huawei/bma/cdev_drv/../edma_drv/bma_include.h:109:19: error: storage size of 'uptime' isn't known
109 |   struct timespec uptime;         |                   ^~~~~~
>> drivers/net/ethernet/huawei/bma/cdev_drv/bma_cdev.c:102:2: note: in expansion of macro 'GET_SYS_SECONDS'
102 |  GET_SYS_SECONDS(running_time);
|  ^~~~~~~~~~~~~~~
>> drivers/net/ethernet/huawei/bma/cdev_drv/../edma_drv/bma_include.h:110:3: error: implicit declaration of function 'get_monotonic_boottime' [-Werror=implicit-function-declaration]
110 |   get_monotonic_boottime(&uptime);         |   ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/huawei/bma/cdev_drv/bma_cdev.c:102:2: note: in expansion of macro 'GET_SYS_SECONDS'
102 |  GET_SYS_SECONDS(running_time);
|  ^~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_drv/../edma_drv/bma_include.h:109:19: warning: unused variable 'uptime' [-Wunused-variable]
109 |   struct timespec uptime;         |                   ^~~~~~
>> drivers/net/ethernet/huawei/bma/cdev_drv/bma_cdev.c:102:2: note: in expansion of macro 'GET_SYS_SECONDS'
102 |  GET_SYS_SECONDS(running_time);
|  ^~~~~~~~~~~~~~~
>> drivers/net/ethernet/huawei/bma/cdev_drv/bma_cdev.c:108:45: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'int' [-Wformat=]
108 |  len += sprintf(buf + len, "running_time :%luD %02lu:%02lu:%02lun",
|                                           ~~^
|                                             |
|                                             long unsigned int
|                                           %u
109 |          running_time / (SECONDS_PER_DAY),
|          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|                       |
|                       int
drivers/net/ethernet/huawei/bma/cdev_drv/bma_cdev.c:108:52: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'int' [-Wformat=]
108 |  len += sprintf(buf + len, "running_time :%luD %02lu:%02lu:%02lun",
|                                                ~~~~^
|                                                    |
|                                                    long unsigned int
|                                                %02u
drivers/net/ethernet/huawei/bma/cdev_drv/bma_cdev.c:108:58: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'int' [-Wformat=]
108 |  len += sprintf(buf + len, "running_time :%luD %02lu:%02lu:%02lun",
|                                                      ~~~~^
|                                                          |
|                                                          long unsigned int
|                                                      %02u
drivers/net/ethernet/huawei/bma/cdev_drv/bma_cdev.c:108:64: warning: format '%lu' expects argument of type 'long unsigned int', but argument 6 has type 'int' [-Wformat=]
108 |  len += sprintf(buf + len, "running_time :%luD %02lu:%02lu:%02lun",
|                                                            ~~~~^
|                                                                |
|                                                                long unsigned int
|                                                            %02u
In file included from drivers/net/ethernet/huawei/bma/cdev_drv/bma_cdev.c:23:
drivers/net/ethernet/huawei/bma/cdev_drv/bma_cdev.c: In function 'bma_cdev_init':
>> drivers/net/ethernet/huawei/bma/cdev_drv/../edma_drv/bma_include.h:109:19: error: storage size of 'uptime' isn't known
109 |   struct timespec uptime;         |                   ^~~~~~
drivers/net/ethernet/huawei/bma/cdev_drv/bma_cdev.c:216:2: note: in expansion of macro 'GET_SYS_SECONDS'
216 |  GET_SYS_SECONDS(g_cdev_set.init_time);
|  ^~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/cdev_drv/../edma_drv/bma_include.h:109:19: warning: unused variable 'uptime' [-Wunused-variable]
109 |   struct timespec uptime;         |                   ^~~~~~
drivers/net/ethernet/huawei/bma/cdev_drv/bma_cdev.c:216:2: note: in expansion of macro 'GET_SYS_SECONDS'
216 |  GET_SYS_SECONDS(g_cdev_set.init_time);
|  ^~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

vim +97 drivers/net/ethernet/huawei/bma/cdev_drv/bma_cdev.c

    92	
    93	static int cdev_param_get_statics(char *buf, const struct kernel_param *kp)
    94	{
    95		int len = 0;
    96		int i = 0;
  > 97		__kernel_time_t running_time = 0;
    98	
    99		if (!buf)
   100			return 0;
   101	
 > 102		GET_SYS_SECONDS(running_time);
   103		running_time -= g_cdev_set.init_time;
   104		len += sprintf(buf + len,
   105			       "============================CDEV_DRIVER_INFO=======================\n");
   106		len += sprintf(buf + len, "version      :%s\n", CDEV_VERSION);
   107	
 > 108		len += sprintf(buf + len, "running_time :%luD %02lu:%02lu:%02lu\n",
   109			       running_time / (SECONDS_PER_DAY),
   110			       running_time % (SECONDS_PER_DAY) / SECONDS_PER_HOUR,
   111			       running_time % SECONDS_PER_HOUR / SECONDS_PER_MINUTE,
   112			       running_time % SECONDS_PER_MINUTE);
   113	
   114		for (i = 0; i < g_cdev_set.dev_num; i++) {
   115			len += sprintf(buf + len,
   116				       "===================================================\n");
   117			len += sprintf(buf + len, "name      :%s\n",
   118				       g_cdev_set.dev_list[i].dev_name);
   119			len +=
   120			    sprintf(buf + len, "dev_id    :%08x\n",
   121				    g_cdev_set.dev_list[i].dev_id);
   122			len += sprintf(buf + len, "type      :%u\n",
   123				       g_cdev_set.dev_list[i].type);
   124			len += sprintf(buf + len, "status    :%s\n",
   125				       g_cdev_set.dev_list[i].s.open_status ==
   126				       1 ? "open" : "close");
   127			len += sprintf(buf + len, "send_pkgs :%u\n",
   128				       g_cdev_set.dev_list[i].s.send_pkgs);
   129			len +=
   130			    sprintf(buf + len, "send_bytes:%u\n",
   131				    g_cdev_set.dev_list[i].s.send_bytes);
   132			len += sprintf(buf + len, "send_failed_count:%u\n",
   133				       g_cdev_set.dev_list[i].s.send_failed_count);
   134			len += sprintf(buf + len, "recv_pkgs :%u\n",
   135				       g_cdev_set.dev_list[i].s.recv_pkgs);
   136			len += sprintf(buf + len, "recv_bytes:%u\n",
   137				       g_cdev_set.dev_list[i].s.recv_bytes);
   138			len += sprintf(buf + len, "recv_failed_count:%u\n",
   139				       g_cdev_set.dev_list[i].s.recv_failed_count);
   140		}
   141	
   142		return len;
   143	}
   144	module_param_call(statistics, NULL, cdev_param_get_statics, &debug, 0444);
   145	MODULE_PARM_DESC(statistics, "Statistics info of cdev driver,readonly");
   146	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 73467 bytes --]

^ permalink raw reply

* Re: [PATCH v4 1/3] mm/slab: Use memzero_explicit() in kzfree()
From: Michal Hocko @ 2020-06-16  6:42 UTC (permalink / raw)
  To: Waiman Long
  Cc: Andrew Morton, David Howells, Jarkko Sakkinen, James Morris,
	Serge E. Hallyn, Linus Torvalds, Joe Perches, Matthew Wilcox,
	David Rientjes, Johannes Weiner, Dan Carpenter, David Sterba,
	Jason A . Donenfeld, linux-mm, keyrings, linux-kernel,
	linux-crypto, linux-pm, linux-stm32, linux-amlogic,
	linux-mediatek, linuxppc-dev, virtualization, netdev, linux-ppp,
	wireguard, linux-wireless, devel, linux-scsi, target-devel,
	linux-btrfs, linux-cifs, linux-fscrypt, ecryptfs, kasan-dev,
	linux-bluetooth, linux-wpan, linux-sctp, linux-nfs,
	tipc-discussion, linux-security-module, linux-integrity, stable
In-Reply-To: <20200616015718.7812-2-longman@redhat.com>

On Mon 15-06-20 21:57:16, Waiman Long wrote:
> The kzfree() function is normally used to clear some sensitive
> information, like encryption keys, in the buffer before freeing it back
> to the pool. Memset() is currently used for the buffer clearing. However,
> it is entirely possible that the compiler may choose to optimize away the
> memory clearing especially if LTO is being used. To make sure that this
> optimization will not happen, memzero_explicit(), which is introduced
> in v3.18, is now used in kzfree() to do the clearing.
> 
> Fixes: 3ef0e5ba4673 ("slab: introduce kzfree()")
> Cc: stable@vger.kernel.org
> Signed-off-by: Waiman Long <longman@redhat.com>

Acked-by: Michal Hocko <mhocko@suse.com>

Although I am not really sure this is a stable material. Is there any
known instance where the memset was optimized out from kzfree?

> ---
>  mm/slab_common.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/slab_common.c b/mm/slab_common.c
> index 9e72ba224175..37d48a56431d 100644
> --- a/mm/slab_common.c
> +++ b/mm/slab_common.c
> @@ -1726,7 +1726,7 @@ void kzfree(const void *p)
>  	if (unlikely(ZERO_OR_NULL_PTR(mem)))
>  		return;
>  	ks = ksize(mem);
> -	memset(mem, 0, ks);
> +	memzero_explicit(mem, ks);
>  	kfree(mem);
>  }
>  EXPORT_SYMBOL(kzfree);
> -- 
> 2.18.1
> 

-- 
Michal Hocko
SUSE Labs

^ permalink raw reply

* [PATCH v2] tc: qdisc: filter qdisc's by parent/handle specification
From: Anton Danilov @ 2020-06-16  6:39 UTC (permalink / raw)
  To: netdev, stephen; +Cc: Anton Danilov

There wasn't a way to get a qdisc info by handle or parent, only full
dump of qdisc's with following grep/sed usage.

The 'qdisc get' command have been added.

tc qdisc { show | get } [ dev STRING ] [ QDISC_ID ] [ invisible ]
  QDISC_ID := { root | ingress | handle QHANDLE | parent CLASSID }

This change doesn't require any changes in the kernel.

Signed-off-by: Anton Danilov <littlesmilingcloud@gmail.com>
---

changes since v1:
  coding style fixes

---
 man/man8/tc.8 |   8 +++-
 tc/tc_qdisc.c | 111 +++++++++++++++++++++++++++++++++++---------------
 2 files changed, 84 insertions(+), 35 deletions(-)

diff --git a/man/man8/tc.8 b/man/man8/tc.8
index e8e0cd0f..8753088f 100644
--- a/man/man8/tc.8
+++ b/man/man8/tc.8
@@ -77,9 +77,13 @@ tc \- show / manipulate traffic control settings
 .B tc
 .RI "[ " OPTIONS " ]"
 .RI "[ " FORMAT " ]"
-.B qdisc show [ dev
+.B qdisc { show | get } [ dev
 \fIDEV\fR
-.B ]
+.B ] [ root | ingress | handle
+\fIQHANDLE\fR
+.B | parent
+\fICLASSID\fR
+.B ] [ invisible ]
 .P
 .B tc
 .RI "[ " OPTIONS " ]"
diff --git a/tc/tc_qdisc.c b/tc/tc_qdisc.c
index 181fe2f0..af2dd1c8 100644
--- a/tc/tc_qdisc.c
+++ b/tc/tc_qdisc.c
@@ -35,11 +35,12 @@ static int usage(void)
 		"       [ ingress_block BLOCK_INDEX ] [ egress_block BLOCK_INDEX ]\n"
 		"       [ [ QDISC_KIND ] [ help | OPTIONS ] ]\n"
 		"\n"
-		"       tc qdisc show [ dev STRING ] [ ingress | clsact ] [ invisible ]\n"
+		"       tc qdisc { show | get } [ dev STRING ] [ QDISC_ID ] [ invisible ]\n"
 		"Where:\n"
 		"QDISC_KIND := { [p|b]fifo | tbf | prio | cbq | red | etc. }\n"
 		"OPTIONS := ... try tc qdisc add <desired QDISC_KIND> help\n"
-		"STAB_OPTIONS := ... try tc qdisc add stab help\n");
+		"STAB_OPTIONS := ... try tc qdisc add stab help\n"
+		"QDISC_ID := { root | ingress | handle QHANDLE | parent CLASSID }\n");
 	return -1;
 }
 
@@ -212,6 +213,8 @@ static int tc_qdisc_modify(int cmd, unsigned int flags, int argc, char **argv)
 }
 
 static int filter_ifindex;
+static __u32 filter_parent;
+static __u32 filter_handle;
 
 int print_qdisc(struct nlmsghdr *n, void *arg)
 {
@@ -235,6 +238,12 @@ int print_qdisc(struct nlmsghdr *n, void *arg)
 	if (filter_ifindex && filter_ifindex != t->tcm_ifindex)
 		return 0;
 
+	if (filter_handle && filter_handle != t->tcm_handle)
+		return 0;
+
+	if (filter_parent && filter_parent != t->tcm_parent)
+		return 0;
+
 	parse_rtattr_flags(tb, TCA_MAX, TCA_RTA(t), len, NLA_F_NESTED);
 
 	if (tb[TCA_KIND] == NULL) {
@@ -344,21 +353,70 @@ int print_qdisc(struct nlmsghdr *n, void *arg)
 
 static int tc_qdisc_list(int argc, char **argv)
 {
-	struct tcmsg t = { .tcm_family = AF_UNSPEC };
+	struct {
+		struct nlmsghdr n;
+		struct tcmsg t;
+		char buf[256];
+	} req = {
+		.n.nlmsg_type = RTM_GETQDISC,
+		.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg)),
+		.t.tcm_family = AF_UNSPEC,
+	};
+
 	char d[IFNAMSIZ] = {};
+	bool arg_error = false;
 	bool dump_invisible = false;
+	__u32 handle;
 
-	while (argc > 0) {
+	while (argc > 0 && !arg_error) {
 		if (strcmp(*argv, "dev") == 0) {
 			NEXT_ARG();
 			strncpy(d, *argv, sizeof(d)-1);
+		} else if (strcmp(*argv, "root") == 0) {
+			if (filter_parent || filter_handle) {
+				fprintf(stderr,
+					"only one of parent/handle/root/ingress can be specified\n");
+				arg_error = true;
+				break;
+			}
+			filter_parent = TC_H_ROOT;
 		} else if (strcmp(*argv, "ingress") == 0 ||
 			   strcmp(*argv, "clsact") == 0) {
-			if (t.tcm_parent) {
-				fprintf(stderr, "Duplicate parent ID\n");
-				usage();
+			if (filter_parent || filter_handle) {
+				fprintf(stderr,
+				    "only one of parent/handle/root/ingress can be specified\n");
+				arg_error = true;
+				break;
 			}
-			t.tcm_parent = TC_H_INGRESS;
+			filter_parent = TC_H_INGRESS;
+		} else if (matches(*argv, "parent") == 0) {
+			if (filter_parent || filter_handle) {
+				fprintf(stderr,
+				    "only one of parent/handle/root/ingress can be specified\n");
+				arg_error = true;
+				break;
+			}
+			NEXT_ARG();
+			if (get_tc_classid(&handle, *argv)) {
+				invarg("invalid parent ID", *argv);
+				arg_error = true;
+				break;
+			}
+			filter_parent = handle;
+		} else if (matches(*argv, "handle") == 0) {
+			if (filter_parent || filter_handle) {
+				fprintf(stderr,
+				    "only one of parent/handle/root/ingress can be specified\n");
+				arg_error = true;
+				break;
+			}
+			NEXT_ARG();
+			if (get_qdisc_handle(&handle, *argv)) {
+				invarg("invalid handle ID", *argv);
+				arg_error = true;
+				break;
+			}
+			filter_handle = handle;
 		} else if (matches(*argv, "help") == 0) {
 			usage();
 		} else if (strcmp(*argv, "invisible") == 0) {
@@ -371,35 +429,26 @@ static int tc_qdisc_list(int argc, char **argv)
 		argc--; argv++;
 	}
 
+	if (arg_error) {
+		/* argument error message should be already displayed above */
+		return -1;
+	}
+
 	ll_init_map(&rth);
 
 	if (d[0]) {
-		t.tcm_ifindex = ll_name_to_index(d);
-		if (!t.tcm_ifindex)
+		req.t.tcm_ifindex = ll_name_to_index(d);
+		if (!req.t.tcm_ifindex)
 			return -nodev(d);
-		filter_ifindex = t.tcm_ifindex;
+		filter_ifindex = req.t.tcm_ifindex;
 	}
 
 	if (dump_invisible) {
-		struct {
-			struct nlmsghdr n;
-			struct tcmsg t;
-			char buf[256];
-		} req = {
-			.n.nlmsg_type = RTM_GETQDISC,
-			.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg)),
-		};
-
-		req.t.tcm_family = AF_UNSPEC;
-
 		addattr(&req.n, 256, TCA_DUMP_INVISIBLE);
-		if (rtnl_dump_request_n(&rth, &req.n) < 0) {
-			perror("Cannot send dump request");
-			return 1;
-		}
+	}
 
-	} else if (rtnl_dump_request(&rth, RTM_GETQDISC, &t, sizeof(t)) < 0) {
-		perror("Cannot send dump request");
+	if (rtnl_dump_request_n(&rth, &req.n) < 0) {
+		perror("Cannot send request");
 		return 1;
 	}
 
@@ -427,12 +476,8 @@ int do_qdisc(int argc, char **argv)
 		return tc_qdisc_modify(RTM_NEWQDISC, NLM_F_REPLACE, argc-1, argv+1);
 	if (matches(*argv, "delete") == 0)
 		return tc_qdisc_modify(RTM_DELQDISC, 0,  argc-1, argv+1);
-#if 0
-	if (matches(*argv, "get") == 0)
-		return tc_qdisc_get(RTM_GETQDISC, 0,  argc-1, argv+1);
-#endif
 	if (matches(*argv, "list") == 0 || matches(*argv, "show") == 0
-	    || matches(*argv, "lst") == 0)
+	    || matches(*argv, "lst") == 0 || matches(*argv, "get") == 0)
 		return tc_qdisc_list(argc-1, argv+1);
 	if (matches(*argv, "help") == 0) {
 		usage();
-- 
2.26.2


^ permalink raw reply related

* Re: [PATCH net v5 0/3] esp, ah: improve crypto algorithm selections
From: Steffen Klassert @ 2020-06-16  6:02 UTC (permalink / raw)
  To: Eric Biggers
  Cc: netdev, linux-crypto, Corentin Labbe, Greg Kroah-Hartman,
	Herbert Xu
In-Reply-To: <20200615221318.149558-1-ebiggers@kernel.org>

On Mon, Jun 15, 2020 at 03:13:15PM -0700, Eric Biggers wrote:
> This series consolidates and modernizes the lists of crypto algorithms
> that are selected by the IPsec kconfig options, and adds CRYPTO_SEQIV
> since it no longer gets selected automatically by other things.
> 
> See previous discussion at
> https://lkml.kernel.org/netdev/20200604192322.22142-1-ebiggers@kernel.org/T/#u
> 
> Changed v4 => v5:
>   - Rebased onto latest net/master to resolve conflict with
>     "treewide: replace '---help---' in Kconfig files with 'help'"

The target trees for IPsec patches is the ipsec and ipsec-next tree.
I have the v4 patchset already in the testing branch of the ipsec tree
and plan to merge it to master. This conflict has to be resolved
when the ipsec tree is merged into the net tree.


^ permalink raw reply

* Re: [PATCH v2 1/7] Bluetooth: Add definitions for advertisement monitor features
From: Miao-chen Chou @ 2020-06-16  5:59 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Bluetooth Kernel Mailing List, Alain Michaud,
	Luiz Augusto von Dentz, Manish Mandlik, Michael Sun, Yoni Shavit,
	David S. Miller, Jakub Kicinski, Johan Hedberg, LKML, netdev
In-Reply-To: <6E7BEC8E-D158-4990-A499-B38BE21FD80D@holtmann.org>

Hi Marcel,

https://patchwork.kernel.org/patch/11606491/ was uploaded for review.

Thanks,
Miao

On Fri, Jun 12, 2020 at 11:17 PM Marcel Holtmann <marcel@holtmann.org> wrote:
>
> Hi Miao-chen,
>
> > The name in the mgmt-api.txt doc is "Add Advertisement Patterns
> > Monitor Command", and Luiz changed the name from
> > MGMT_OP_ADD_ADV_PATTERNS_MONITOR to MGMT_OP_ADD_ADV_MONITOR before
> > applied. So we either change the doc or change the header file to
> > match. Based on the outcome I may need to change the name in mgmt.h in
> > the kernel patch.
>
> we change the mgmt.h to match the documentation.
>
> Regards
>
> Marcel
>

^ permalink raw reply

* [PATCH net] bareudp: Fixed configuration to avoid having garbage values
From: Martin Varghese @ 2020-06-16  5:48 UTC (permalink / raw)
  To: netdev, davem; +Cc: Martin

From: Martin <martin.varghese@nokia.com>

Code to initialize the conf structure while gathering the configuration
of the device was missing.

Fixes: 571912c69f0e ("net: UDP tunnel encapsulation module for tunnelling different protocols like MPLS, IP, NSH etc.")
Signed-off-by: Martin <martin.varghese@nokia.com>
---
 drivers/net/bareudp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/bareudp.c b/drivers/net/bareudp.c
index efd1a1d..5d3c691 100644
--- a/drivers/net/bareudp.c
+++ b/drivers/net/bareudp.c
@@ -552,6 +552,8 @@ static int bareudp_validate(struct nlattr *tb[], struct nlattr *data[],
 static int bareudp2info(struct nlattr *data[], struct bareudp_conf *conf,
 			struct netlink_ext_ack *extack)
 {
+	memset(conf, 0, sizeof(*conf));
+
 	if (!data[IFLA_BAREUDP_PORT]) {
 		NL_SET_ERR_MSG(extack, "port not specified");
 		return -EINVAL;
-- 
1.8.3.1


^ permalink raw reply related

* Re: [PATCH v4 02/11] fs: Move __scm_install_fd() to __fd_install_received()
From: Kees Cook @ 2020-06-16  5:48 UTC (permalink / raw)
  To: Sargun Dhillon
  Cc: linux-kernel, Christian Brauner, David S. Miller,
	Christoph Hellwig, Tycho Andersen, Jakub Kicinski, Alexander Viro,
	Aleksa Sarai, Matt Denton, Jann Horn, Chris Palmer, Robert Sesek,
	Giuseppe Scrivano, Greg Kroah-Hartman, Andy Lutomirski,
	Will Drewry, Shuah Khan, netdev, containers, linux-api,
	linux-fsdevel, linux-kselftest
In-Reply-To: <20200616052941.GB16032@ircssh-2.c.rugged-nimbus-611.internal>

On Tue, Jun 16, 2020 at 05:29:41AM +0000, Sargun Dhillon wrote:
> On Mon, Jun 15, 2020 at 08:25:15PM -0700, Kees Cook wrote:
> > +/**
> > + * __fd_install_received() - Install received file into file descriptor table
> > + *
> > + * @fd: fd to install into (if negative, a new fd will be allocated)
> > + * @file: struct file that was received from another process
> > + * @ufd_required: true to use @ufd for writing fd number to userspace
> > + * @ufd: __user pointer to write new fd number to
> > + * @o_flags: the O_* flags to apply to the new fd entry
> Probably doesn't matter, but this function doesn't take the fd, or ufd_required
> argument in this patch. 
> 
> > + *
> > + * Installs a received file into the file descriptor table, with appropriate
> > + * checks and count updates. Optionally writes the fd number to userspace.
> ufd does not apppear options here.

Argh, yes, thanks. I think this was a fixup targeting the wrong commit.
I will adjust.

-- 
Kees Cook

^ permalink raw reply

* Re: [PATCH v4 02/11] fs: Move __scm_install_fd() to __fd_install_received()
From: Sargun Dhillon @ 2020-06-16  5:29 UTC (permalink / raw)
  To: Kees Cook
  Cc: linux-kernel, Christian Brauner, David S. Miller,
	Christoph Hellwig, Tycho Andersen, Jakub Kicinski, Alexander Viro,
	Aleksa Sarai, Matt Denton, Jann Horn, Chris Palmer, Robert Sesek,
	Giuseppe Scrivano, Greg Kroah-Hartman, Andy Lutomirski,
	Will Drewry, Shuah Khan, netdev, containers, linux-api,
	linux-fsdevel, linux-kselftest
In-Reply-To: <20200616032524.460144-3-keescook@chromium.org>

On Mon, Jun 15, 2020 at 08:25:15PM -0700, Kees Cook wrote:
> In preparation for users of the "install a received file" logic outside
> of net/ (pidfd and seccomp), relocate and rename __scm_install_fd() from
> net/core/scm.c to __fd_install_received() in fs/file.c, and provide a
> wrapper named fd_install_received_user(), as future patches will change
> the interface to __fd_install_received().
> 
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  fs/file.c            | 47 ++++++++++++++++++++++++++++++++++++++++++++
>  include/linux/file.h |  8 ++++++++
>  include/net/scm.h    |  1 -
>  net/compat.c         |  2 +-
>  net/core/scm.c       | 32 +-----------------------------
>  5 files changed, 57 insertions(+), 33 deletions(-)
> 
> diff --git a/fs/file.c b/fs/file.c
> index abb8b7081d7a..fcfddae0d252 100644
> --- a/fs/file.c
> +++ b/fs/file.c
> @@ -11,6 +11,7 @@
>  #include <linux/export.h>
>  #include <linux/fs.h>
>  #include <linux/mm.h>
> +#include <linux/net.h>
>  #include <linux/sched/signal.h>
>  #include <linux/slab.h>
>  #include <linux/file.h>
> @@ -18,6 +19,8 @@
>  #include <linux/bitops.h>
>  #include <linux/spinlock.h>
>  #include <linux/rcupdate.h>
> +#include <net/cls_cgroup.h>
> +#include <net/netprio_cgroup.h>
>  
>  unsigned int sysctl_nr_open __read_mostly = 1024*1024;
>  unsigned int sysctl_nr_open_min = BITS_PER_LONG;
> @@ -931,6 +934,50 @@ int replace_fd(unsigned fd, struct file *file, unsigned flags)
>  	return err;
>  }
>  
> +/**
> + * __fd_install_received() - Install received file into file descriptor table
> + *
> + * @fd: fd to install into (if negative, a new fd will be allocated)
> + * @file: struct file that was received from another process
> + * @ufd_required: true to use @ufd for writing fd number to userspace
> + * @ufd: __user pointer to write new fd number to
> + * @o_flags: the O_* flags to apply to the new fd entry
Probably doesn't matter, but this function doesn't take the fd, or ufd_required
argument in this patch. 

> + *
> + * Installs a received file into the file descriptor table, with appropriate
> + * checks and count updates. Optionally writes the fd number to userspace.
ufd does not apppear options here.

> + *
> + * Returns -ve on error.
> + */
> +int __fd_install_received(struct file *file, int __user *ufd, unsigned int o_flags)
> +{
> +	struct socket *sock;
> +	int new_fd;
> +	int error;
> +
> +	error = security_file_receive(file);
> +	if (error)
> +		return error;
> +
> +	new_fd = get_unused_fd_flags(o_flags);
> +	if (new_fd < 0)
> +		return new_fd;
> +
> +	error = put_user(new_fd, ufd);
> +	if (error) {
> +		put_unused_fd(new_fd);
> +		return error;
> +	}
> +
> +	/* Bump the usage count and install the file. */
> +	sock = sock_from_file(file, &error);
> +	if (sock) {
> +		sock_update_netprioidx(&sock->sk->sk_cgrp_data);
> +		sock_update_classid(&sock->sk->sk_cgrp_data);
> +	}
> +	fd_install(new_fd, get_file(file));
> +	return 0;
> +}
> +
>  static int ksys_dup3(unsigned int oldfd, unsigned int newfd, int flags)
>  {
>  	int err = -EBADF;
> diff --git a/include/linux/file.h b/include/linux/file.h
> index 122f80084a3e..fe18a1a0d555 100644
> --- a/include/linux/file.h
> +++ b/include/linux/file.h
> @@ -91,6 +91,14 @@ extern void put_unused_fd(unsigned int fd);
>  
>  extern void fd_install(unsigned int fd, struct file *file);
>  
> +extern int __fd_install_received(struct file *file, int __user *ufd,
> +				 unsigned int o_flags);
> +static inline int fd_install_received_user(struct file *file, int __user *ufd,
> +					   unsigned int o_flags)
> +{
> +	return __fd_install_received(file, ufd, o_flags);
> +}
> +
>  extern void flush_delayed_fput(void);
>  extern void __fput_sync(struct file *);
>  
> diff --git a/include/net/scm.h b/include/net/scm.h
> index 581a94d6c613..1ce365f4c256 100644
> --- a/include/net/scm.h
> +++ b/include/net/scm.h
> @@ -37,7 +37,6 @@ struct scm_cookie {
>  #endif
>  };
>  
> -int __scm_install_fd(struct file *file, int __user *ufd, unsigned int o_flags);
>  void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm);
>  void scm_detach_fds_compat(struct msghdr *msg, struct scm_cookie *scm);
>  int __scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm);
> diff --git a/net/compat.c b/net/compat.c
> index 27d477fdcaa0..94f288e8dac5 100644
> --- a/net/compat.c
> +++ b/net/compat.c
> @@ -298,7 +298,7 @@ void scm_detach_fds_compat(struct msghdr *msg, struct scm_cookie *scm)
>  	int err = 0, i;
>  
>  	for (i = 0; i < fdmax; i++) {
> -		err = __scm_install_fd(scm->fp->fp[i], cmsg_data + i, o_flags);
> +		err = fd_install_received_user(scm->fp->fp[i], cmsg_data + i, o_flags);
>  		if (err)
>  			break;
>  	}
> diff --git a/net/core/scm.c b/net/core/scm.c
> index 6151678c73ed..df190f1fdd28 100644
> --- a/net/core/scm.c
> +++ b/net/core/scm.c
> @@ -280,36 +280,6 @@ void put_cmsg_scm_timestamping(struct msghdr *msg, struct scm_timestamping_inter
>  }
>  EXPORT_SYMBOL(put_cmsg_scm_timestamping);
>  
> -int __scm_install_fd(struct file *file, int __user *ufd, unsigned int o_flags)
> -{
> -	struct socket *sock;
> -	int new_fd;
> -	int error;
> -
> -	error = security_file_receive(file);
> -	if (error)
> -		return error;
> -
> -	new_fd = get_unused_fd_flags(o_flags);
> -	if (new_fd < 0)
> -		return new_fd;
> -
> -	error = put_user(new_fd, ufd);
> -	if (error) {
> -		put_unused_fd(new_fd);
> -		return error;
> -	}
> -
> -	/* Bump the usage count and install the file. */
> -	sock = sock_from_file(file, &error);
> -	if (sock) {
> -		sock_update_netprioidx(&sock->sk->sk_cgrp_data);
> -		sock_update_classid(&sock->sk->sk_cgrp_data);
> -	}
> -	fd_install(new_fd, get_file(file));
> -	return 0;
> -}
> -
>  static int scm_max_fds(struct msghdr *msg)
>  {
>  	if (msg->msg_controllen <= sizeof(struct cmsghdr))
> @@ -336,7 +306,7 @@ void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm)
>  	}
>  
>  	for (i = 0; i < fdmax; i++) {
> -		err = __scm_install_fd(scm->fp->fp[i], cmsg_data + i, o_flags);
> +		err = fd_install_received_user(scm->fp->fp[i], cmsg_data + i, o_flags);
>  		if (err)
>  			break;
>  	}
> -- 
> 2.25.1
> 

^ permalink raw reply

* [PATCH bpf 1/2] bpf: bpf_probe_read_kernel_str() has to return amount of data read on success
From: Andrii Nakryiko @ 2020-06-16  5:04 UTC (permalink / raw)
  To: bpf, netdev, ast, daniel
  Cc: andrii.nakryiko, kernel-team, Andrii Nakryiko, Christoph Hellwig

During recent refactorings, bpf_probe_read_kernel_str() started returning 0 on
success, instead of amount of data successfully read. This majorly breaks
applications relying on bpf_probe_read_kernel_str() and bpf_probe_read_str()
and their results. Fix this by returning actual number of bytes read.

Cc: Christoph Hellwig <hch@lst.de>
Fixes: 8d92db5c04d1 ("bpf: rework the compat kernel probe handling")
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
---
 kernel/trace/bpf_trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index e729c9e587a0..a3ac7de98baa 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -241,7 +241,7 @@ bpf_probe_read_kernel_str_common(void *dst, u32 size, const void *unsafe_ptr)
 	if (unlikely(ret < 0))
 		goto fail;
 
-	return 0;
+	return ret;
 fail:
 	memset(dst, 0, size);
 	return ret;
-- 
2.24.1


^ permalink raw reply related

* [PATCH bpf 2/2] selftests/bpf: add variable-length data concatenation pattern test
From: Andrii Nakryiko @ 2020-06-16  5:04 UTC (permalink / raw)
  To: bpf, netdev, ast, daniel
  Cc: andrii.nakryiko, kernel-team, Andrii Nakryiko, Christoph Hellwig
In-Reply-To: <20200616050432.1902042-1-andriin@fb.com>

Add selftest that validates variable-length data reading and concatentation
with one big shared data array. This is a common pattern in production use for
monitoring and tracing applications, that potentially can read a lot of data,
but usually reads much less. Such pattern allows to determine precisely what
amount of data needs to be sent over perfbuf/ringbuf and maximize efficiency.

This is the first BPF selftest that at all looks at and tests
bpf_probe_read_str()-like helper's return value, closing a major gap in BPF
testing. It surfaced the problem with bpf_probe_read_kernel_str() returning
0 on success, instead of amount of bytes successfully read.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
---
 .../testing/selftests/bpf/prog_tests/varlen.c | 56 +++++++++++
 .../testing/selftests/bpf/progs/test_varlen.c | 96 +++++++++++++++++++
 2 files changed, 152 insertions(+)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/varlen.c
 create mode 100644 tools/testing/selftests/bpf/progs/test_varlen.c

diff --git a/tools/testing/selftests/bpf/prog_tests/varlen.c b/tools/testing/selftests/bpf/prog_tests/varlen.c
new file mode 100644
index 000000000000..e498e2b90da1
--- /dev/null
+++ b/tools/testing/selftests/bpf/prog_tests/varlen.c
@@ -0,0 +1,56 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright (c) 2020 Facebook */
+
+#include <test_progs.h>
+#include <time.h>
+#include "test_varlen.skel.h"
+
+#define CHECK_VAL(got, exp) \
+	CHECK((got) != (exp), "check", "got %ld != exp %ld\n", \
+	      (long)(got), (long)(exp))
+
+void test_varlen(void)
+{
+	int duration = 0, err;
+	struct test_varlen* skel;
+	struct test_varlen__bss *bss;
+	struct test_varlen__data *data;
+	const char str1[] = "Hello, ";
+	const char str2[] = "World!";
+	const char exp_str[] = "Hello, \0World!\0";
+	const int size1 = sizeof(str1);
+	const int size2 = sizeof(str2);
+
+	skel = test_varlen__open_and_load();
+	if (CHECK(!skel, "skel_open", "failed to open skeleton\n"))
+		return;
+	bss = skel->bss;
+	data = skel->data;
+
+	err = test_varlen__attach(skel);
+	if (CHECK(err, "skel_attach", "skeleton attach failed: %d\n", err))
+		goto cleanup;
+
+	bss->test_pid = getpid();
+
+	/* trigger everything */
+	memcpy(bss->buf_in1, str1, size1);
+	memcpy(bss->buf_in2, str2, size2);
+	bss->capture = true;
+	usleep(1);
+	bss->capture = false;
+
+	CHECK_VAL(bss->payload1_len1, size1);
+	CHECK_VAL(bss->payload1_len2, size2);
+	CHECK_VAL(bss->total1, size1 + size2);
+	CHECK(memcmp(bss->payload1, exp_str, size1 + size2), "content_check",
+	      "doesn't match!");
+			
+	CHECK_VAL(data->payload2_len1, size1);
+	CHECK_VAL(data->payload2_len2, size2);
+	CHECK_VAL(data->total2, size1 + size2);
+	CHECK(memcmp(data->payload2, exp_str, size1 + size2), "content_check",
+	      "doesn't match!");
+cleanup:
+	test_varlen__destroy(skel);
+}
diff --git a/tools/testing/selftests/bpf/progs/test_varlen.c b/tools/testing/selftests/bpf/progs/test_varlen.c
new file mode 100644
index 000000000000..09691852debf
--- /dev/null
+++ b/tools/testing/selftests/bpf/progs/test_varlen.c
@@ -0,0 +1,96 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright (c) 2020 Facebook */
+
+#include "vmlinux.h"
+#include <bpf/bpf_helpers.h>
+#include <bpf/bpf_tracing.h>
+#include <bpf/bpf_core_read.h>
+
+#define MAX_LEN 256
+
+char buf_in1[MAX_LEN] = {};
+char buf_in2[MAX_LEN] = {};
+
+int test_pid = 0;
+bool capture = false;
+
+/* .bss */
+long payload1_len1 = 0;
+long payload1_len2 = 0;
+long total1 = 0;
+char payload1[MAX_LEN + MAX_LEN] = {};
+
+/* .data */
+int payload2_len1 = -1;
+int payload2_len2 = -1;
+int total2 = -1;
+char payload2[MAX_LEN + MAX_LEN] = { 1 };
+
+SEC("raw_tp/sys_enter")
+int handler64(void *regs)
+{
+	int pid = bpf_get_current_pid_tgid() >> 32;
+	void *payload = payload1;
+	u64 len;
+
+	/* ignore irrelevant invocations */
+	if (test_pid != pid || !capture)
+		return 0;
+
+	len = bpf_probe_read_kernel_str(payload, MAX_LEN, &buf_in1[0]);
+	if (len <= MAX_LEN) {
+		payload += len;
+		payload1_len1 = len;
+	}
+
+	len = bpf_probe_read_kernel_str(payload, MAX_LEN, &buf_in2[0]);
+	if (len <= MAX_LEN) {
+		payload += len;
+		payload1_len2 = len;
+	}
+
+	total1 = payload - (void *)payload1;
+
+	return 0;
+}
+
+SEC("tp_btf/sys_enter")
+int handler32(void *regs)
+{
+	int pid = bpf_get_current_pid_tgid() >> 32;
+	void *payload = payload2;
+	u32 len;
+
+	/* ignore irrelevant invocations */
+	if (test_pid != pid || !capture)
+		return 0;
+
+	len = bpf_probe_read_kernel_str(payload, MAX_LEN, &buf_in1[0]);
+	if (len <= MAX_LEN) {
+		payload += len;
+		payload2_len1 = len;
+	}
+
+	len = bpf_probe_read_kernel_str(payload, MAX_LEN, &buf_in2[0]);
+	if (len <= MAX_LEN) {
+		payload += len;
+		payload2_len2 = len;
+	}
+
+	total2 = payload - (void *)payload2;
+
+	return 0;
+}
+
+SEC("tp_btf/sys_exit")
+int handler_exit(void *regs)
+{
+	long bla;
+
+	if (bpf_probe_read_kernel(&bla, sizeof(bla), 0))
+		return 1;
+	else
+		return 0;
+}
+
+char LICENSE[] SEC("license") = "GPL";
-- 
2.24.1


^ permalink raw reply related

* Re: [PATCH 1/5] Huawei BMA: Adding Huawei BMA driver: host_edma_drv
From: kernel test robot @ 2020-06-16  4:56 UTC (permalink / raw)
  To: yunaixin03610, netdev; +Cc: kbuild-all, yunaixin
In-Reply-To: <20200615145906.1013-2-yunaixin03610@163.com>

[-- Attachment #1: Type: text/plain, Size: 13079 bytes --]

Hi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.8-rc1 next-20200615]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/yunaixin03610-163-com/Adding-Huawei-BMA-drivers/20200616-102318
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git a5dc8300df75e8b8384b4c82225f1e4a0b4d9b55
config: i386-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
reproduce (this is a W=1 build):
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>, old ones prefixed by <<):

In file included from drivers/net/ethernet/huawei/bma/edma_drv/bma_devintf.h:21,
from drivers/net/ethernet/huawei/bma/edma_drv/bma_pci.c:21:
>> drivers/net/ethernet/huawei/bma/edma_drv/edma_host.h:246:2: error: unknown type name '__kernel_time_t'
246 |  __kernel_time_t init_time;
|  ^~~~~~~~~~~~~~~
>> drivers/net/ethernet/huawei/bma/edma_drv/bma_pci.c:67:5: warning: no previous prototype for 'edma_param_get_statics' [-Wmissing-prototypes]
67 | int edma_param_get_statics(char *buf, const struct kernel_param *kp)
|     ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/huawei/bma/edma_drv/bma_pci.c:142:5: warning: no previous prototype for '__atu_config_H' [-Wmissing-prototypes]
142 | s32 __atu_config_H(struct pci_dev *pdev, unsigned int region,
|     ^~~~~~~~~~~~~~
In file included from drivers/net/ethernet/huawei/bma/edma_drv/bma_devintf.h:20,
from drivers/net/ethernet/huawei/bma/edma_drv/bma_pci.c:21:
drivers/net/ethernet/huawei/bma/edma_drv/bma_pci.c: In function 'ioremap_pme_bar1_mem':
>> drivers/net/ethernet/huawei/bma/edma_drv/bma_pci.h:80:17: error: implicit declaration of function 'ioremap_nocache'; did you mean 'ioremap_cache'? [-Werror=implicit-function-declaration]
80 | #define IOREMAP ioremap_nocache
|                 ^~~~~~~~~~~~~~~
>> drivers/net/ethernet/huawei/bma/edma_drv/bma_pci.c:246:7: note: in expansion of macro 'IOREMAP'
246 |       IOREMAP(bma_pci_dev->bma_base_phy_addr,
|       ^~~~~~~
>> drivers/net/ethernet/huawei/bma/edma_drv/bma_pci.c:245:30: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
245 |   bma_pci_dev->bma_base_addr =
|                              ^
drivers/net/ethernet/huawei/bma/edma_drv/bma_pci.c: In function 'ioremap_bar_mem':
drivers/net/ethernet/huawei/bma/edma_drv/bma_pci.c:310:31: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
310 |   bma_pci_dev->kbox_base_addr =
|                               ^
drivers/net/ethernet/huawei/bma/edma_drv/bma_pci.c: At top level:
>> drivers/net/ethernet/huawei/bma/edma_drv/bma_pci.c:328:5: warning: no previous prototype for 'pme_pci_enable_msi' [-Wmissing-prototypes]
328 | int pme_pci_enable_msi(struct pci_dev *pdev)
|     ^~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/huawei/bma/edma_drv/bma_pci.c:354:5: warning: no previous prototype for 'pci_device_init' [-Wmissing-prototypes]
354 | int pci_device_init(struct pci_dev *pdev, struct bma_pci_dev_s *bma_pci_dev)
|     ^~~~~~~~~~~~~~~
>> drivers/net/ethernet/huawei/bma/edma_drv/bma_pci.c:383:5: warning: no previous prototype for 'pci_device_config' [-Wmissing-prototypes]
383 | int pci_device_config(struct pci_dev *pdev)
|     ^~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/huawei/bma/edma_drv/bma_pci.c:505:12: warning: no previous prototype for 'bma_pci_init' [-Wmissing-prototypes]
505 | int __init bma_pci_init(void)
|            ^~~~~~~~~~~~
>> drivers/net/ethernet/huawei/bma/edma_drv/bma_pci.c:518:13: warning: no previous prototype for 'bma_pci_cleanup' [-Wmissing-prototypes]
518 | void __exit bma_pci_cleanup(void)
|             ^~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
In file included from drivers/net/ethernet/huawei/bma/edma_drv/bma_devintf.h:21,
from drivers/net/ethernet/huawei/bma/edma_drv/bma_devintf.c:26:
>> drivers/net/ethernet/huawei/bma/edma_drv/edma_host.h:246:2: error: unknown type name '__kernel_time_t'
246 |  __kernel_time_t init_time;
|  ^~~~~~~~~~~~~~~
In file included from drivers/net/ethernet/huawei/bma/edma_drv/bma_devintf.h:20,
from drivers/net/ethernet/huawei/bma/edma_drv/bma_devintf.c:26:
drivers/net/ethernet/huawei/bma/edma_drv/bma_devintf.c: In function 'bma_cdev_add_msg':
>> drivers/net/ethernet/huawei/bma/edma_drv/bma_pci.h:88:20: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
88 |    netdev_alert(0, "edma: %s, %d, " fmt,          |                    ^~~~~~~~~~~~~~~~
>> drivers/net/ethernet/huawei/bma/edma_drv/bma_devintf.c:500:3: note: in expansion of macro 'BMA_LOG'
500 |   BMA_LOG(DLOG_DEBUG, "msg_len is %ldn", msg_len);
|   ^~~~~~~
drivers/net/ethernet/huawei/bma/edma_drv/bma_devintf.c:500:37: note: format string is defined here
500 |   BMA_LOG(DLOG_DEBUG, "msg_len is %ldn", msg_len);
|                                   ~~^
|                                     |
|                                     long int
|                                   %d
--
In file included from drivers/net/ethernet/huawei/bma/edma_drv/bma_devintf.h:21,
from drivers/net/ethernet/huawei/bma/edma_drv/bma_pci.h:19,
from drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c:22:
>> drivers/net/ethernet/huawei/bma/edma_drv/edma_host.h:246:2: error: unknown type name '__kernel_time_t'
246 |  __kernel_time_t init_time;
|  ^~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c: In function 'edmainfo_show':
>> drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c:35:2: error: unknown type name '__kernel_time_t'; did you mean '__kernel_timer_t'?
35 |  __kernel_time_t running_time = 0;
|  ^~~~~~~~~~~~~~~
|  __kernel_timer_t
In file included from drivers/net/ethernet/huawei/bma/edma_drv/edma_host.h:19,
from drivers/net/ethernet/huawei/bma/edma_drv/bma_devintf.h:21,
from drivers/net/ethernet/huawei/bma/edma_drv/bma_pci.h:19,
from drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c:22:
>> drivers/net/ethernet/huawei/bma/edma_drv/bma_include.h:109:19: error: storage size of 'uptime' isn't known
109 |   struct timespec uptime;         |                   ^~~~~~
>> drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c:49:2: note: in expansion of macro 'GET_SYS_SECONDS'
49 |  GET_SYS_SECONDS(running_time);
|  ^~~~~~~~~~~~~~~
>> drivers/net/ethernet/huawei/bma/edma_drv/bma_include.h:110:3: error: implicit declaration of function 'get_monotonic_boottime' [-Werror=implicit-function-declaration]
110 |   get_monotonic_boottime(&uptime);         |   ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c:49:2: note: in expansion of macro 'GET_SYS_SECONDS'
49 |  GET_SYS_SECONDS(running_time);
|  ^~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/edma_drv/bma_include.h:109:19: warning: unused variable 'uptime' [-Wunused-variable]
109 |   struct timespec uptime;         |                   ^~~~~~
>> drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c:49:2: note: in expansion of macro 'GET_SYS_SECONDS'
49 |  GET_SYS_SECONDS(running_time);
|  ^~~~~~~~~~~~~~~
>> drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c:55:45: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'int' [-Wformat=]
55 |  len += sprintf(buf + len, "running_time :%luD %02lu:%02lu:%02lun",
|                                           ~~^
|                                             |
|                                             long unsigned int
|                                           %u
drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c:55:52: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'int' [-Wformat=]
55 |  len += sprintf(buf + len, "running_time :%luD %02lu:%02lu:%02lun",
|                                                ~~~~^
|                                                    |
|                                                    long unsigned int
|                                                %02u
drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c:55:58: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'int' [-Wformat=]
55 |  len += sprintf(buf + len, "running_time :%luD %02lu:%02lu:%02lun",
|                                                      ~~~~^
|                                                          |
|                                                          long unsigned int
|                                                      %02u
drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c:55:64: warning: format '%lu' expects argument of type 'long unsigned int', but argument 6 has type 'int' [-Wformat=]
55 |  len += sprintf(buf + len, "running_time :%luD %02lu:%02lu:%02lun",
|                                                            ~~~~^
|                                                                |
|                                                                long unsigned int
|                                                            %02u
drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c: At top level:
>> drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c:581:6: warning: no previous prototype for 'host_dma_transfer_without_list' [-Wmissing-prototypes]
581 | void host_dma_transfer_without_list(struct edma_host_s *edma_host,
|      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c:608:6: warning: no previous prototype for 'host_dma_transfer_withlist' [-Wmissing-prototypes]
608 | void host_dma_transfer_withlist(struct edma_host_s *edma_host,
|      ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c:22:
drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c: In function 'edma_host_send_msg':
>> drivers/net/ethernet/huawei/bma/edma_drv/bma_pci.h:88:20: warning: format '%lu' expects argument of type 'long unsigned int', but argument 6 has type 'unsigned int' [-Wformat=]
88 |    netdev_alert(0, "edma: %s, %d, " fmt,          |                    ^~~~~~~~~~~~~~~~
>> drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c:791:3: note: in expansion of macro 'BMA_LOG'
791 |   BMA_LOG(DLOG_ERROR,
|   ^~~~~~~
drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c:792:48: note: format string is defined here
792 |    "Length of send message %u is larger than %lun",
|                                              ~~^
|                                                |
|                                                long unsigned int
|                                              %u
In file included from drivers/net/ethernet/huawei/bma/edma_drv/edma_host.h:19,
from drivers/net/ethernet/huawei/bma/edma_drv/bma_devintf.h:21,
from drivers/net/ethernet/huawei/bma/edma_drv/bma_pci.h:19,
from drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c:22:
drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c: In function 'edma_host_init':
>> drivers/net/ethernet/huawei/bma/edma_drv/bma_include.h:109:19: error: storage size of 'uptime' isn't known
109 |   struct timespec uptime;         |                   ^~~~~~
drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c:1410:2: note: in expansion of macro 'GET_SYS_SECONDS'
1410 |  GET_SYS_SECONDS(edma_host->statistics.init_time);
|  ^~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/edma_drv/bma_include.h:109:19: warning: unused variable 'uptime' [-Wunused-variable]
109 |   struct timespec uptime;         |                   ^~~~~~
drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c:1410:2: note: in expansion of macro 'GET_SYS_SECONDS'
1410 |  GET_SYS_SECONDS(edma_host->statistics.init_time);
|  ^~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c: In function 'edma_host_cleanup':
>> drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c:1434:20: warning: variable 'bma_dev' set but not used [-Wunused-but-set-variable]
1434 |  struct bma_dev_s *bma_dev = NULL;
|                    ^~~~~~~
cc1: some warnings being treated as errors

vim +/__kernel_time_t +246 drivers/net/ethernet/huawei/bma/edma_drv/edma_host.h

   243	
   244	struct edma_statistics_s {
   245		unsigned int remote_status;
 > 246		__kernel_time_t init_time;
   247		unsigned int h2b_int;
   248		unsigned int b2h_int;
   249		unsigned int recv_bytes;
   250		unsigned int send_bytes;
   251		unsigned int send_pkgs;
   252		unsigned int recv_pkgs;
   253		unsigned int failed_count;
   254		unsigned int drop_pkgs;
   255		unsigned int dma_count;
   256		unsigned int lost_count;
   257	};
   258	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 73467 bytes --]

^ permalink raw reply

* [PATCH 1/1 v2] mvpp2: remove module bugfix
From: Sven Auhagen @ 2020-06-16  4:35 UTC (permalink / raw)
  To: netdev
  Cc: antoine.tenart, gregory.clement, maxime.chevallier,
	thomas.petazzoni, miquel.raynal, mw, lorenzo, technoboy85

The remove function does not destroy all
BM Pools when per cpu pool is active.

When reloading the mvpp2 as a module the BM Pools
are still active in hardware and due to the bug
have twice the size now old + new.

This eventually leads to a kernel crash.

v2:
* add Fixes tag

Fixes: 7d04b0b13b11 ("mvpp2: percpu buffers")
Signed-off-by: Sven Auhagen <sven.auhagen@voleatech.de>
---
 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 2b5dad2ec650..9d08312c1c47 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -5984,7 +5984,7 @@ static int mvpp2_remove(struct platform_device *pdev)
 	struct mvpp2 *priv = platform_get_drvdata(pdev);
 	struct fwnode_handle *fwnode = pdev->dev.fwnode;
 	struct fwnode_handle *port_fwnode;
-	int i = 0;
+	int i = 0, poolnum = MVPP2_BM_POOLS_NUM;
 
 	mvpp2_dbgfs_cleanup(priv);
 
@@ -5998,7 +5998,10 @@ static int mvpp2_remove(struct platform_device *pdev)
 
 	destroy_workqueue(priv->stats_queue);
 
-	for (i = 0; i < MVPP2_BM_POOLS_NUM; i++) {
+	if (priv->percpu_pools)
+		poolnum = mvpp2_get_nrxqs(priv) * 2;
+
+	for (i = 0; i < poolnum; i++) {
 		struct mvpp2_bm_pool *bm_pool = &priv->bm_pools[i];
 
 		mvpp2_bm_pool_destroy(&pdev->dev, priv, bm_pool);
-- 
2.20.1


^ permalink raw reply related

* Re: [PATCH 00/17] spelling.txt: /decriptors/descriptors/
From: Martin K. Petersen @ 2020-06-16  3:59 UTC (permalink / raw)
  To: Kieran Bingham, Kieran Bingham
  Cc: Martin K . Petersen, netdev, linux-input, linux-renesas-soc,
	linux-mm, linux-rdma, linuxppc-dev, linux-scsi, virtualization,
	linux-pm, linux-arm-kernel, linux-kernel, linux-mtd,
	linux-wireless, dri-devel, linux-usb, linux-gpio, ath10k
In-Reply-To: <20200609124610.3445662-1-kieran.bingham+renesas@ideasonboard.com>

On Tue, 9 Jun 2020 13:45:53 +0100, Kieran Bingham wrote:

> I wouldn't normally go through spelling fixes, but I caught sight of
> this typo twice, and then foolishly grepped the tree for it, and saw how
> pervasive it was.
> 
> so here I am ... fixing a typo globally... but with an addition in
> scripts/spelling.txt so it shouldn't re-appear ;-)
> 
> [...]

Applied to 5.9/scsi-queue, thanks!

[06/17] scsi: Fix trivial spelling
        https://git.kernel.org/mkp/scsi/c/0a19a725c0ed

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox