* [PATCH][next] habanalabs: fix incorrect check on failed workqueue create
@ 2020-07-30 8:20 Colin King
2020-07-30 10:51 ` Oded Gabbay
0 siblings, 1 reply; 6+ messages in thread
From: Colin King @ 2020-07-30 8:20 UTC (permalink / raw)
To: Oded Gabbay, Arnd Bergmann, Greg Kroah-Hartman, Tomer Tayar,
Omer Shpigelman, Ofir Bitton
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
The null check on a failed workqueue create is currently null checking
hdev->cq_wq rather than the pointer hdev->cq_wq[i] and so the test
will never be true on a failed workqueue create. Fix this by checking
hdev->cq_wq[i].
Addresses-Coverity: ("Dereference before null check")
Fixes: 5574cb2194b1 ("habanalabs: Assign each CQ with its own work queue")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/misc/habanalabs/common/device.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/misc/habanalabs/common/device.c b/drivers/misc/habanalabs/common/device.c
index be16b75bdfdb..35214a186913 100644
--- a/drivers/misc/habanalabs/common/device.c
+++ b/drivers/misc/habanalabs/common/device.c
@@ -288,7 +288,7 @@ static int device_early_init(struct hl_device *hdev)
for (i = 0 ; i < hdev->asic_prop.completion_queues_count ; i++) {
snprintf(workq_name, 32, "hl-free-jobs-%u", i);
hdev->cq_wq[i] = create_singlethread_workqueue(workq_name);
- if (hdev->cq_wq = NULL) {
+ if (hdev->cq_wq[i] = NULL) {
dev_err(hdev->dev, "Failed to allocate CQ workqueue\n");
rc = -ENOMEM;
goto free_cq_wq;
--
2.27.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH][next] habanalabs: fix incorrect check on failed workqueue create
2020-07-30 8:20 [PATCH][next] habanalabs: fix incorrect check on failed workqueue create Colin King
@ 2020-07-30 10:51 ` Oded Gabbay
2020-07-31 6:20 ` Greg Kroah-Hartman
0 siblings, 1 reply; 6+ messages in thread
From: Oded Gabbay @ 2020-07-30 10:51 UTC (permalink / raw)
To: Colin King, Greg Kroah-Hartman
Cc: Arnd Bergmann, Tomer Tayar, Omer Shpigelman, Ofir Bitton,
kernel-janitors, Linux-Kernel@Vger. Kernel. Org
On Thu, Jul 30, 2020 at 11:20 AM Colin King <colin.king@canonical.com> wrote:
>
> From: Colin Ian King <colin.king@canonical.com>
>
> The null check on a failed workqueue create is currently null checking
> hdev->cq_wq rather than the pointer hdev->cq_wq[i] and so the test
> will never be true on a failed workqueue create. Fix this by checking
> hdev->cq_wq[i].
>
> Addresses-Coverity: ("Dereference before null check")
> Fixes: 5574cb2194b1 ("habanalabs: Assign each CQ with its own work queue")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/misc/habanalabs/common/device.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/misc/habanalabs/common/device.c b/drivers/misc/habanalabs/common/device.c
> index be16b75bdfdb..35214a186913 100644
> --- a/drivers/misc/habanalabs/common/device.c
> +++ b/drivers/misc/habanalabs/common/device.c
> @@ -288,7 +288,7 @@ static int device_early_init(struct hl_device *hdev)
> for (i = 0 ; i < hdev->asic_prop.completion_queues_count ; i++) {
> snprintf(workq_name, 32, "hl-free-jobs-%u", i);
> hdev->cq_wq[i] = create_singlethread_workqueue(workq_name);
> - if (hdev->cq_wq = NULL) {
> + if (hdev->cq_wq[i] = NULL) {
> dev_err(hdev->dev, "Failed to allocate CQ workqueue\n");
> rc = -ENOMEM;
> goto free_cq_wq;
> --
> 2.27.0
>
This patch is:
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Greg, can you please apply it directly to the char-misc-next branch ?
I don't want to send a pull request for 1 patch.
Thanks,
Oded
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH][next] habanalabs: fix incorrect check on failed workqueue create
2020-07-30 10:51 ` Oded Gabbay
@ 2020-07-31 6:20 ` Greg Kroah-Hartman
2020-08-09 11:02 ` Oded Gabbay
0 siblings, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2020-07-31 6:20 UTC (permalink / raw)
To: Oded Gabbay
Cc: Colin King, Arnd Bergmann, Tomer Tayar, Omer Shpigelman,
Ofir Bitton, kernel-janitors, Linux-Kernel@Vger. Kernel. Org
On Thu, Jul 30, 2020 at 01:51:48PM +0300, Oded Gabbay wrote:
> On Thu, Jul 30, 2020 at 11:20 AM Colin King <colin.king@canonical.com> wrote:
> >
> > From: Colin Ian King <colin.king@canonical.com>
> >
> > The null check on a failed workqueue create is currently null checking
> > hdev->cq_wq rather than the pointer hdev->cq_wq[i] and so the test
> > will never be true on a failed workqueue create. Fix this by checking
> > hdev->cq_wq[i].
> >
> > Addresses-Coverity: ("Dereference before null check")
> > Fixes: 5574cb2194b1 ("habanalabs: Assign each CQ with its own work queue")
> > Signed-off-by: Colin Ian King <colin.king@canonical.com>
> > ---
> > drivers/misc/habanalabs/common/device.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/misc/habanalabs/common/device.c b/drivers/misc/habanalabs/common/device.c
> > index be16b75bdfdb..35214a186913 100644
> > --- a/drivers/misc/habanalabs/common/device.c
> > +++ b/drivers/misc/habanalabs/common/device.c
> > @@ -288,7 +288,7 @@ static int device_early_init(struct hl_device *hdev)
> > for (i = 0 ; i < hdev->asic_prop.completion_queues_count ; i++) {
> > snprintf(workq_name, 32, "hl-free-jobs-%u", i);
> > hdev->cq_wq[i] = create_singlethread_workqueue(workq_name);
> > - if (hdev->cq_wq = NULL) {
> > + if (hdev->cq_wq[i] = NULL) {
> > dev_err(hdev->dev, "Failed to allocate CQ workqueue\n");
> > rc = -ENOMEM;
> > goto free_cq_wq;
> > --
> > 2.27.0
> >
>
> This patch is:
> Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
>
> Greg, can you please apply it directly to the char-misc-next branch ?
> I don't want to send a pull request for 1 patch.
Already merged :)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH][next] habanalabs: fix incorrect check on failed workqueue create
2020-07-31 6:20 ` Greg Kroah-Hartman
@ 2020-08-09 11:02 ` Oded Gabbay
2020-08-09 12:02 ` Greg Kroah-Hartman
0 siblings, 1 reply; 6+ messages in thread
From: Oded Gabbay @ 2020-08-09 11:02 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Colin King, Arnd Bergmann, Tomer Tayar, Omer Shpigelman,
Ofir Bitton, kernel-janitors, Linux-Kernel@Vger. Kernel. Org
On Fri, Jul 31, 2020 at 9:21 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> On Thu, Jul 30, 2020 at 01:51:48PM +0300, Oded Gabbay wrote:
> > On Thu, Jul 30, 2020 at 11:20 AM Colin King <colin.king@canonical.com> wrote:
> > >
> > > From: Colin Ian King <colin.king@canonical.com>
> > >
> > > The null check on a failed workqueue create is currently null checking
> > > hdev->cq_wq rather than the pointer hdev->cq_wq[i] and so the test
> > > will never be true on a failed workqueue create. Fix this by checking
> > > hdev->cq_wq[i].
> > >
> > > Addresses-Coverity: ("Dereference before null check")
> > > Fixes: 5574cb2194b1 ("habanalabs: Assign each CQ with its own work queue")
> > > Signed-off-by: Colin Ian King <colin.king@canonical.com>
> > > ---
> > > drivers/misc/habanalabs/common/device.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/misc/habanalabs/common/device.c b/drivers/misc/habanalabs/common/device.c
> > > index be16b75bdfdb..35214a186913 100644
> > > --- a/drivers/misc/habanalabs/common/device.c
> > > +++ b/drivers/misc/habanalabs/common/device.c
> > > @@ -288,7 +288,7 @@ static int device_early_init(struct hl_device *hdev)
> > > for (i = 0 ; i < hdev->asic_prop.completion_queues_count ; i++) {
> > > snprintf(workq_name, 32, "hl-free-jobs-%u", i);
> > > hdev->cq_wq[i] = create_singlethread_workqueue(workq_name);
> > > - if (hdev->cq_wq = NULL) {
> > > + if (hdev->cq_wq[i] = NULL) {
> > > dev_err(hdev->dev, "Failed to allocate CQ workqueue\n");
> > > rc = -ENOMEM;
> > > goto free_cq_wq;
> > > --
> > > 2.27.0
> > >
> >
> > This patch is:
> > Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
> >
> > Greg, can you please apply it directly to the char-misc-next branch ?
> > I don't want to send a pull request for 1 patch.
>
> Already merged :)
Hi Greg,
I can't find this patch in char-misc-next.
Can you please check if you applied it ?
If not, I'll apply it to my fixes tree and send it to you for -rc2
Thanks,
Oded
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH][next] habanalabs: fix incorrect check on failed workqueue create
2020-08-09 11:02 ` Oded Gabbay
@ 2020-08-09 12:02 ` Greg Kroah-Hartman
2020-08-09 12:03 ` Oded Gabbay
0 siblings, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2020-08-09 12:02 UTC (permalink / raw)
To: Oded Gabbay
Cc: Colin King, Arnd Bergmann, Tomer Tayar, Omer Shpigelman,
Ofir Bitton, kernel-janitors, Linux-Kernel@Vger. Kernel. Org
On Sun, Aug 09, 2020 at 02:02:18PM +0300, Oded Gabbay wrote:
> On Fri, Jul 31, 2020 at 9:21 AM Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> >
> > On Thu, Jul 30, 2020 at 01:51:48PM +0300, Oded Gabbay wrote:
> > > On Thu, Jul 30, 2020 at 11:20 AM Colin King <colin.king@canonical.com> wrote:
> > > >
> > > > From: Colin Ian King <colin.king@canonical.com>
> > > >
> > > > The null check on a failed workqueue create is currently null checking
> > > > hdev->cq_wq rather than the pointer hdev->cq_wq[i] and so the test
> > > > will never be true on a failed workqueue create. Fix this by checking
> > > > hdev->cq_wq[i].
> > > >
> > > > Addresses-Coverity: ("Dereference before null check")
> > > > Fixes: 5574cb2194b1 ("habanalabs: Assign each CQ with its own work queue")
> > > > Signed-off-by: Colin Ian King <colin.king@canonical.com>
> > > > ---
> > > > drivers/misc/habanalabs/common/device.c | 2 +-
> > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/misc/habanalabs/common/device.c b/drivers/misc/habanalabs/common/device.c
> > > > index be16b75bdfdb..35214a186913 100644
> > > > --- a/drivers/misc/habanalabs/common/device.c
> > > > +++ b/drivers/misc/habanalabs/common/device.c
> > > > @@ -288,7 +288,7 @@ static int device_early_init(struct hl_device *hdev)
> > > > for (i = 0 ; i < hdev->asic_prop.completion_queues_count ; i++) {
> > > > snprintf(workq_name, 32, "hl-free-jobs-%u", i);
> > > > hdev->cq_wq[i] = create_singlethread_workqueue(workq_name);
> > > > - if (hdev->cq_wq = NULL) {
> > > > + if (hdev->cq_wq[i] = NULL) {
> > > > dev_err(hdev->dev, "Failed to allocate CQ workqueue\n");
> > > > rc = -ENOMEM;
> > > > goto free_cq_wq;
> > > > --
> > > > 2.27.0
> > > >
> > >
> > > This patch is:
> > > Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
> > >
> > > Greg, can you please apply it directly to the char-misc-next branch ?
> > > I don't want to send a pull request for 1 patch.
> >
> > Already merged :)
>
> Hi Greg,
> I can't find this patch in char-misc-next.
> Can you please check if you applied it ?
Oops, you are right, I did not take it, my fault, sorry.
> If not, I'll apply it to my fixes tree and send it to you for -rc2
That would be great, thanks for following up on this.
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH][next] habanalabs: fix incorrect check on failed workqueue create
2020-08-09 12:02 ` Greg Kroah-Hartman
@ 2020-08-09 12:03 ` Oded Gabbay
0 siblings, 0 replies; 6+ messages in thread
From: Oded Gabbay @ 2020-08-09 12:03 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Colin King, Arnd Bergmann, Tomer Tayar, Omer Shpigelman,
Ofir Bitton, kernel-janitors, Linux-Kernel@Vger. Kernel. Org
On Sun, Aug 9, 2020 at 3:02 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> On Sun, Aug 09, 2020 at 02:02:18PM +0300, Oded Gabbay wrote:
> > On Fri, Jul 31, 2020 at 9:21 AM Greg Kroah-Hartman
> > <gregkh@linuxfoundation.org> wrote:
> > >
> > > On Thu, Jul 30, 2020 at 01:51:48PM +0300, Oded Gabbay wrote:
> > > > On Thu, Jul 30, 2020 at 11:20 AM Colin King <colin.king@canonical.com> wrote:
> > > > >
> > > > > From: Colin Ian King <colin.king@canonical.com>
> > > > >
> > > > > The null check on a failed workqueue create is currently null checking
> > > > > hdev->cq_wq rather than the pointer hdev->cq_wq[i] and so the test
> > > > > will never be true on a failed workqueue create. Fix this by checking
> > > > > hdev->cq_wq[i].
> > > > >
> > > > > Addresses-Coverity: ("Dereference before null check")
> > > > > Fixes: 5574cb2194b1 ("habanalabs: Assign each CQ with its own work queue")
> > > > > Signed-off-by: Colin Ian King <colin.king@canonical.com>
> > > > > ---
> > > > > drivers/misc/habanalabs/common/device.c | 2 +-
> > > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/drivers/misc/habanalabs/common/device.c b/drivers/misc/habanalabs/common/device.c
> > > > > index be16b75bdfdb..35214a186913 100644
> > > > > --- a/drivers/misc/habanalabs/common/device.c
> > > > > +++ b/drivers/misc/habanalabs/common/device.c
> > > > > @@ -288,7 +288,7 @@ static int device_early_init(struct hl_device *hdev)
> > > > > for (i = 0 ; i < hdev->asic_prop.completion_queues_count ; i++) {
> > > > > snprintf(workq_name, 32, "hl-free-jobs-%u", i);
> > > > > hdev->cq_wq[i] = create_singlethread_workqueue(workq_name);
> > > > > - if (hdev->cq_wq = NULL) {
> > > > > + if (hdev->cq_wq[i] = NULL) {
> > > > > dev_err(hdev->dev, "Failed to allocate CQ workqueue\n");
> > > > > rc = -ENOMEM;
> > > > > goto free_cq_wq;
> > > > > --
> > > > > 2.27.0
> > > > >
> > > >
> > > > This patch is:
> > > > Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
> > > >
> > > > Greg, can you please apply it directly to the char-misc-next branch ?
> > > > I don't want to send a pull request for 1 patch.
> > >
> > > Already merged :)
> >
> > Hi Greg,
> > I can't find this patch in char-misc-next.
> > Can you please check if you applied it ?
>
> Oops, you are right, I did not take it, my fault, sorry.
>
> > If not, I'll apply it to my fixes tree and send it to you for -rc2
>
> That would be great, thanks for following up on this.
>
> greg k-h
Sure, np.
Thanks,
Oded
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-08-09 12:03 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-30 8:20 [PATCH][next] habanalabs: fix incorrect check on failed workqueue create Colin King
2020-07-30 10:51 ` Oded Gabbay
2020-07-31 6:20 ` Greg Kroah-Hartman
2020-08-09 11:02 ` Oded Gabbay
2020-08-09 12:02 ` Greg Kroah-Hartman
2020-08-09 12:03 ` Oded Gabbay
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).