diff mbox series

loop: Fix IS_ERR() vs NULL bugs in loop_prepare_queue()

Message ID 20200228141350.iaviwnry3z4ipjqe@kili.mountain (mailing list archive)
State New, archived
Headers show
Series loop: Fix IS_ERR() vs NULL bugs in loop_prepare_queue() | expand

Commit Message

Dan Carpenter Feb. 28, 2020, 2:13 p.m. UTC
The alloc_workqueue() function returns NULL on error, it never returns
error pointers.

Fixes: 29dab2122492 ("loop: use worker per cgroup instead of kworker")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/block/loop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jens Axboe Feb. 28, 2020, 2:25 p.m. UTC | #1
On 2/28/20 7:13 AM, Dan Carpenter wrote:
> The alloc_workqueue() function returns NULL on error, it never returns
> error pointers.
> 
> Fixes: 29dab2122492 ("loop: use worker per cgroup instead of kworker")

I can't seem to find this commit?
Dan Carpenter Feb. 28, 2020, 4:11 p.m. UTC | #2
On Fri, Feb 28, 2020 at 07:25:58AM -0700, Jens Axboe wrote:
> On 2/28/20 7:13 AM, Dan Carpenter wrote:
> > The alloc_workqueue() function returns NULL on error, it never returns
> > error pointers.
> > 
> > Fixes: 29dab2122492 ("loop: use worker per cgroup instead of kworker")
> 
> I can't seem to find this commit?

I guess this went through Andrew Morton's tree.  I'll resend to him.

regards,
dan carpenter
Dan Schatzberg Feb. 28, 2020, 4:15 p.m. UTC | #3
es65;5603;1cOn Fri, Feb 28, 2020 at 07:25:58AM -0700, Jens Axboe wrote:
> On 2/28/20 7:13 AM, Dan Carpenter wrote:
> > The alloc_workqueue() function returns NULL on error, it never returns
> > error pointers.
> > 
> > Fixes: 29dab2122492 ("loop: use worker per cgroup instead of kworker")
> 
> I can't seem to find this commit?
> 
> -- 
> Jens Axboe
>

This went through Andrew's tree as patch series "Charge loop device
i/o to issuing cgroup", v3., it is currently in linux-next.

Thanks for fixing this Dan.

Acked-by: Dan Schatzberg <schatzberg.dan@gmail.com>
diff mbox series

Patch

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index da8ec0b9d909..a31ca5e04fae 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -897,7 +897,7 @@  static int loop_prepare_queue(struct loop_device *lo)
 					WQ_UNBOUND | WQ_FREEZABLE |
 					WQ_MEM_RECLAIM,
 					lo->lo_number);
-	if (IS_ERR(lo->workqueue))
+	if (!lo->workqueue)
 		return -ENOMEM;
 
 	return 0;