* [PATCH] nbd:fix memory leak in nbd_get_socket()
@ 2019-11-19 3:16 Sun Ke
2019-11-19 3:19 ` Eric Biggers
0 siblings, 1 reply; 2+ messages in thread
From: Sun Ke @ 2019-11-19 3:16 UTC (permalink / raw)
To: sunke32, josef, axboe, linux-block, nbd, linux-kernel
Before return NULL,put the sock first.
Fixes: cf1b2326b734 ("nbd: verify socket is supported during setup")
Signed-off-by: Sun Ke <sunke32@huawei.com>
---
drivers/block/nbd.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index a94ee45..19e7599 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -993,6 +993,7 @@ static struct socket *nbd_get_socket(struct nbd_device *nbd, unsigned long fd,
if (sock->ops->shutdown == sock_no_shutdown) {
dev_err(disk_to_dev(nbd->disk), "Unsupported socket: shutdown callout must be supported.\n");
*err = -EINVAL;
+ sockfd_put(sock);
return NULL;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] nbd:fix memory leak in nbd_get_socket()
2019-11-19 3:16 [PATCH] nbd:fix memory leak in nbd_get_socket() Sun Ke
@ 2019-11-19 3:19 ` Eric Biggers
0 siblings, 0 replies; 2+ messages in thread
From: Eric Biggers @ 2019-11-19 3:19 UTC (permalink / raw)
To: Sun Ke; +Cc: josef, axboe, linux-block, nbd, linux-kernel
On Tue, Nov 19, 2019 at 11:16:48AM +0800, Sun Ke wrote:
> Before return NULL,put the sock first.
>
> Fixes: cf1b2326b734 ("nbd: verify socket is supported during setup")
Since this commit went to stable kernels, can you add Cc stable to this one?
Thanks,
- Eric
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-11-19 3:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-19 3:16 [PATCH] nbd:fix memory leak in nbd_get_socket() Sun Ke
2019-11-19 3:19 ` Eric Biggers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).