Skip to contentSkip to conversation

raw/ifpga: fix fd leak in rte fpga do pr

PATCH Superseded Andy Pei 3 participants 10 messages Apr 17, 2019 – Apr 24, 2019

lore
Share & tools
lore

Andy Pei

author
#0 lore raw

PATCH 1/1 raw/ifpga: fix fd leak in rte fpga do pr

In rte_fpga_do_pr() function, if 'stat' returns error, rte_fpga_do_pr() returns -EINVAL without closing the 'file_fd' that has been opened.
After this patch, 'file_fd' is closed before rte_fpga_do_pr() returns -EINVAL when 'stat' returns error

Fixes ef1e8ede3da5 ("raw/ifpga: add Intel FPGA bus rawdev driver")

---

---
 drivers/raw/ifpga_rawdev/ifpga_rawdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +2 -1
index da772d0..eff001b 100644
@@ -244,7 +244,8 @@
 	if (ret) {
 		IFPGA_RAWDEV_PMD_ERR("stat on bitstream file failed: %s\n",
 				file_name);
-		return -EINVAL;
+		ret = -EINVAL;
+		goto close_fd;
 	}
 	buffer_size = file_stat.st_size;
 	IFPGA_RAWDEV_PMD_INFO("bitstream file size: %zu\n", buffer_size);
Signature · 1 line
1.8.3.1
#1 lore raw

Hi,

Quoted 8 lines

-----Original Message-----
From: Pei, Andy
Sent: Wednesday, April 17, 2019 14:49
To: [email protected]
Cc: Pei, Andy <[email protected]>; Xu, Rosen <[email protected]>; Kovacevic, Marko <[email protected]>; [email protected]; [email protected]
Subject: [PATCH] raw/ifpga: fix fd leak in rte fpga do pr

Pls use raw/ifpga_rawdev prefix.
I suggest you to run ./devtools/check-git-log.sh -1 before you sending patch.

Quoted 5 lines

In rte_fpga_do_pr() function, if 'stat' returns error, rte_fpga_do_pr() returns -EINVAL without closing the 'file_fd' that has been opened.
After this patch, 'file_fd' is closed before rte_fpga_do_pr() returns -EINVAL when 'stat' returns error

Pls put this in the commit message:
Coverity issue: 279441

Quoted 31 lines
Fixes ef1e8ede3da5 ("raw/ifpga: add Intel FPGA bus rawdev driver")

---

---
 drivers/raw/ifpga_rawdev/ifpga_rawdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +2 -1
index da772d0..eff001b 100644
@@ -244,7 +244,8 @@
 	if (ret) {
 		IFPGA_RAWDEV_PMD_ERR("stat on bitstream file
 failed: %s\n",
 				file_name);
-		return -EINVAL;
+		ret = -EINVAL;
+		goto close_fd;
 	}
 	buffer_size = file_stat.st_size;

IFPGA_RAWDEV_PMD_INFO("bitstream file size: %zu\n", buffer_size);
--
1.8.3.1

author
#2 lore raw

Okay

-----Original Message-----
From: Xu, Rosen
Sent: Wednesday, April 17, 2019 3:14 PM
To: Pei, Andy <[email protected]>; [email protected]
Cc: Kovacevic, Marko <[email protected]>; [email protected]; [email protected]
Subject: RE: [PATCH] raw/ifpga: fix fd leak in rte fpga do pr

Hi,

Quoted 8 lines

-----Original Message-----
From: Pei, Andy
Sent: Wednesday, April 17, 2019 14:49
To: [email protected]
Cc: Pei, Andy <[email protected]>; Xu, Rosen <[email protected]>; Kovacevic, Marko <[email protected]>; [email protected]; [email protected]
Subject: [PATCH] raw/ifpga: fix fd leak in rte fpga do pr

Pls use raw/ifpga_rawdev prefix.
I suggest you to run ./devtools/check-git-log.sh -1 before you sending patch.

Quoted 5 lines

In rte_fpga_do_pr() function, if 'stat' returns error, rte_fpga_do_pr() returns -EINVAL without closing the 'file_fd' that has been opened.
After this patch, 'file_fd' is closed before rte_fpga_do_pr() returns -EINVAL when 'stat' returns error

Pls put this in the commit message:
Coverity issue: 279441

Quoted 31 lines
Fixes ef1e8ede3da5 ("raw/ifpga: add Intel FPGA bus rawdev driver")

---

---
 drivers/raw/ifpga_rawdev/ifpga_rawdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +2 -1
index da772d0..eff001b 100644
@@ -244,7 +244,8 @@
 	if (ret) {
 		IFPGA_RAWDEV_PMD_ERR("stat on bitstream file
 failed: %s\n",
 				file_name);
-		return -EINVAL;
+		ret = -EINVAL;
+		goto close_fd;
 	}
 	buffer_size = file_stat.st_size;

IFPGA_RAWDEV_PMD_INFO("bitstream file size: %zu\n", buffer_size);
--
1.8.3.1

author
#3 lore raw

PATCH v2 1/1 raw/ifpga_rawdev: fix fd leak in rte fpga do pr

In reply to Andy Pei

In rte_fpga_do_pr() function, if 'stat' returns error, rte_fpga_do_pr() returns -EINVAL without closing the 'file_fd' that has been opened.
After this patch, 'file_fd' is closed before rte_fpga_do_pr() returns -EINVAL when 'stat' returns error

Coverity issue: 279441

Fixes ef1e8ede3da5 ("raw/ifpga: add Intel FPGA bus rawdev driver")

---

---
 drivers/raw/ifpga_rawdev/ifpga_rawdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +2 -1
index da772d0..eff001b 100644
@@ -244,7 +244,8 @@
 	if (ret) {
 		IFPGA_RAWDEV_PMD_ERR("stat on bitstream file failed: %s\n",
 				file_name);
-		return -EINVAL;
+		ret = -EINVAL;
+		goto close_fd;
 	}
 	buffer_size = file_stat.st_size;
 	IFPGA_RAWDEV_PMD_INFO("bitstream file size: %zu\n", buffer_size);
Signature · 1 line
1.8.3.1
Acked-by on v2 1/1
#4 lore raw

Re: [dpdk-dev] [PATCH v2] raw/ifpga_rawdev: fix fd leak in rte fpga do pr

Quoted 46 lines

-----Original Message-----
From: Pei, Andy
Sent: Wednesday, April 17, 2019 15:16
To: [email protected]
Cc: Pei, Andy <[email protected]>; Xu, Rosen <[email protected]>; Kovacevic, Marko <[email protected]>; [email protected]; [email protected]
Subject: [PATCH v2] raw/ifpga_rawdev: fix fd leak in rte fpga do pr

In rte_fpga_do_pr() function, if 'stat' returns error, rte_fpga_do_pr() returns -EINVAL without closing the 'file_fd' that has been opened.
After this patch, 'file_fd' is closed before rte_fpga_do_pr() returns -EINVAL when 'stat' returns error

Coverity issue: 279441

Fixes ef1e8ede3da5 ("raw/ifpga: add Intel FPGA bus rawdev driver")

---

---
 drivers/raw/ifpga_rawdev/ifpga_rawdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/raw/ifpga_rawdev/ifpga_rawdev.c +2 -1
index da772d0..eff001b 100644
@@ -244,7 +244,8 @@
 	if (ret) {
 		IFPGA_RAWDEV_PMD_ERR("stat on bitstream file
 failed: %s\n",
 				file_name);
-		return -EINVAL;
+		ret = -EINVAL;
+		goto close_fd;
 	}
 	buffer_size = file_stat.st_size;
Quoted 3 lines

IFPGA_RAWDEV_PMD_INFO("bitstream file size: %zu\n", buffer_size);
--
1.8.3.1

#5 lore raw

Re: [dpdk-dev] [dpdk-stable] [PATCH v2] raw/ifpga_rawdev: fix fd leak in rte fpga do pr

Quoted 14 lines
Quoted 14 lines

In rte_fpga_do_pr() function, if 'stat' returns error, rte_fpga_do_pr() returns -EINVAL without closing the 'file_fd' that has been opened.
After this patch, 'file_fd' is closed before rte_fpga_do_pr() returns -EINVAL when 'stat' returns error

Coverity issue: 279441

Fixes ef1e8ede3da5 ("raw/ifpga: add Intel FPGA bus rawdev driver")
Quoted 3 lines
Quoted 1 line

Li Qiang <[email protected]> proposed the same patch. Why he is not referenced here?
Which patch should I merge?

author
#6 lore raw

Re: [dpdk-dev] [dpdk-stable] [PATCH v2] raw/ifpga_rawdev: fix fd leak in rte fpga do pr

Hi Thomas,

My patch is the same as LI Qiang's patch.
I was told that Qiang's patch cannot get onto the patchwork, so I just help him do this.

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Tuesday, April 23, 2019 1:52 AM
To: Xu, Rosen <[email protected]>; Pei, Andy <[email protected]>
Cc: [email protected]; [email protected]; Kovacevic, Marko <[email protected]>; [email protected]
Subject: Re: [dpdk-stable] [PATCH v2] raw/ifpga_rawdev: fix fd leak in rte fpga do pr

Quoted 14 lines
Quoted 14 lines

In rte_fpga_do_pr() function, if 'stat' returns error, rte_fpga_do_pr() returns -EINVAL without closing the 'file_fd' that has been opened.
After this patch, 'file_fd' is closed before rte_fpga_do_pr() returns -EINVAL when 'stat' returns error

Coverity issue: 279441

Fixes ef1e8ede3da5 ("raw/ifpga: add Intel FPGA bus rawdev driver")
Quoted 3 lines
Quoted 1 line

Li Qiang <[email protected]> proposed the same patch. Why he is not referenced here?
Which patch should I merge?

#7 lore raw

Re: [dpdk-dev] [dpdk-stable] [PATCH v2] raw/ifpga_rawdev: fix fd leak in rte fpga do pr

Hi Thomas,

Qian has some problem with his email. So some patch can't be found in patch work. For it's a urgent bug. After we have aligned with Qian, Andy send this patch. Thanks.

Quoted 48 lines

-----Original Message-----
From: Pei, Andy
Sent: Tuesday, April 23, 2019 9:19
To: Thomas Monjalon <[email protected]>; Xu, Rosen <[email protected]>
Cc: [email protected]; [email protected]; Kovacevic, Marko <[email protected]>; [email protected]
Subject: RE: [dpdk-stable] [PATCH v2] raw/ifpga_rawdev: fix fd leak in rte fpga do pr

Hi Thomas,

My patch is the same as LI Qiang's patch.
I was told that Qiang's patch cannot get onto the patchwork, so I just help him do this.

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Tuesday, April 23, 2019 1:52 AM
To: Xu, Rosen <[email protected]>; Pei, Andy <[email protected]>
Cc: [email protected]; [email protected]; Kovacevic, Marko <[email protected]>; [email protected]
Subject: Re: [dpdk-stable] [PATCH v2] raw/ifpga_rawdev: fix fd leak in rte fpga do pr

Quoted 14 lines
Quoted 14 lines

In rte_fpga_do_pr() function, if 'stat' returns error, rte_fpga_do_pr() returns -EINVAL without closing the 'file_fd' that has been opened.
After this patch, 'file_fd' is closed before rte_fpga_do_pr() returns -EINVAL when 'stat' returns error

Coverity issue: 279441

Fixes ef1e8ede3da5 ("raw/ifpga: add Intel FPGA bus rawdev driver")
Quoted 3 lines
Quoted 1 line

Li Qiang <[email protected]> proposed the same patch. Why he is not referenced here?
Which patch should I merge?

#8 lore raw

Re: [dpdk-dev] [dpdk-stable] [PATCH v2] raw/ifpga_rawdev: fix fd leak in rte fpga do pr

When you need to re-send a patch, please apply it with "git am" so the original author is kept.

Another nit: the title is full of abbreviation, it is hard to read. The title prefix should be "raw/ifpga", even if checkpatch complains.

Please re-send, thanks.

23/04/2019 03:36, Xu, Rosen:

Quoted 51 lines

Hi Thomas,

Qian has some problem with his email. So some patch can't be found in patch work. For it's a urgent bug. After we have aligned with Qian, Andy send this patch. Thanks.

Quoted 46 lines

