# Re: start switching sysfs attributes to expose the seq\_file

- From: Tejun Heo \<tj@kernel.org\>
- Date: 2021-09-13 16:46:17 
- List: linux-block
- Page: https://ratatoskr.run/linux-block/2021/09/214073
- Thread: https://ratatoskr.run/linux-block/2021/09/214031/t.md

```text
On Mon, Sep 13, 2021 at 07:41:08AM +0200, Christoph Hellwig wrote:
> Hi all,
> 
> Al pointed out multiple times that seq_get_buf is highly dangerous as
> it opens up the tight seq_file abstractions to buffer overflows.  The
> last such caller now is sysfs.
> 
> This series allows attributes to implement a seq_show method and switch
> the block and XFS code as users that I'm most familiar with to use
> seq_files directly after a few preparatory cleanups.  With this series
> "leaf" users of sysfs_ops can be converted one at at a time, after that
> we can move the seq_get_buf into the multiplexers (e.g. kobj, device,
> class attributes) and remove the show method in sysfs_ops and repeat the
> process until all attributes are converted.  This will probably take a
> fair amount of time.

The whole series looks good to me. With Greg's sysfs_emit argument aside on
which I don't have any opinion,

Acked-by: Tejun Heo <tj@kernel.org>

Thanks.

-- 
tejun
```
