Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1222124 > unrolled thread
| Started by | Sudip Mukherjee <sudipm.mukherjee@gmail.com> |
|---|---|
| First post | 2015-09-10 13:20 +0200 |
| Last post | 2015-09-11 16:30 +0200 |
| Articles | 5 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] spi: spidev: fix possible NULL dereference Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-09-10 13:20 +0200
Re: [PATCH] spi: spidev: fix possible NULL dereference Jarkko Nikula <jarkko.nikula@linux.intel.com> - 2015-09-11 14:20 +0200
Re: [PATCH] spi: spidev: fix possible NULL dereference Mark Brown <broonie@kernel.org> - 2015-09-11 14:30 +0200
Re: [PATCH] spi: spidev: fix possible NULL dereference Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-09-11 15:00 +0200
Re: [PATCH] spi: spidev: fix possible NULL dereference Mark Brown <broonie@kernel.org> - 2015-09-11 16:30 +0200
| From | Sudip Mukherjee <sudipm.mukherjee@gmail.com> |
|---|---|
| Date | 2015-09-10 13:20 +0200 |
| Subject | [PATCH] spi: spidev: fix possible NULL dereference |
| Message-ID | <q783w-8ez-15@gated-at.bofh.it> |
During the last close we are freeing spidev if spidev->spi is NULL, but just before checking if spidev->spi is NULL we are dereferencing it. Lets add a check there to avoid the NULL dereference. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> --- drivers/spi/spidev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c index fba92a5..ef008e5 100644 --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c @@ -651,7 +651,8 @@ static int spidev_release(struct inode *inode, struct file *filp) kfree(spidev->rx_buffer); spidev->rx_buffer = NULL; - spidev->speed_hz = spidev->spi->max_speed_hz; + if (spidev->spi) + spidev->speed_hz = spidev->spi->max_speed_hz; /* ... after we unbound from the underlying device? */ spin_lock_irq(&spidev->spi_lock); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Jarkko Nikula <jarkko.nikula@linux.intel.com> |
|---|---|
| Date | 2015-09-11 14:20 +0200 |
| Message-ID | <q7vt8-1gv-21@gated-at.bofh.it> |
| In reply to | #1222124 |
Hi
On 09/10/2015 02:18 PM, Sudip Mukherjee wrote:
> During the last close we are freeing spidev if spidev->spi is NULL, but
> just before checking if spidev->spi is NULL we are dereferencing it.
> Lets add a check there to avoid the NULL dereference.
>
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> ---
> drivers/spi/spidev.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
> index fba92a5..ef008e5 100644
> --- a/drivers/spi/spidev.c
> +++ b/drivers/spi/spidev.c
> @@ -651,7 +651,8 @@ static int spidev_release(struct inode *inode, struct file *filp)
> kfree(spidev->rx_buffer);
> spidev->rx_buffer = NULL;
>
> - spidev->speed_hz = spidev->spi->max_speed_hz;
> + if (spidev->spi)
> + spidev->speed_hz = spidev->spi->max_speed_hz;
>
> /* ... after we unbound from the underlying device? */
> spin_lock_irq(&spidev->spi_lock);
Actually this fixes a *real* NULL dereference case but it is not related
to normal open/close life cycle of spidev. It requires that spidev is
kept open when SPI master is removed.
spidev->spi is set to NULL in spidev_remove() and it is called before
spidev_release() in case master is removed while spidev is in use
It would be good to update this to commit log, add a tag below and Cc
<stable@vger.kernel.org>
Fixes: 9169051617df ("spi: spidev: Don't mangle max_speed_hz in
underlying spi device")
You can add these too:
Reviewed-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Mark Brown <broonie@kernel.org> |
|---|---|
| Date | 2015-09-11 14:30 +0200 |
| Message-ID | <q7vCO-1rQ-27@gated-at.bofh.it> |
| In reply to | #1222773 |
[Multipart message — attachments visible in raw view] — view raw
On Fri, Sep 11, 2015 at 03:11:32PM +0300, Jarkko Nikula wrote:
> Actually this fixes a *real* NULL dereference case but it is not related to
> normal open/close life cycle of spidev. It requires that spidev is kept open
> when SPI master is removed.
> spidev->spi is set to NULL in spidev_remove() and it is called before
> spidev_release() in case master is removed while spidev is in use
> It would be good to update this to commit log, add a tag below and Cc
> <stable@vger.kernel.org>
> Fixes: 9169051617df ("spi: spidev: Don't mangle max_speed_hz in underlying
> spi device")
The patch was already applied :(
[toc] | [prev] | [next] | [standalone]
| From | Sudip Mukherjee <sudipm.mukherjee@gmail.com> |
|---|---|
| Date | 2015-09-11 15:00 +0200 |
| Message-ID | <q7w5Q-203-23@gated-at.bofh.it> |
| In reply to | #1222784 |
On Fri, Sep 11, 2015 at 01:25:13PM +0100, Mark Brown wrote:
> On Fri, Sep 11, 2015 at 03:11:32PM +0300, Jarkko Nikula wrote:
>
> > Actually this fixes a *real* NULL dereference case but it is not related to
> > normal open/close life cycle of spidev. It requires that spidev is kept open
> > when SPI master is removed.
>
> > spidev->spi is set to NULL in spidev_remove() and it is called before
> > spidev_release() in case master is removed while spidev is in use
>
> > It would be good to update this to commit log, add a tag below and Cc
> > <stable@vger.kernel.org>
>
> > Fixes: 9169051617df ("spi: spidev: Don't mangle max_speed_hz in underlying
> > spi device")
>
> The patch was already applied :(
Applied? But usually I will receive an auto mail from you after applying.
I dont think I have received any.
regards
sudip
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Mark Brown <broonie@kernel.org> |
|---|---|
| Date | 2015-09-11 16:30 +0200 |
| Message-ID | <q7xuV-4eq-1@gated-at.bofh.it> |
| In reply to | #1222828 |
[Multipart message — attachments visible in raw view] — view raw
On Fri, Sep 11, 2015 at 06:19:45PM +0530, Sudip Mukherjee wrote: > On Fri, Sep 11, 2015 at 01:25:13PM +0100, Mark Brown wrote: > > The patch was already applied :( > Applied? But usually I will receive an auto mail from you after applying. > I dont think I have received any. You get a mail when the changes are pushed, which had happened by the time I replied.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web