-----Original Message-----
From: Pei, Andy
Sent: Tuesday, April 23, 2019 9:19
To: Thomas Monjalon <[email protected]>; Xu, Rosen <[email protected]>
Cc: [email protected]; [email protected]; Kovacevic, Marko <[email protected]>; [email protected]
Subject: RE: [dpdk-stable] [PATCH v2] raw/ifpga_rawdev: fix fd leak in rte fpga do pr

Hi Thomas,

My patch is the same as LI Qiang's patch.
I was told that Qiang's patch cannot get onto the patchwork, so I just help him do this.

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Tuesday, April 23, 2019 1:52 AM
To: Xu, Rosen <[email protected]>; Pei, Andy <[email protected]>
Cc: [email protected]; [email protected]; Kovacevic, Marko <[email protected]>; [email protected]
Subject: Re: [dpdk-stable] [PATCH v2] raw/ifpga_rawdev: fix fd leak in rte fpga do pr

Quoted 14 lines
Quoted 14 lines

In rte_fpga_do_pr() function, if 'stat' returns error, rte_fpga_do_pr() returns -EINVAL without closing the 'file_fd' that has been opened.
After this patch, 'file_fd' is closed before rte_fpga_do_pr() returns -EINVAL when 'stat' returns error

Coverity issue: 279441

Fixes ef1e8ede3da5 ("raw/ifpga: add Intel FPGA bus rawdev driver")
Quoted 3 lines
Quoted 1 line

Li Qiang <[email protected]> proposed the same patch. Why he is not referenced here?
Which patch should I merge?

author
#9 lore raw

Re: [dpdk-dev] [dpdk-stable] [PATCH v2] raw/ifpga_rawdev: fix fd leak in rte fpga do pr

Hi,

I saw Qiang's patch on patchwork today,
[v3] drivers: ifpga_rawdev: fix fd leak in rte_fpga_do_pr

So I think it seems OK to ignore my patch.

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Tuesday, April 23, 2019 4:45 PM
To: Pei, Andy <[email protected]>
Cc: Xu, Rosen <[email protected]>; [email protected]; [email protected]; Kovacevic, Marko <[email protected]>; [email protected]
Subject: Re: [dpdk-stable] [PATCH v2] raw/ifpga_rawdev: fix fd leak in rte fpga do pr

When you need to re-send a patch, please apply it with "git am" so the original author is kept.

Another nit: the title is full of abbreviation, it is hard to read. The title prefix should be "raw/ifpga", even if checkpatch complains.

Please re-send, thanks.

23/04/2019 03:36, Xu, Rosen:

Quoted 52 lines

Hi Thomas,

Qian has some problem with his email. So some patch can't be found in patch work. For it's a urgent bug. After we have aligned with Qian, Andy send this patch. Thanks.

Quoted 47 lines

-----Original Message-----
From: Pei, Andy
Sent: Tuesday, April 23, 2019 9:19
To: Thomas Monjalon <[email protected]>; Xu, Rosen <[email protected]>
Cc: [email protected]; [email protected]; Kovacevic, Marko <[email protected]>; [email protected]
Subject: RE: [dpdk-stable] [PATCH v2] raw/ifpga_rawdev: fix fd leak in rte fpga do pr

Hi Thomas,

My patch is the same as LI Qiang's patch.
I was told that Qiang's patch cannot get onto the patchwork, so I just help him do this.

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Tuesday, April 23, 2019 1:52 AM
To: Xu, Rosen <[email protected]>; Pei, Andy <[email protected]>
Cc: [email protected]; [email protected]; Kovacevic, Marko <[email protected]>; [email protected]
Subject: Re: [dpdk-stable] [PATCH v2] raw/ifpga_rawdev: fix fd leak in rte fpga do pr

Quoted 15 lines
Quoted 15 lines

In rte_fpga_do_pr() function, if 'stat' returns error, rte_fpga_do_pr() returns -EINVAL without closing the 'file_fd' that has been opened.
After this patch, 'file_fd' is closed before rte_fpga_do_pr() returns -EINVAL when 'stat' returns error

Coverity issue: 279441

Fixes ef1e8ede3da5 ("raw/ifpga: add Intel FPGA bus rawdev

driver")
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

Quoted 3 lines
Quoted 1 line

Li Qiang <[email protected]> proposed the same patch. Why he is not referenced here?
Which patch should I merge?