* [PATCH v1 02/19] infiniband/mthca: Fix dma_map_sg error check [not found] <20220819060801.10443-1-jinpu.wang@ionos.com> @ 2022-08-19 6:07 ` Jack Wang 2022-08-19 22:19 ` Kees Cook ` (2 more replies) 2022-08-19 6:08 ` [PATCH v1 19/19] net/mlx4: Fix error check for dma_map_sg Jack Wang 1 sibling, 3 replies; 8+ messages in thread From: Jack Wang @ 2022-08-19 6:07 UTC (permalink / raw) To: linux-kernel Cc: Jason Gunthorpe, Leon Romanovsky, Christophe JAILLET, Kees Cook, Håkon Bugge, linux-rdma dma_map_sg return 0 on error, in case of error set EIO as return code. Cc: Jason Gunthorpe <jgg@ziepe.ca> Cc: Leon Romanovsky <leon@kernel.org> Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Cc: Kees Cook <keescook@chromium.org> Cc: "Håkon Bugge" <haakon.bugge@oracle.com> Cc: linux-rdma@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Jack Wang <jinpu.wang@ionos.com> --- drivers/infiniband/hw/mthca/mthca_memfree.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/hw/mthca/mthca_memfree.c b/drivers/infiniband/hw/mthca/mthca_memfree.c index f2734a5c5f26..44fd5fdf64d5 100644 --- a/drivers/infiniband/hw/mthca/mthca_memfree.c +++ b/drivers/infiniband/hw/mthca/mthca_memfree.c @@ -189,7 +189,7 @@ struct mthca_icm *mthca_alloc_icm(struct mthca_dev *dev, int npages, chunk->npages, DMA_BIDIRECTIONAL); - if (chunk->nsg <= 0) + if (!chunk->nsg) goto fail; } @@ -208,7 +208,7 @@ struct mthca_icm *mthca_alloc_icm(struct mthca_dev *dev, int npages, chunk->nsg = dma_map_sg(&dev->pdev->dev, chunk->mem, chunk->npages, DMA_BIDIRECTIONAL); - if (chunk->nsg <= 0) + if (!chunk->nsg) goto fail; } @@ -482,8 +482,9 @@ int mthca_map_user_db(struct mthca_dev *dev, struct mthca_uar *uar, ret = dma_map_sg(&dev->pdev->dev, &db_tab->page[i].mem, 1, DMA_TO_DEVICE); - if (ret < 0) { + if (!ret) { unpin_user_page(pages[0]); + ret = -EIO; goto out; } -- 2.34.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v1 02/19] infiniband/mthca: Fix dma_map_sg error check 2022-08-19 6:07 ` [PATCH v1 02/19] infiniband/mthca: Fix dma_map_sg error check Jack Wang @ 2022-08-19 22:19 ` Kees Cook 2022-08-21 11:46 ` Leon Romanovsky 2022-08-22 5:11 ` Dan Carpenter 2 siblings, 0 replies; 8+ messages in thread From: Kees Cook @ 2022-08-19 22:19 UTC (permalink / raw) To: Jack Wang Cc: linux-kernel, Jason Gunthorpe, Leon Romanovsky, Christophe JAILLET, Håkon Bugge, linux-rdma On Fri, Aug 19, 2022 at 08:07:44AM +0200, Jack Wang wrote: > dma_map_sg return 0 on error, in case of error set > EIO as return code. > > Cc: Jason Gunthorpe <jgg@ziepe.ca> > Cc: Leon Romanovsky <leon@kernel.org> > Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr> > Cc: Kees Cook <keescook@chromium.org> > Cc: "Håkon Bugge" <haakon.bugge@oracle.com> > Cc: linux-rdma@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > Signed-off-by: Jack Wang <jinpu.wang@ionos.com> Reviewed-by: Kees Cook <keescook@chromium.org> -- Kees Cook ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 02/19] infiniband/mthca: Fix dma_map_sg error check 2022-08-19 6:07 ` [PATCH v1 02/19] infiniband/mthca: Fix dma_map_sg error check Jack Wang 2022-08-19 22:19 ` Kees Cook @ 2022-08-21 11:46 ` Leon Romanovsky 2022-08-22 5:11 ` Dan Carpenter 2 siblings, 0 replies; 8+ messages in thread From: Leon Romanovsky @ 2022-08-21 11:46 UTC (permalink / raw) To: Jack Wang Cc: linux-kernel, Jason Gunthorpe, Christophe JAILLET, Kees Cook, Håkon Bugge, linux-rdma On Fri, Aug 19, 2022 at 08:07:44AM +0200, Jack Wang wrote: > dma_map_sg return 0 on error, in case of error set > EIO as return code. > > Cc: Jason Gunthorpe <jgg@ziepe.ca> > Cc: Leon Romanovsky <leon@kernel.org> > Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr> > Cc: Kees Cook <keescook@chromium.org> > Cc: "Håkon Bugge" <haakon.bugge@oracle.com> > Cc: linux-rdma@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > Signed-off-by: Jack Wang <jinpu.wang@ionos.com> > --- > drivers/infiniband/hw/mthca/mthca_memfree.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/infiniband/hw/mthca/mthca_memfree.c b/drivers/infiniband/hw/mthca/mthca_memfree.c > index f2734a5c5f26..44fd5fdf64d5 100644 > --- a/drivers/infiniband/hw/mthca/mthca_memfree.c > +++ b/drivers/infiniband/hw/mthca/mthca_memfree.c > @@ -189,7 +189,7 @@ struct mthca_icm *mthca_alloc_icm(struct mthca_dev *dev, int npages, > chunk->npages, > DMA_BIDIRECTIONAL); > > - if (chunk->nsg <= 0) > + if (!chunk->nsg) > goto fail; > } > > @@ -208,7 +208,7 @@ struct mthca_icm *mthca_alloc_icm(struct mthca_dev *dev, int npages, > chunk->nsg = dma_map_sg(&dev->pdev->dev, chunk->mem, > chunk->npages, DMA_BIDIRECTIONAL); > > - if (chunk->nsg <= 0) > + if (!chunk->nsg) > goto fail; > } > > @@ -482,8 +482,9 @@ int mthca_map_user_db(struct mthca_dev *dev, struct mthca_uar *uar, > > ret = dma_map_sg(&dev->pdev->dev, &db_tab->page[i].mem, 1, > DMA_TO_DEVICE); > - if (ret < 0) { > + if (!ret) { This code is not equivalent to original code. mthca didn't count ret == 0 as an error. Most likely, it is a bug, but I don't want to change old and unmaintained driver without any real need. Thanks > unpin_user_page(pages[0]); > + ret = -EIO; > goto out; > } > > -- > 2.34.1 > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 02/19] infiniband/mthca: Fix dma_map_sg error check 2022-08-19 6:07 ` [PATCH v1 02/19] infiniband/mthca: Fix dma_map_sg error check Jack Wang 2022-08-19 22:19 ` Kees Cook 2022-08-21 11:46 ` Leon Romanovsky @ 2022-08-22 5:11 ` Dan Carpenter 2 siblings, 0 replies; 8+ messages in thread From: Dan Carpenter @ 2022-08-22 5:11 UTC (permalink / raw) To: Jack Wang Cc: linux-kernel, Jason Gunthorpe, Leon Romanovsky, Christophe JAILLET, Kees Cook, Håkon Bugge, linux-rdma On Fri, Aug 19, 2022 at 08:07:44AM +0200, Jack Wang wrote: > dma_map_sg return 0 on error, in case of error set > EIO as return code. > The first two chunks are just cleanups but the third one is a bug fix so it needs a Fixes tag. regards, dan carpenter ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v1 19/19] net/mlx4: Fix error check for dma_map_sg [not found] <20220819060801.10443-1-jinpu.wang@ionos.com> 2022-08-19 6:07 ` [PATCH v1 02/19] infiniband/mthca: Fix dma_map_sg error check Jack Wang @ 2022-08-19 6:08 ` Jack Wang 2022-08-21 11:42 ` Leon Romanovsky 2022-08-22 18:20 ` Jakub Kicinski 1 sibling, 2 replies; 8+ messages in thread From: Jack Wang @ 2022-08-19 6:08 UTC (permalink / raw) To: linux-kernel Cc: Tariq Toukan, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, linux-rdma dma_map_sg return 0 on error. Cc: Tariq Toukan <tariqt@nvidia.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Eric Dumazet <edumazet@google.com> Cc: Jakub Kicinski <kuba@kernel.org> Cc: Paolo Abeni <pabeni@redhat.com> Cc: netdev@vger.kernel.org Cc: linux-rdma@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Jack Wang <jinpu.wang@ionos.com> --- drivers/net/ethernet/mellanox/mlx4/icm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/icm.c b/drivers/net/ethernet/mellanox/mlx4/icm.c index d89a3da89e5a..59b8b3c73582 100644 --- a/drivers/net/ethernet/mellanox/mlx4/icm.c +++ b/drivers/net/ethernet/mellanox/mlx4/icm.c @@ -208,7 +208,7 @@ struct mlx4_icm *mlx4_alloc_icm(struct mlx4_dev *dev, int npages, chunk->sg, chunk->npages, DMA_BIDIRECTIONAL); - if (chunk->nsg <= 0) + if (!chunk->nsg) goto fail; } @@ -222,7 +222,7 @@ struct mlx4_icm *mlx4_alloc_icm(struct mlx4_dev *dev, int npages, chunk->nsg = dma_map_sg(&dev->persist->pdev->dev, chunk->sg, chunk->npages, DMA_BIDIRECTIONAL); - if (chunk->nsg <= 0) + if (!chunk->nsg) goto fail; } -- 2.34.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v1 19/19] net/mlx4: Fix error check for dma_map_sg 2022-08-19 6:08 ` [PATCH v1 19/19] net/mlx4: Fix error check for dma_map_sg Jack Wang @ 2022-08-21 11:42 ` Leon Romanovsky 2022-08-22 18:20 ` Jakub Kicinski 1 sibling, 0 replies; 8+ messages in thread From: Leon Romanovsky @ 2022-08-21 11:42 UTC (permalink / raw) To: Jack Wang Cc: linux-kernel, Tariq Toukan, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, linux-rdma On Fri, Aug 19, 2022 at 08:08:01AM +0200, Jack Wang wrote: > dma_map_sg return 0 on error. > > Cc: Tariq Toukan <tariqt@nvidia.com> > Cc: "David S. Miller" <davem@davemloft.net> > Cc: Eric Dumazet <edumazet@google.com> > Cc: Jakub Kicinski <kuba@kernel.org> > Cc: Paolo Abeni <pabeni@redhat.com> > Cc: netdev@vger.kernel.org > Cc: linux-rdma@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > > Signed-off-by: Jack Wang <jinpu.wang@ionos.com> > --- > drivers/net/ethernet/mellanox/mlx4/icm.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > Thanks, Reviewed-by: Leon Romanovsky <leonro@nvidia.com> ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 19/19] net/mlx4: Fix error check for dma_map_sg 2022-08-19 6:08 ` [PATCH v1 19/19] net/mlx4: Fix error check for dma_map_sg Jack Wang 2022-08-21 11:42 ` Leon Romanovsky @ 2022-08-22 18:20 ` Jakub Kicinski 2022-08-24 14:39 ` Jinpu Wang 1 sibling, 1 reply; 8+ messages in thread From: Jakub Kicinski @ 2022-08-22 18:20 UTC (permalink / raw) To: Jack Wang Cc: linux-kernel, Tariq Toukan, David S. Miller, Eric Dumazet, Paolo Abeni, netdev, linux-rdma On Fri, 19 Aug 2022 08:08:01 +0200 Jack Wang wrote: > dma_map_sg return 0 on error. You need to resend it as an individual patch, not part of a series if you want it to be applied to the networking tree. Please keep Leon's review tag. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 19/19] net/mlx4: Fix error check for dma_map_sg 2022-08-22 18:20 ` Jakub Kicinski @ 2022-08-24 14:39 ` Jinpu Wang 0 siblings, 0 replies; 8+ messages in thread From: Jinpu Wang @ 2022-08-24 14:39 UTC (permalink / raw) To: Jakub Kicinski Cc: linux-kernel, Tariq Toukan, David S. Miller, Eric Dumazet, Paolo Abeni, netdev, linux-rdma On Mon, Aug 22, 2022 at 8:20 PM Jakub Kicinski <kuba@kernel.org> wrote: > > On Fri, 19 Aug 2022 08:08:01 +0200 Jack Wang wrote: > > dma_map_sg return 0 on error. > > You need to resend it as an individual patch, not part of a series if > you want it to be applied to the networking tree. Please keep Leon's > review tag. Got it. Will do ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-08-24 14:39 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20220819060801.10443-1-jinpu.wang@ionos.com>
2022-08-19 6:07 ` [PATCH v1 02/19] infiniband/mthca: Fix dma_map_sg error check Jack Wang
2022-08-19 22:19 ` Kees Cook
2022-08-21 11:46 ` Leon Romanovsky
2022-08-22 5:11 ` Dan Carpenter
2022-08-19 6:08 ` [PATCH v1 19/19] net/mlx4: Fix error check for dma_map_sg Jack Wang
2022-08-21 11:42 ` Leon Romanovsky
2022-08-22 18:20 ` Jakub Kicinski
2022-08-24 14:39 ` Jinpu Wang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox