Message ID | 20201110144614.43194-1-wanghai38@huawei.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net] cosa: Add missing kfree in error path of cosa_write | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net |
netdev/subject_prefix | success | Link |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 2 this patch: 2 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 7 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
netdev/stable | success | Stable not CCed |
Wang Hai wrote:
: If memory allocation for 'kbuf' succeed, cosa_write() doesn't have a
: corresponding kfree() in exception handling. Thus add kfree() for this
: function implementation.
Acked-By: Jan "Yenya" Kasprzak <kas@fi.muni.cz>
Looks correct, thanks.
That said, COSA is an ancient ISA bus device designed in late 1990s,
I doubt anybody is still using it. I still do have one or two of these
cards myself, but no computer with ISA bus to use them.
-Yenya
:
: Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
: Reported-by: Hulk Robot <hulkci@huawei.com>
: Signed-off-by: Wang Hai <wanghai38@huawei.com>
: ---
: drivers/net/wan/cosa.c | 1 +
: 1 file changed, 1 insertion(+)
:
: diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c
: index f8aed0696d77..2369ca250cd6 100644
: --- a/drivers/net/wan/cosa.c
: +++ b/drivers/net/wan/cosa.c
: @@ -889,6 +889,7 @@ static ssize_t cosa_write(struct file *file,
: chan->tx_status = 1;
: spin_unlock_irqrestore(&cosa->lock, flags);
: up(&chan->wsem);
: + kfree(kbuf);
: return -ERESTARTSYS;
: }
: }
: --
: 2.17.1
On Tue, 10 Nov 2020 17:38:09 +0100 Jan Kasprzak wrote: > Wang Hai wrote: > : If memory allocation for 'kbuf' succeed, cosa_write() doesn't have a > : corresponding kfree() in exception handling. Thus add kfree() for this > : function implementation. > > Acked-By: Jan "Yenya" Kasprzak <kas@fi.muni.cz> Applied, thanks! > That said, COSA is an ancient ISA bus device designed in late 1990s, > I doubt anybody is still using it. I still do have one or two of these > cards myself, but no computer with ISA bus to use them. Maybe we can move it out to staging or just remove it?
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c index f8aed0696d77..2369ca250cd6 100644 --- a/drivers/net/wan/cosa.c +++ b/drivers/net/wan/cosa.c @@ -889,6 +889,7 @@ static ssize_t cosa_write(struct file *file, chan->tx_status = 1; spin_unlock_irqrestore(&cosa->lock, flags); up(&chan->wsem); + kfree(kbuf); return -ERESTARTSYS; } }
If memory allocation for 'kbuf' succeed, cosa_write() doesn't have a corresponding kfree() in exception handling. Thus add kfree() for this function implementation. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Wang Hai <wanghai38@huawei.com> --- drivers/net/wan/cosa.c | 1 + 1 file changed, 1 insertion(+)