Before return NULL,put the sock first.
Cc: stable@vger.kernel.org Fixes: cf1b2326b734 ("nbd: verify socket is supported during setup") Signed-off-by: Sun Ke sunke32@huawei.com --- v2: add cc:stable tag --- 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; }
On 11/19/2019 12:09 AM, Sun Ke wrote:
Before return NULL,put the sock first.
Cc: stable@vger.kernel.org Fixes: cf1b2326b734 ("nbd: verify socket is supported during setup") Signed-off-by: Sun Ke sunke32@huawei.com
v2: add cc:stable tag
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;
return NULL; }sockfd_put(sock);
Reviewed-by: Mike Christie mchristi@redhat.com
On 11/19/19 9:22 AM, Mike Christie wrote:
On 11/19/2019 12:09 AM, Sun Ke wrote:
Before return NULL,put the sock first.
Cc: stable@vger.kernel.org Fixes: cf1b2326b734 ("nbd: verify socket is supported during setup") Signed-off-by: Sun Ke sunke32@huawei.com
v2: add cc:stable tag
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;
return NULL; }sockfd_put(sock);
Reviewed-by: Mike Christie mchristi@redhat.com
Thanks (both of you), applied for 5.4.
linux-stable-mirror@lists.linaro.org